schematichq 1.5.4 → 1.5.6
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/.fern/metadata.json +4 -4
- data/.fern/replay.lock +13 -1
- data/WASM_VERSION +1 -1
- data/lib/schematic/accounts/client.rb +0 -271
- data/lib/schematic/billing/client.rb +447 -0
- data/lib/schematic/billing/types/count_billing_invoices_params.rb +28 -0
- data/lib/schematic/billing/types/count_billing_invoices_request.rb +27 -0
- data/lib/schematic/billing/types/count_billing_invoices_response.rb +13 -0
- data/lib/schematic/billing/types/create_payment_method_request_body.rb +2 -0
- data/lib/schematic/billing/types/finalize_native_invoice_response.rb +13 -0
- data/lib/schematic/{accounts/types/delete_environment_response.rb → billing/types/get_billing_invoice_response.rb} +3 -3
- data/lib/schematic/billing/types/get_company_native_subscription_response.rb +13 -0
- data/lib/schematic/billing/types/list_billing_invoices_params.rb +28 -0
- data/lib/schematic/billing/types/list_billing_invoices_request.rb +27 -0
- data/lib/schematic/billing/types/list_billing_invoices_response.rb +13 -0
- data/lib/schematic/billing/types/mark_billing_invoice_paid_response.rb +13 -0
- data/lib/schematic/billing/types/mark_invoice_paid_request_body.rb +19 -0
- data/lib/schematic/billing/types/void_native_invoice_response.rb +13 -0
- data/lib/schematic/catalogs/client.rb +82 -0
- data/lib/schematic/{accounts/types/create_api_key_response.rb → catalogs/types/get_public_catalog_by_id_response.rb} +3 -3
- data/lib/schematic/{accounts/types/delete_api_key_response.rb → catalogs/types/get_public_catalog_response.rb} +3 -3
- data/lib/schematic/client.rb +195 -1
- data/lib/schematic/credits/client.rb +48 -0
- data/lib/schematic/credits/types/count_credit_event_ledger_params.rb +2 -0
- data/lib/schematic/credits/types/count_credit_event_ledger_request.rb +2 -0
- data/lib/schematic/{accounts/types/create_environment_response.rb → credits/types/get_credit_event_ledger_entry_response.rb} +3 -3
- data/lib/schematic/credits/types/list_credit_event_ledger_params.rb +2 -0
- data/lib/schematic/credits/types/list_credit_event_ledger_request.rb +2 -0
- data/lib/schematic/features/client.rb +0 -2
- data/lib/schematic/internal/iterators/cursor_item_iterator.rb +2 -2
- data/lib/schematic/internal/iterators/cursor_page_iterator.rb +11 -2
- data/lib/schematic/internal/iterators/item_iterator.rb +11 -2
- data/lib/schematic/internal/iterators/offset_item_iterator.rb +2 -2
- data/lib/schematic/internal/iterators/offset_page_iterator.rb +15 -6
- data/lib/schematic/internal/types/model.rb +17 -1
- data/lib/schematic/planbundle/types/create_custom_plan_bundle_request_body.rb +2 -0
- data/lib/schematic/planbundle/types/create_plan_bundle_request_body.rb +2 -0
- data/lib/schematic/planbundle/types/update_plan_bundle_request_body.rb +2 -0
- data/lib/schematic/plans/client.rb +61 -5
- data/lib/schematic/plans/types/list_custom_plan_billings_params.rb +4 -0
- data/lib/schematic/plans/types/list_custom_plan_billings_request.rb +4 -0
- data/lib/schematic/plans/types/preview_publish_plan_version_response.rb +13 -0
- data/lib/schematic/plans/types/retry_custom_plan_billing_request_body.rb +2 -0
- data/lib/schematic/types/amendment_proration_lands_on.rb +13 -0
- data/lib/schematic/types/billing_invoice_address_response_data.rb +19 -0
- data/lib/schematic/types/billing_invoice_billing_details_response_data.rb +15 -0
- data/lib/schematic/types/billing_invoice_detail_response_data.rb +65 -0
- data/lib/schematic/types/billing_invoice_line_response_data.rb +31 -0
- data/lib/schematic/types/billing_invoice_response_data.rb +51 -0
- data/lib/schematic/types/billing_invoice_settlement_response_data.rb +17 -0
- data/lib/schematic/types/billing_invoice_tax_id_response_data.rb +11 -0
- data/lib/schematic/types/billing_invoice_terms_response_data.rb +21 -0
- data/lib/schematic/types/billing_native_subscription_change_response_data.rb +15 -0
- data/lib/schematic/types/billing_native_subscription_line_response_data.rb +47 -0
- data/lib/schematic/types/billing_native_subscription_response_data.rb +31 -0
- data/lib/schematic/types/billing_plan_credit_grant_response_data.rb +2 -0
- data/lib/schematic/types/billing_plan_credit_grant_warning_tier_response_data.rb +13 -0
- data/lib/schematic/types/billing_statement_line_response_data.rb +21 -0
- data/lib/schematic/types/billing_statement_response_data.rb +19 -0
- data/lib/schematic/types/catalog_bundle_currency_price_response_data.rb +13 -0
- data/lib/schematic/types/catalog_capabilities_response_data.rb +11 -0
- data/lib/schematic/types/catalog_credit_bundle_response_data.rb +39 -0
- data/lib/schematic/types/catalog_credit_grant_response_data.rb +29 -0
- data/lib/schematic/types/catalog_currency_prices_response_data.rb +17 -0
- data/lib/schematic/types/catalog_custom_plan_cta_response_data.rb +13 -0
- data/lib/schematic/types/catalog_detail_response_data.rb +23 -0
- data/lib/schematic/types/catalog_entitlement_response_data.rb +61 -0
- data/lib/schematic/types/catalog_plan_entitlement_response_data.rb +63 -0
- data/lib/schematic/types/catalog_plan_response_data.rb +41 -0
- data/lib/schematic/types/catalog_price_response_data.rb +29 -0
- data/lib/schematic/types/catalog_price_tier_response_data.rb +17 -0
- data/lib/schematic/types/charge_timing.rb +12 -0
- data/lib/schematic/types/checkout_charge_timing.rb +13 -0
- data/lib/schematic/types/checkout_problem_code.rb +4 -0
- data/lib/schematic/types/collector.rb +13 -0
- data/lib/schematic/types/company_billing_profile_response_data.rb +12 -0
- data/lib/schematic/types/company_credit_balance.rb +4 -0
- data/lib/schematic/types/create_billing_plan_credit_grant_request_body.rb +2 -0
- data/lib/schematic/types/create_flag_request_body.rb +1 -1
- data/lib/schematic/types/create_or_update_flag_request_body.rb +1 -1
- data/lib/schematic/types/credit_spend_policy.rb +2 -0
- data/lib/schematic/types/credit_spend_window_unit.rb +2 -0
- data/lib/schematic/types/custom_plan_billing_response_data.rb +2 -0
- data/lib/schematic/types/entitlement_type.rb +1 -0
- data/lib/schematic/types/event_body.rb +3 -3
- data/lib/schematic/types/event_body_inference.rb +4 -0
- data/lib/schematic/types/flag_detail_response_data.rb +1 -1
- data/lib/schematic/types/flag_in_plan_response_data.rb +1 -1
- data/lib/schematic/types/flag_response_data.rb +1 -1
- data/lib/schematic/types/invoice_collection_state.rb +17 -0
- data/lib/schematic/types/invoice_document_state.rb +14 -0
- data/lib/schematic/types/invoice_line_kind.rb +15 -0
- data/lib/schematic/types/line_kind.rb +13 -0
- data/lib/schematic/types/payment_gating.rb +12 -0
- data/lib/schematic/types/payment_method_billing_details_request_body.rb +13 -0
- data/lib/schematic/types/plan_credit_grant_warning_tier_request_body.rb +11 -0
- data/lib/schematic/types/plan_version_migration_preview_company_response_data.rb +2 -0
- data/lib/schematic/types/plan_version_migration_preview_note_response_data.rb +13 -0
- data/lib/schematic/types/plan_version_response_data.rb +2 -0
- data/lib/schematic/types/preflight_event_quantities_request_body.rb +13 -0
- data/lib/schematic/types/preflight_request_body.rb +2 -0
- data/lib/schematic/types/preview_subscription_finance_response_data.rb +6 -0
- data/lib/schematic/types/preview_subscription_proration_line_response_data.rb +21 -0
- data/lib/schematic/types/preview_subscription_proration_response_data.rb +21 -0
- data/lib/schematic/types/proration_line_kind.rb +12 -0
- data/lib/schematic/types/public_catalog_response_data.rb +29 -0
- data/lib/schematic/types/publish_plan_version_request_body.rb +45 -0
- data/lib/schematic/types/publish_preview_pay_in_advance_response_data.rb +15 -0
- data/lib/schematic/types/publish_preview_payment_method_response_data.rb +15 -0
- data/lib/schematic/types/publish_preview_proration_line_response_data.rb +19 -0
- data/lib/schematic/types/publish_preview_response_data.rb +55 -0
- data/lib/schematic/types/renewal_policy.rb +13 -0
- data/lib/schematic/types/rulesengine_credit_spend_policy.rb +2 -0
- data/lib/schematic/types/subscription_change_action.rb +14 -0
- data/lib/schematic/types/update_billing_plan_credit_grant_request_body.rb +2 -0
- data/lib/schematic/types/webhook_request_type.rb +1 -0
- data/lib/schematic/version.rb +1 -1
- data/lib/schematic/wasm/rulesengine.wasm +0 -0
- data/lib/schematic.rb +71 -18
- data/reference.md +1148 -506
- metadata +68 -15
- data/lib/schematic/accounts/types/create_api_key_request_body.rb +0 -19
- data/lib/schematic/accounts/types/create_environment_request_body.rb +0 -13
- data/lib/schematic/accounts/types/update_api_key_request_body.rb +0 -17
- data/lib/schematic/accounts/types/update_api_key_response.rb +0 -13
- data/lib/schematic/accounts/types/update_environment_request_body.rb +0 -17
- data/lib/schematic/accounts/types/update_environment_response.rb +0 -13
- data/lib/schematic/plans/types/publish_plan_version_request_body.rb +0 -47
- data/lib/schematic/types/api_key_create_response_data.rb +0 -33
- data/lib/schematic/types/environment_detail_response_data.rb +0 -21
|
@@ -12,8 +12,8 @@ module Schematic
|
|
|
12
12
|
# Instantiates an OffsetPageIterator, an Enumerable class which wraps calls to an offset-based paginated API and yields pages of items from it.
|
|
13
13
|
#
|
|
14
14
|
# @param initial_page [Integer] The initial page to use when iterating, if any.
|
|
15
|
-
# @param item_field [Symbol] The field to pull the list of items to iterate over.
|
|
16
|
-
# @param has_next_field [Symbol] The field to pull the boolean of whether a next page exists from, if any.
|
|
15
|
+
# @param item_field [Symbol, Array<Symbol>] The field (or nested path) to pull the list of items to iterate over.
|
|
16
|
+
# @param has_next_field [Symbol, Array<Symbol>] The field (or nested path) to pull the boolean of whether a next page exists from, if any.
|
|
17
17
|
# @param step [Boolean] If true, treats the page number as a true offset (i.e. increments the page number by the number of items returned from each call rather than just 1)
|
|
18
18
|
# @param block [Proc] A block which is responsible for receiving a page number to use and returning the given page from the API.
|
|
19
19
|
# The block should return a two-element array: [parsed_page, raw_http_response].
|
|
@@ -89,7 +89,7 @@ module Schematic
|
|
|
89
89
|
return @has_next_page = false if @next_page
|
|
90
90
|
|
|
91
91
|
fetched_page = fetch_page(@page_number)
|
|
92
|
-
fetched_page_items = fetched_page
|
|
92
|
+
fetched_page_items = read_field(fetched_page, @item_field)
|
|
93
93
|
if fetched_page_items.nil? || fetched_page_items.empty?
|
|
94
94
|
@has_next_page = false
|
|
95
95
|
else
|
|
@@ -109,9 +109,9 @@ module Schematic
|
|
|
109
109
|
this_page = fetch_page(@page_number)
|
|
110
110
|
end
|
|
111
111
|
|
|
112
|
-
@has_next_page = this_page
|
|
112
|
+
@has_next_page = read_field(this_page, @has_next_field) if @has_next_field
|
|
113
113
|
|
|
114
|
-
items = this_page
|
|
114
|
+
items = read_field(this_page, @item_field)
|
|
115
115
|
if items.nil? || items.empty?
|
|
116
116
|
@page_number = nil
|
|
117
117
|
return nil
|
|
@@ -131,7 +131,7 @@ module Schematic
|
|
|
131
131
|
private
|
|
132
132
|
|
|
133
133
|
def page_has_items?(page)
|
|
134
|
-
items = page
|
|
134
|
+
items = read_field(page, @item_field)
|
|
135
135
|
!items.nil? && !items.empty?
|
|
136
136
|
end
|
|
137
137
|
|
|
@@ -146,6 +146,15 @@ module Schematic
|
|
|
146
146
|
result
|
|
147
147
|
end
|
|
148
148
|
end
|
|
149
|
+
|
|
150
|
+
# Reads a field from an API response, walking through enclosing objects when the field is nested.
|
|
151
|
+
#
|
|
152
|
+
# @param value [Object, nil] The API response.
|
|
153
|
+
# @param field [Symbol, Array<Symbol>] The field name, or the path of field names for a nested field.
|
|
154
|
+
# @return [Object, nil]
|
|
155
|
+
def read_field(value, field)
|
|
156
|
+
Array(field).reduce(value) { |object, name| object&.send(name) }
|
|
157
|
+
end
|
|
149
158
|
end
|
|
150
159
|
end
|
|
151
160
|
end
|
|
@@ -94,6 +94,18 @@ module Schematic
|
|
|
94
94
|
define_setter(name)
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
+
# Whether an unknown input key is dropped instead of kept as an extra field: it matches a declared
|
|
98
|
+
# field's name or API name, ignoring case
|
|
99
|
+
#
|
|
100
|
+
# @api private
|
|
101
|
+
#
|
|
102
|
+
# @param key [Symbol, String]
|
|
103
|
+
# @return [Boolean]
|
|
104
|
+
def drop_extra_key?(key)
|
|
105
|
+
key = key.to_s
|
|
106
|
+
fields.any? { |name, field| name.to_s.casecmp?(key) || field.api_name.to_s.casecmp?(key) }
|
|
107
|
+
end
|
|
108
|
+
|
|
97
109
|
# @api private
|
|
98
110
|
private def define_accessor(name)
|
|
99
111
|
method_name = name.to_sym
|
|
@@ -163,8 +175,12 @@ module Schematic
|
|
|
163
175
|
@data[field_name] = Utils.coerce(field.type, field_value)
|
|
164
176
|
end
|
|
165
177
|
|
|
166
|
-
# Any remaining values in the input become extra fields
|
|
178
|
+
# Any remaining values in the input become extra fields, except keys that match a declared field
|
|
179
|
+
# case-insensitively (e.g. `VALUE` next to `value`): re-emitting those would let a case-insensitive
|
|
180
|
+
# JSON decoder downstream read the extra key instead of the declared field.
|
|
167
181
|
values.each do |name, value|
|
|
182
|
+
next if self.class.drop_extra_key?(name)
|
|
183
|
+
|
|
168
184
|
self.class.add_extra_field_definition(name: name, type: value.class)
|
|
169
185
|
|
|
170
186
|
@data[name.to_sym] = value
|
|
@@ -11,6 +11,8 @@ module Schematic
|
|
|
11
11
|
field :entitlements, -> { Internal::Types::Array[Schematic::Types::PlanBundleEntitlementRequestBody] }, optional: false, nullable: false
|
|
12
12
|
|
|
13
13
|
field :plan, -> { Schematic::Types::CreateCustomPlanBundlePlanRequestBody }, optional: false, nullable: false
|
|
14
|
+
|
|
15
|
+
field :renewal_policy, -> { Schematic::Types::RenewalPolicy }, optional: true, nullable: false
|
|
14
16
|
end
|
|
15
17
|
end
|
|
16
18
|
end
|
|
@@ -11,6 +11,8 @@ module Schematic
|
|
|
11
11
|
field :entitlements, -> { Internal::Types::Array[Schematic::Types::PlanBundleEntitlementRequestBody] }, optional: false, nullable: false
|
|
12
12
|
|
|
13
13
|
field :plan, -> { Schematic::Types::CreatePlanRequestBody }, optional: false, nullable: false
|
|
14
|
+
|
|
15
|
+
field :renewal_policy, -> { Schematic::Types::RenewalPolicy }, optional: true, nullable: false
|
|
14
16
|
end
|
|
15
17
|
end
|
|
16
18
|
end
|
|
@@ -15,6 +15,8 @@ module Schematic
|
|
|
15
15
|
field :plan, -> { Schematic::Types::UpdatePlanRequestBody }, optional: false, nullable: false
|
|
16
16
|
|
|
17
17
|
field :plan_version_id, -> { String }, optional: true, nullable: false
|
|
18
|
+
|
|
19
|
+
field :renewal_policy, -> { Schematic::Types::RenewalPolicy }, optional: true, nullable: false
|
|
18
20
|
end
|
|
19
21
|
end
|
|
20
22
|
end
|
|
@@ -70,7 +70,9 @@ module Schematic
|
|
|
70
70
|
# @option request_options [Integer] :timeout_in_seconds
|
|
71
71
|
# @option params [String, nil] :company_id
|
|
72
72
|
# @option params [String, nil] :plan_id
|
|
73
|
+
# @option params [String, nil] :plan_version_id
|
|
73
74
|
# @option params [Schematic::Types::PlanBillingSource, nil] :plan_billing_source
|
|
75
|
+
# @option params [Schematic::Types::PlanBillingSource, nil] :plan_billing_sources
|
|
74
76
|
# @option params [Schematic::Types::CustomPlanBillingStatus, nil] :status
|
|
75
77
|
# @option params [Schematic::Types::CustomPlanBillingStatus, nil] :statuses
|
|
76
78
|
# @option params [Integer, nil] :limit
|
|
@@ -80,7 +82,9 @@ module Schematic
|
|
|
80
82
|
# client.plans.list_custom_plan_billings(
|
|
81
83
|
# company_id: "company_id",
|
|
82
84
|
# plan_id: "plan_id",
|
|
85
|
+
# plan_version_id: "plan_version_id",
|
|
83
86
|
# plan_billing_source: "amendment",
|
|
87
|
+
# plan_billing_sources: ["amendment"],
|
|
84
88
|
# status: "active",
|
|
85
89
|
# statuses: ["active"],
|
|
86
90
|
# limit: 1000000,
|
|
@@ -93,7 +97,9 @@ module Schematic
|
|
|
93
97
|
query_params = {}
|
|
94
98
|
query_params["company_id"] = params[:company_id] if params.key?(:company_id)
|
|
95
99
|
query_params["plan_id"] = params[:plan_id] if params.key?(:plan_id)
|
|
100
|
+
query_params["plan_version_id"] = params[:plan_version_id] if params.key?(:plan_version_id)
|
|
96
101
|
query_params["plan_billing_source"] = params[:plan_billing_source] if params.key?(:plan_billing_source)
|
|
102
|
+
query_params["plan_billing_sources"] = params[:plan_billing_sources] if params.key?(:plan_billing_sources)
|
|
97
103
|
query_params["status"] = params[:status] if params.key?(:status)
|
|
98
104
|
query_params["statuses"] = params[:statuses] if params.key?(:statuses)
|
|
99
105
|
query_params["limit"] = params[:limit] if params.key?(:limit)
|
|
@@ -1044,7 +1050,7 @@ module Schematic
|
|
|
1044
1050
|
end
|
|
1045
1051
|
|
|
1046
1052
|
# @param request_options [Hash]
|
|
1047
|
-
# @param params [Schematic::
|
|
1053
|
+
# @param params [Schematic::Types::PublishPlanVersionRequestBody]
|
|
1048
1054
|
# @option request_options [String] :base_url
|
|
1049
1055
|
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1050
1056
|
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
@@ -1062,15 +1068,14 @@ module Schematic
|
|
|
1062
1068
|
# @return [Schematic::Plans::Types::PublishPlanVersionResponse]
|
|
1063
1069
|
def publish_plan_version(request_options: {}, **params)
|
|
1064
1070
|
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
body = request_data.except(*non_body_param_names)
|
|
1071
|
+
path_param_names = %i[plan_version_id]
|
|
1072
|
+
body_params = params.except(*path_param_names)
|
|
1068
1073
|
|
|
1069
1074
|
request = Schematic::Internal::JSON::Request.new(
|
|
1070
1075
|
base_url: request_options[:base_url],
|
|
1071
1076
|
method: "PUT",
|
|
1072
1077
|
path: "plans/version/#{URI.encode_uri_component(params[:plan_version_id].to_s)}/publish",
|
|
1073
|
-
body:
|
|
1078
|
+
body: Schematic::Types::PublishPlanVersionRequestBody.new(body_params).to_h,
|
|
1074
1079
|
request_options: request_options
|
|
1075
1080
|
)
|
|
1076
1081
|
begin
|
|
@@ -1094,6 +1099,57 @@ module Schematic
|
|
|
1094
1099
|
raise error_class.new(response.body, code: code, body: error_body)
|
|
1095
1100
|
end
|
|
1096
1101
|
end
|
|
1102
|
+
|
|
1103
|
+
# @param request_options [Hash]
|
|
1104
|
+
# @param params [Schematic::Types::PublishPlanVersionRequestBody]
|
|
1105
|
+
# @option request_options [String] :base_url
|
|
1106
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1107
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1108
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1109
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1110
|
+
# @option params [String] :plan_version_id
|
|
1111
|
+
#
|
|
1112
|
+
# @example
|
|
1113
|
+
# client.plans.preview_publish_plan_version(
|
|
1114
|
+
# plan_version_id: "plan_version_id",
|
|
1115
|
+
# excluded_company_ids: ["excluded_company_ids"],
|
|
1116
|
+
# migration_strategy: "end_of_billing_period"
|
|
1117
|
+
# )
|
|
1118
|
+
#
|
|
1119
|
+
# @return [Schematic::Plans::Types::PreviewPublishPlanVersionResponse]
|
|
1120
|
+
def preview_publish_plan_version(request_options: {}, **params)
|
|
1121
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1122
|
+
path_param_names = %i[plan_version_id]
|
|
1123
|
+
body_params = params.except(*path_param_names)
|
|
1124
|
+
|
|
1125
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1126
|
+
base_url: request_options[:base_url],
|
|
1127
|
+
method: "POST",
|
|
1128
|
+
path: "plans/version/#{URI.encode_uri_component(params[:plan_version_id].to_s)}/publish-preview",
|
|
1129
|
+
body: Schematic::Types::PublishPlanVersionRequestBody.new(body_params).to_h,
|
|
1130
|
+
request_options: request_options
|
|
1131
|
+
)
|
|
1132
|
+
begin
|
|
1133
|
+
response = @client.send(request)
|
|
1134
|
+
rescue Net::HTTPRequestTimeout
|
|
1135
|
+
raise Schematic::Errors::TimeoutError
|
|
1136
|
+
end
|
|
1137
|
+
code = response.code.to_i
|
|
1138
|
+
if code.between?(200, 299)
|
|
1139
|
+
(response.body.to_s.empty? ? nil : Schematic::Plans::Types::PreviewPublishPlanVersionResponse.load(response.body))
|
|
1140
|
+
else
|
|
1141
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1142
|
+
error_types = {
|
|
1143
|
+
400 => Schematic::Types::ApiError,
|
|
1144
|
+
401 => Schematic::Types::ApiError,
|
|
1145
|
+
403 => Schematic::Types::ApiError,
|
|
1146
|
+
404 => Schematic::Types::ApiError,
|
|
1147
|
+
500 => Schematic::Types::ApiError
|
|
1148
|
+
}
|
|
1149
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1150
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1151
|
+
end
|
|
1152
|
+
end
|
|
1097
1153
|
end
|
|
1098
1154
|
end
|
|
1099
1155
|
end
|
|
@@ -13,8 +13,12 @@ module Schematic
|
|
|
13
13
|
|
|
14
14
|
field :plan_billing_source, -> { Schematic::Types::PlanBillingSource }, optional: true, nullable: false
|
|
15
15
|
|
|
16
|
+
field :plan_billing_sources, -> { Internal::Types::Array[Schematic::Types::PlanBillingSource] }, optional: true, nullable: false
|
|
17
|
+
|
|
16
18
|
field :plan_id, -> { String }, optional: true, nullable: false
|
|
17
19
|
|
|
20
|
+
field :plan_version_id, -> { String }, optional: true, nullable: false
|
|
21
|
+
|
|
18
22
|
field :status, -> { Schematic::Types::CustomPlanBillingStatus }, optional: true, nullable: false
|
|
19
23
|
|
|
20
24
|
field :statuses, -> { Internal::Types::Array[Schematic::Types::CustomPlanBillingStatus] }, optional: true, nullable: false
|
|
@@ -8,8 +8,12 @@ module Schematic
|
|
|
8
8
|
|
|
9
9
|
field :plan_id, -> { String }, optional: true, nullable: false
|
|
10
10
|
|
|
11
|
+
field :plan_version_id, -> { String }, optional: true, nullable: false
|
|
12
|
+
|
|
11
13
|
field :plan_billing_source, -> { Schematic::Types::PlanBillingSource }, optional: true, nullable: false
|
|
12
14
|
|
|
15
|
+
field :plan_billing_sources, -> { Schematic::Types::PlanBillingSource }, optional: true, nullable: false
|
|
16
|
+
|
|
13
17
|
field :status, -> { Schematic::Types::CustomPlanBillingStatus }, optional: true, nullable: false
|
|
14
18
|
|
|
15
19
|
field :statuses, -> { Schematic::Types::CustomPlanBillingStatus }, optional: true, nullable: false
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Plans
|
|
5
|
+
module Types
|
|
6
|
+
class PreviewPublishPlanVersionResponse < Internal::Types::Model
|
|
7
|
+
field :data, -> { Schematic::Types::PublishPreviewResponseData }, optional: false, nullable: false
|
|
8
|
+
|
|
9
|
+
field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -16,6 +16,8 @@ module Schematic
|
|
|
16
16
|
|
|
17
17
|
field :days_until_due, -> { Integer }, optional: true, nullable: false
|
|
18
18
|
|
|
19
|
+
field :end_date, -> { String }, optional: true, nullable: false
|
|
20
|
+
|
|
19
21
|
field :prorate_first_period, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
20
22
|
|
|
21
23
|
field :send_invoice, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Types
|
|
5
|
+
module AmendmentProrationLandsOn
|
|
6
|
+
extend Schematic::Internal::Types::Enum
|
|
7
|
+
|
|
8
|
+
IMMEDIATE_INVOICE = "immediate_invoice"
|
|
9
|
+
NEXT_INVOICE = "next_invoice"
|
|
10
|
+
NONE = "none"
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Types
|
|
5
|
+
class BillingInvoiceAddressResponseData < Internal::Types::Model
|
|
6
|
+
field :city, -> { String }, optional: false, nullable: false
|
|
7
|
+
|
|
8
|
+
field :country, -> { String }, optional: false, nullable: false
|
|
9
|
+
|
|
10
|
+
field :line_1, -> { String }, optional: false, nullable: false, api_name: "line1"
|
|
11
|
+
|
|
12
|
+
field :line_2, -> { String }, optional: false, nullable: false, api_name: "line2"
|
|
13
|
+
|
|
14
|
+
field :postal_code, -> { String }, optional: false, nullable: false
|
|
15
|
+
|
|
16
|
+
field :state, -> { String }, optional: false, nullable: false
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Types
|
|
5
|
+
class BillingInvoiceBillingDetailsResponseData < Internal::Types::Model
|
|
6
|
+
field :address, -> { Schematic::Types::BillingInvoiceAddressResponseData }, optional: true, nullable: false
|
|
7
|
+
|
|
8
|
+
field :email, -> { String }, optional: true, nullable: false
|
|
9
|
+
|
|
10
|
+
field :phone, -> { String }, optional: true, nullable: false
|
|
11
|
+
|
|
12
|
+
field :tax_ids, -> { Internal::Types::Array[Schematic::Types::BillingInvoiceTaxIdResponseData] }, optional: false, nullable: false
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Types
|
|
5
|
+
class BillingInvoiceDetailResponseData < Internal::Types::Model
|
|
6
|
+
field :amount_paid, -> { Integer }, optional: false, nullable: false
|
|
7
|
+
|
|
8
|
+
field :amount_remaining, -> { Integer }, optional: false, nullable: false
|
|
9
|
+
|
|
10
|
+
field :collection_state, -> { Schematic::Types::InvoiceCollectionState }, optional: true, nullable: false
|
|
11
|
+
|
|
12
|
+
field :collector, -> { Schematic::Types::Collector }, optional: true, nullable: false
|
|
13
|
+
|
|
14
|
+
field :company_id, -> { String }, optional: false, nullable: false
|
|
15
|
+
|
|
16
|
+
field :contract_id, -> { String }, optional: true, nullable: false
|
|
17
|
+
|
|
18
|
+
field :created_at, -> { String }, optional: false, nullable: false
|
|
19
|
+
|
|
20
|
+
field :currency, -> { Schematic::Types::Currency }, optional: false, nullable: false
|
|
21
|
+
|
|
22
|
+
field :discount, -> { Integer }, optional: false, nullable: false
|
|
23
|
+
|
|
24
|
+
field :document_state, -> { Schematic::Types::InvoiceDocumentState }, optional: true, nullable: false
|
|
25
|
+
|
|
26
|
+
field :due_at, -> { String }, optional: true, nullable: false
|
|
27
|
+
|
|
28
|
+
field :external_id, -> { String }, optional: true, nullable: false
|
|
29
|
+
|
|
30
|
+
field :finalized_at, -> { String }, optional: true, nullable: false
|
|
31
|
+
|
|
32
|
+
field :id, -> { String }, optional: false, nullable: false
|
|
33
|
+
|
|
34
|
+
field :lines, -> { Internal::Types::Array[Schematic::Types::BillingInvoiceLineResponseData] }, optional: false, nullable: false
|
|
35
|
+
|
|
36
|
+
field :number, -> { String }, optional: true, nullable: false
|
|
37
|
+
|
|
38
|
+
field :pdf_url, -> { String }, optional: true, nullable: false
|
|
39
|
+
|
|
40
|
+
field :period_end, -> { String }, optional: true, nullable: false
|
|
41
|
+
|
|
42
|
+
field :period_start, -> { String }, optional: true, nullable: false
|
|
43
|
+
|
|
44
|
+
field :provider_type, -> { Schematic::Types::BillingProviderType }, optional: false, nullable: false
|
|
45
|
+
|
|
46
|
+
field :settlements, -> { Internal::Types::Array[Schematic::Types::BillingInvoiceSettlementResponseData] }, optional: false, nullable: false
|
|
47
|
+
|
|
48
|
+
field :status, -> { Schematic::Types::InvoiceStatus }, optional: false, nullable: false
|
|
49
|
+
|
|
50
|
+
field :subscription_external_id, -> { String }, optional: true, nullable: false
|
|
51
|
+
|
|
52
|
+
field :subscription_id, -> { String }, optional: true, nullable: false
|
|
53
|
+
|
|
54
|
+
field :subtotal, -> { Integer }, optional: false, nullable: false
|
|
55
|
+
|
|
56
|
+
field :tax, -> { Integer }, optional: false, nullable: false
|
|
57
|
+
|
|
58
|
+
field :terms, -> { Schematic::Types::BillingInvoiceTermsResponseData }, optional: true, nullable: false
|
|
59
|
+
|
|
60
|
+
field :total, -> { Integer }, optional: false, nullable: false
|
|
61
|
+
|
|
62
|
+
field :url, -> { String }, optional: true, nullable: false
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Types
|
|
5
|
+
class BillingInvoiceLineResponseData < Internal::Types::Model
|
|
6
|
+
field :amount, -> { Integer }, optional: false, nullable: false
|
|
7
|
+
|
|
8
|
+
field :charge_ids, -> { Internal::Types::Array[String] }, optional: false, nullable: false
|
|
9
|
+
|
|
10
|
+
field :description, -> { String }, optional: true, nullable: false
|
|
11
|
+
|
|
12
|
+
field :external_id, -> { String }, optional: true, nullable: false
|
|
13
|
+
|
|
14
|
+
field :id, -> { String }, optional: true, nullable: false
|
|
15
|
+
|
|
16
|
+
field :kind, -> { Schematic::Types::InvoiceLineKind }, optional: false, nullable: false
|
|
17
|
+
|
|
18
|
+
field :period_end, -> { String }, optional: true, nullable: false
|
|
19
|
+
|
|
20
|
+
field :period_start, -> { String }, optional: true, nullable: false
|
|
21
|
+
|
|
22
|
+
field :quantity, -> { Integer }, optional: true, nullable: false
|
|
23
|
+
|
|
24
|
+
field :subscription_line_id, -> { String }, optional: true, nullable: false
|
|
25
|
+
|
|
26
|
+
field :taxable, -> { Internal::Types::Boolean }, optional: false, nullable: false
|
|
27
|
+
|
|
28
|
+
field :unit_amount, -> { Integer }, optional: true, nullable: false
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Types
|
|
5
|
+
class BillingInvoiceResponseData < Internal::Types::Model
|
|
6
|
+
field :amount_paid, -> { Integer }, optional: false, nullable: false
|
|
7
|
+
|
|
8
|
+
field :amount_remaining, -> { Integer }, optional: false, nullable: false
|
|
9
|
+
|
|
10
|
+
field :collection_state, -> { Schematic::Types::InvoiceCollectionState }, optional: true, nullable: false
|
|
11
|
+
|
|
12
|
+
field :collector, -> { Schematic::Types::Collector }, optional: true, nullable: false
|
|
13
|
+
|
|
14
|
+
field :company_id, -> { String }, optional: false, nullable: false
|
|
15
|
+
|
|
16
|
+
field :contract_id, -> { String }, optional: true, nullable: false
|
|
17
|
+
|
|
18
|
+
field :created_at, -> { String }, optional: false, nullable: false
|
|
19
|
+
|
|
20
|
+
field :currency, -> { Schematic::Types::Currency }, optional: false, nullable: false
|
|
21
|
+
|
|
22
|
+
field :document_state, -> { Schematic::Types::InvoiceDocumentState }, optional: true, nullable: false
|
|
23
|
+
|
|
24
|
+
field :due_at, -> { String }, optional: true, nullable: false
|
|
25
|
+
|
|
26
|
+
field :external_id, -> { String }, optional: true, nullable: false
|
|
27
|
+
|
|
28
|
+
field :finalized_at, -> { String }, optional: true, nullable: false
|
|
29
|
+
|
|
30
|
+
field :id, -> { String }, optional: false, nullable: false
|
|
31
|
+
|
|
32
|
+
field :number, -> { String }, optional: true, nullable: false
|
|
33
|
+
|
|
34
|
+
field :period_end, -> { String }, optional: true, nullable: false
|
|
35
|
+
|
|
36
|
+
field :period_start, -> { String }, optional: true, nullable: false
|
|
37
|
+
|
|
38
|
+
field :provider_type, -> { Schematic::Types::BillingProviderType }, optional: false, nullable: false
|
|
39
|
+
|
|
40
|
+
field :status, -> { Schematic::Types::InvoiceStatus }, optional: false, nullable: false
|
|
41
|
+
|
|
42
|
+
field :subscription_external_id, -> { String }, optional: true, nullable: false
|
|
43
|
+
|
|
44
|
+
field :subtotal, -> { Integer }, optional: false, nullable: false
|
|
45
|
+
|
|
46
|
+
field :total, -> { Integer }, optional: false, nullable: false
|
|
47
|
+
|
|
48
|
+
field :url, -> { String }, optional: true, nullable: false
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Types
|
|
5
|
+
class BillingInvoiceSettlementResponseData < Internal::Types::Model
|
|
6
|
+
field :amount, -> { Integer }, optional: false, nullable: false
|
|
7
|
+
|
|
8
|
+
field :collector, -> { Schematic::Types::Collector }, optional: false, nullable: false
|
|
9
|
+
|
|
10
|
+
field :id, -> { String }, optional: true, nullable: false
|
|
11
|
+
|
|
12
|
+
field :reference, -> { String }, optional: true, nullable: false
|
|
13
|
+
|
|
14
|
+
field :settled_at, -> { String }, optional: false, nullable: false
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Types
|
|
5
|
+
class BillingInvoiceTaxIdResponseData < Internal::Types::Model
|
|
6
|
+
field :type, -> { Schematic::Types::TaxIdType }, optional: false, nullable: false
|
|
7
|
+
|
|
8
|
+
field :value, -> { String }, optional: false, nullable: false
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Types
|
|
5
|
+
class BillingInvoiceTermsResponseData < Internal::Types::Model
|
|
6
|
+
field :billing_details, -> { Schematic::Types::BillingInvoiceBillingDetailsResponseData }, optional: true, nullable: false
|
|
7
|
+
|
|
8
|
+
field :collection_method, -> { Schematic::Types::BillingCollectionMethod }, optional: false, nullable: false
|
|
9
|
+
|
|
10
|
+
field :collector, -> { Schematic::Types::Collector }, optional: false, nullable: false
|
|
11
|
+
|
|
12
|
+
field :currency, -> { Schematic::Types::Currency }, optional: true, nullable: false
|
|
13
|
+
|
|
14
|
+
field :days_until_due, -> { Integer }, optional: true, nullable: false
|
|
15
|
+
|
|
16
|
+
field :payment_gating, -> { Schematic::Types::PaymentGating }, optional: false, nullable: false
|
|
17
|
+
|
|
18
|
+
field :purchase_order, -> { String }, optional: true, nullable: false
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Types
|
|
5
|
+
class BillingNativeSubscriptionChangeResponseData < Internal::Types::Model
|
|
6
|
+
field :action, -> { Schematic::Types::SubscriptionChangeAction }, optional: false, nullable: false
|
|
7
|
+
|
|
8
|
+
field :effective_at, -> { String }, optional: false, nullable: false
|
|
9
|
+
|
|
10
|
+
field :line, -> { Schematic::Types::BillingNativeSubscriptionLineResponseData }, optional: true, nullable: false
|
|
11
|
+
|
|
12
|
+
field :replaces, -> { Schematic::Types::BillingNativeSubscriptionLineResponseData }, optional: true, nullable: false
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Types
|
|
5
|
+
class BillingNativeSubscriptionLineResponseData < Internal::Types::Model
|
|
6
|
+
field :anchor, -> { String }, optional: false, nullable: false
|
|
7
|
+
|
|
8
|
+
field :anchor_day, -> { Integer }, optional: false, nullable: false
|
|
9
|
+
|
|
10
|
+
field :base, -> { Internal::Types::Boolean }, optional: false, nullable: false
|
|
11
|
+
|
|
12
|
+
field :cadence_count, -> { Integer }, optional: false, nullable: false
|
|
13
|
+
|
|
14
|
+
field :cadence_unit, -> { Schematic::Types::BillingProductPriceInterval }, optional: false, nullable: false
|
|
15
|
+
|
|
16
|
+
field :currency, -> { Schematic::Types::Currency }, optional: false, nullable: false
|
|
17
|
+
|
|
18
|
+
field :current_period_end, -> { String }, optional: true, nullable: false
|
|
19
|
+
|
|
20
|
+
field :current_period_start, -> { String }, optional: true, nullable: false
|
|
21
|
+
|
|
22
|
+
field :effective_from, -> { String }, optional: false, nullable: false
|
|
23
|
+
|
|
24
|
+
field :effective_to, -> { String }, optional: true, nullable: false
|
|
25
|
+
|
|
26
|
+
field :id, -> { String }, optional: false, nullable: false
|
|
27
|
+
|
|
28
|
+
field :kind, -> { Schematic::Types::LineKind }, optional: false, nullable: false
|
|
29
|
+
|
|
30
|
+
field :quantity, -> { Integer }, optional: false, nullable: false
|
|
31
|
+
|
|
32
|
+
field :source_id, -> { String }, optional: false, nullable: false
|
|
33
|
+
|
|
34
|
+
field :source_name, -> { String }, optional: true, nullable: false
|
|
35
|
+
|
|
36
|
+
field :source_plan_type, -> { Schematic::Types::PlanType }, optional: true, nullable: false
|
|
37
|
+
|
|
38
|
+
field :taxable, -> { Internal::Types::Boolean }, optional: false, nullable: false
|
|
39
|
+
|
|
40
|
+
field :tiers_mode, -> { Schematic::Types::BillingTiersMode }, optional: true, nullable: false
|
|
41
|
+
|
|
42
|
+
field :timing, -> { Schematic::Types::ChargeTiming }, optional: false, nullable: false
|
|
43
|
+
|
|
44
|
+
field :unit_amount, -> { Integer }, optional: true, nullable: false
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Types
|
|
5
|
+
class BillingNativeSubscriptionResponseData < Internal::Types::Model
|
|
6
|
+
field :cancel_at, -> { String }, optional: true, nullable: false
|
|
7
|
+
|
|
8
|
+
field :company_id, -> { String }, optional: false, nullable: false
|
|
9
|
+
|
|
10
|
+
field :currency, -> { Schematic::Types::Currency }, optional: false, nullable: false
|
|
11
|
+
|
|
12
|
+
field :id, -> { String }, optional: false, nullable: false
|
|
13
|
+
|
|
14
|
+
field :lines, -> { Internal::Types::Array[Schematic::Types::BillingNativeSubscriptionLineResponseData] }, optional: false, nullable: false
|
|
15
|
+
|
|
16
|
+
field :period_end, -> { String }, optional: false, nullable: false
|
|
17
|
+
|
|
18
|
+
field :period_start, -> { String }, optional: false, nullable: false
|
|
19
|
+
|
|
20
|
+
field :scheduled_changes, -> { Internal::Types::Array[Schematic::Types::BillingNativeSubscriptionChangeResponseData] }, optional: false, nullable: false
|
|
21
|
+
|
|
22
|
+
field :started_at, -> { String }, optional: true, nullable: false
|
|
23
|
+
|
|
24
|
+
field :statement, -> { Schematic::Types::BillingStatementResponseData }, optional: true, nullable: false
|
|
25
|
+
|
|
26
|
+
field :status, -> { Schematic::Types::SubscriptionStatus }, optional: false, nullable: false
|
|
27
|
+
|
|
28
|
+
field :terms, -> { Schematic::Types::BillingInvoiceTermsResponseData }, optional: true, nullable: false
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -94,6 +94,8 @@ module Schematic
|
|
|
94
94
|
field :unit_price_decimal, -> { String }, optional: true, nullable: false
|
|
95
95
|
|
|
96
96
|
field :updated_at, -> { String }, optional: false, nullable: false
|
|
97
|
+
|
|
98
|
+
field :warning_tiers, -> { Internal::Types::Array[Schematic::Types::BillingPlanCreditGrantWarningTierResponseData] }, optional: false, nullable: false
|
|
97
99
|
end
|
|
98
100
|
end
|
|
99
101
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Types
|
|
5
|
+
class BillingPlanCreditGrantWarningTierResponseData < Internal::Types::Model
|
|
6
|
+
field :id, -> { String }, optional: false, nullable: false
|
|
7
|
+
|
|
8
|
+
field :key, -> { String }, optional: false, nullable: false
|
|
9
|
+
|
|
10
|
+
field :value, -> { Integer }, optional: false, nullable: false
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|