Class: Growatt::API
- Inherits:
-
Object
- Object
- Growatt::API
- Includes:
- Authentication, Connection, WrAPI::Authentication, WrAPI::Connection, WrAPI::Request
- Defined in:
- lib/growatt/api.rb
Overview
The API class is an internal component of the Growatt module.
It is responsible for managing API configurations, connections, and authentication.
This class should not be accessed directly. Instead, use Growatt.client to interact with the API.
Direct Known Subclasses
Instance Method Summary collapse
-
#config ⇒ Hash
Retrieves the current API configuration as a hash.
-
#initialize(options = {}) ⇒ API
constructor
Initializes a new
Growatt::APIinstance.
Methods included from Authentication
Methods included from Connection
Constructor Details
#initialize(options = {}) ⇒ API
Initializes a new Growatt::API instance.
This method copies configuration settings from the Growatt module singleton and allows
for optional overrides through the options parameter.
29 30 31 32 33 34 |
# File 'lib/growatt/api.rb', line 29 def initialize( = {}) = Growatt..merge() WrAPI::Configuration::VALID_OPTIONS_KEYS.each do |key| send("#{key}=", [key]) end end |
Instance Method Details
#config ⇒ Hash
Retrieves the current API configuration as a hash.
43 44 45 46 47 48 49 |
# File 'lib/growatt/api.rb', line 43 def config conf = {} WrAPI::Configuration::VALID_OPTIONS_KEYS.each do |key| conf[key] = send key end conf end |