def sync(filter: nil, since: nil, full_state: false,
             set_presence: true, timeout: 30_000)
      options = { full_state: full_state }

      options[:since] = since if since
      options[:set_presence] = 'offline' unless set_presence
      options[:timeout] = timeout if timeout
      options[:filter] = parse_filter filter

      make_request(:get, '/sync', params: options).parsed_response
    end
def sync(filter: nil, since: nil, full_state: false,
             set_presence: true, timeout: 30_000)
      options = { full_state: full_state }

      options[:since] = since if since
      options[:set_presence] = 'offline' unless set_presence
      options[:timeout] = timeout if timeout
      options[:filter] = parse_filter filter

      make_request(:get, '/sync', params: options).parsed_response
    end
Synchronize with the latest state on the server.

 For initial sync, call this method with the `since` parameter
 set to `nil`.

 @param filter [String,Hash] The ID of a filter to use, or provided
   directly as a hash.
 @param since [String,nil] A point in time to continue sync from.
   Will retrieve a snapshot of the state if not set, which will also
   provide a `next_batch` value to use for `since` in the next call.
 @param full_state [Boolean] If `true`, all state events will be returned
   for all rooms the user is a member of.
 @param set_presence [Boolean] If `true`, the user performing this request
   will have their presence updated to show them as being online.
 @param timeout [Fixnum] Maximum time (in milliseconds) to wait before
   the request is aborted.
 @return [Hash] The initial snapshot of the state (if no `since` value
   was provided), or a delta to use for updating state.