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,
sig/orb/resources/customers/credits.rbs,
sig/orb/resources/customers/credits/ledger.rbs,
sig/orb/resources/customers/credits/top_ups.rbs
Overview
The Credit Ledger Entry resource models prepaid credits within Orb.
Defined Under Namespace
Instance Attribute Summary collapse
-
#ledger ⇒ Orb::Resources::Customers::Credits::Ledger
readonly
The Credit Ledger Entry resource models prepaid credits within Orb.
-
#top_ups ⇒ Orb::Resources::Customers::Credits::TopUps
readonly
The Credit Ledger Entry resource models prepaid credits within Orb.
Instance Method Summary collapse
-
#initialize(client:) ⇒ Credits
constructor
private
A new instance of Credits.
-
#list(customer_id, currency: nil, cursor: nil, effective_date_gt: nil, effective_date_gte: nil, effective_date_lt: nil, effective_date_lte: 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, effective_date_gt: nil, effective_date_gte: nil, effective_date_lt: nil, effective_date_lte: 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.
140 141 142 143 144 |
# File 'lib/orb/resources/customers/credits.rb', line 140 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)
The Credit Ledger Entry resource models prepaid credits within Orb.
12 13 14 |
# File 'lib/orb/resources/customers/credits.rb', line 12 def ledger @ledger end |
#top_ups ⇒ Orb::Resources::Customers::Credits::TopUps (readonly)
The Credit Ledger Entry resource models prepaid credits within Orb.
17 18 19 |
# File 'lib/orb/resources/customers/credits.rb', line 17 def top_ups @top_ups end |
Instance Method Details
#list(customer_id, currency: nil, cursor: nil, effective_date_gt: nil, effective_date_gte: nil, effective_date_lt: nil, effective_date_lte: 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.
Results can be filtered by the block's effective_date using the
effective_date[gte], effective_date[gt], effective_date[lt], and
effective_date[lte] query parameters. This filters on when the credit block
becomes effective, which may differ from creation time for backdated credits.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/orb/resources/customers/credits.rb', line 60 def list(customer_id, params = {}) parsed, = Orb::Customers::CreditListParams.dump_request(params) query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["customers/%1$s/credits", customer_id], query: query.transform_keys( effective_date_gt: "effective_date[gt]", effective_date_gte: "effective_date[gte]", effective_date_lt: "effective_date[lt]", effective_date_lte: "effective_date[lte]" ), page: Orb::Internal::Page, model: Orb::Models::Customers::CreditListResponse, options: ) end |
#list_by_external_id(external_customer_id, currency: nil, cursor: nil, effective_date_gt: nil, effective_date_gte: nil, effective_date_lt: nil, effective_date_lte: 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.
Results can be filtered by the block's effective_date using the
effective_date[gte], effective_date[gt], effective_date[lt], and
effective_date[lte] query parameters. This filters on when the credit block
becomes effective, which may differ from creation time for backdated credits.
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/orb/resources/customers/credits.rb', line 119 def list_by_external_id(external_customer_id, params = {}) parsed, = Orb::Customers::CreditListByExternalIDParams.dump_request(params) query = Orb::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["customers/external_customer_id/%1$s/credits", external_customer_id], query: query.transform_keys( effective_date_gt: "effective_date[gt]", effective_date_gte: "effective_date[gte]", effective_date_lt: "effective_date[lt]", effective_date_lte: "effective_date[lte]" ), page: Orb::Internal::Page, model: Orb::Models::Customers::CreditListByExternalIDResponse, options: ) end |