Class: Hoolp::Client
Constant Summary collapse
- USER_AGENT =
"ASK HELMUT Hooolp Client #{VERSION}".freeze
- DEFAULT_OPTIONS =
{ base_url: "http://api2.hooolp.com" }.freeze
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #api_key ⇒ Object
- #base_url ⇒ Object
- #events(location_id:) ⇒ Object
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(options) ⇒ Client
Returns a new instance of Client.
14 15 16 |
# File 'lib/hoolp/client.rb', line 14 def initialize() () end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
10 11 12 |
# File 'lib/hoolp/client.rb', line 10 def @options end |
Instance Method Details
#api_key ⇒ Object
41 42 43 |
# File 'lib/hoolp/client.rb', line 41 def api_key @options.fetch(:api_key) end |
#base_url ⇒ Object
37 38 39 |
# File 'lib/hoolp/client.rb', line 37 def base_url @options.fetch(:base_url) end |
#events(location_id:) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/hoolp/client.rb', line 18 def events(location_id:) query = construct_query_arguments( resource: "events", options: "locations=#{location_id}&ctr=DE" ) response = self.class.get( *query ) result = JSON.parse(response.body) raise ApiError(result) if !result.is_a?(Array) && result.key?("error") result.map do |item| Resource::Event.new(item.fetch("event")) end end |