Sha256: 2a7149bb3af803ad3ff740a88c4975d906b95421dd3c7396b25a7d83bb455e34

Contents?: true

Size: 607 Bytes

Versions: 17

Compression:

Stored size: 607 Bytes

Contents

module RocketChat
  module Messages
    #
    # Support methods for *.list calls
    #
    module ListSupport
      private

      def build_list_body(offset, count, sort, fields, query = nil)
        body = {}

        body[:offset] = offset.to_i if offset.is_a? Integer
        body[:count] = count.to_i if count.is_a? Integer
        [[:sort, sort], [:fields, fields], [:query, query]].each do |field, val|
          case val
          when Hash
            body[field] = val.to_json
          when String
            body[field] = val
          end
        end

        body
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
rocketchat-0.1.18 lib/rocket_chat/messages/list_support.rb
rocketchat-0.1.17 lib/rocket_chat/messages/list_support.rb
rocketchat-0.1.16 lib/rocket_chat/messages/list_support.rb
rocketchat-0.1.15 lib/rocket_chat/messages/list_support.rb
rocketchat-0.1.14 lib/rocket_chat/messages/list_support.rb
rocketchat-0.1.13 lib/rocket_chat/messages/list_support.rb
rocketchat-0.1.12 lib/rocket_chat/messages/list_support.rb
rocketchat-0.1.11 lib/rocket_chat/messages/list_support.rb
rocketchat-0.1.10 lib/rocket_chat/messages/list_support.rb
rocketchat-0.1.9 lib/rocket_chat/messages/list_support.rb
rocketchat-0.1.8 lib/rocket_chat/messages/list_support.rb
rocketchat-0.1.7 lib/rocket_chat/messages/list_support.rb
rocketchat-0.1.6 lib/rocket_chat/messages/list_support.rb
rocketchat-0.1.5 lib/rocket_chat/messages/list_support.rb
rocketchat-0.1.4 lib/rocket_chat/messages/list_support.rb
rocketchat-0.1.3 lib/rocket_chat/messages/list_support.rb
rocketchat-0.1.2 lib/rocket_chat/messages/list_support.rb