Class: Enphase::Client
- Inherits:
-
Object
- Object
- Enphase::Client
- Defined in:
- lib/enphase/client.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#datetime_format ⇒ Object
readonly
Returns the value of attribute datetime_format.
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
Instance Method Summary collapse
-
#initialize(api_key:, user_id:, datetime_format: 'iso8601') ⇒ Client
constructor
datetime format can be ‘iso8601’ or ‘epoch’, defaults to ‘iso8601’.
-
#inverters(site_id:) ⇒ Object
Inverters Summary Endpoint.
-
#stats(system_id:, **params) ⇒ Object
Stats Endpoint.
-
#summary(system_id:, **params) ⇒ Object
Summary Endpoint.
-
#systems(**params) ⇒ Object
Index Endpoint.
Constructor Details
#initialize(api_key:, user_id:, datetime_format: 'iso8601') ⇒ Client
datetime format can be ‘iso8601’ or ‘epoch’, defaults to ‘iso8601’
15 16 17 18 19 |
# File 'lib/enphase/client.rb', line 15 def initialize(api_key:, user_id:, datetime_format: 'iso8601') @api_key = api_key @user_id = user_id @datetime_format = datetime_format end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
12 13 14 |
# File 'lib/enphase/client.rb', line 12 def api_key @api_key end |
#datetime_format ⇒ Object (readonly)
Returns the value of attribute datetime_format.
12 13 14 |
# File 'lib/enphase/client.rb', line 12 def datetime_format @datetime_format end |
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
12 13 14 |
# File 'lib/enphase/client.rb', line 12 def user_id @user_id end |
Instance Method Details
#inverters(site_id:) ⇒ Object
Inverters Summary Endpoint
32 33 34 |
# File 'lib/enphase/client.rb', line 32 def inverters(site_id:) get_json(url: 'systems/inverters_summary_by_envoy_or_site', params: {site_id: site_id}) end |
#stats(system_id:, **params) ⇒ Object
Stats Endpoint
22 23 24 |
# File 'lib/enphase/client.rb', line 22 def stats(system_id:, **params) get_json(url: "systems/#{system_id}/stats", params: params) end |
#summary(system_id:, **params) ⇒ Object
Summary Endpoint
27 28 29 |
# File 'lib/enphase/client.rb', line 27 def summary(system_id:, **params) get_json(url: "systems/#{system_id}/summary", params: params) end |
#systems(**params) ⇒ Object
Index Endpoint
37 38 39 |
# File 'lib/enphase/client.rb', line 37 def systems(**params) get_json(url: 'systems', params: params) end |