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.
-
#ingest_api_url ⇒ Object
readonly
Returns the value of attribute ingest_api_url.
-
#use_ingest_service ⇒ Object
readonly
Returns the value of attribute use_ingest_service.
Instance Method Summary collapse
- #activity_logs ⇒ Object
- #add_ons ⇒ Object
- #applied_coupons ⇒ Object
- #base_api_url ⇒ Object
- #base_ingest_api_url ⇒ Object
- #billable_metrics ⇒ Object
- #billing_entities ⇒ Object
- #coupons ⇒ Object
- #credit_notes ⇒ Object
- #customers ⇒ Object
- #events ⇒ Object
- #fees ⇒ Object
-
#initialize(api_key: nil, api_url: nil, use_ingest_service: false, ingest_api_url: nil) ⇒ Client
constructor
A new instance of Client.
- #invoices ⇒ Object
- #organizations ⇒ Object
- #plans ⇒ Object
- #subscriptions ⇒ Object
- #taxes ⇒ Object
- #wallet_transactions ⇒ Object
- #wallets ⇒ Object
- #webhook_endpoints ⇒ Object
- #webhooks ⇒ Object
Constructor Details
#initialize(api_key: nil, api_url: nil, use_ingest_service: false, ingest_api_url: nil) ⇒ Client
Returns a new instance of Client.
12 13 14 15 16 17 |
# File 'lib/lago/api/client.rb', line 12 def initialize(api_key: nil, api_url: nil, use_ingest_service: false, ingest_api_url: nil) @api_key = api_key @api_url = api_url @use_ingest_service = use_ingest_service @ingest_api_url = ingest_api_url end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
10 11 12 |
# File 'lib/lago/api/client.rb', line 10 def api_key @api_key end |
#api_url ⇒ Object (readonly)
Returns the value of attribute api_url.
10 11 12 |
# File 'lib/lago/api/client.rb', line 10 def api_url @api_url end |
#ingest_api_url ⇒ Object (readonly)
Returns the value of attribute ingest_api_url.
10 11 12 |
# File 'lib/lago/api/client.rb', line 10 def ingest_api_url @ingest_api_url end |
#use_ingest_service ⇒ Object (readonly)
Returns the value of attribute use_ingest_service.
10 11 12 |
# File 'lib/lago/api/client.rb', line 10 def use_ingest_service @use_ingest_service end |
Instance Method Details
#activity_logs ⇒ Object
104 105 106 |
# File 'lib/lago/api/client.rb', line 104 def activity_logs Lago::Api::Resources::ActivityLog.new(self) end |
#add_ons ⇒ Object
72 73 74 |
# File 'lib/lago/api/client.rb', line 72 def add_ons Lago::Api::Resources::AddOn.new(self) end |
#applied_coupons ⇒ Object
52 53 54 |
# File 'lib/lago/api/client.rb', line 52 def applied_coupons Lago::Api::Resources::AppliedCoupon.new(self) end |
#base_api_url ⇒ Object
19 20 21 22 23 |
# File 'lib/lago/api/client.rb', line 19 def base_api_url base_url = api_url.nil? ? Lago::Api::BASE_URL : api_url URI.join(base_url, Lago::Api::API_PATH) end |
#base_ingest_api_url ⇒ Object
25 26 27 28 29 30 |
# File 'lib/lago/api/client.rb', line 25 def base_ingest_api_url return base_api_url unless use_ingest_service ingest_url = ingest_api_url.nil? ? Lago::Api::BASE_INGEST_URL : ingest_api_url URI.join(ingest_url, Lago::Api::API_PATH) end |
#billable_metrics ⇒ Object
56 57 58 |
# File 'lib/lago/api/client.rb', line 56 def billable_metrics Lago::Api::Resources::BillableMetric.new(self) end |
#billing_entities ⇒ Object
100 101 102 |
# File 'lib/lago/api/client.rb', line 100 def billing_entities Lago::Api::Resources::BillingEntity.new(self) end |
#coupons ⇒ Object
68 69 70 |
# File 'lib/lago/api/client.rb', line 68 def coupons Lago::Api::Resources::Coupon.new(self) end |
#credit_notes ⇒ Object
60 61 62 |
# File 'lib/lago/api/client.rb', line 60 def credit_notes Lago::Api::Resources::CreditNote.new(self) end |
#customers ⇒ Object
32 33 34 |
# File 'lib/lago/api/client.rb', line 32 def customers Lago::Api::Resources::Customer.new(self) end |
#events ⇒ Object
44 45 46 |
# File 'lib/lago/api/client.rb', line 44 def events Lago::Api::Resources::Event.new(self) end |
#fees ⇒ Object
48 49 50 |
# File 'lib/lago/api/client.rb', line 48 def fees Lago::Api::Resources::Fee.new(self) end |
#invoices ⇒ Object
36 37 38 |
# File 'lib/lago/api/client.rb', line 36 def invoices Lago::Api::Resources::Invoice.new(self) end |
#organizations ⇒ Object
76 77 78 |
# File 'lib/lago/api/client.rb', line 76 def organizations Lago::Api::Resources::Organization.new(self) end |
#plans ⇒ Object
64 65 66 |
# File 'lib/lago/api/client.rb', line 64 def plans Lago::Api::Resources::Plan.new(self) end |
#subscriptions ⇒ Object
40 41 42 |
# File 'lib/lago/api/client.rb', line 40 def subscriptions Lago::Api::Resources::Subscription.new(self) end |
#taxes ⇒ Object
80 81 82 |
# File 'lib/lago/api/client.rb', line 80 def taxes Lago::Api::Resources::Tax.new(self) end |
#wallet_transactions ⇒ Object
88 89 90 |
# File 'lib/lago/api/client.rb', line 88 def wallet_transactions Lago::Api::Resources::WalletTransaction.new(self) end |
#wallets ⇒ Object
84 85 86 |
# File 'lib/lago/api/client.rb', line 84 def wallets Lago::Api::Resources::Wallet.new(self) end |
#webhook_endpoints ⇒ Object
96 97 98 |
# File 'lib/lago/api/client.rb', line 96 def webhook_endpoints Lago::Api::Resources::WebhookEndpoint.new(self) end |