Sha256: b75c6ee34c7887956f4b7ace2744bbef4de4e5552b4d8e51758cbd9940ca0a56

Contents?: true

Size: 769 Bytes

Versions: 9

Compression:

Stored size: 769 Bytes

Contents

module Youroom
  class RoomTimeline < Request
    attr_reader :room_id, :since, :page, :flat, :search_query, :read_state
    QUERY_KEYS = %w[since page flat search_query read_state]

    def initialize(access_token, room_id, params={}, url=BASE_URL)
      required_structure(room_id, String, Symbol, Fixnum)
      required_structure(params, Hash)
      @room_id = room_id
      params.each { |k,v| self.instance_variable_set("@#{k}", v)}
      super(access_token, url)
    end

    def path
      query_str = "&"
      QUERY_KEYS.each do |query_key|
        val = self.instance_variable_get("@#{query_key}")
        query_str += "#{query_key}=#{val}&" if !val.nil?
      end
      File.join(url, 'r', room_id.to_s, '?format=json'+"#{query_str.chop}")
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
youroom_api-0.1.4 lib/youroom_api/request/room_timeline.rb
youroom_api-0.1.3 lib/youroom_api/request/room_timeline.rb
youroom_api-0.1.2 lib/youroom_api/request/room_timeline.rb
youroom_api-0.1.1 lib/youroom_api/request/room_timeline.rb
youroom_api-0.1.0 lib/youroom_api/request/room_timeline.rb
youroom_api-0.0.13 lib/youroom_api/request/room_timeline.rb
youroom_api-0.0.12 lib/youroom_api/request/room_timeline.rb
youroom_api-0.0.11 lib/youroom_api/request/room_timeline.rb
youroom_api-0.0.10 lib/youroom_api/request/room_timeline.rb