schematichq 1.5.3 → 1.5.5
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/.fernignore +2 -0
- data/.rubocop.yml +4 -0
- data/README.md +1 -1
- data/WASM_VERSION +1 -1
- data/lib/schematic/accesstokens/client.rb +9 -1
- data/lib/schematic/accounts/client.rb +183 -21
- data/lib/schematic/billing/client.rb +748 -34
- data/lib/schematic/billing/types/count_native_invoices_params.rb +20 -0
- data/lib/schematic/billing/types/count_native_invoices_request.rb +19 -0
- data/lib/schematic/billing/types/count_native_invoices_response.rb +13 -0
- data/lib/schematic/billing/types/create_billing_price_request_body.rb +1 -1
- data/lib/schematic/billing/types/create_billing_product_request_body.rb +1 -1
- data/lib/schematic/billing/types/create_billing_subscription_request_body.rb +1 -1
- data/lib/schematic/billing/types/create_coupon_request_body.rb +2 -2
- data/lib/schematic/billing/types/create_invoice_request_body.rb +1 -1
- data/lib/schematic/billing/types/finalize_native_invoice_response.rb +13 -0
- data/lib/schematic/billing/types/get_billing_settings_response.rb +13 -0
- data/lib/schematic/billing/types/get_company_native_subscription_response.rb +13 -0
- data/lib/schematic/billing/types/get_native_invoice_response.rb +13 -0
- data/lib/schematic/billing/types/list_billing_prices_params.rb +1 -1
- data/lib/schematic/billing/types/list_billing_prices_request.rb +1 -1
- data/lib/schematic/billing/types/list_billing_product_prices_params.rb +1 -1
- data/lib/schematic/billing/types/list_billing_product_prices_request.rb +1 -1
- data/lib/schematic/billing/types/list_native_invoices_params.rb +20 -0
- data/lib/schematic/billing/types/list_native_invoices_request.rb +19 -0
- data/lib/schematic/billing/types/list_native_invoices_response.rb +13 -0
- data/lib/schematic/billing/types/mark_invoice_paid_request_body.rb +19 -0
- data/lib/schematic/billing/types/mark_native_invoice_paid_response.rb +13 -0
- data/lib/schematic/billing/types/update_billing_settings_request_body.rb +11 -0
- data/lib/schematic/billing/types/update_billing_settings_response.rb +13 -0
- data/lib/schematic/billing/types/void_native_invoice_response.rb +13 -0
- data/lib/schematic/catalogs/client.rb +121 -14
- data/lib/schematic/checkout/client.rb +80 -9
- data/lib/schematic/checkout/types/checkout_data_request_body.rb +1 -1
- data/lib/schematic/client.rb +5 -3
- data/lib/schematic/companies/client.rb +380 -44
- data/lib/schematic/components/client.rb +70 -8
- data/lib/schematic/components/types/create_component_request_body.rb +1 -1
- data/lib/schematic/components/types/update_component_request_body.rb +1 -1
- data/lib/schematic/componentspublic/client.rb +8 -1
- data/lib/schematic/credits/client.rb +409 -41
- data/lib/schematic/credits/types/acquire_credit_lease_request_body.rb +1 -1
- data/lib/schematic/credits/types/create_billing_credit_request_body.rb +1 -1
- data/lib/schematic/credits/types/create_company_credit_grant.rb +1 -1
- data/lib/schematic/credits/types/create_credit_bundle_request_body.rb +1 -1
- data/lib/schematic/credits/types/create_credit_spend_policy_request_body.rb +2 -2
- data/lib/schematic/credits/types/extend_credit_lease_request_body.rb +1 -1
- data/lib/schematic/credits/types/get_credit_balance_time_series_params.rb +18 -0
- data/lib/schematic/credits/types/get_credit_balance_time_series_request.rb +17 -0
- data/lib/schematic/credits/types/get_credit_balance_time_series_response.rb +13 -0
- data/lib/schematic/credits/types/reserve_credits_request_body.rb +1 -1
- data/lib/schematic/credits/types/update_credit_spend_policy_request_body.rb +2 -2
- data/lib/schematic/dataexports/client.rb +36 -6
- data/lib/schematic/entitlements/client.rb +244 -28
- data/lib/schematic/entitlements/types/create_billing_linked_plan_entitlement_request_body.rb +4 -2
- data/lib/schematic/entitlements/types/create_company_override_request_body.rb +3 -1
- data/lib/schematic/entitlements/types/create_plan_entitlement_request_body.rb +4 -2
- data/lib/schematic/entitlements/types/update_company_override_request_body.rb +3 -1
- data/lib/schematic/entitlements/types/update_plan_entitlement_request_body.rb +4 -2
- data/lib/schematic/errors/connection_error.rb +11 -0
- data/lib/schematic/errors/response_error.rb +23 -2
- data/lib/schematic/events/client.rb +78 -9
- data/lib/schematic/features/client.rb +160 -20
- data/lib/schematic/features/types/check_and_reserve_flag_request_body.rb +1 -1
- data/lib/schematic/features/types/create_billing_linked_feature_request_body.rb +2 -0
- data/lib/schematic/features/types/create_feature_request_body.rb +2 -0
- data/lib/schematic/features/types/update_feature_request_body.rb +2 -0
- data/lib/schematic/insights/client.rb +48 -6
- data/lib/schematic/integrationsapi/client.rb +120 -14
- data/lib/schematic/internal/http/base_request.rb +30 -0
- data/lib/schematic/internal/http/raw_client.rb +35 -5
- data/lib/schematic/internal/iterators/cursor_item_iterator.rb +9 -4
- data/lib/schematic/internal/iterators/cursor_page_iterator.rb +78 -15
- data/lib/schematic/internal/iterators/item_iterator.rb +70 -15
- data/lib/schematic/internal/iterators/offset_item_iterator.rb +9 -4
- data/lib/schematic/internal/iterators/offset_page_iterator.rb +71 -14
- data/lib/schematic/internal/json/request.rb +11 -2
- data/lib/schematic/internal/multipart/multipart_request.rb +1 -0
- data/lib/schematic/internal/types/model.rb +24 -4
- data/lib/schematic/internal/types/utils.rb +7 -0
- data/lib/schematic/licenses/client.rb +26 -3
- data/lib/schematic/planbundle/client.rb +27 -3
- data/lib/schematic/plangroups/client.rb +26 -3
- data/lib/schematic/planmigrations/client.rb +98 -11
- data/lib/schematic/plans/client.rb +274 -28
- data/lib/schematic/plans/types/get_plan_version_diff_params.rb +12 -0
- data/lib/schematic/plans/types/get_plan_version_diff_request.rb +13 -0
- data/lib/schematic/plans/types/get_plan_version_diff_response.rb +13 -0
- 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/rules_engine.rb +14 -2
- data/lib/schematic/scheduledcheckout/client.rb +35 -4
- data/lib/schematic/schematic_client.rb +22 -11
- data/lib/schematic/types/amendment_proration_lands_on.rb +13 -0
- data/lib/schematic/types/billing_coupon_response_data.rb +2 -2
- data/lib/schematic/types/billing_credit_grant_response_data.rb +8 -8
- data/lib/schematic/types/billing_customer_subscription.rb +1 -1
- data/lib/schematic/types/billing_invoice_detail_response_data.rb +49 -0
- data/lib/schematic/types/billing_invoice_line_response_data.rb +27 -0
- data/lib/schematic/types/billing_invoice_response_data.rb +43 -0
- data/lib/schematic/types/billing_invoice_settlement_response_data.rb +17 -0
- data/lib/schematic/types/billing_invoice_terms_response_data.rb +19 -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 +1 -1
- data/lib/schematic/types/billing_price_response_data.rb +1 -1
- data/lib/schematic/types/billing_price_view.rb +1 -1
- data/lib/schematic/types/billing_product_detail_response_data.rb +2 -2
- data/lib/schematic/types/billing_product_for_subscription_response_data.rb +2 -2
- data/lib/schematic/types/billing_product_price_response_data.rb +1 -1
- data/lib/schematic/types/billing_product_pricing.rb +1 -1
- data/lib/schematic/types/billing_product_response_data.rb +2 -2
- data/lib/schematic/types/billing_settings_response_data.rb +9 -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/billing_subscription_discount_view.rb +2 -2
- data/lib/schematic/types/billing_subscription_response_data.rb +1 -1
- data/lib/schematic/types/billing_subscription_view.rb +1 -1
- data/lib/schematic/types/catalog_config_ordered_plan.rb +2 -0
- data/lib/schematic/types/catalog_config_ordered_plan_response_data.rb +2 -0
- data/lib/schematic/types/catalog_config_plan_credit.rb +11 -0
- data/lib/schematic/types/catalog_config_plan_credit_response_data.rb +11 -0
- data/lib/schematic/types/change_subscription_internal_request_body.rb +1 -1
- data/lib/schematic/types/change_subscription_request_body.rb +1 -1
- data/lib/schematic/types/charge_timing.rb +12 -0
- data/lib/schematic/types/checkout_problem_code.rb +54 -0
- data/lib/schematic/types/checkout_problem_response_data.rb +31 -0
- data/lib/schematic/types/checkout_problem_source.rb +13 -0
- data/lib/schematic/types/checkout_subscription.rb +1 -1
- data/lib/schematic/types/collector.rb +13 -0
- data/lib/schematic/types/company_billing_entity_subscription_response_data.rb +1 -1
- data/lib/schematic/types/company_billing_profile_response_data.rb +12 -0
- data/lib/schematic/types/company_credit_balance.rb +7 -3
- data/lib/schematic/types/company_credit_balance_response_data.rb +4 -4
- data/lib/schematic/types/company_detail_response_data.rb +1 -1
- data/lib/schematic/types/company_override_response_data.rb +3 -1
- data/lib/schematic/types/company_plan_credit_grant_view.rb +1 -1
- data/lib/schematic/types/company_plan_detail_response_data.rb +2 -0
- data/lib/schematic/types/company_subscription_response_data.rb +1 -1
- data/lib/schematic/types/company_user_usage_response_data.rb +2 -2
- data/lib/schematic/types/company_user_usage_row_response_data.rb +2 -2
- data/lib/schematic/types/component_response_data.rb +1 -1
- data/lib/schematic/types/condition.rb +3 -1
- data/lib/schematic/types/condition_response_data.rb +3 -1
- data/lib/schematic/types/condition_view.rb +3 -1
- data/lib/schematic/types/coupon_request_body.rb +2 -2
- data/lib/schematic/types/create_billing_plan_credit_grant_request_body.rb +1 -1
- data/lib/schematic/types/create_entitlement_in_bundle_request_body.rb +4 -2
- data/lib/schematic/types/create_entitlement_req_common.rb +3 -1
- data/lib/schematic/types/create_flag_request_body.rb +1 -1
- data/lib/schematic/types/create_or_update_condition_request_body.rb +1 -1
- data/lib/schematic/types/create_or_update_flag_request_body.rb +1 -1
- data/lib/schematic/types/credit_balance_event_response_data.rb +21 -0
- data/lib/schematic/types/credit_balance_feature_consumption_response_data.rb +13 -0
- data/lib/schematic/types/credit_balance_point_response_data.rb +15 -0
- data/lib/schematic/types/credit_balance_time_series_response_data.rb +15 -0
- data/lib/schematic/types/credit_bundle_currency_price.rb +1 -1
- data/lib/schematic/types/credit_bundle_currency_price_request_body.rb +1 -1
- data/lib/schematic/types/credit_bundle_currency_price_response_data.rb +1 -1
- data/lib/schematic/types/credit_burn_breakdown_line.rb +15 -0
- data/lib/schematic/types/credit_company_grant_view.rb +8 -8
- data/lib/schematic/types/credit_currency_price.rb +1 -1
- data/lib/schematic/types/credit_currency_price_request_body.rb +1 -1
- data/lib/schematic/types/credit_currency_price_response_data.rb +1 -1
- data/lib/schematic/types/credit_event_ledger_response_data.rb +10 -6
- data/lib/schematic/types/credit_grant_detail.rb +1 -1
- data/lib/schematic/types/credit_lease_response_data.rb +2 -2
- data/lib/schematic/types/credit_reservation_response_data.rb +2 -2
- data/lib/schematic/types/credit_spend_policy.rb +4 -2
- data/lib/schematic/types/credit_spend_policy_response_data.rb +4 -4
- data/lib/schematic/types/credit_transfer_response_data.rb +1 -1
- data/lib/schematic/types/credit_transfer_view.rb +1 -1
- data/lib/schematic/types/credit_usage.rb +5 -5
- data/lib/schematic/types/credit_usage_aggregation.rb +4 -4
- data/lib/schematic/types/credit_usage_reason.rb +1 -0
- data/lib/schematic/types/credits_in_plan.rb +11 -0
- data/lib/schematic/types/currency.rb +144 -0
- data/lib/schematic/types/currency_price_request_body.rb +1 -1
- data/lib/schematic/types/custom_plan_billing_response_data.rb +6 -0
- data/lib/schematic/types/entitlement_currency_prices_response_data.rb +1 -1
- data/lib/schematic/types/estimated_plan_total.rb +1 -1
- data/lib/schematic/types/event_body_inference.rb +4 -0
- data/lib/schematic/types/feature_company_response_data.rb +7 -7
- data/lib/schematic/types/feature_detail_response_data.rb +2 -0
- data/lib/schematic/types/feature_entitlement.rb +8 -6
- data/lib/schematic/types/feature_event_source.rb +12 -0
- data/lib/schematic/types/feature_in_plan_response_data.rb +2 -0
- data/lib/schematic/types/feature_response_data.rb +2 -0
- data/lib/schematic/types/feature_usage_response_data.rb +7 -7
- data/lib/schematic/types/feature_view.rb +2 -0
- data/lib/schematic/types/flag_check_reservation_response_data.rb +3 -3
- 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/insights_summary_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/invoice_request_body.rb +1 -1
- data/lib/schematic/types/invoice_response_data.rb +1 -1
- data/lib/schematic/types/line_kind.rb +13 -0
- data/lib/schematic/types/manage_plan_preview_response_response_data.rb +2 -0
- data/lib/schematic/types/manage_plan_request.rb +3 -1
- data/lib/schematic/types/manage_plan_response_response_data.rb +4 -0
- data/lib/schematic/types/mrr_response_data.rb +1 -1
- data/lib/schematic/types/onboarding_milestone_view.rb +1 -1
- data/lib/schematic/types/ordered_plans_in_group.rb +2 -0
- data/lib/schematic/types/payment_gating.rb +12 -0
- data/lib/schematic/types/plan_billing_source.rb +1 -0
- data/lib/schematic/types/plan_change_action.rb +1 -0
- data/lib/schematic/types/plan_change_amendment_status.rb +15 -0
- data/lib/schematic/types/plan_change_response_data.rb +4 -0
- data/lib/schematic/types/plan_credit_grant_view.rb +1 -1
- data/lib/schematic/types/plan_credit_order.rb +11 -0
- data/lib/schematic/types/plan_credit_visibility.rb +11 -0
- data/lib/schematic/types/plan_currency_price_request_body.rb +1 -1
- data/lib/schematic/types/plan_currency_prices_response_data.rb +1 -1
- data/lib/schematic/types/plan_entitlement_response_data.rb +3 -1
- data/lib/schematic/types/plan_group_plan_entitlements_order.rb +2 -0
- data/lib/schematic/types/plan_version_billing_product_change_response_data.rb +11 -0
- data/lib/schematic/types/plan_version_credit_grant_change_response_data.rb +17 -0
- data/lib/schematic/types/plan_version_diff_change_type.rb +13 -0
- data/lib/schematic/types/plan_version_diff_price_cadence.rb +14 -0
- data/lib/schematic/types/plan_version_diff_response_data.rb +23 -0
- data/lib/schematic/types/plan_version_entitlement_change_response_data.rb +17 -0
- data/lib/schematic/types/plan_version_field_change_response_data.rb +13 -0
- data/lib/schematic/types/plan_version_price_change_response_data.rb +15 -0
- data/lib/schematic/types/plan_view_public_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 +3 -1
- data/lib/schematic/types/preview_subscription_change_response_data.rb +3 -1
- data/lib/schematic/types/preview_subscription_discount_response_data.rb +2 -2
- data/lib/schematic/types/preview_subscription_finance_response_data.rb +2 -2
- data/lib/schematic/types/publish_plan_version_request_body.rb +43 -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 +53 -0
- data/lib/schematic/types/rulesengine_company.rb +1 -1
- data/lib/schematic/types/rulesengine_condition.rb +3 -1
- data/lib/schematic/types/rulesengine_credit_postpaid_config.rb +1 -1
- data/lib/schematic/types/rulesengine_credit_spend_policy.rb +4 -2
- data/lib/schematic/types/rulesengine_feature_entitlement.rb +8 -6
- data/lib/schematic/types/scheduled_downgrade_response_data.rb +1 -1
- data/lib/schematic/types/subscription_change_action.rb +14 -0
- data/lib/schematic/types/top_feature_by_usage_response_data.rb +1 -1
- data/lib/schematic/types/upcoming_invoice_response_data.rb +1 -1
- data/lib/schematic/types/update_billing_plan_credit_grant_request_body.rb +1 -1
- data/lib/schematic/types/update_entitlement_req_common.rb +3 -1
- data/lib/schematic/types/upsert_billing_product_request_body.rb +1 -1
- data/lib/schematic/types/usage_based_entitlement_request_body.rb +1 -1
- data/lib/schematic/types/usage_based_entitlement_response_data.rb +1 -1
- data/lib/schematic/types/user_credit_usage_response_data.rb +2 -2
- data/lib/schematic/types/user_daily_credit_point_response_data.rb +1 -1
- data/lib/schematic/types/user_feature_usage_response_data.rb +1 -1
- data/lib/schematic/version.rb +1 -1
- data/lib/schematic/wasm/rulesengine.wasm +0 -0
- data/lib/schematic/webhooks/client.rb +88 -10
- data/lib/schematic.rb +80 -8
- data/reference.md +892 -113
- metadata +75 -3
- data/lib/schematic/plans/types/publish_plan_version_request_body.rb +0 -45
|
@@ -56,7 +56,15 @@ module Schematic
|
|
|
56
56
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::ListCouponsResponse.load(response.body))
|
|
57
57
|
else
|
|
58
58
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
59
|
-
|
|
59
|
+
error_types = {
|
|
60
|
+
400 => Schematic::Types::ApiError,
|
|
61
|
+
401 => Schematic::Types::ApiError,
|
|
62
|
+
403 => Schematic::Types::ApiError,
|
|
63
|
+
404 => Schematic::Types::ApiError,
|
|
64
|
+
500 => Schematic::Types::ApiError
|
|
65
|
+
}
|
|
66
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
67
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
60
68
|
end
|
|
61
69
|
end
|
|
62
70
|
|
|
@@ -100,7 +108,15 @@ module Schematic
|
|
|
100
108
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::UpsertBillingCouponResponse.load(response.body))
|
|
101
109
|
else
|
|
102
110
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
103
|
-
|
|
111
|
+
error_types = {
|
|
112
|
+
400 => Schematic::Types::ApiError,
|
|
113
|
+
401 => Schematic::Types::ApiError,
|
|
114
|
+
403 => Schematic::Types::ApiError,
|
|
115
|
+
404 => Schematic::Types::ApiError,
|
|
116
|
+
500 => Schematic::Types::ApiError
|
|
117
|
+
}
|
|
118
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
119
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
104
120
|
end
|
|
105
121
|
end
|
|
106
122
|
|
|
@@ -135,7 +151,15 @@ module Schematic
|
|
|
135
151
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::DeleteBillingCouponResponse.load(response.body))
|
|
136
152
|
else
|
|
137
153
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
138
|
-
|
|
154
|
+
error_types = {
|
|
155
|
+
400 => Schematic::Types::ApiError,
|
|
156
|
+
401 => Schematic::Types::ApiError,
|
|
157
|
+
403 => Schematic::Types::ApiError,
|
|
158
|
+
404 => Schematic::Types::ApiError,
|
|
159
|
+
500 => Schematic::Types::ApiError
|
|
160
|
+
}
|
|
161
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
162
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
139
163
|
end
|
|
140
164
|
end
|
|
141
165
|
|
|
@@ -170,7 +194,15 @@ module Schematic
|
|
|
170
194
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::DeleteBillingCustomerResponse.load(response.body))
|
|
171
195
|
else
|
|
172
196
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
173
|
-
|
|
197
|
+
error_types = {
|
|
198
|
+
400 => Schematic::Types::ApiError,
|
|
199
|
+
401 => Schematic::Types::ApiError,
|
|
200
|
+
403 => Schematic::Types::ApiError,
|
|
201
|
+
404 => Schematic::Types::ApiError,
|
|
202
|
+
500 => Schematic::Types::ApiError
|
|
203
|
+
}
|
|
204
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
205
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
174
206
|
end
|
|
175
207
|
end
|
|
176
208
|
|
|
@@ -212,7 +244,15 @@ module Schematic
|
|
|
212
244
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::UpsertBillingCustomerResponse.load(response.body))
|
|
213
245
|
else
|
|
214
246
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
215
|
-
|
|
247
|
+
error_types = {
|
|
248
|
+
400 => Schematic::Types::ApiError,
|
|
249
|
+
401 => Schematic::Types::ApiError,
|
|
250
|
+
403 => Schematic::Types::ApiError,
|
|
251
|
+
404 => Schematic::Types::ApiError,
|
|
252
|
+
500 => Schematic::Types::ApiError
|
|
253
|
+
}
|
|
254
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
255
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
216
256
|
end
|
|
217
257
|
end
|
|
218
258
|
|
|
@@ -268,7 +308,15 @@ module Schematic
|
|
|
268
308
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::ListCustomersWithSubscriptionsResponse.load(response.body))
|
|
269
309
|
else
|
|
270
310
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
271
|
-
|
|
311
|
+
error_types = {
|
|
312
|
+
400 => Schematic::Types::ApiError,
|
|
313
|
+
401 => Schematic::Types::ApiError,
|
|
314
|
+
403 => Schematic::Types::ApiError,
|
|
315
|
+
404 => Schematic::Types::ApiError,
|
|
316
|
+
500 => Schematic::Types::ApiError
|
|
317
|
+
}
|
|
318
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
319
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
272
320
|
end
|
|
273
321
|
end
|
|
274
322
|
|
|
@@ -324,7 +372,15 @@ module Schematic
|
|
|
324
372
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::CountCustomersResponse.load(response.body))
|
|
325
373
|
else
|
|
326
374
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
327
|
-
|
|
375
|
+
error_types = {
|
|
376
|
+
400 => Schematic::Types::ApiError,
|
|
377
|
+
401 => Schematic::Types::ApiError,
|
|
378
|
+
403 => Schematic::Types::ApiError,
|
|
379
|
+
404 => Schematic::Types::ApiError,
|
|
380
|
+
500 => Schematic::Types::ApiError
|
|
381
|
+
}
|
|
382
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
383
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
328
384
|
end
|
|
329
385
|
end
|
|
330
386
|
|
|
@@ -377,7 +433,15 @@ module Schematic
|
|
|
377
433
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::ListInvoicesResponse.load(response.body))
|
|
378
434
|
else
|
|
379
435
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
380
|
-
|
|
436
|
+
error_types = {
|
|
437
|
+
400 => Schematic::Types::ApiError,
|
|
438
|
+
401 => Schematic::Types::ApiError,
|
|
439
|
+
403 => Schematic::Types::ApiError,
|
|
440
|
+
404 => Schematic::Types::ApiError,
|
|
441
|
+
500 => Schematic::Types::ApiError
|
|
442
|
+
}
|
|
443
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
444
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
381
445
|
end
|
|
382
446
|
end
|
|
383
447
|
|
|
@@ -395,7 +459,7 @@ module Schematic
|
|
|
395
459
|
# amount_paid: 1000000,
|
|
396
460
|
# amount_remaining: 1000000,
|
|
397
461
|
# collection_method: "collection_method",
|
|
398
|
-
# currency: "
|
|
462
|
+
# currency: "aed",
|
|
399
463
|
# customer_external_id: "customer_external_id",
|
|
400
464
|
# subtotal: 1000000
|
|
401
465
|
# )
|
|
@@ -420,7 +484,15 @@ module Schematic
|
|
|
420
484
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::UpsertInvoiceResponse.load(response.body))
|
|
421
485
|
else
|
|
422
486
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
423
|
-
|
|
487
|
+
error_types = {
|
|
488
|
+
400 => Schematic::Types::ApiError,
|
|
489
|
+
401 => Schematic::Types::ApiError,
|
|
490
|
+
403 => Schematic::Types::ApiError,
|
|
491
|
+
404 => Schematic::Types::ApiError,
|
|
492
|
+
500 => Schematic::Types::ApiError
|
|
493
|
+
}
|
|
494
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
495
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
424
496
|
end
|
|
425
497
|
end
|
|
426
498
|
|
|
@@ -455,7 +527,15 @@ module Schematic
|
|
|
455
527
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::DeleteBillingInvoiceResponse.load(response.body))
|
|
456
528
|
else
|
|
457
529
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
458
|
-
|
|
530
|
+
error_types = {
|
|
531
|
+
400 => Schematic::Types::ApiError,
|
|
532
|
+
401 => Schematic::Types::ApiError,
|
|
533
|
+
403 => Schematic::Types::ApiError,
|
|
534
|
+
404 => Schematic::Types::ApiError,
|
|
535
|
+
500 => Schematic::Types::ApiError
|
|
536
|
+
}
|
|
537
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
538
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
459
539
|
end
|
|
460
540
|
end
|
|
461
541
|
|
|
@@ -502,7 +582,15 @@ module Schematic
|
|
|
502
582
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::ListMetersResponse.load(response.body))
|
|
503
583
|
else
|
|
504
584
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
505
|
-
|
|
585
|
+
error_types = {
|
|
586
|
+
400 => Schematic::Types::ApiError,
|
|
587
|
+
401 => Schematic::Types::ApiError,
|
|
588
|
+
403 => Schematic::Types::ApiError,
|
|
589
|
+
404 => Schematic::Types::ApiError,
|
|
590
|
+
500 => Schematic::Types::ApiError
|
|
591
|
+
}
|
|
592
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
593
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
506
594
|
end
|
|
507
595
|
end
|
|
508
596
|
|
|
@@ -542,7 +630,15 @@ module Schematic
|
|
|
542
630
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::UpsertBillingMeterResponse.load(response.body))
|
|
543
631
|
else
|
|
544
632
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
545
|
-
|
|
633
|
+
error_types = {
|
|
634
|
+
400 => Schematic::Types::ApiError,
|
|
635
|
+
401 => Schematic::Types::ApiError,
|
|
636
|
+
403 => Schematic::Types::ApiError,
|
|
637
|
+
404 => Schematic::Types::ApiError,
|
|
638
|
+
500 => Schematic::Types::ApiError
|
|
639
|
+
}
|
|
640
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
641
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
546
642
|
end
|
|
547
643
|
end
|
|
548
644
|
|
|
@@ -592,7 +688,15 @@ module Schematic
|
|
|
592
688
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::ListPaymentMethodsResponse.load(response.body))
|
|
593
689
|
else
|
|
594
690
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
595
|
-
|
|
691
|
+
error_types = {
|
|
692
|
+
400 => Schematic::Types::ApiError,
|
|
693
|
+
401 => Schematic::Types::ApiError,
|
|
694
|
+
403 => Schematic::Types::ApiError,
|
|
695
|
+
404 => Schematic::Types::ApiError,
|
|
696
|
+
500 => Schematic::Types::ApiError
|
|
697
|
+
}
|
|
698
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
699
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
596
700
|
end
|
|
597
701
|
end
|
|
598
702
|
|
|
@@ -631,7 +735,15 @@ module Schematic
|
|
|
631
735
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::UpsertPaymentMethodResponse.load(response.body))
|
|
632
736
|
else
|
|
633
737
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
634
|
-
|
|
738
|
+
error_types = {
|
|
739
|
+
400 => Schematic::Types::ApiError,
|
|
740
|
+
401 => Schematic::Types::ApiError,
|
|
741
|
+
403 => Schematic::Types::ApiError,
|
|
742
|
+
404 => Schematic::Types::ApiError,
|
|
743
|
+
500 => Schematic::Types::ApiError
|
|
744
|
+
}
|
|
745
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
746
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
635
747
|
end
|
|
636
748
|
end
|
|
637
749
|
|
|
@@ -666,7 +778,15 @@ module Schematic
|
|
|
666
778
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::DeletePaymentMethodByExternalIdResponse.load(response.body))
|
|
667
779
|
else
|
|
668
780
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
669
|
-
|
|
781
|
+
error_types = {
|
|
782
|
+
400 => Schematic::Types::ApiError,
|
|
783
|
+
401 => Schematic::Types::ApiError,
|
|
784
|
+
403 => Schematic::Types::ApiError,
|
|
785
|
+
404 => Schematic::Types::ApiError,
|
|
786
|
+
500 => Schematic::Types::ApiError
|
|
787
|
+
}
|
|
788
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
789
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
670
790
|
end
|
|
671
791
|
end
|
|
672
792
|
|
|
@@ -677,7 +797,7 @@ module Schematic
|
|
|
677
797
|
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
678
798
|
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
679
799
|
# @option request_options [Integer] :timeout_in_seconds
|
|
680
|
-
# @option params [
|
|
800
|
+
# @option params [Schematic::Types::Currency, nil] :currency
|
|
681
801
|
# @option params [Boolean, nil] :for_initial_plan
|
|
682
802
|
# @option params [Boolean, nil] :for_trial_expiry_plan
|
|
683
803
|
# @option params [String, nil] :ids
|
|
@@ -698,7 +818,7 @@ module Schematic
|
|
|
698
818
|
#
|
|
699
819
|
# @example
|
|
700
820
|
# client.billing.list_billing_prices(
|
|
701
|
-
# currency: "
|
|
821
|
+
# currency: "aed",
|
|
702
822
|
# for_initial_plan: true,
|
|
703
823
|
# for_trial_expiry_plan: true,
|
|
704
824
|
# ids: ["ids"],
|
|
@@ -758,7 +878,15 @@ module Schematic
|
|
|
758
878
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::ListBillingPricesResponse.load(response.body))
|
|
759
879
|
else
|
|
760
880
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
761
|
-
|
|
881
|
+
error_types = {
|
|
882
|
+
400 => Schematic::Types::ApiError,
|
|
883
|
+
401 => Schematic::Types::ApiError,
|
|
884
|
+
403 => Schematic::Types::ApiError,
|
|
885
|
+
404 => Schematic::Types::ApiError,
|
|
886
|
+
500 => Schematic::Types::ApiError
|
|
887
|
+
}
|
|
888
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
889
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
762
890
|
end
|
|
763
891
|
end
|
|
764
892
|
|
|
@@ -773,7 +901,7 @@ module Schematic
|
|
|
773
901
|
# @example
|
|
774
902
|
# client.billing.upsert_billing_price(
|
|
775
903
|
# billing_scheme: "per_unit",
|
|
776
|
-
# currency: "
|
|
904
|
+
# currency: "aed",
|
|
777
905
|
# external_account_id: "external_account_id",
|
|
778
906
|
# interval: "interval",
|
|
779
907
|
# is_active: true,
|
|
@@ -806,7 +934,15 @@ module Schematic
|
|
|
806
934
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::UpsertBillingPriceResponse.load(response.body))
|
|
807
935
|
else
|
|
808
936
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
809
|
-
|
|
937
|
+
error_types = {
|
|
938
|
+
400 => Schematic::Types::ApiError,
|
|
939
|
+
401 => Schematic::Types::ApiError,
|
|
940
|
+
403 => Schematic::Types::ApiError,
|
|
941
|
+
404 => Schematic::Types::ApiError,
|
|
942
|
+
500 => Schematic::Types::ApiError
|
|
943
|
+
}
|
|
944
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
945
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
810
946
|
end
|
|
811
947
|
end
|
|
812
948
|
|
|
@@ -841,7 +977,15 @@ module Schematic
|
|
|
841
977
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::DeleteBillingProductResponse.load(response.body))
|
|
842
978
|
else
|
|
843
979
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
844
|
-
|
|
980
|
+
error_types = {
|
|
981
|
+
400 => Schematic::Types::ApiError,
|
|
982
|
+
401 => Schematic::Types::ApiError,
|
|
983
|
+
403 => Schematic::Types::ApiError,
|
|
984
|
+
404 => Schematic::Types::ApiError,
|
|
985
|
+
500 => Schematic::Types::ApiError
|
|
986
|
+
}
|
|
987
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
988
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
845
989
|
end
|
|
846
990
|
end
|
|
847
991
|
|
|
@@ -852,7 +996,7 @@ module Schematic
|
|
|
852
996
|
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
853
997
|
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
854
998
|
# @option request_options [Integer] :timeout_in_seconds
|
|
855
|
-
# @option params [
|
|
999
|
+
# @option params [Schematic::Types::Currency, nil] :currency
|
|
856
1000
|
# @option params [Boolean, nil] :for_initial_plan
|
|
857
1001
|
# @option params [Boolean, nil] :for_trial_expiry_plan
|
|
858
1002
|
# @option params [String, nil] :ids
|
|
@@ -873,7 +1017,7 @@ module Schematic
|
|
|
873
1017
|
#
|
|
874
1018
|
# @example
|
|
875
1019
|
# client.billing.list_billing_product_prices(
|
|
876
|
-
# currency: "
|
|
1020
|
+
# currency: "aed",
|
|
877
1021
|
# for_initial_plan: true,
|
|
878
1022
|
# for_trial_expiry_plan: true,
|
|
879
1023
|
# ids: ["ids"],
|
|
@@ -933,7 +1077,15 @@ module Schematic
|
|
|
933
1077
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::ListBillingProductPricesResponse.load(response.body))
|
|
934
1078
|
else
|
|
935
1079
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
936
|
-
|
|
1080
|
+
error_types = {
|
|
1081
|
+
400 => Schematic::Types::ApiError,
|
|
1082
|
+
401 => Schematic::Types::ApiError,
|
|
1083
|
+
403 => Schematic::Types::ApiError,
|
|
1084
|
+
404 => Schematic::Types::ApiError,
|
|
1085
|
+
500 => Schematic::Types::ApiError
|
|
1086
|
+
}
|
|
1087
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1088
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
937
1089
|
end
|
|
938
1090
|
end
|
|
939
1091
|
|
|
@@ -968,7 +1120,15 @@ module Schematic
|
|
|
968
1120
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::DeleteProductPriceResponse.load(response.body))
|
|
969
1121
|
else
|
|
970
1122
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
971
|
-
|
|
1123
|
+
error_types = {
|
|
1124
|
+
400 => Schematic::Types::ApiError,
|
|
1125
|
+
401 => Schematic::Types::ApiError,
|
|
1126
|
+
403 => Schematic::Types::ApiError,
|
|
1127
|
+
404 => Schematic::Types::ApiError,
|
|
1128
|
+
500 => Schematic::Types::ApiError
|
|
1129
|
+
}
|
|
1130
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1131
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
972
1132
|
end
|
|
973
1133
|
end
|
|
974
1134
|
|
|
@@ -1006,7 +1166,15 @@ module Schematic
|
|
|
1006
1166
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::UpsertBillingProductResponse.load(response.body))
|
|
1007
1167
|
else
|
|
1008
1168
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1009
|
-
|
|
1169
|
+
error_types = {
|
|
1170
|
+
400 => Schematic::Types::ApiError,
|
|
1171
|
+
401 => Schematic::Types::ApiError,
|
|
1172
|
+
403 => Schematic::Types::ApiError,
|
|
1173
|
+
404 => Schematic::Types::ApiError,
|
|
1174
|
+
500 => Schematic::Types::ApiError
|
|
1175
|
+
}
|
|
1176
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1177
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1010
1178
|
end
|
|
1011
1179
|
end
|
|
1012
1180
|
|
|
@@ -1083,7 +1251,15 @@ module Schematic
|
|
|
1083
1251
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::ListBillingProductsResponse.load(response.body))
|
|
1084
1252
|
else
|
|
1085
1253
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1086
|
-
|
|
1254
|
+
error_types = {
|
|
1255
|
+
400 => Schematic::Types::ApiError,
|
|
1256
|
+
401 => Schematic::Types::ApiError,
|
|
1257
|
+
403 => Schematic::Types::ApiError,
|
|
1258
|
+
404 => Schematic::Types::ApiError,
|
|
1259
|
+
500 => Schematic::Types::ApiError
|
|
1260
|
+
}
|
|
1261
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1262
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1087
1263
|
end
|
|
1088
1264
|
end
|
|
1089
1265
|
|
|
@@ -1160,7 +1336,15 @@ module Schematic
|
|
|
1160
1336
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::CountBillingProductsResponse.load(response.body))
|
|
1161
1337
|
else
|
|
1162
1338
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1163
|
-
|
|
1339
|
+
error_types = {
|
|
1340
|
+
400 => Schematic::Types::ApiError,
|
|
1341
|
+
401 => Schematic::Types::ApiError,
|
|
1342
|
+
403 => Schematic::Types::ApiError,
|
|
1343
|
+
404 => Schematic::Types::ApiError,
|
|
1344
|
+
500 => Schematic::Types::ApiError
|
|
1345
|
+
}
|
|
1346
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1347
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1164
1348
|
end
|
|
1165
1349
|
end
|
|
1166
1350
|
|
|
@@ -1213,7 +1397,15 @@ module Schematic
|
|
|
1213
1397
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::ListCompanyBillingProfilesResponse.load(response.body))
|
|
1214
1398
|
else
|
|
1215
1399
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1216
|
-
|
|
1400
|
+
error_types = {
|
|
1401
|
+
400 => Schematic::Types::ApiError,
|
|
1402
|
+
401 => Schematic::Types::ApiError,
|
|
1403
|
+
403 => Schematic::Types::ApiError,
|
|
1404
|
+
404 => Schematic::Types::ApiError,
|
|
1405
|
+
500 => Schematic::Types::ApiError
|
|
1406
|
+
}
|
|
1407
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1408
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1217
1409
|
end
|
|
1218
1410
|
end
|
|
1219
1411
|
|
|
@@ -1256,7 +1448,98 @@ module Schematic
|
|
|
1256
1448
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::UpdateCompanyBillingProfileResponse.load(response.body))
|
|
1257
1449
|
else
|
|
1258
1450
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1259
|
-
|
|
1451
|
+
error_types = {
|
|
1452
|
+
400 => Schematic::Types::ApiError,
|
|
1453
|
+
401 => Schematic::Types::ApiError,
|
|
1454
|
+
403 => Schematic::Types::ApiError,
|
|
1455
|
+
404 => Schematic::Types::ApiError,
|
|
1456
|
+
500 => Schematic::Types::ApiError
|
|
1457
|
+
}
|
|
1458
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1459
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1460
|
+
end
|
|
1461
|
+
end
|
|
1462
|
+
|
|
1463
|
+
# @param request_options [Hash]
|
|
1464
|
+
# @param _params [Hash]
|
|
1465
|
+
# @option request_options [String] :base_url
|
|
1466
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1467
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1468
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1469
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1470
|
+
#
|
|
1471
|
+
# @example
|
|
1472
|
+
# client.billing.get_billing_settings
|
|
1473
|
+
#
|
|
1474
|
+
# @return [Schematic::Billing::Types::GetBillingSettingsResponse]
|
|
1475
|
+
def get_billing_settings(request_options: {}, **_params)
|
|
1476
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1477
|
+
base_url: request_options[:base_url],
|
|
1478
|
+
method: "GET",
|
|
1479
|
+
path: "billing/settings",
|
|
1480
|
+
request_options: request_options
|
|
1481
|
+
)
|
|
1482
|
+
begin
|
|
1483
|
+
response = @client.send(request)
|
|
1484
|
+
rescue Net::HTTPRequestTimeout
|
|
1485
|
+
raise Schematic::Errors::TimeoutError
|
|
1486
|
+
end
|
|
1487
|
+
code = response.code.to_i
|
|
1488
|
+
if code.between?(200, 299)
|
|
1489
|
+
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::GetBillingSettingsResponse.load(response.body))
|
|
1490
|
+
else
|
|
1491
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1492
|
+
error_types = {
|
|
1493
|
+
401 => Schematic::Types::ApiError,
|
|
1494
|
+
403 => Schematic::Types::ApiError,
|
|
1495
|
+
404 => Schematic::Types::ApiError,
|
|
1496
|
+
500 => Schematic::Types::ApiError
|
|
1497
|
+
}
|
|
1498
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1499
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1500
|
+
end
|
|
1501
|
+
end
|
|
1502
|
+
|
|
1503
|
+
# @param request_options [Hash]
|
|
1504
|
+
# @param params [Schematic::Billing::Types::UpdateBillingSettingsRequestBody]
|
|
1505
|
+
# @option request_options [String] :base_url
|
|
1506
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1507
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1508
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1509
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1510
|
+
#
|
|
1511
|
+
# @example
|
|
1512
|
+
# client.billing.update_billing_settings
|
|
1513
|
+
#
|
|
1514
|
+
# @return [Schematic::Billing::Types::UpdateBillingSettingsResponse]
|
|
1515
|
+
def update_billing_settings(request_options: {}, **params)
|
|
1516
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1517
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1518
|
+
base_url: request_options[:base_url],
|
|
1519
|
+
method: "POST",
|
|
1520
|
+
path: "billing/settings",
|
|
1521
|
+
body: Schematic::Billing::Types::UpdateBillingSettingsRequestBody.new(params).to_h,
|
|
1522
|
+
request_options: request_options
|
|
1523
|
+
)
|
|
1524
|
+
begin
|
|
1525
|
+
response = @client.send(request)
|
|
1526
|
+
rescue Net::HTTPRequestTimeout
|
|
1527
|
+
raise Schematic::Errors::TimeoutError
|
|
1528
|
+
end
|
|
1529
|
+
code = response.code.to_i
|
|
1530
|
+
if code.between?(200, 299)
|
|
1531
|
+
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::UpdateBillingSettingsResponse.load(response.body))
|
|
1532
|
+
else
|
|
1533
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1534
|
+
error_types = {
|
|
1535
|
+
400 => Schematic::Types::ApiError,
|
|
1536
|
+
401 => Schematic::Types::ApiError,
|
|
1537
|
+
403 => Schematic::Types::ApiError,
|
|
1538
|
+
404 => Schematic::Types::ApiError,
|
|
1539
|
+
500 => Schematic::Types::ApiError
|
|
1540
|
+
}
|
|
1541
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1542
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1260
1543
|
end
|
|
1261
1544
|
end
|
|
1262
1545
|
|
|
@@ -1271,7 +1554,7 @@ module Schematic
|
|
|
1271
1554
|
# @example
|
|
1272
1555
|
# client.billing.upsert_billing_subscription(
|
|
1273
1556
|
# cancel_at_period_end: true,
|
|
1274
|
-
# currency: "
|
|
1557
|
+
# currency: "aed",
|
|
1275
1558
|
# customer_external_id: "customer_external_id",
|
|
1276
1559
|
# discounts: [{
|
|
1277
1560
|
# coupon_external_id: "coupon_external_id",
|
|
@@ -1281,7 +1564,7 @@ module Schematic
|
|
|
1281
1564
|
# }],
|
|
1282
1565
|
# expired_at: "2024-01-15T09:30:00Z",
|
|
1283
1566
|
# product_external_ids: [{
|
|
1284
|
-
# currency: "
|
|
1567
|
+
# currency: "aed",
|
|
1285
1568
|
# interval: "interval",
|
|
1286
1569
|
# price: 1000000,
|
|
1287
1570
|
# price_external_id: "price_external_id",
|
|
@@ -1313,7 +1596,438 @@ module Schematic
|
|
|
1313
1596
|
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::UpsertBillingSubscriptionResponse.load(response.body))
|
|
1314
1597
|
else
|
|
1315
1598
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1316
|
-
|
|
1599
|
+
error_types = {
|
|
1600
|
+
400 => Schematic::Types::ApiError,
|
|
1601
|
+
401 => Schematic::Types::ApiError,
|
|
1602
|
+
403 => Schematic::Types::ApiError,
|
|
1603
|
+
404 => Schematic::Types::ApiError,
|
|
1604
|
+
500 => Schematic::Types::ApiError
|
|
1605
|
+
}
|
|
1606
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1607
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1608
|
+
end
|
|
1609
|
+
end
|
|
1610
|
+
|
|
1611
|
+
# @param request_options [Hash]
|
|
1612
|
+
# @param params [Hash]
|
|
1613
|
+
# @option request_options [String] :base_url
|
|
1614
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1615
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1616
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1617
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1618
|
+
# @option params [String] :company_id
|
|
1619
|
+
#
|
|
1620
|
+
# @example
|
|
1621
|
+
# client.billing.get_company_native_subscription(company_id: "company_id")
|
|
1622
|
+
#
|
|
1623
|
+
# @return [Schematic::Billing::Types::GetCompanyNativeSubscriptionResponse]
|
|
1624
|
+
def get_company_native_subscription(request_options: {}, **params)
|
|
1625
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1626
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1627
|
+
base_url: request_options[:base_url],
|
|
1628
|
+
method: "GET",
|
|
1629
|
+
path: "companies/#{URI.encode_uri_component(params[:company_id].to_s)}/native-subscription",
|
|
1630
|
+
request_options: request_options
|
|
1631
|
+
)
|
|
1632
|
+
begin
|
|
1633
|
+
response = @client.send(request)
|
|
1634
|
+
rescue Net::HTTPRequestTimeout
|
|
1635
|
+
raise Schematic::Errors::TimeoutError
|
|
1636
|
+
end
|
|
1637
|
+
code = response.code.to_i
|
|
1638
|
+
if code.between?(200, 299)
|
|
1639
|
+
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::GetCompanyNativeSubscriptionResponse.load(response.body))
|
|
1640
|
+
else
|
|
1641
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1642
|
+
error_types = {
|
|
1643
|
+
401 => Schematic::Types::ApiError,
|
|
1644
|
+
403 => Schematic::Types::ApiError,
|
|
1645
|
+
404 => Schematic::Types::ApiError,
|
|
1646
|
+
500 => Schematic::Types::ApiError
|
|
1647
|
+
}
|
|
1648
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1649
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1650
|
+
end
|
|
1651
|
+
end
|
|
1652
|
+
|
|
1653
|
+
# @param request_options [Hash]
|
|
1654
|
+
# @param params [Hash]
|
|
1655
|
+
# @option request_options [String] :base_url
|
|
1656
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1657
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1658
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1659
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1660
|
+
# @option params [String, nil] :company_id
|
|
1661
|
+
# @option params [String, nil] :contract_id
|
|
1662
|
+
# @option params [Schematic::Types::InvoiceDocumentState, nil] :document_state
|
|
1663
|
+
# @option params [Integer, nil] :limit
|
|
1664
|
+
# @option params [Integer, nil] :offset
|
|
1665
|
+
#
|
|
1666
|
+
# @example
|
|
1667
|
+
# client.billing.list_native_invoices(
|
|
1668
|
+
# company_id: "company_id",
|
|
1669
|
+
# contract_id: "contract_id",
|
|
1670
|
+
# document_state: "credited",
|
|
1671
|
+
# limit: 1000000,
|
|
1672
|
+
# offset: 1000000
|
|
1673
|
+
# )
|
|
1674
|
+
#
|
|
1675
|
+
# @return [Schematic::Billing::Types::ListNativeInvoicesResponse]
|
|
1676
|
+
def list_native_invoices(request_options: {}, **params)
|
|
1677
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1678
|
+
query_params = {}
|
|
1679
|
+
query_params["company_id"] = params[:company_id] if params.key?(:company_id)
|
|
1680
|
+
query_params["contract_id"] = params[:contract_id] if params.key?(:contract_id)
|
|
1681
|
+
query_params["document_state"] = params[:document_state] if params.key?(:document_state)
|
|
1682
|
+
query_params["limit"] = params[:limit] if params.key?(:limit)
|
|
1683
|
+
query_params["offset"] = params[:offset] if params.key?(:offset)
|
|
1684
|
+
|
|
1685
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1686
|
+
base_url: request_options[:base_url],
|
|
1687
|
+
method: "GET",
|
|
1688
|
+
path: "invoices",
|
|
1689
|
+
query: query_params,
|
|
1690
|
+
request_options: request_options
|
|
1691
|
+
)
|
|
1692
|
+
begin
|
|
1693
|
+
response = @client.send(request)
|
|
1694
|
+
rescue Net::HTTPRequestTimeout
|
|
1695
|
+
raise Schematic::Errors::TimeoutError
|
|
1696
|
+
end
|
|
1697
|
+
code = response.code.to_i
|
|
1698
|
+
if code.between?(200, 299)
|
|
1699
|
+
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::ListNativeInvoicesResponse.load(response.body))
|
|
1700
|
+
else
|
|
1701
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1702
|
+
error_types = {
|
|
1703
|
+
400 => Schematic::Types::ApiError,
|
|
1704
|
+
401 => Schematic::Types::ApiError,
|
|
1705
|
+
403 => Schematic::Types::ApiError,
|
|
1706
|
+
404 => Schematic::Types::ApiError,
|
|
1707
|
+
500 => Schematic::Types::ApiError
|
|
1708
|
+
}
|
|
1709
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1710
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1711
|
+
end
|
|
1712
|
+
end
|
|
1713
|
+
|
|
1714
|
+
# @param request_options [Hash]
|
|
1715
|
+
# @param params [Hash]
|
|
1716
|
+
# @option request_options [String] :base_url
|
|
1717
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1718
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1719
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1720
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1721
|
+
# @option params [String] :invoice_id
|
|
1722
|
+
#
|
|
1723
|
+
# @example
|
|
1724
|
+
# client.billing.get_native_invoice(invoice_id: "invoice_id")
|
|
1725
|
+
#
|
|
1726
|
+
# @return [Schematic::Billing::Types::GetNativeInvoiceResponse]
|
|
1727
|
+
def get_native_invoice(request_options: {}, **params)
|
|
1728
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1729
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1730
|
+
base_url: request_options[:base_url],
|
|
1731
|
+
method: "GET",
|
|
1732
|
+
path: "invoices/#{URI.encode_uri_component(params[:invoice_id].to_s)}",
|
|
1733
|
+
request_options: request_options
|
|
1734
|
+
)
|
|
1735
|
+
begin
|
|
1736
|
+
response = @client.send(request)
|
|
1737
|
+
rescue Net::HTTPRequestTimeout
|
|
1738
|
+
raise Schematic::Errors::TimeoutError
|
|
1739
|
+
end
|
|
1740
|
+
code = response.code.to_i
|
|
1741
|
+
if code.between?(200, 299)
|
|
1742
|
+
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::GetNativeInvoiceResponse.load(response.body))
|
|
1743
|
+
else
|
|
1744
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1745
|
+
error_types = {
|
|
1746
|
+
401 => Schematic::Types::ApiError,
|
|
1747
|
+
403 => Schematic::Types::ApiError,
|
|
1748
|
+
404 => Schematic::Types::ApiError,
|
|
1749
|
+
500 => Schematic::Types::ApiError
|
|
1750
|
+
}
|
|
1751
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1752
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1753
|
+
end
|
|
1754
|
+
end
|
|
1755
|
+
|
|
1756
|
+
# @param request_options [Hash]
|
|
1757
|
+
# @param params [Hash]
|
|
1758
|
+
# @option request_options [String] :base_url
|
|
1759
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1760
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1761
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1762
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1763
|
+
# @option params [String] :invoice_id
|
|
1764
|
+
#
|
|
1765
|
+
# @example
|
|
1766
|
+
# client.billing.export_native_invoice(invoice_id: "invoice_id")
|
|
1767
|
+
#
|
|
1768
|
+
# @return [String]
|
|
1769
|
+
def export_native_invoice(request_options: {}, **params)
|
|
1770
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1771
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1772
|
+
base_url: request_options[:base_url],
|
|
1773
|
+
method: "GET",
|
|
1774
|
+
path: "invoices/#{URI.encode_uri_component(params[:invoice_id].to_s)}/export",
|
|
1775
|
+
request_options: request_options
|
|
1776
|
+
)
|
|
1777
|
+
begin
|
|
1778
|
+
response = @client.send(request)
|
|
1779
|
+
rescue Net::HTTPRequestTimeout
|
|
1780
|
+
raise Schematic::Errors::TimeoutError
|
|
1781
|
+
end
|
|
1782
|
+
code = response.code.to_i
|
|
1783
|
+
return response.body if code.between?(200, 299)
|
|
1784
|
+
|
|
1785
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1786
|
+
error_types = {
|
|
1787
|
+
401 => Schematic::Types::ApiError,
|
|
1788
|
+
403 => Schematic::Types::ApiError,
|
|
1789
|
+
404 => Schematic::Types::ApiError,
|
|
1790
|
+
500 => Schematic::Types::ApiError
|
|
1791
|
+
}
|
|
1792
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1793
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1794
|
+
end
|
|
1795
|
+
|
|
1796
|
+
# @param request_options [Hash]
|
|
1797
|
+
# @param params [Hash]
|
|
1798
|
+
# @option request_options [String] :base_url
|
|
1799
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1800
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1801
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1802
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1803
|
+
# @option params [String] :invoice_id
|
|
1804
|
+
#
|
|
1805
|
+
# @example
|
|
1806
|
+
# client.billing.finalize_native_invoice(invoice_id: "invoice_id")
|
|
1807
|
+
#
|
|
1808
|
+
# @return [Schematic::Billing::Types::FinalizeNativeInvoiceResponse]
|
|
1809
|
+
def finalize_native_invoice(request_options: {}, **params)
|
|
1810
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1811
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1812
|
+
base_url: request_options[:base_url],
|
|
1813
|
+
method: "POST",
|
|
1814
|
+
path: "invoices/#{URI.encode_uri_component(params[:invoice_id].to_s)}/finalize",
|
|
1815
|
+
request_options: request_options
|
|
1816
|
+
)
|
|
1817
|
+
begin
|
|
1818
|
+
response = @client.send(request)
|
|
1819
|
+
rescue Net::HTTPRequestTimeout
|
|
1820
|
+
raise Schematic::Errors::TimeoutError
|
|
1821
|
+
end
|
|
1822
|
+
code = response.code.to_i
|
|
1823
|
+
if code.between?(200, 299)
|
|
1824
|
+
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::FinalizeNativeInvoiceResponse.load(response.body))
|
|
1825
|
+
else
|
|
1826
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1827
|
+
error_types = {
|
|
1828
|
+
400 => Schematic::Types::ApiError,
|
|
1829
|
+
401 => Schematic::Types::ApiError,
|
|
1830
|
+
403 => Schematic::Types::ApiError,
|
|
1831
|
+
404 => Schematic::Types::ApiError,
|
|
1832
|
+
500 => Schematic::Types::ApiError
|
|
1833
|
+
}
|
|
1834
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1835
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1836
|
+
end
|
|
1837
|
+
end
|
|
1838
|
+
|
|
1839
|
+
# @param request_options [Hash]
|
|
1840
|
+
# @param params [Schematic::Billing::Types::MarkInvoicePaidRequestBody]
|
|
1841
|
+
# @option request_options [String] :base_url
|
|
1842
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1843
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1844
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1845
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1846
|
+
# @option params [String] :invoice_id
|
|
1847
|
+
#
|
|
1848
|
+
# @example
|
|
1849
|
+
# client.billing.mark_native_invoice_paid(
|
|
1850
|
+
# invoice_id: "invoice_id",
|
|
1851
|
+
# idempotency_key: "idempotency_key"
|
|
1852
|
+
# )
|
|
1853
|
+
#
|
|
1854
|
+
# @return [Schematic::Billing::Types::MarkNativeInvoicePaidResponse]
|
|
1855
|
+
def mark_native_invoice_paid(request_options: {}, **params)
|
|
1856
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1857
|
+
request_data = Schematic::Billing::Types::MarkInvoicePaidRequestBody.new(params).to_h
|
|
1858
|
+
non_body_param_names = %w[invoice_id]
|
|
1859
|
+
body = request_data.except(*non_body_param_names)
|
|
1860
|
+
|
|
1861
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1862
|
+
base_url: request_options[:base_url],
|
|
1863
|
+
method: "POST",
|
|
1864
|
+
path: "invoices/#{URI.encode_uri_component(params[:invoice_id].to_s)}/mark-paid",
|
|
1865
|
+
body: body,
|
|
1866
|
+
request_options: request_options
|
|
1867
|
+
)
|
|
1868
|
+
begin
|
|
1869
|
+
response = @client.send(request)
|
|
1870
|
+
rescue Net::HTTPRequestTimeout
|
|
1871
|
+
raise Schematic::Errors::TimeoutError
|
|
1872
|
+
end
|
|
1873
|
+
code = response.code.to_i
|
|
1874
|
+
if code.between?(200, 299)
|
|
1875
|
+
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::MarkNativeInvoicePaidResponse.load(response.body))
|
|
1876
|
+
else
|
|
1877
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1878
|
+
error_types = {
|
|
1879
|
+
400 => Schematic::Types::ApiError,
|
|
1880
|
+
401 => Schematic::Types::ApiError,
|
|
1881
|
+
403 => Schematic::Types::ApiError,
|
|
1882
|
+
404 => Schematic::Types::ApiError,
|
|
1883
|
+
500 => Schematic::Types::ApiError
|
|
1884
|
+
}
|
|
1885
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1886
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1887
|
+
end
|
|
1888
|
+
end
|
|
1889
|
+
|
|
1890
|
+
# @param request_options [Hash]
|
|
1891
|
+
# @param params [Hash]
|
|
1892
|
+
# @option request_options [String] :base_url
|
|
1893
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1894
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1895
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1896
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1897
|
+
# @option params [String] :invoice_id
|
|
1898
|
+
#
|
|
1899
|
+
# @example
|
|
1900
|
+
# client.billing.download_native_invoice_pdf(invoice_id: "invoice_id")
|
|
1901
|
+
#
|
|
1902
|
+
# @return [String]
|
|
1903
|
+
def download_native_invoice_pdf(request_options: {}, **params)
|
|
1904
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1905
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1906
|
+
base_url: request_options[:base_url],
|
|
1907
|
+
method: "GET",
|
|
1908
|
+
path: "invoices/#{URI.encode_uri_component(params[:invoice_id].to_s)}/pdf",
|
|
1909
|
+
request_options: request_options
|
|
1910
|
+
)
|
|
1911
|
+
begin
|
|
1912
|
+
response = @client.send(request)
|
|
1913
|
+
rescue Net::HTTPRequestTimeout
|
|
1914
|
+
raise Schematic::Errors::TimeoutError
|
|
1915
|
+
end
|
|
1916
|
+
code = response.code.to_i
|
|
1917
|
+
return response.body if code.between?(200, 299)
|
|
1918
|
+
|
|
1919
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1920
|
+
error_types = {
|
|
1921
|
+
401 => Schematic::Types::ApiError,
|
|
1922
|
+
403 => Schematic::Types::ApiError,
|
|
1923
|
+
404 => Schematic::Types::ApiError,
|
|
1924
|
+
500 => Schematic::Types::ApiError
|
|
1925
|
+
}
|
|
1926
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1927
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1928
|
+
end
|
|
1929
|
+
|
|
1930
|
+
# @param request_options [Hash]
|
|
1931
|
+
# @param params [Hash]
|
|
1932
|
+
# @option request_options [String] :base_url
|
|
1933
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1934
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1935
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1936
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1937
|
+
# @option params [String] :invoice_id
|
|
1938
|
+
#
|
|
1939
|
+
# @example
|
|
1940
|
+
# client.billing.void_native_invoice(invoice_id: "invoice_id")
|
|
1941
|
+
#
|
|
1942
|
+
# @return [Schematic::Billing::Types::VoidNativeInvoiceResponse]
|
|
1943
|
+
def void_native_invoice(request_options: {}, **params)
|
|
1944
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1945
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
1946
|
+
base_url: request_options[:base_url],
|
|
1947
|
+
method: "POST",
|
|
1948
|
+
path: "invoices/#{URI.encode_uri_component(params[:invoice_id].to_s)}/void",
|
|
1949
|
+
request_options: request_options
|
|
1950
|
+
)
|
|
1951
|
+
begin
|
|
1952
|
+
response = @client.send(request)
|
|
1953
|
+
rescue Net::HTTPRequestTimeout
|
|
1954
|
+
raise Schematic::Errors::TimeoutError
|
|
1955
|
+
end
|
|
1956
|
+
code = response.code.to_i
|
|
1957
|
+
if code.between?(200, 299)
|
|
1958
|
+
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::VoidNativeInvoiceResponse.load(response.body))
|
|
1959
|
+
else
|
|
1960
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
1961
|
+
error_types = {
|
|
1962
|
+
400 => Schematic::Types::ApiError,
|
|
1963
|
+
401 => Schematic::Types::ApiError,
|
|
1964
|
+
403 => Schematic::Types::ApiError,
|
|
1965
|
+
404 => Schematic::Types::ApiError,
|
|
1966
|
+
500 => Schematic::Types::ApiError
|
|
1967
|
+
}
|
|
1968
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
1969
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1970
|
+
end
|
|
1971
|
+
end
|
|
1972
|
+
|
|
1973
|
+
# @param request_options [Hash]
|
|
1974
|
+
# @param params [Hash]
|
|
1975
|
+
# @option request_options [String] :base_url
|
|
1976
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
1977
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
1978
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
1979
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
1980
|
+
# @option params [String, nil] :company_id
|
|
1981
|
+
# @option params [String, nil] :contract_id
|
|
1982
|
+
# @option params [Schematic::Types::InvoiceDocumentState, nil] :document_state
|
|
1983
|
+
# @option params [Integer, nil] :limit
|
|
1984
|
+
# @option params [Integer, nil] :offset
|
|
1985
|
+
#
|
|
1986
|
+
# @example
|
|
1987
|
+
# client.billing.count_native_invoices(
|
|
1988
|
+
# company_id: "company_id",
|
|
1989
|
+
# contract_id: "contract_id",
|
|
1990
|
+
# document_state: "credited",
|
|
1991
|
+
# limit: 1000000,
|
|
1992
|
+
# offset: 1000000
|
|
1993
|
+
# )
|
|
1994
|
+
#
|
|
1995
|
+
# @return [Schematic::Billing::Types::CountNativeInvoicesResponse]
|
|
1996
|
+
def count_native_invoices(request_options: {}, **params)
|
|
1997
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
1998
|
+
query_params = {}
|
|
1999
|
+
query_params["company_id"] = params[:company_id] if params.key?(:company_id)
|
|
2000
|
+
query_params["contract_id"] = params[:contract_id] if params.key?(:contract_id)
|
|
2001
|
+
query_params["document_state"] = params[:document_state] if params.key?(:document_state)
|
|
2002
|
+
query_params["limit"] = params[:limit] if params.key?(:limit)
|
|
2003
|
+
query_params["offset"] = params[:offset] if params.key?(:offset)
|
|
2004
|
+
|
|
2005
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
2006
|
+
base_url: request_options[:base_url],
|
|
2007
|
+
method: "GET",
|
|
2008
|
+
path: "invoices/count",
|
|
2009
|
+
query: query_params,
|
|
2010
|
+
request_options: request_options
|
|
2011
|
+
)
|
|
2012
|
+
begin
|
|
2013
|
+
response = @client.send(request)
|
|
2014
|
+
rescue Net::HTTPRequestTimeout
|
|
2015
|
+
raise Schematic::Errors::TimeoutError
|
|
2016
|
+
end
|
|
2017
|
+
code = response.code.to_i
|
|
2018
|
+
if code.between?(200, 299)
|
|
2019
|
+
(response.body.to_s.empty? ? nil : Schematic::Billing::Types::CountNativeInvoicesResponse.load(response.body))
|
|
2020
|
+
else
|
|
2021
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
2022
|
+
error_types = {
|
|
2023
|
+
400 => Schematic::Types::ApiError,
|
|
2024
|
+
401 => Schematic::Types::ApiError,
|
|
2025
|
+
403 => Schematic::Types::ApiError,
|
|
2026
|
+
404 => Schematic::Types::ApiError,
|
|
2027
|
+
500 => Schematic::Types::ApiError
|
|
2028
|
+
}
|
|
2029
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
2030
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
1317
2031
|
end
|
|
1318
2032
|
end
|
|
1319
2033
|
end
|