Class: MetrifoxSDK::Client
- Inherits:
-
Object
- Object
- MetrifoxSDK::Client
- Includes:
- UtilMethods
- Defined in:
- lib/metrifox_sdk/client.rb
Constant Summary collapse
- DEFAULT_BASE_URL =
"https://api.metrifox.com/api/v1/".freeze
- DEFAULT_WEB_APP_BASE_URL =
"https://app.metrifox.com".freeze
- METER_SERVICE_BASE_URL =
"https://api-meter.metrifox.com/".freeze
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#meter_service_base_url ⇒ Object
readonly
Returns the value of attribute meter_service_base_url.
-
#web_app_base_url ⇒ Object
readonly
Returns the value of attribute web_app_base_url.
Instance Method Summary collapse
- #checkout ⇒ Object
- #customers ⇒ Object
-
#initialize(config = {}) ⇒ Client
constructor
A new instance of Client.
- #subscriptions ⇒ Object
- #usages ⇒ Object
- #wallets ⇒ Object
Methods included from UtilMethods
Constructor Details
#initialize(config = {}) ⇒ Client
Returns a new instance of Client.
13 14 15 16 17 18 19 |
# File 'lib/metrifox_sdk/client.rb', line 13 def initialize(config = {}) @config = config @api_key = config[:api_key] || get_api_key_from_environment @base_url = config[:base_url] || DEFAULT_BASE_URL @web_app_base_url = config[:web_app_base_url] || DEFAULT_WEB_APP_BASE_URL @meter_service_base_url = config[:meter_service_base_url] || ENV["METRIFOX_METER_SERVICE_BASE_URL"] || METER_SERVICE_BASE_URL end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
11 12 13 |
# File 'lib/metrifox_sdk/client.rb', line 11 def api_key @api_key end |
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
11 12 13 |
# File 'lib/metrifox_sdk/client.rb', line 11 def base_url @base_url end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
11 12 13 |
# File 'lib/metrifox_sdk/client.rb', line 11 def config @config end |
#meter_service_base_url ⇒ Object (readonly)
Returns the value of attribute meter_service_base_url.
11 12 13 |
# File 'lib/metrifox_sdk/client.rb', line 11 def meter_service_base_url @meter_service_base_url end |
#web_app_base_url ⇒ Object (readonly)
Returns the value of attribute web_app_base_url.
11 12 13 |
# File 'lib/metrifox_sdk/client.rb', line 11 def web_app_base_url @web_app_base_url end |
Instance Method Details
#checkout ⇒ Object
29 30 31 |
# File 'lib/metrifox_sdk/client.rb', line 29 def checkout @checkout ||= Checkout::Module.new(self) end |
#customers ⇒ Object
21 22 23 |
# File 'lib/metrifox_sdk/client.rb', line 21 def customers @customers ||= Customers::Module.new(self) end |
#subscriptions ⇒ Object
33 34 35 |
# File 'lib/metrifox_sdk/client.rb', line 33 def subscriptions @subscriptions ||= Subscriptions::Module.new(self) end |