Class: PlayAsia::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/play_asia/query.rb

Direct Known Subclasses

ListingQuery

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_client) ⇒ Query

Returns a new instance of Query.



4
5
6
7
# File 'lib/play_asia/query.rb', line 4

def initialize(http_client)
  @endpoint = 'http://www.play-asia.com/__api__.php'
  @http_client = http_client
end

Instance Attribute Details

#urlObject (readonly)

Returns the value of attribute url.



2
3
4
# File 'lib/play_asia/query.rb', line 2

def url
  @url
end

Instance Method Details

#build(headers, opts) ⇒ Object



9
10
11
# File 'lib/play_asia/query.rb', line 9

def build(headers, opts)
  @url = build_url(@endpoint, opts)
end

#execObject



13
14
15
# File 'lib/play_asia/query.rb', line 13

def exec
  PlayAsia::Response.new @http_client.request(@url, headers).read
end