Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Latest commit

 

History

History
363 lines (255 loc) · 8.56 KB

AddOnsApi.md

File metadata and controls

363 lines (255 loc) · 8.56 KB

LagoAPI::AddOnsApi

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

Method HTTP request Description
create_add_on POST /add_ons Create an add-on
destroy_add_on DELETE /add_ons/{code} Delete an add-on
find_add_on GET /add_ons/{code} Retrieve an add-on
find_all_add_ons GET /add_ons List all add-ons
update_add_on PUT /add_ons/{code} Update an add-on

create_add_on

create_add_on(add_on_create_input)

Create an add-on

This endpoint is used to create an add-on that can be then attached to a one-off invoice.

Examples

require 'time'
require 'lago_ruby'
# setup authorization
LagoAPI.configure do |config|
  # Configure Bearer authorization: bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
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 "Error when calling AddOnsApi->create_add_on: #{e}"
end

Using the create_add_on_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> create_add_on_with_http_info(add_on_create_input)

begin
  # Create an add-on
  data, status_code, headers = api_instance.create_add_on_with_http_info(add_on_create_input)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <AddOn>
rescue LagoAPI::ApiError => e
  puts "Error when calling AddOnsApi->create_add_on_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
add_on_create_input AddOnCreateInput Add-on payload

Return type

AddOn

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

destroy_add_on

destroy_add_on(code)

Delete an add-on

This endpoint is used to delete an existing add-on.

Examples

require 'time'
require 'lago_ruby'
# setup authorization
LagoAPI.configure do |config|
  # Configure Bearer authorization: bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = LagoAPI::AddOnsApi.new
code = 'setup_fee' # String | Unique code used to identify the add-on.

begin
  # Delete an add-on
  result = api_instance.destroy_add_on(code)
  p result
rescue LagoAPI::ApiError => e
  puts "Error when calling AddOnsApi->destroy_add_on: #{e}"
end

Using the destroy_add_on_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> destroy_add_on_with_http_info(code)

begin
  # Delete an add-on
  data, status_code, headers = api_instance.destroy_add_on_with_http_info(code)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <AddOn>
rescue LagoAPI::ApiError => e
  puts "Error when calling AddOnsApi->destroy_add_on_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
code String Unique code used to identify the add-on.

Return type

AddOn

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

find_add_on

find_add_on(code)

Retrieve an add-on

This endpoint is used to retrieve a specific add-on.

Examples

require 'time'
require 'lago_ruby'
# setup authorization
LagoAPI.configure do |config|
  # Configure Bearer authorization: bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = LagoAPI::AddOnsApi.new
code = 'setup_fee' # String | Unique code used to identify the add-on.

begin
  # Retrieve an add-on
  result = api_instance.find_add_on(code)
  p result
rescue LagoAPI::ApiError => e
  puts "Error when calling AddOnsApi->find_add_on: #{e}"
end

Using the find_add_on_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> find_add_on_with_http_info(code)

begin
  # Retrieve an add-on
  data, status_code, headers = api_instance.find_add_on_with_http_info(code)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <AddOn>
rescue LagoAPI::ApiError => e
  puts "Error when calling AddOnsApi->find_add_on_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
code String Unique code used to identify the add-on.

Return type

AddOn

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

find_all_add_ons

find_all_add_ons(opts)

List all add-ons

This endpoint is used to list all existing add-ons.

Examples

require 'time'
require 'lago_ruby'
# setup authorization
LagoAPI.configure do |config|
  # Configure Bearer authorization: bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = LagoAPI::AddOnsApi.new
opts = {
  page: 1, # Integer | Page number.
  per_page: 20 # Integer | Number of records per page.
}

begin
  # List all add-ons
  result = api_instance.find_all_add_ons(opts)
  p result
rescue LagoAPI::ApiError => e
  puts "Error when calling AddOnsApi->find_all_add_ons: #{e}"
end

Using the find_all_add_ons_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> find_all_add_ons_with_http_info(opts)

begin
  # List all add-ons
  data, status_code, headers = api_instance.find_all_add_ons_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <AddOnsPaginated>
rescue LagoAPI::ApiError => e
  puts "Error when calling AddOnsApi->find_all_add_ons_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
page Integer Page number. [optional]
per_page Integer Number of records per page. [optional]

Return type

AddOnsPaginated

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

update_add_on

update_add_on(code, add_on_update_input)

Update an add-on

This endpoint is used to update an existing add-on.

Examples

require 'time'
require 'lago_ruby'
# setup authorization
LagoAPI.configure do |config|
  # Configure Bearer authorization: bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = LagoAPI::AddOnsApi.new
code = 'setup_fee' # String | Unique code used to identify the add-on.
add_on_update_input = LagoAPI::AddOnUpdateInput.new({add_on: LagoAPI::AddOnBaseInput.new}) # AddOnUpdateInput | Add-on payload

begin
  # Update an add-on
  result = api_instance.update_add_on(code, add_on_update_input)
  p result
rescue LagoAPI::ApiError => e
  puts "Error when calling AddOnsApi->update_add_on: #{e}"
end

Using the update_add_on_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> update_add_on_with_http_info(code, add_on_update_input)

begin
  # Update an add-on
  data, status_code, headers = api_instance.update_add_on_with_http_info(code, add_on_update_input)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <AddOn>
rescue LagoAPI::ApiError => e
  puts "Error when calling AddOnsApi->update_add_on_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
code String Unique code used to identify the add-on.
add_on_update_input AddOnUpdateInput Add-on payload

Return type

AddOn

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json