Module: Growatt
- Extended by:
- WrAPI::Configuration, WrAPI::RespondTo
- Defined in:
- lib/growatt.rb,
lib/growatt/api.rb,
lib/growatt/const.rb,
lib/growatt/error.rb,
lib/growatt/client.rb,
lib/growatt/version.rb,
lib/growatt/connection.rb,
lib/growatt/pagination.rb,
lib/growatt/authorization.rb
Overview
The ‘Growatt` module provides a Ruby client for interacting with the Growatt API.
It extends ‘WrAPI::Configuration` for managing API settings and `WrAPI::RespondTo` for handling API responses dynamically.
The module allows you to create a client instance, configure API endpoints, and manage pagination settings.
Defined Under Namespace
Modules: Authentication, Connection, RequestPagination Classes: API, AuthenticationError, Client, ConfigurationError, Enum, ExportLimit, GrowattError, Inverter, Timespan
Constant Summary collapse
- DEFAULT_UA =
Default User-Agent string for API requests.
"Ruby Growatt API client #{Growatt::VERSION}".freeze
- DEFAULT_ENDPOINT =
Default API endpoint for Growatt services.
Note: ‘openapi.growatt.com/` is an alternative, but it does not work with some accounts.
'https://server.growatt.com/'
- DEFAULT_PAGINATION =
Default pagination class used for handling paginated API responses.
RequestPagination::DataPager
- VERSION =
'0.2.1'
Class Method Summary collapse
-
.client(options = {}) ⇒ Growatt::Client
Initializes and returns a new ‘Growatt::Client` instance.
-
.reset ⇒ Object
Resets the Growatt configuration to default values.
Class Method Details
.client(options = {}) ⇒ Growatt::Client
Initializes and returns a new ‘Growatt::Client` instance.
44 45 46 47 48 49 50 |
# File 'lib/growatt.rb', line 44 def self.client( = {}) Growatt::Client.new({ user_agent: DEFAULT_UA, endpoint: DEFAULT_ENDPOINT, pagination_class: DEFAULT_PAGINATION }.merge()) end |
.reset ⇒ Object
Resets the Growatt configuration to default values.
This method restores the API endpoint, user agent, and pagination settings to their default values.
55 56 57 58 59 60 61 |
# File 'lib/growatt.rb', line 55 def self.reset super self.endpoint = nil self.user_agent = DEFAULT_UA self.endpoint = DEFAULT_ENDPOINT self.pagination_class = DEFAULT_PAGINATION end |