Class: Citywrapper::ApiBase
- Inherits:
-
Object
- Object
- Citywrapper::ApiBase
- Defined in:
- lib/citywrapper/api_base.rb
Direct Known Subclasses
Constant Summary collapse
- JSON_HEADERS =
{ 'Content-Type' => 'application/json', 'Accept' => 'application/json' }.freeze
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize ⇒ ApiBase
constructor
A new instance of ApiBase.
- #request(params: {}, method: :get) ⇒ Object
Constructor Details
#initialize ⇒ ApiBase
Returns a new instance of ApiBase.
12 13 14 15 |
# File 'lib/citywrapper/api_base.rb', line 12 def initialize @config = Citywrapper.configuration warn "NOTE: #{self.class} is deprecated and will likely not work in the future" end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
5 6 7 |
# File 'lib/citywrapper/api_base.rb', line 5 def config @config end |
#response ⇒ Object
Returns the value of attribute response.
5 6 7 |
# File 'lib/citywrapper/api_base.rb', line 5 def response @response end |
Instance Method Details
#request(params: {}, method: :get) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/citywrapper/api_base.rb', line 17 def request(params: {}, method: :get) raise 'Please set your API key' unless config.api_key @method = method @params = params @query_uri = build_query run_request process_response end |