Class: Magicseaweed::APIClient
- Inherits:
-
Object
- Object
- Magicseaweed::APIClient
- Defined in:
- lib/magicseaweed/api_client.rb
Overview
Call the Magicseaweed API
Defined Under Namespace
Classes: Error
Constant Summary collapse
- HOST =
'magicseaweed.com'
Instance Method Summary collapse
- #get_forecast(spot_id:, fields: nil) ⇒ Object
-
#initialize(api_key:, units: nil) ⇒ APIClient
constructor
A new instance of APIClient.
Constructor Details
#initialize(api_key:, units: nil) ⇒ APIClient
Returns a new instance of APIClient.
13 14 15 16 |
# File 'lib/magicseaweed/api_client.rb', line 13 def initialize(api_key:, units: nil) @api_key = api_key @units = units end |
Instance Method Details
#get_forecast(spot_id:, fields: nil) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/magicseaweed/api_client.rb', line 18 def get_forecast(spot_id:, fields: nil) @spot_id = spot_id @fields = fields Net::HTTP.get_response(forecast_uri).then(&method(:handle_response)) end |