Class: CityGrid::Api
- Inherits:
-
Object
show all
- Defined in:
- lib/city_grid/api.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(request_opts = {}) ⇒ Api
Returns a new instance of Api.
6
7
8
|
# File 'lib/city_grid/api.rb', line 6
def initialize request_opts={}
@request_opts = request_opts
end
|
Instance Attribute Details
#request_opts ⇒ Object
Returns the value of attribute request_opts.
4
5
6
|
# File 'lib/city_grid/api.rb', line 4
def request_opts
@request_opts
end
|
Instance Method Details
#request ⇒ Object
14
15
16
|
# File 'lib/city_grid/api.rb', line 14
def request
@request ||= Request.new(uri, request_opts)
end
|
#results ⇒ Object
10
11
12
|
# File 'lib/city_grid/api.rb', line 10
def results
Result.new(request.parsed_response)
end
|
#uri ⇒ Object
18
19
20
|
# File 'lib/city_grid/api.rb', line 18
def uri
raise "must be called from a subclass of Api"
end
|