Class: Orb::Resources::Customers::Credits
- Inherits:
-
Object
- Object
- Orb::Resources::Customers::Credits
- Defined in:
- lib/orb/resources/customers/credits.rb,
lib/orb/resources/customers/credits/ledger.rb,
lib/orb/resources/customers/credits/top_ups.rb
Defined Under Namespace
Instance Attribute Summary collapse
- #ledger ⇒ Orb::Resources::Customers::Credits::Ledger readonly
- #top_ups ⇒ Orb::Resources::Customers::Credits::TopUps readonly
Instance Method Summary collapse
-
#initialize(client:) ⇒ Credits
constructor
private
A new instance of Credits.
-
#list(customer_id, currency: nil, cursor: nil, include_all_blocks: nil, limit: nil, request_options: {}) ⇒ Orb::Internal::Page<Orb::Models::Customers::CreditListResponse>
Some parameter documentations has been truncated, see Models::Customers::CreditListParams for more details.
-
#list_by_external_id(external_customer_id, currency: nil, cursor: nil, include_all_blocks: nil, limit: nil, request_options: {}) ⇒ Orb::Internal::Page<Orb::Models::Customers::CreditListByExternalIDResponse>
Some parameter documentations has been truncated, see Models::Customers::CreditListByExternalIDParams for more details.
Constructor Details
#initialize(client:) ⇒ Credits
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Credits.
96 97 98 99 100 |
# File 'lib/orb/resources/customers/credits.rb', line 96 def initialize(client:) @client = client @ledger = Orb::Resources::Customers::Credits::Ledger.new(client: client) @top_ups = Orb::Resources::Customers::Credits::TopUps.new(client: client) end |
Instance Attribute Details
#ledger ⇒ Orb::Resources::Customers::Credits::Ledger (readonly)
8 9 10 |
# File 'lib/orb/resources/customers/credits.rb', line 8 def ledger @ledger end |
#top_ups ⇒ Orb::Resources::Customers::Credits::TopUps (readonly)
11 12 13 |
# File 'lib/orb/resources/customers/credits.rb', line 11 def top_ups @top_ups end |
Instance Method Details
#list(customer_id, currency: nil, cursor: nil, include_all_blocks: nil, limit: nil, request_options: {}) ⇒ Orb::Internal::Page<Orb::Models::Customers::CreditListResponse>
Some parameter documentations has been truncated, see Models::Customers::CreditListParams for more details.
Returns a paginated list of unexpired, non-zero credit blocks for a customer.
If ‘include_all_blocks` is set to `true`, all credit blocks (including expired and depleted blocks) will be included in the response.
Note that ‘currency` defaults to credits if not specified. To use a real world currency, set `currency` to an ISO 4217 string.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/orb/resources/customers/credits.rb', line 41 def list(customer_id, params = {}) parsed, = Orb::Customers::CreditListParams.dump_request(params) @client.request( method: :get, path: ["customers/%1$s/credits", customer_id], query: parsed, page: Orb::Internal::Page, model: Orb::Models::Customers::CreditListResponse, options: ) end |
#list_by_external_id(external_customer_id, currency: nil, cursor: nil, include_all_blocks: nil, limit: nil, request_options: {}) ⇒ Orb::Internal::Page<Orb::Models::Customers::CreditListByExternalIDResponse>
Some parameter documentations has been truncated, see Models::Customers::CreditListByExternalIDParams for more details.
Returns a paginated list of unexpired, non-zero credit blocks for a customer.
If ‘include_all_blocks` is set to `true`, all credit blocks (including expired and depleted blocks) will be included in the response.
Note that ‘currency` defaults to credits if not specified. To use a real world currency, set `currency` to an ISO 4217 string.
81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/orb/resources/customers/credits.rb', line 81 def list_by_external_id(external_customer_id, params = {}) parsed, = Orb::Customers::CreditListByExternalIDParams.dump_request(params) @client.request( method: :get, path: ["customers/external_customer_id/%1$s/credits", external_customer_id], query: parsed, page: Orb::Internal::Page, model: Orb::Models::Customers::CreditListByExternalIDResponse, options: ) end |