Class: Alman::ApiClient
- Inherits:
-
Object
- Object
- Alman::ApiClient
- Defined in:
- lib/alman/apibits/api_client.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
- #execute(api_method) ⇒ Object
-
#initialize(headers, params) ⇒ ApiClient
constructor
A new instance of ApiClient.
- #inspect ⇒ Object
- #refresh_from(headers, params) ⇒ Object
Constructor Details
#initialize(headers, params) ⇒ ApiClient
Returns a new instance of ApiClient.
5 6 7 |
# File 'lib/alman/apibits/api_client.rb', line 5 def initialize(headers, params) self.refresh_from(headers, params) end |
Instance Attribute Details
#headers ⇒ Object
Returns the value of attribute headers.
3 4 5 |
# File 'lib/alman/apibits/api_client.rb', line 3 def headers @headers end |
#params ⇒ Object
Returns the value of attribute params.
3 4 5 |
# File 'lib/alman/apibits/api_client.rb', line 3 def params @params end |
Instance Method Details
#execute(api_method) ⇒ Object
15 16 17 18 19 |
# File 'lib/alman/apibits/api_client.rb', line 15 def execute(api_method) api_method.headers = ParamsBuilder.merge(api_method.headers, @headers) api_method.params = ParamsBuilder.merge(api_method.params, @params) api_method.execute end |
#inspect ⇒ Object
21 22 23 24 25 |
# File 'lib/alman/apibits/api_client.rb', line 21 def inspect "#<#{self.class}:0x#{self.object_id.to_s(16)}> Headers: " + JSON.pretty_generate(@headers) + ", Params: " + JSON.pretty_generate(@params) end |
#refresh_from(headers, params) ⇒ Object
9 10 11 12 13 |
# File 'lib/alman/apibits/api_client.rb', line 9 def refresh_from(headers, params) @headers = headers @params = params self end |