Class: EasyBroker::Locations
- Inherits:
-
Object
- Object
- EasyBroker::Locations
- Defined in:
- lib/easy_broker/locations.rb
Constant Summary collapse
- ENDPOINT =
'/locations'
Instance Attribute Summary collapse
-
#api_client ⇒ Object
readonly
Returns the value of attribute api_client.
Instance Method Summary collapse
- #find(name = nil) ⇒ Object
-
#initialize(api_client) ⇒ Locations
constructor
A new instance of Locations.
Constructor Details
#initialize(api_client) ⇒ Locations
Returns a new instance of Locations.
8 9 10 |
# File 'lib/easy_broker/locations.rb', line 8 def initialize(api_client) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object (readonly)
Returns the value of attribute api_client.
6 7 8 |
# File 'lib/easy_broker/locations.rb', line 6 def api_client @api_client end |
Instance Method Details
#find(name = nil) ⇒ Object
12 13 14 15 16 |
# File 'lib/easy_broker/locations.rb', line 12 def find(name = nil) query = { query: name }.compact response = api_client.get(ENDPOINT, query: query) JSON.parse(response.body, object_class: OpenStruct) end |