orb-billing 1.12.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -0
- data/README.md +1 -1
- data/lib/orb/client.rb +72 -0
- data/lib/orb/internal/util.rb +31 -0
- data/lib/orb/models/billable_metric.rb +10 -1
- data/lib/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rb +11 -2
- data/lib/orb/models/customers/credits/ledger_create_entry_params.rb +11 -2
- data/lib/orb/models/invoice_create_params.rb +11 -1
- data/lib/orb/models/invoice_update_params.rb +11 -1
- data/lib/orb/models/item.rb +1 -0
- data/lib/orb/models/item_update_params.rb +1 -0
- data/lib/orb/models/new_floating_scalable_matrix_with_unit_pricing_price.rb +9 -1
- data/lib/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rb +9 -1
- data/lib/orb/models/new_subscription_scalable_matrix_with_unit_pricing_price.rb +9 -1
- data/lib/orb/models/price.rb +9 -1
- data/lib/orb/models/price_create_params.rb +9 -1
- data/lib/orb/models/price_evaluate_multiple_params.rb +12 -1
- data/lib/orb/models/price_evaluate_params.rb +12 -1
- data/lib/orb/models/price_evaluate_preview_events_params.rb +12 -1
- data/lib/orb/models/price_interval.rb +12 -1
- data/lib/orb/models/subscription_create_params.rb +24 -2
- data/lib/orb/models/subscription_price_intervals_params.rb +24 -2
- data/lib/orb/models/subscription_schedule_plan_change_params.rb +24 -2
- data/lib/orb/resources/alerts.rb +11 -3
- data/lib/orb/resources/beta/external_plan_id.rb +4 -0
- data/lib/orb/resources/beta.rb +8 -0
- data/lib/orb/resources/coupons/subscriptions.rb +7 -1
- data/lib/orb/resources/coupons.rb +12 -1
- data/lib/orb/resources/credit_blocks.rb +2 -0
- data/lib/orb/resources/credit_notes.rb +4 -1
- data/lib/orb/resources/customers/balance_transactions.rb +20 -1
- data/lib/orb/resources/customers/costs.rb +22 -2
- data/lib/orb/resources/customers/credits/ledger.rb +18 -6
- data/lib/orb/resources/customers/credits/top_ups.rb +6 -2
- data/lib/orb/resources/customers/credits.rb +10 -2
- data/lib/orb/resources/customers.rb +58 -1
- data/lib/orb/resources/dimensional_price_groups.rb +2 -1
- data/lib/orb/resources/events/backfills.rb +5 -1
- data/lib/orb/resources/events/volume.rb +5 -1
- data/lib/orb/resources/events.rb +12 -2
- data/lib/orb/resources/invoice_line_items.rb +5 -0
- data/lib/orb/resources/invoices.rb +23 -10
- data/lib/orb/resources/items.rb +5 -1
- data/lib/orb/resources/license_types.rb +5 -1
- data/lib/orb/resources/licenses/external_licenses.rb +2 -1
- data/lib/orb/resources/licenses/usage.rb +4 -2
- data/lib/orb/resources/licenses.rb +4 -2
- data/lib/orb/resources/metrics.rb +5 -1
- data/lib/orb/resources/plans/external_plan_id.rb +4 -0
- data/lib/orb/resources/plans/migrations.rb +6 -1
- data/lib/orb/resources/plans.rb +14 -1
- data/lib/orb/resources/prices/external_price_id.rb +10 -0
- data/lib/orb/resources/prices.rb +25 -2
- data/lib/orb/resources/subscription_changes.rb +2 -1
- data/lib/orb/resources/subscriptions.rb +8 -4
- data/lib/orb/version.rb +1 -1
- data/rbi/orb/client.rbi +72 -0
- data/rbi/orb/internal/util.rbi +18 -0
- data/rbi/orb/models/billable_metric.rbi +11 -3
- data/rbi/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbi +15 -2
- data/rbi/orb/models/customers/credits/ledger_create_entry_params.rbi +15 -2
- data/rbi/orb/models/invoice_create_params.rbi +12 -0
- data/rbi/orb/models/invoice_update_params.rbi +12 -0
- data/rbi/orb/models/item.rbi +5 -0
- data/rbi/orb/models/item_update_params.rbi +5 -0
- data/rbi/orb/models/new_floating_scalable_matrix_with_unit_pricing_price.rbi +8 -0
- data/rbi/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rbi +8 -0
- data/rbi/orb/models/new_subscription_scalable_matrix_with_unit_pricing_price.rbi +8 -0
- data/rbi/orb/models/price.rbi +8 -0
- data/rbi/orb/models/price_create_params.rbi +8 -0
- data/rbi/orb/models/price_evaluate_multiple_params.rbi +11 -0
- data/rbi/orb/models/price_evaluate_params.rbi +10 -0
- data/rbi/orb/models/price_evaluate_preview_events_params.rbi +11 -0
- data/rbi/orb/models/price_interval.rbi +13 -3
- data/rbi/orb/models/subscription_create_params.rbi +22 -0
- data/rbi/orb/models/subscription_price_intervals_params.rbi +22 -0
- data/rbi/orb/models/subscription_schedule_plan_change_params.rbi +22 -0
- data/rbi/orb/resources/alerts.rbi +5 -0
- data/rbi/orb/resources/beta/external_plan_id.rbi +4 -0
- data/rbi/orb/resources/beta.rbi +8 -0
- data/rbi/orb/resources/coupons/subscriptions.rbi +5 -0
- data/rbi/orb/resources/coupons.rbi +10 -0
- data/rbi/orb/resources/credit_blocks.rbi +2 -0
- data/rbi/orb/resources/credit_notes.rbi +2 -0
- data/rbi/orb/resources/customers/balance_transactions.rbi +18 -0
- data/rbi/orb/resources/customers/costs.rbi +18 -0
- data/rbi/orb/resources/customers/credits/ledger.rbi +14 -4
- data/rbi/orb/resources/customers/credits/top_ups.rbi +2 -0
- data/rbi/orb/resources/customers/credits.rbi +6 -0
- data/rbi/orb/resources/customers.rbi +56 -0
- data/rbi/orb/resources/events/backfills.rbi +3 -0
- data/rbi/orb/resources/events/volume.rbi +3 -0
- data/rbi/orb/resources/events.rbi +9 -0
- data/rbi/orb/resources/invoice_line_items.rbi +5 -0
- data/rbi/orb/resources/invoices.rbi +21 -5
- data/rbi/orb/resources/items.rbi +3 -0
- data/rbi/orb/resources/license_types.rbi +3 -0
- data/rbi/orb/resources/metrics.rbi +3 -0
- data/rbi/orb/resources/plans/external_plan_id.rbi +4 -0
- data/rbi/orb/resources/plans/migrations.rbi +4 -0
- data/rbi/orb/resources/plans.rbi +12 -0
- data/rbi/orb/resources/prices/external_price_id.rbi +10 -0
- data/rbi/orb/resources/prices.rbi +24 -0
- data/sig/orb/internal/util.rbs +10 -0
- data/sig/orb/models/billable_metric.rbs +8 -3
- data/sig/orb/models/customers/credits/ledger_create_entry_by_external_id_params.rbs +7 -0
- data/sig/orb/models/customers/credits/ledger_create_entry_params.rbs +7 -0
- data/sig/orb/models/invoice_create_params.rbs +5 -0
- data/sig/orb/models/invoice_update_params.rbs +5 -0
- data/sig/orb/models/item.rbs +2 -0
- data/sig/orb/models/item_update_params.rbs +2 -0
- data/sig/orb/models/new_floating_scalable_matrix_with_unit_pricing_price.rbs +5 -0
- data/sig/orb/models/new_plan_scalable_matrix_with_unit_pricing_price.rbs +5 -0
- data/sig/orb/models/new_subscription_scalable_matrix_with_unit_pricing_price.rbs +5 -0
- data/sig/orb/models/price.rbs +5 -0
- data/sig/orb/models/price_create_params.rbs +5 -0
- data/sig/orb/models/price_evaluate_multiple_params.rbs +5 -0
- data/sig/orb/models/price_evaluate_params.rbs +6 -1
- data/sig/orb/models/price_evaluate_preview_events_params.rbs +5 -0
- data/sig/orb/models/price_interval.rbs +8 -3
- data/sig/orb/models/subscription_create_params.rbs +10 -0
- data/sig/orb/models/subscription_price_intervals_params.rbs +10 -0
- data/sig/orb/models/subscription_schedule_plan_change_params.rbs +10 -0
- data/sig/orb/resources/invoices.rbs +2 -0
- data/sig/orb/resources/prices.rbs +1 -0
- metadata +2 -2
|
@@ -3,10 +3,16 @@
|
|
|
3
3
|
module Orb
|
|
4
4
|
module Resources
|
|
5
5
|
class Customers
|
|
6
|
+
# The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid
|
|
7
|
+
# credits within Orb.
|
|
6
8
|
class Credits
|
|
9
|
+
# The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid
|
|
10
|
+
# credits within Orb.
|
|
7
11
|
# @return [Orb::Resources::Customers::Credits::Ledger]
|
|
8
12
|
attr_reader :ledger
|
|
9
13
|
|
|
14
|
+
# The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid
|
|
15
|
+
# credits within Orb.
|
|
10
16
|
# @return [Orb::Resources::Customers::Credits::TopUps]
|
|
11
17
|
attr_reader :top_ups
|
|
12
18
|
|
|
@@ -53,10 +59,11 @@ module Orb
|
|
|
53
59
|
# @see Orb::Models::Customers::CreditListParams
|
|
54
60
|
def list(customer_id, params = {})
|
|
55
61
|
parsed, options = Orb::Customers::CreditListParams.dump_request(params)
|
|
62
|
+
query = Orb::Internal::Util.encode_query_params(parsed)
|
|
56
63
|
@client.request(
|
|
57
64
|
method: :get,
|
|
58
65
|
path: ["customers/%1$s/credits", customer_id],
|
|
59
|
-
query:
|
|
66
|
+
query: query.transform_keys(
|
|
60
67
|
effective_date_gt: "effective_date[gt]",
|
|
61
68
|
effective_date_gte: "effective_date[gte]",
|
|
62
69
|
effective_date_lt: "effective_date[lt]",
|
|
@@ -111,10 +118,11 @@ module Orb
|
|
|
111
118
|
# @see Orb::Models::Customers::CreditListByExternalIDParams
|
|
112
119
|
def list_by_external_id(external_customer_id, params = {})
|
|
113
120
|
parsed, options = Orb::Customers::CreditListByExternalIDParams.dump_request(params)
|
|
121
|
+
query = Orb::Internal::Util.encode_query_params(parsed)
|
|
114
122
|
@client.request(
|
|
115
123
|
method: :get,
|
|
116
124
|
path: ["customers/external_customer_id/%1$s/credits", external_customer_id],
|
|
117
|
-
query:
|
|
125
|
+
query: query.transform_keys(
|
|
118
126
|
effective_date_gt: "effective_date[gt]",
|
|
119
127
|
effective_date_gte: "effective_date[gte]",
|
|
120
128
|
effective_date_lt: "effective_date[lt]",
|
|
@@ -2,13 +2,69 @@
|
|
|
2
2
|
|
|
3
3
|
module Orb
|
|
4
4
|
module Resources
|
|
5
|
+
# A customer is a buyer of your products, and the other party to the billing
|
|
6
|
+
# relationship.
|
|
7
|
+
#
|
|
8
|
+
# In Orb, customers are assigned system generated identifiers automatically, but
|
|
9
|
+
# it's often desirable to have these match existing identifiers in your system. To
|
|
10
|
+
# avoid having to denormalize Orb ID information, you can pass in an
|
|
11
|
+
# `external_customer_id` with your own identifier. See
|
|
12
|
+
# [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
|
|
13
|
+
# information about how these aliases work in Orb.
|
|
14
|
+
#
|
|
15
|
+
# In addition to having an identifier in your system, a customer may exist in a
|
|
16
|
+
# payment provider solution like Stripe. Use the `payment_provider_id` and the
|
|
17
|
+
# `payment_provider` enum field to express this mapping.
|
|
18
|
+
#
|
|
19
|
+
# A customer also has a timezone (from the standard
|
|
20
|
+
# [IANA timezone database](https://www.iana.org/time-zones)), which defaults to
|
|
21
|
+
# your account's timezone. See [Timezone localization](/essentials/timezones) for
|
|
22
|
+
# information on what this timezone parameter influences within Orb.
|
|
5
23
|
class Customers
|
|
24
|
+
# A customer is a buyer of your products, and the other party to the billing
|
|
25
|
+
# relationship.
|
|
26
|
+
#
|
|
27
|
+
# In Orb, customers are assigned system generated identifiers automatically, but
|
|
28
|
+
# it's often desirable to have these match existing identifiers in your system. To
|
|
29
|
+
# avoid having to denormalize Orb ID information, you can pass in an
|
|
30
|
+
# `external_customer_id` with your own identifier. See
|
|
31
|
+
# [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
|
|
32
|
+
# information about how these aliases work in Orb.
|
|
33
|
+
#
|
|
34
|
+
# In addition to having an identifier in your system, a customer may exist in a
|
|
35
|
+
# payment provider solution like Stripe. Use the `payment_provider_id` and the
|
|
36
|
+
# `payment_provider` enum field to express this mapping.
|
|
37
|
+
#
|
|
38
|
+
# A customer also has a timezone (from the standard
|
|
39
|
+
# [IANA timezone database](https://www.iana.org/time-zones)), which defaults to
|
|
40
|
+
# your account's timezone. See [Timezone localization](/essentials/timezones) for
|
|
41
|
+
# information on what this timezone parameter influences within Orb.
|
|
6
42
|
# @return [Orb::Resources::Customers::Costs]
|
|
7
43
|
attr_reader :costs
|
|
8
44
|
|
|
45
|
+
# The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid
|
|
46
|
+
# credits within Orb.
|
|
9
47
|
# @return [Orb::Resources::Customers::Credits]
|
|
10
48
|
attr_reader :credits
|
|
11
49
|
|
|
50
|
+
# A customer is a buyer of your products, and the other party to the billing
|
|
51
|
+
# relationship.
|
|
52
|
+
#
|
|
53
|
+
# In Orb, customers are assigned system generated identifiers automatically, but
|
|
54
|
+
# it's often desirable to have these match existing identifiers in your system. To
|
|
55
|
+
# avoid having to denormalize Orb ID information, you can pass in an
|
|
56
|
+
# `external_customer_id` with your own identifier. See
|
|
57
|
+
# [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
|
|
58
|
+
# information about how these aliases work in Orb.
|
|
59
|
+
#
|
|
60
|
+
# In addition to having an identifier in your system, a customer may exist in a
|
|
61
|
+
# payment provider solution like Stripe. Use the `payment_provider_id` and the
|
|
62
|
+
# `payment_provider` enum field to express this mapping.
|
|
63
|
+
#
|
|
64
|
+
# A customer also has a timezone (from the standard
|
|
65
|
+
# [IANA timezone database](https://www.iana.org/time-zones)), which defaults to
|
|
66
|
+
# your account's timezone. See [Timezone localization](/essentials/timezones) for
|
|
67
|
+
# information on what this timezone parameter influences within Orb.
|
|
12
68
|
# @return [Orb::Resources::Customers::BalanceTransactions]
|
|
13
69
|
attr_reader :balance_transactions
|
|
14
70
|
|
|
@@ -184,10 +240,11 @@ module Orb
|
|
|
184
240
|
# @see Orb::Models::CustomerListParams
|
|
185
241
|
def list(params = {})
|
|
186
242
|
parsed, options = Orb::CustomerListParams.dump_request(params)
|
|
243
|
+
query = Orb::Internal::Util.encode_query_params(parsed)
|
|
187
244
|
@client.request(
|
|
188
245
|
method: :get,
|
|
189
246
|
path: "customers",
|
|
190
|
-
query:
|
|
247
|
+
query: query.transform_keys(
|
|
191
248
|
created_at_gt: "created_at[gt]",
|
|
192
249
|
created_at_gte: "created_at[gte]",
|
|
193
250
|
created_at_lt: "created_at[lt]",
|
|
@@ -114,10 +114,11 @@ module Orb
|
|
|
114
114
|
# @see Orb::Models::DimensionalPriceGroupListParams
|
|
115
115
|
def list(params = {})
|
|
116
116
|
parsed, options = Orb::DimensionalPriceGroupListParams.dump_request(params)
|
|
117
|
+
query = Orb::Internal::Util.encode_query_params(parsed)
|
|
117
118
|
@client.request(
|
|
118
119
|
method: :get,
|
|
119
120
|
path: "dimensional_price_groups",
|
|
120
|
-
query:
|
|
121
|
+
query: query,
|
|
121
122
|
page: Orb::Internal::Page,
|
|
122
123
|
model: Orb::DimensionalPriceGroup,
|
|
123
124
|
options: options
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
module Orb
|
|
4
4
|
module Resources
|
|
5
5
|
class Events
|
|
6
|
+
# The [Event](/core-concepts#event) resource represents a usage event that has
|
|
7
|
+
# been created for a customer. Events are the core of Orb's usage-based billing
|
|
8
|
+
# model, and are used to calculate the usage charges for a given billing period.
|
|
6
9
|
class Backfills
|
|
7
10
|
# Some parameter documentations has been truncated, see
|
|
8
11
|
# {Orb::Models::Events::BackfillCreateParams} for more details.
|
|
@@ -104,10 +107,11 @@ module Orb
|
|
|
104
107
|
# @see Orb::Models::Events::BackfillListParams
|
|
105
108
|
def list(params = {})
|
|
106
109
|
parsed, options = Orb::Events::BackfillListParams.dump_request(params)
|
|
110
|
+
query = Orb::Internal::Util.encode_query_params(parsed)
|
|
107
111
|
@client.request(
|
|
108
112
|
method: :get,
|
|
109
113
|
path: "events/backfills",
|
|
110
|
-
query:
|
|
114
|
+
query: query,
|
|
111
115
|
page: Orb::Internal::Page,
|
|
112
116
|
model: Orb::Models::Events::BackfillListResponse,
|
|
113
117
|
options: options
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
module Orb
|
|
4
4
|
module Resources
|
|
5
5
|
class Events
|
|
6
|
+
# The [Event](/core-concepts#event) resource represents a usage event that has
|
|
7
|
+
# been created for a customer. Events are the core of Orb's usage-based billing
|
|
8
|
+
# model, and are used to calculate the usage charges for a given billing period.
|
|
6
9
|
class Volume
|
|
7
10
|
# Some parameter documentations has been truncated, see
|
|
8
11
|
# {Orb::Models::Events::VolumeListParams} for more details.
|
|
@@ -38,10 +41,11 @@ module Orb
|
|
|
38
41
|
# @see Orb::Models::Events::VolumeListParams
|
|
39
42
|
def list(params)
|
|
40
43
|
parsed, options = Orb::Events::VolumeListParams.dump_request(params)
|
|
44
|
+
query = Orb::Internal::Util.encode_query_params(parsed)
|
|
41
45
|
@client.request(
|
|
42
46
|
method: :get,
|
|
43
47
|
path: "events/volume",
|
|
44
|
-
query:
|
|
48
|
+
query: query,
|
|
45
49
|
model: Orb::Events::EventVolumes,
|
|
46
50
|
options: options
|
|
47
51
|
)
|
data/lib/orb/resources/events.rb
CHANGED
|
@@ -2,10 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
module Orb
|
|
4
4
|
module Resources
|
|
5
|
+
# The [Event](/core-concepts#event) resource represents a usage event that has
|
|
6
|
+
# been created for a customer. Events are the core of Orb's usage-based billing
|
|
7
|
+
# model, and are used to calculate the usage charges for a given billing period.
|
|
5
8
|
class Events
|
|
9
|
+
# The [Event](/core-concepts#event) resource represents a usage event that has
|
|
10
|
+
# been created for a customer. Events are the core of Orb's usage-based billing
|
|
11
|
+
# model, and are used to calculate the usage charges for a given billing period.
|
|
6
12
|
# @return [Orb::Resources::Events::Backfills]
|
|
7
13
|
attr_reader :backfills
|
|
8
14
|
|
|
15
|
+
# The [Event](/core-concepts#event) resource represents a usage event that has
|
|
16
|
+
# been created for a customer. Events are the core of Orb's usage-based billing
|
|
17
|
+
# model, and are used to calculate the usage charges for a given billing period.
|
|
9
18
|
# @return [Orb::Resources::Events::Volume]
|
|
10
19
|
attr_reader :volume
|
|
11
20
|
|
|
@@ -368,12 +377,13 @@ module Orb
|
|
|
368
377
|
#
|
|
369
378
|
# @see Orb::Models::EventIngestParams
|
|
370
379
|
def ingest(params)
|
|
371
|
-
parsed, options = Orb::EventIngestParams.dump_request(params)
|
|
372
380
|
query_params = [:backfill_id, :debug]
|
|
381
|
+
parsed, options = Orb::EventIngestParams.dump_request(params)
|
|
382
|
+
query = Orb::Internal::Util.encode_query_params(parsed.slice(*query_params))
|
|
373
383
|
@client.request(
|
|
374
384
|
method: :post,
|
|
375
385
|
path: "ingest",
|
|
376
|
-
query:
|
|
386
|
+
query: query,
|
|
377
387
|
body: parsed.except(*query_params),
|
|
378
388
|
model: Orb::Models::EventIngestResponse,
|
|
379
389
|
options: options
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
module Orb
|
|
4
4
|
module Resources
|
|
5
|
+
# An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity,
|
|
6
|
+
# representing the request for payment for a single subscription. This includes a
|
|
7
|
+
# set of line items, which correspond to prices in the subscription's plan and can
|
|
8
|
+
# represent fixed recurring fees or usage-based fees. They are generated at the
|
|
9
|
+
# end of a billing period, or as the result of an action, such as a cancellation.
|
|
5
10
|
class InvoiceLineItems
|
|
6
11
|
# Some parameter documentations has been truncated, see
|
|
7
12
|
# {Orb::Models::InvoiceLineItemCreateParams} for more details.
|
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
module Orb
|
|
4
4
|
module Resources
|
|
5
|
+
# An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity,
|
|
6
|
+
# representing the request for payment for a single subscription. This includes a
|
|
7
|
+
# set of line items, which correspond to prices in the subscription's plan and can
|
|
8
|
+
# represent fixed recurring fees or usage-based fees. They are generated at the
|
|
9
|
+
# end of a billing period, or as the result of an action, such as a cancellation.
|
|
5
10
|
class Invoices
|
|
6
11
|
# Some parameter documentations has been truncated, see
|
|
7
12
|
# {Orb::Models::InvoiceCreateParams} for more details.
|
|
8
13
|
#
|
|
9
14
|
# This endpoint is used to create a one-off invoice for a customer.
|
|
10
15
|
#
|
|
11
|
-
# @overload create(currency:, invoice_date:, line_items:, customer_id: nil, discount: nil, due_date: nil, external_customer_id: nil, memo: nil, metadata: nil, net_terms: nil, will_auto_issue: nil, request_options: {})
|
|
16
|
+
# @overload create(currency:, invoice_date:, line_items:, auto_collection: nil, customer_id: nil, discount: nil, due_date: nil, external_customer_id: nil, memo: nil, metadata: nil, net_terms: nil, will_auto_issue: nil, request_options: {})
|
|
12
17
|
#
|
|
13
18
|
# @param currency [String] An ISO 4217 currency string. Must be the same as the customer's currency if it i
|
|
14
19
|
#
|
|
@@ -16,6 +21,8 @@ module Orb
|
|
|
16
21
|
#
|
|
17
22
|
# @param line_items [Array<Orb::Models::InvoiceCreateParams::LineItem>]
|
|
18
23
|
#
|
|
24
|
+
# @param auto_collection [Boolean, nil] Determines whether this invoice will automatically attempt to charge a saved pay
|
|
25
|
+
#
|
|
19
26
|
# @param customer_id [String, nil] The id of the `Customer` to create this invoice for. One of `customer_id` and `e
|
|
20
27
|
#
|
|
21
28
|
# @param discount [Orb::Models::PercentageDiscount, Orb::Models::TrialDiscount, Orb::Models::UsageDiscount, Orb::Models::AmountDiscount, nil] An optional discount to attach to the invoice.
|
|
@@ -45,18 +52,21 @@ module Orb
|
|
|
45
52
|
# Some parameter documentations has been truncated, see
|
|
46
53
|
# {Orb::Models::InvoiceUpdateParams} for more details.
|
|
47
54
|
#
|
|
48
|
-
# This endpoint allows you to update the `metadata`, `net_terms`, `due_date`,
|
|
49
|
-
# `invoice_date` properties on an invoice. If you pass null
|
|
50
|
-
# value, it will clear any existing metadata for that invoice.
|
|
55
|
+
# This endpoint allows you to update the `metadata`, `net_terms`, `due_date`,
|
|
56
|
+
# `invoice_date`, and `auto_collection` properties on an invoice. If you pass null
|
|
57
|
+
# for the metadata value, it will clear any existing metadata for that invoice.
|
|
51
58
|
#
|
|
52
59
|
# `metadata` can be modified regardless of invoice state. `net_terms`, `due_date`,
|
|
53
|
-
# and `
|
|
54
|
-
# `invoice_date` can only be modified for non-subscription
|
|
60
|
+
# `invoice_date`, and `auto_collection` can only be modified if the invoice is in
|
|
61
|
+
# a `draft` state. `invoice_date` can only be modified for non-subscription
|
|
62
|
+
# invoices.
|
|
55
63
|
#
|
|
56
|
-
# @overload update(invoice_id, due_date: nil, invoice_date: nil, metadata: nil, net_terms: nil, request_options: {})
|
|
64
|
+
# @overload update(invoice_id, auto_collection: nil, due_date: nil, invoice_date: nil, metadata: nil, net_terms: nil, request_options: {})
|
|
57
65
|
#
|
|
58
66
|
# @param invoice_id [String]
|
|
59
67
|
#
|
|
68
|
+
# @param auto_collection [Boolean, nil] Determines whether this invoice will automatically attempt to charge a saved pay
|
|
69
|
+
#
|
|
60
70
|
# @param due_date [Date, Time, nil] An optional custom due date for the invoice. If not set, the due date will be ca
|
|
61
71
|
#
|
|
62
72
|
# @param invoice_date [Date, Time, nil] The date of the invoice. Can only be modified for one-off draft invoices.
|
|
@@ -145,10 +155,11 @@ module Orb
|
|
|
145
155
|
# @see Orb::Models::InvoiceListParams
|
|
146
156
|
def list(params = {})
|
|
147
157
|
parsed, options = Orb::InvoiceListParams.dump_request(params)
|
|
158
|
+
query = Orb::Internal::Util.encode_query_params(parsed)
|
|
148
159
|
@client.request(
|
|
149
160
|
method: :get,
|
|
150
161
|
path: "invoices",
|
|
151
|
-
query:
|
|
162
|
+
query: query.transform_keys(
|
|
152
163
|
amount_gt: "amount[gt]",
|
|
153
164
|
amount_lt: "amount[lt]",
|
|
154
165
|
due_date_gt: "due_date[gt]",
|
|
@@ -227,10 +238,11 @@ module Orb
|
|
|
227
238
|
# @see Orb::Models::InvoiceFetchUpcomingParams
|
|
228
239
|
def fetch_upcoming(params)
|
|
229
240
|
parsed, options = Orb::InvoiceFetchUpcomingParams.dump_request(params)
|
|
241
|
+
query = Orb::Internal::Util.encode_query_params(parsed)
|
|
230
242
|
@client.request(
|
|
231
243
|
method: :get,
|
|
232
244
|
path: "invoices/upcoming",
|
|
233
|
-
query:
|
|
245
|
+
query: query,
|
|
234
246
|
model: Orb::Models::InvoiceFetchUpcomingResponse,
|
|
235
247
|
options: options
|
|
236
248
|
)
|
|
@@ -370,10 +382,11 @@ module Orb
|
|
|
370
382
|
# @see Orb::Models::InvoiceListSummaryParams
|
|
371
383
|
def list_summary(params = {})
|
|
372
384
|
parsed, options = Orb::InvoiceListSummaryParams.dump_request(params)
|
|
385
|
+
query = Orb::Internal::Util.encode_query_params(parsed)
|
|
373
386
|
@client.request(
|
|
374
387
|
method: :get,
|
|
375
388
|
path: "invoices/summary",
|
|
376
|
-
query:
|
|
389
|
+
query: query.transform_keys(
|
|
377
390
|
amount_gt: "amount[gt]",
|
|
378
391
|
amount_lt: "amount[lt]",
|
|
379
392
|
due_date_gt: "due_date[gt]",
|
data/lib/orb/resources/items.rb
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
module Orb
|
|
4
4
|
module Resources
|
|
5
|
+
# The Item resource represents a sellable product or good. Items are associated
|
|
6
|
+
# with all line items, billable metrics, and prices and are used for defining
|
|
7
|
+
# external sync behavior for invoices and tax calculation purposes.
|
|
5
8
|
class Items
|
|
6
9
|
# Some parameter documentations has been truncated, see
|
|
7
10
|
# {Orb::Models::ItemCreateParams} for more details.
|
|
@@ -74,10 +77,11 @@ module Orb
|
|
|
74
77
|
# @see Orb::Models::ItemListParams
|
|
75
78
|
def list(params = {})
|
|
76
79
|
parsed, options = Orb::ItemListParams.dump_request(params)
|
|
80
|
+
query = Orb::Internal::Util.encode_query_params(parsed)
|
|
77
81
|
@client.request(
|
|
78
82
|
method: :get,
|
|
79
83
|
path: "items",
|
|
80
|
-
query:
|
|
84
|
+
query: query,
|
|
81
85
|
page: Orb::Internal::Page,
|
|
82
86
|
model: Orb::Item,
|
|
83
87
|
options: options
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
module Orb
|
|
4
4
|
module Resources
|
|
5
|
+
# The LicenseType resource represents a type of license that can be assigned to
|
|
6
|
+
# users. License types are used during billing by grouping metrics on the
|
|
7
|
+
# configured grouping key.
|
|
5
8
|
class LicenseTypes
|
|
6
9
|
# Some parameter documentations has been truncated, see
|
|
7
10
|
# {Orb::Models::LicenseTypeCreateParams} for more details.
|
|
@@ -79,10 +82,11 @@ module Orb
|
|
|
79
82
|
# @see Orb::Models::LicenseTypeListParams
|
|
80
83
|
def list(params = {})
|
|
81
84
|
parsed, options = Orb::LicenseTypeListParams.dump_request(params)
|
|
85
|
+
query = Orb::Internal::Util.encode_query_params(parsed)
|
|
82
86
|
@client.request(
|
|
83
87
|
method: :get,
|
|
84
88
|
path: "license_types",
|
|
85
|
-
query:
|
|
89
|
+
query: query,
|
|
86
90
|
page: Orb::Internal::Page,
|
|
87
91
|
model: Orb::Models::LicenseTypeListResponse,
|
|
88
92
|
options: options
|
|
@@ -37,10 +37,11 @@ module Orb
|
|
|
37
37
|
# @see Orb::Models::Licenses::ExternalLicenseGetUsageParams
|
|
38
38
|
def get_usage(external_license_id, params)
|
|
39
39
|
parsed, options = Orb::Licenses::ExternalLicenseGetUsageParams.dump_request(params)
|
|
40
|
+
query = Orb::Internal::Util.encode_query_params(parsed)
|
|
40
41
|
@client.request(
|
|
41
42
|
method: :get,
|
|
42
43
|
path: ["licenses/external_licenses/%1$s/usage", external_license_id],
|
|
43
|
-
query:
|
|
44
|
+
query: query,
|
|
44
45
|
model: Orb::Models::Licenses::ExternalLicenseGetUsageResponse,
|
|
45
46
|
options: options
|
|
46
47
|
)
|
|
@@ -35,10 +35,11 @@ module Orb
|
|
|
35
35
|
# @see Orb::Models::Licenses::UsageGetAllUsageParams
|
|
36
36
|
def get_all_usage(params)
|
|
37
37
|
parsed, options = Orb::Licenses::UsageGetAllUsageParams.dump_request(params)
|
|
38
|
+
query = Orb::Internal::Util.encode_query_params(parsed)
|
|
38
39
|
@client.request(
|
|
39
40
|
method: :get,
|
|
40
41
|
path: "licenses/usage",
|
|
41
|
-
query:
|
|
42
|
+
query: query,
|
|
42
43
|
model: Orb::Models::Licenses::UsageGetAllUsageResponse,
|
|
43
44
|
options: options
|
|
44
45
|
)
|
|
@@ -72,10 +73,11 @@ module Orb
|
|
|
72
73
|
# @see Orb::Models::Licenses::UsageGetUsageParams
|
|
73
74
|
def get_usage(license_id, params = {})
|
|
74
75
|
parsed, options = Orb::Licenses::UsageGetUsageParams.dump_request(params)
|
|
76
|
+
query = Orb::Internal::Util.encode_query_params(parsed)
|
|
75
77
|
@client.request(
|
|
76
78
|
method: :get,
|
|
77
79
|
path: ["licenses/%1$s/usage", license_id],
|
|
78
|
-
query:
|
|
80
|
+
query: query,
|
|
79
81
|
model: Orb::Models::Licenses::UsageGetUsageResponse,
|
|
80
82
|
options: options
|
|
81
83
|
)
|
|
@@ -91,10 +91,11 @@ module Orb
|
|
|
91
91
|
# @see Orb::Models::LicenseListParams
|
|
92
92
|
def list(params)
|
|
93
93
|
parsed, options = Orb::LicenseListParams.dump_request(params)
|
|
94
|
+
query = Orb::Internal::Util.encode_query_params(parsed)
|
|
94
95
|
@client.request(
|
|
95
96
|
method: :get,
|
|
96
97
|
path: "licenses",
|
|
97
|
-
query:
|
|
98
|
+
query: query,
|
|
98
99
|
page: Orb::Internal::Page,
|
|
99
100
|
model: Orb::Models::LicenseListResponse,
|
|
100
101
|
options: options
|
|
@@ -149,10 +150,11 @@ module Orb
|
|
|
149
150
|
# @see Orb::Models::LicenseRetrieveByExternalIDParams
|
|
150
151
|
def retrieve_by_external_id(external_license_id, params)
|
|
151
152
|
parsed, options = Orb::LicenseRetrieveByExternalIDParams.dump_request(params)
|
|
153
|
+
query = Orb::Internal::Util.encode_query_params(parsed)
|
|
152
154
|
@client.request(
|
|
153
155
|
method: :get,
|
|
154
156
|
path: ["licenses/external_license_id/%1$s", external_license_id],
|
|
155
|
-
query:
|
|
157
|
+
query: query,
|
|
156
158
|
model: Orb::Models::LicenseRetrieveByExternalIDResponse,
|
|
157
159
|
options: options
|
|
158
160
|
)
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
module Orb
|
|
4
4
|
module Resources
|
|
5
|
+
# The Metric resource represents a calculation of a quantity based on events.
|
|
6
|
+
# Metrics are defined by the query that transforms raw usage events into
|
|
7
|
+
# meaningful values for your customers.
|
|
5
8
|
class Metrics
|
|
6
9
|
# Some parameter documentations has been truncated, see
|
|
7
10
|
# {Orb::Models::MetricCreateParams} for more details.
|
|
@@ -95,10 +98,11 @@ module Orb
|
|
|
95
98
|
# @see Orb::Models::MetricListParams
|
|
96
99
|
def list(params = {})
|
|
97
100
|
parsed, options = Orb::MetricListParams.dump_request(params)
|
|
101
|
+
query = Orb::Internal::Util.encode_query_params(parsed)
|
|
98
102
|
@client.request(
|
|
99
103
|
method: :get,
|
|
100
104
|
path: "metrics",
|
|
101
|
-
query:
|
|
105
|
+
query: query.transform_keys(
|
|
102
106
|
created_at_gt: "created_at[gt]",
|
|
103
107
|
created_at_gte: "created_at[gte]",
|
|
104
108
|
created_at_lt: "created_at[lt]",
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
module Orb
|
|
4
4
|
module Resources
|
|
5
5
|
class Plans
|
|
6
|
+
# The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
|
|
7
|
+
# subscribed to by a customer. Plans define the billing behavior of the
|
|
8
|
+
# subscription. You can see more about how to configure prices in the
|
|
9
|
+
# [Price resource](/reference/price).
|
|
6
10
|
class ExternalPlanID
|
|
7
11
|
# Some parameter documentations has been truncated, see
|
|
8
12
|
# {Orb::Models::Plans::ExternalPlanIDUpdateParams} for more details.
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
module Orb
|
|
4
4
|
module Resources
|
|
5
5
|
class Plans
|
|
6
|
+
# The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
|
|
7
|
+
# subscribed to by a customer. Plans define the billing behavior of the
|
|
8
|
+
# subscription. You can see more about how to configure prices in the
|
|
9
|
+
# [Price resource](/reference/price).
|
|
6
10
|
class Migrations
|
|
7
11
|
# Fetch migration
|
|
8
12
|
#
|
|
@@ -52,10 +56,11 @@ module Orb
|
|
|
52
56
|
# @see Orb::Models::Plans::MigrationListParams
|
|
53
57
|
def list(plan_id, params = {})
|
|
54
58
|
parsed, options = Orb::Plans::MigrationListParams.dump_request(params)
|
|
59
|
+
query = Orb::Internal::Util.encode_query_params(parsed)
|
|
55
60
|
@client.request(
|
|
56
61
|
method: :get,
|
|
57
62
|
path: ["plans/%1$s/migrations", plan_id],
|
|
58
|
-
query:
|
|
63
|
+
query: query,
|
|
59
64
|
page: Orb::Internal::Page,
|
|
60
65
|
model: Orb::Models::Plans::MigrationListResponse,
|
|
61
66
|
options: options
|
data/lib/orb/resources/plans.rb
CHANGED
|
@@ -2,10 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
module Orb
|
|
4
4
|
module Resources
|
|
5
|
+
# The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
|
|
6
|
+
# subscribed to by a customer. Plans define the billing behavior of the
|
|
7
|
+
# subscription. You can see more about how to configure prices in the
|
|
8
|
+
# [Price resource](/reference/price).
|
|
5
9
|
class Plans
|
|
10
|
+
# The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
|
|
11
|
+
# subscribed to by a customer. Plans define the billing behavior of the
|
|
12
|
+
# subscription. You can see more about how to configure prices in the
|
|
13
|
+
# [Price resource](/reference/price).
|
|
6
14
|
# @return [Orb::Resources::Plans::ExternalPlanID]
|
|
7
15
|
attr_reader :external_plan_id
|
|
8
16
|
|
|
17
|
+
# The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
|
|
18
|
+
# subscribed to by a customer. Plans define the billing behavior of the
|
|
19
|
+
# subscription. You can see more about how to configure prices in the
|
|
20
|
+
# [Price resource](/reference/price).
|
|
9
21
|
# @return [Orb::Resources::Plans::Migrations]
|
|
10
22
|
attr_reader :migrations
|
|
11
23
|
|
|
@@ -110,10 +122,11 @@ module Orb
|
|
|
110
122
|
# @see Orb::Models::PlanListParams
|
|
111
123
|
def list(params = {})
|
|
112
124
|
parsed, options = Orb::PlanListParams.dump_request(params)
|
|
125
|
+
query = Orb::Internal::Util.encode_query_params(parsed)
|
|
113
126
|
@client.request(
|
|
114
127
|
method: :get,
|
|
115
128
|
path: "plans",
|
|
116
|
-
query:
|
|
129
|
+
query: query.transform_keys(
|
|
117
130
|
created_at_gt: "created_at[gt]",
|
|
118
131
|
created_at_gte: "created_at[gte]",
|
|
119
132
|
created_at_lt: "created_at[lt]",
|
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
module Orb
|
|
4
4
|
module Resources
|
|
5
5
|
class Prices
|
|
6
|
+
# The Price resource represents a price that can be billed on a subscription,
|
|
7
|
+
# resulting in a charge on an invoice in the form of an invoice line item. Prices
|
|
8
|
+
# take a quantity and determine an amount to bill.
|
|
9
|
+
#
|
|
10
|
+
# Orb supports a few different pricing models out of the box. Each of these models
|
|
11
|
+
# is serialized differently in a given Price object. The model_type field
|
|
12
|
+
# determines the key for the configuration object that is present.
|
|
13
|
+
#
|
|
14
|
+
# For more on the types of prices, see
|
|
15
|
+
# [the core concepts documentation](/core-concepts#plan-and-price)
|
|
6
16
|
class ExternalPriceID
|
|
7
17
|
# Some parameter documentations has been truncated, see
|
|
8
18
|
# {Orb::Models::Prices::ExternalPriceIDUpdateParams} for more details.
|
data/lib/orb/resources/prices.rb
CHANGED
|
@@ -2,7 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
module Orb
|
|
4
4
|
module Resources
|
|
5
|
+
# The Price resource represents a price that can be billed on a subscription,
|
|
6
|
+
# resulting in a charge on an invoice in the form of an invoice line item. Prices
|
|
7
|
+
# take a quantity and determine an amount to bill.
|
|
8
|
+
#
|
|
9
|
+
# Orb supports a few different pricing models out of the box. Each of these models
|
|
10
|
+
# is serialized differently in a given Price object. The model_type field
|
|
11
|
+
# determines the key for the configuration object that is present.
|
|
12
|
+
#
|
|
13
|
+
# For more on the types of prices, see
|
|
14
|
+
# [the core concepts documentation](/core-concepts#plan-and-price)
|
|
5
15
|
class Prices
|
|
16
|
+
# The Price resource represents a price that can be billed on a subscription,
|
|
17
|
+
# resulting in a charge on an invoice in the form of an invoice line item. Prices
|
|
18
|
+
# take a quantity and determine an amount to bill.
|
|
19
|
+
#
|
|
20
|
+
# Orb supports a few different pricing models out of the box. Each of these models
|
|
21
|
+
# is serialized differently in a given Price object. The model_type field
|
|
22
|
+
# determines the key for the configuration object that is present.
|
|
23
|
+
#
|
|
24
|
+
# For more on the types of prices, see
|
|
25
|
+
# [the core concepts documentation](/core-concepts#plan-and-price)
|
|
6
26
|
# @return [Orb::Resources::Prices::ExternalPriceID]
|
|
7
27
|
attr_reader :external_price_id
|
|
8
28
|
|
|
@@ -176,10 +196,11 @@ module Orb
|
|
|
176
196
|
# @see Orb::Models::PriceListParams
|
|
177
197
|
def list(params = {})
|
|
178
198
|
parsed, options = Orb::PriceListParams.dump_request(params)
|
|
199
|
+
query = Orb::Internal::Util.encode_query_params(parsed)
|
|
179
200
|
@client.request(
|
|
180
201
|
method: :get,
|
|
181
202
|
path: "prices",
|
|
182
|
-
query:
|
|
203
|
+
query: query,
|
|
183
204
|
page: Orb::Internal::Page,
|
|
184
205
|
model: Orb::Price,
|
|
185
206
|
options: options
|
|
@@ -215,7 +236,7 @@ module Orb
|
|
|
215
236
|
# endpoint rather than a GET endpoint because it employs a JSON body rather than
|
|
216
237
|
# query parameters.
|
|
217
238
|
#
|
|
218
|
-
# @overload evaluate(price_id, timeframe_end:, timeframe_start:, customer_id: nil, external_customer_id: nil, filter: nil, grouping_keys: nil, request_options: {})
|
|
239
|
+
# @overload evaluate(price_id, timeframe_end:, timeframe_start:, customer_id: nil, external_customer_id: nil, filter: nil, grouping_keys: nil, metric_parameter_overrides: nil, request_options: {})
|
|
219
240
|
#
|
|
220
241
|
# @param price_id [String]
|
|
221
242
|
#
|
|
@@ -231,6 +252,8 @@ module Orb
|
|
|
231
252
|
#
|
|
232
253
|
# @param grouping_keys [Array<String>] Properties (or [computed properties](/extensibility/advanced-metrics#computed-pr
|
|
233
254
|
#
|
|
255
|
+
# @param metric_parameter_overrides [Hash{Symbol=>Object}, nil] Optional overrides for parameterized billable metric parameters. If the metric h
|
|
256
|
+
#
|
|
234
257
|
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
235
258
|
#
|
|
236
259
|
# @return [Orb::Models::PriceEvaluateResponse]
|
|
@@ -56,10 +56,11 @@ module Orb
|
|
|
56
56
|
# @see Orb::Models::SubscriptionChangeListParams
|
|
57
57
|
def list(params = {})
|
|
58
58
|
parsed, options = Orb::SubscriptionChangeListParams.dump_request(params)
|
|
59
|
+
query = Orb::Internal::Util.encode_query_params(parsed)
|
|
59
60
|
@client.request(
|
|
60
61
|
method: :get,
|
|
61
62
|
path: "subscription_changes",
|
|
62
|
-
query:
|
|
63
|
+
query: query,
|
|
63
64
|
page: Orb::Internal::Page,
|
|
64
65
|
model: Orb::Models::SubscriptionChangeListResponse,
|
|
65
66
|
options: options
|