Sha256: bf74eef0d4f8a33cc7eacccce010e3ac4e578f7c72a70ea0a78f38d875ffe08d

Contents?: true

Size: 630 Bytes

Versions: 8

Compression:

Stored size: 630 Bytes

Contents

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

    def initialize(access_token, params={}, url=BASE_URL)
      required_structure(params, Hash)
      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, '?format=json'+"#{query_str.chop}")
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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