Skip to content

getlago/lago-ruby

Repository files navigation

lago_ruby

LagoAPI - the Ruby gem for the Lago API documentation

Lago API allows your application to push customer information and metrics (events) from your application to the billing application.

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 0.51.0-beta
  • Package version: 0.52.0-beta
  • Build package: org.openapitools.codegen.languages.RubyClientCodegen

Gem Version License: MIT

Installation

Build a gem

To build the Ruby code into a gem:

gem build lago_ruby.gemspec

Then either install the gem locally:

gem install ./lago_ruby-0.52.0-beta.gem

(for development, run gem install --dev ./lago_ruby-0.52.0-beta.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'lago_ruby', '~> 0.52.0-beta'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'lago_ruby', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'lago_ruby'

# Setup authorization
LagoAPI.configure do |config|
  # Configure Bearer authorization: bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
  # Configure a proc to get access tokens in lieu of the static access_token configuration
  config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } 
end

api_instance = LagoAPI::AddOnsApi.new
add_on_create_input = LagoAPI::AddOnCreateInput.new({add_on: LagoAPI::AddOnCreateInputAddOn.new({name: 'Setup Fee', code: 'setup_fee', amount_cents: 50000, amount_currency: LagoAPI::Currency::AED})}) # AddOnCreateInput | Add-on payload

begin
  #Create an add-on
  result = api_instance.create_add_on(add_on_create_input)
  p result
rescue LagoAPI::ApiError => e
  puts "Exception when calling AddOnsApi->create_add_on: #{e}"
end

Documentation for API Endpoints

The Lago API documentation documentation is available at https://doc.getlago.com.

All URIs are relative to https://api.getlago.com/api/v1

Class Method HTTP request Description
LagoAPI::AddOnsApi create_add_on POST /add_ons Create an add-on
LagoAPI::AddOnsApi destroy_add_on DELETE /add_ons/{code} Delete an add-on
LagoAPI::AddOnsApi find_add_on GET /add_ons/{code} Retrieve an add-on
LagoAPI::AddOnsApi find_all_add_ons GET /add_ons List all add-ons
LagoAPI::AddOnsApi update_add_on PUT /add_ons/{code} Update an add-on
LagoAPI::AnalyticsApi find_all_gross_revenues GET /analytics/gross_revenue List gross revenue
LagoAPI::AnalyticsApi find_all_invoiced_usages GET /analytics/invoiced_usage List usage revenue
LagoAPI::AnalyticsApi find_all_mrrs GET /analytics/mrr List MRR
LagoAPI::AnalyticsApi find_all_outstanding_invoices GET /analytics/outstanding_invoices List outstanding invoices
LagoAPI::BillableMetricsApi create_billable_metric POST /billable_metrics Create a billable metric
LagoAPI::BillableMetricsApi destroy_billable_metric DELETE /billable_metrics/{code} Delete a billable metric
LagoAPI::BillableMetricsApi find_all_billable_metric_groups GET /billable_metrics/{code}/groups Find a billable metric's groups
LagoAPI::BillableMetricsApi find_all_billable_metrics GET /billable_metrics List all billable metrics
LagoAPI::BillableMetricsApi find_billable_metric GET /billable_metrics/{code} Retrieve a billable metric
LagoAPI::BillableMetricsApi update_billable_metric PUT /billable_metrics/{code} Update a billable metric
LagoAPI::CouponsApi apply_coupon POST /applied_coupons Apply a coupon to a customer
LagoAPI::CouponsApi create_coupon POST /coupons Create a coupon
LagoAPI::CouponsApi delete_applied_coupon DELETE /customers/{external_customer_id}/applied_coupons/{applied_coupon_id} Delete an applied coupon
LagoAPI::CouponsApi destroy_coupon DELETE /coupons/{code} Delete a coupon
LagoAPI::CouponsApi find_all_applied_coupons GET /applied_coupons List all applied coupons
LagoAPI::CouponsApi find_all_coupons GET /coupons List all coupons
LagoAPI::CouponsApi find_coupon GET /coupons/{code} Retrieve a coupon
LagoAPI::CouponsApi update_coupon PUT /coupons/{code} Update a coupon
LagoAPI::CreditNotesApi create_credit_note POST /credit_notes Create a credit note
LagoAPI::CreditNotesApi download_credit_note POST /credit_notes/{lago_id}/download Download a credit note PDF
LagoAPI::CreditNotesApi estimate_credit_note POST /credit_notes/estimate Estimate amounts for a new credit note
LagoAPI::CreditNotesApi find_all_credit_notes GET /credit_notes List all credit notes
LagoAPI::CreditNotesApi find_credit_note GET /credit_notes/{lago_id} Retrieve a credit note
LagoAPI::CreditNotesApi update_credit_note PUT /credit_notes/{lago_id} Update a credit note
LagoAPI::CreditNotesApi void_credit_note PUT /credit_notes/{lago_id}/void Void a credit note
LagoAPI::CustomersApi create_customer POST /customers Create a customer
LagoAPI::CustomersApi delete_applied_coupon DELETE /customers/{external_customer_id}/applied_coupons/{applied_coupon_id} Delete an applied coupon
LagoAPI::CustomersApi destroy_customer DELETE /customers/{external_id} Delete a customer
LagoAPI::CustomersApi find_all_customer_past_usage GET /customers/{external_customer_id}/past_usage Retrieve customer past usage
LagoAPI::CustomersApi find_all_customers GET /customers List all customers
LagoAPI::CustomersApi find_customer GET /customers/{external_id} Retrieve a customer
LagoAPI::CustomersApi find_customer_current_usage GET /customers/{external_customer_id}/current_usage Retrieve customer current usage
LagoAPI::CustomersApi generate_customer_checkout_url POST /customers/{external_customer_id}/checkout_url Generate a Customer Payment Provider Checkout URL
LagoAPI::CustomersApi get_customer_portal_url GET /customers/{external_customer_id}/portal_url Get a customer portal URL
LagoAPI::EventsApi create_batch_events POST /events/batch Batch multiple events
LagoAPI::EventsApi create_event POST /events Send usage events
LagoAPI::EventsApi event_estimate_fees POST /events/estimate_fees Estimate fees for a pay in advance charge
LagoAPI::EventsApi find_event GET /events/{transaction_id} Retrieve a specific event
LagoAPI::FeesApi find_all_fees GET /fees List all fees
LagoAPI::FeesApi find_fee GET /fees/{lago_id} Retrieve a specific fee
LagoAPI::FeesApi update_fee PUT /fees/{lago_id} Update a fee
LagoAPI::InvoicesApi create_invoice POST /invoices Create a one-off invoice
LagoAPI::InvoicesApi download_invoice POST /invoices/{lago_id}/download Download an invoice PDF
LagoAPI::InvoicesApi finalize_invoice PUT /invoices/{lago_id}/finalize Finalize a draft invoice
LagoAPI::InvoicesApi find_all_invoices GET /invoices List all invoices
LagoAPI::InvoicesApi find_invoice GET /invoices/{lago_id} Retrieve an invoice
LagoAPI::InvoicesApi refresh_invoice PUT /invoices/{lago_id}/refresh Refresh a draft invoice
LagoAPI::InvoicesApi retry_payment POST /invoices/{lago_id}/retry_payment Retry an invoice payment
LagoAPI::InvoicesApi update_invoice PUT /invoices/{lago_id} Update an invoice
LagoAPI::OrganizationsApi update_organization PUT /organizations Update your organization
LagoAPI::PlansApi create_plan POST /plans Create a plan
LagoAPI::PlansApi destroy_plan DELETE /plans/{code} Delete a plan
LagoAPI::PlansApi find_all_plans GET /plans List all plans
LagoAPI::PlansApi find_plan GET /plans/{code} Retrieve a plan
LagoAPI::PlansApi update_plan PUT /plans/{code} Update a plan
LagoAPI::SubscriptionsApi create_subscription POST /subscriptions Assign a plan to a customer
LagoAPI::SubscriptionsApi destroy_subscription DELETE /subscriptions/{external_id} Terminate a subscription
LagoAPI::SubscriptionsApi find_all_subscriptions GET /subscriptions List all subscriptions
LagoAPI::SubscriptionsApi find_subscription GET /subscriptions/{external_id} Retrieve a subscription
LagoAPI::SubscriptionsApi update_subscription PUT /subscriptions/{external_id} Update a subscription
LagoAPI::TaxesApi create_tax POST /taxes Create a tax
LagoAPI::TaxesApi destroy_tax DELETE /taxes/{code} Delete a tax
LagoAPI::TaxesApi find_all_taxes GET /taxes List all taxes
LagoAPI::TaxesApi find_tax GET /taxes/{code} Retrieve a Tax
LagoAPI::TaxesApi update_tax PUT /taxes/{code} Update a tax
LagoAPI::WalletsApi create_wallet POST /wallets Create a wallet
LagoAPI::WalletsApi create_wallet_transaction POST /wallet_transactions Top up a wallet
LagoAPI::WalletsApi destroy_wallet DELETE /wallets/{lago_id} Terminate a wallet
LagoAPI::WalletsApi find_all_wallet_transactions GET /wallets/{lago_id}/wallet_transactions List all wallet transactions
LagoAPI::WalletsApi find_all_wallets GET /wallets List all wallets
LagoAPI::WalletsApi find_wallet GET /wallets/{lago_id} Retrieve a wallet
LagoAPI::WalletsApi update_wallet PUT /wallets/{lago_id} Update a wallet
LagoAPI::WebhookEndpointsApi create_webhook_endpoint POST /webhook_endpoints Create a webhook_endpoint
LagoAPI::WebhookEndpointsApi destroy_webhook_endpoint DELETE /webhook_endpoints/{lago_id} Delete a webhook endpoint
LagoAPI::WebhookEndpointsApi find_all_webhook_endpoints GET /webhook_endpoints List all webhook endpoints
LagoAPI::WebhookEndpointsApi find_webhook_endpoint GET /webhook_endpoints/{lago_id} Retrieve a webhook endpoint
LagoAPI::WebhookEndpointsApi update_webhook_endpoint PUT /webhook_endpoints/{lago_id} Update a webhook endpoint
LagoAPI::WebhooksApi fetch_public_key GET /webhooks/public_key Retrieve webhook public key

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

bearerAuth

  • Type: Bearer authentication

Releases

No releases published

Packages

No packages published