Class: Lago::Api::Client
- Inherits:
-
Object
- Object
- Lago::Api::Client
- Defined in:
- lib/lago/api/client.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#api_url ⇒ Object
readonly
Returns the value of attribute api_url.
Instance Method Summary collapse
- #applied_add_ons ⇒ Object
- #applied_coupons ⇒ Object
- #base_api_url ⇒ Object
- #customers ⇒ Object
- #events ⇒ Object
-
#initialize(api_key: nil, api_url: nil) ⇒ Client
constructor
A new instance of Client.
- #subscriptions ⇒ Object
Constructor Details
#initialize(api_key: nil, api_url: nil) ⇒ Client
Returns a new instance of Client.
11 12 13 14 |
# File 'lib/lago/api/client.rb', line 11 def initialize(api_key: nil, api_url: nil) @api_key = api_key @api_url = api_url end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
9 10 11 |
# File 'lib/lago/api/client.rb', line 9 def api_key @api_key end |
#api_url ⇒ Object (readonly)
Returns the value of attribute api_url.
9 10 11 |
# File 'lib/lago/api/client.rb', line 9 def api_url @api_url end |
Instance Method Details
#applied_add_ons ⇒ Object
38 39 40 |
# File 'lib/lago/api/client.rb', line 38 def applied_add_ons Lago::Api::Resources::AppliedAddOn.new(self) end |
#applied_coupons ⇒ Object
34 35 36 |
# File 'lib/lago/api/client.rb', line 34 def applied_coupons Lago::Api::Resources::AppliedCoupon.new(self) end |
#base_api_url ⇒ Object
16 17 18 19 20 |
# File 'lib/lago/api/client.rb', line 16 def base_api_url base_url = api_url.nil? ? Lago::Api::BASE_URL : api_url URI.join(base_url, Lago::Api::API_PATH) end |
#customers ⇒ Object
22 23 24 |
# File 'lib/lago/api/client.rb', line 22 def customers Lago::Api::Resources::Customer.new(self) end |
#events ⇒ Object
30 31 32 |
# File 'lib/lago/api/client.rb', line 30 def events Lago::Api::Resources::Event.new(self) end |
#subscriptions ⇒ Object
26 27 28 |
# File 'lib/lago/api/client.rb', line 26 def subscriptions Lago::Api::Resources::Subscription.new(self) end |