schematichq 1.5.3 → 1.5.4
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 +7 -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 +325 -34
- 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/get_billing_settings_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/update_billing_settings_request_body.rb +11 -0
- data/lib/schematic/billing/types/update_billing_settings_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 -18
- 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 +7 -2
- data/lib/schematic/internal/iterators/cursor_page_iterator.rb +68 -14
- data/lib/schematic/internal/iterators/item_iterator.rb +61 -15
- data/lib/schematic/internal/iterators/offset_item_iterator.rb +7 -2
- data/lib/schematic/internal/iterators/offset_page_iterator.rb +57 -9
- 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 +7 -3
- 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 +213 -23
- 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/publish_plan_version_request_body.rb +2 -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/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_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_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/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/company_billing_entity_subscription_response_data.rb +1 -1
- data/lib/schematic/types/company_credit_balance.rb +3 -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_or_update_condition_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 +2 -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/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/insights_summary_response_data.rb +1 -1
- data/lib/schematic/types/invoice_request_body.rb +1 -1
- data/lib/schematic/types/invoice_response_data.rb +1 -1
- 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/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_request_body.rb +1 -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/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 +2 -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/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 +38 -3
- data/reference.md +340 -44
- metadata +37 -2
|
@@ -19,36 +19,74 @@ module Schematic
|
|
|
19
19
|
# The block should return a two-element array: [parsed_page, raw_http_response].
|
|
20
20
|
# @return [Schematic::Internal::OffsetPageIterator]
|
|
21
21
|
def initialize(initial_page:, item_field:, has_next_field:, step:, &block)
|
|
22
|
-
@
|
|
22
|
+
@initial_page = initial_page || (step ? 0 : 1)
|
|
23
23
|
@item_field = item_field
|
|
24
24
|
@has_next_field = has_next_field
|
|
25
25
|
@step = step
|
|
26
26
|
@get_next_page = block
|
|
27
|
+
@http_response = nil
|
|
28
|
+
@first_page_requested = false
|
|
29
|
+
@first_page = nil
|
|
30
|
+
rewind
|
|
31
|
+
end
|
|
27
32
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
# Sends the request for the first page now instead of on the first iteration, so an API error for that page
|
|
34
|
+
# is raised here. The page is kept, and every loop that starts from the first page reuses it instead of
|
|
35
|
+
# requesting it again (an empty first page ends those loops without a new request). Does nothing if the first
|
|
36
|
+
# page was already requested.
|
|
37
|
+
#
|
|
38
|
+
# @return [self]
|
|
39
|
+
def load_first_page
|
|
40
|
+
return self if @first_page_requested
|
|
32
41
|
|
|
33
|
-
@
|
|
42
|
+
@first_page = fetch_page(@initial_page)
|
|
43
|
+
rewind
|
|
44
|
+
self
|
|
34
45
|
end
|
|
35
46
|
|
|
36
|
-
#
|
|
47
|
+
# Uses the first page that `other` loaded with `load_first_page`, unless this iterator already sent a request.
|
|
37
48
|
#
|
|
38
|
-
# @param
|
|
49
|
+
# @param other [Schematic::Internal::OffsetPageIterator]
|
|
39
50
|
# @return [NilClass]
|
|
51
|
+
def reuse_first_page(other)
|
|
52
|
+
return if @first_page_requested || other.first_page.nil?
|
|
53
|
+
|
|
54
|
+
@first_page = other.first_page
|
|
55
|
+
rewind
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Iterates over each page returned by the API, starting again from the first page on every call.
|
|
59
|
+
#
|
|
60
|
+
# @param block [Proc] The block which each retrieved page is yielded to.
|
|
61
|
+
# @return [NilClass, Enumerator] An Enumerator when no block is given.
|
|
40
62
|
def each(&block)
|
|
63
|
+
return enum_for(:each) unless block_given?
|
|
64
|
+
|
|
65
|
+
rewind
|
|
41
66
|
while (page = next_page)
|
|
42
67
|
block.call(page)
|
|
43
68
|
end
|
|
44
69
|
end
|
|
45
70
|
|
|
71
|
+
# Resets page-by-page iteration (`next_page` / `next?`) to the first page.
|
|
72
|
+
#
|
|
73
|
+
# @return [NilClass]
|
|
74
|
+
def rewind
|
|
75
|
+
@page_number = @initial_page
|
|
76
|
+
# A cache of whether the API has another page, if it gives us that information...
|
|
77
|
+
@has_next_page = nil
|
|
78
|
+
# ...or the actual next page, preloaded, if it doesn't. A first page kept by `load_first_page` is reused.
|
|
79
|
+
@next_page = @first_page
|
|
80
|
+
nil
|
|
81
|
+
end
|
|
82
|
+
|
|
46
83
|
# Whether another page will be available from the API.
|
|
47
84
|
#
|
|
48
85
|
# @return [Boolean]
|
|
49
86
|
def next?
|
|
50
87
|
return @has_next_page unless @has_next_page.nil?
|
|
51
|
-
return true if @next_page
|
|
88
|
+
return true if @next_page && page_has_items?(@next_page)
|
|
89
|
+
return @has_next_page = false if @next_page
|
|
52
90
|
|
|
53
91
|
fetched_page = fetch_page(@page_number)
|
|
54
92
|
fetched_page_items = fetched_page&.send(@item_field)
|
|
@@ -86,10 +124,20 @@ module Schematic
|
|
|
86
124
|
this_page
|
|
87
125
|
end
|
|
88
126
|
|
|
127
|
+
protected
|
|
128
|
+
|
|
129
|
+
attr_reader :first_page
|
|
130
|
+
|
|
89
131
|
private
|
|
90
132
|
|
|
133
|
+
def page_has_items?(page)
|
|
134
|
+
items = page.send(@item_field)
|
|
135
|
+
!items.nil? && !items.empty?
|
|
136
|
+
end
|
|
137
|
+
|
|
91
138
|
def fetch_page(page_number)
|
|
92
139
|
result = @get_next_page.call(page_number)
|
|
140
|
+
@first_page_requested = true
|
|
93
141
|
if result.is_a?(Array)
|
|
94
142
|
fetched_page, raw_response = result
|
|
95
143
|
@http_response = raw_response
|
|
@@ -31,9 +31,18 @@ module Schematic
|
|
|
31
31
|
merge_additional_headers(sdk_headers, protected_keys:)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
# @return [String, nil] The encoded HTTP request body
|
|
34
|
+
# @return [String, nil] The encoded HTTP request body, including any additional_body_parameters
|
|
35
|
+
# from request_options.
|
|
35
36
|
def encode_body
|
|
36
|
-
|
|
37
|
+
body = request_body
|
|
38
|
+
body.nil? ? nil : ::JSON.generate(body)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
private
|
|
42
|
+
|
|
43
|
+
# @return [Object, nil] The request body merged with additional_body_parameters.
|
|
44
|
+
def request_body
|
|
45
|
+
merge_additional_body_parameters(@body)
|
|
37
46
|
end
|
|
38
47
|
end
|
|
39
48
|
end
|
|
@@ -108,6 +108,7 @@ module Schematic
|
|
|
108
108
|
method_name = :"#{name}="
|
|
109
109
|
|
|
110
110
|
define_method(method_name) do |val|
|
|
111
|
+
@explicit_fields[name] = true
|
|
111
112
|
@data[name] = val
|
|
112
113
|
end
|
|
113
114
|
end
|
|
@@ -137,6 +138,7 @@ module Schematic
|
|
|
137
138
|
# @return [self]
|
|
138
139
|
def initialize(values = {})
|
|
139
140
|
@data = {}
|
|
141
|
+
@explicit_fields = {}
|
|
140
142
|
|
|
141
143
|
values = Utils.symbolize_keys(values.dup)
|
|
142
144
|
|
|
@@ -145,6 +147,7 @@ module Schematic
|
|
|
145
147
|
[field.api_name.to_sym, field_name].uniq.each do |key|
|
|
146
148
|
next unless values.key?(key)
|
|
147
149
|
|
|
150
|
+
@explicit_fields[field_name] = true
|
|
148
151
|
candidate = values.delete(key)
|
|
149
152
|
value = candidate if value.nil?
|
|
150
153
|
end
|
|
@@ -173,14 +176,15 @@ module Schematic
|
|
|
173
176
|
# If there is a value present in the data, use that value
|
|
174
177
|
# If there is a `nil` value present in the data, and it is optional but NOT nullable, exclude key altogether
|
|
175
178
|
# If there is a `nil` value present in the data, and it is optional and nullable, use the nil value
|
|
179
|
+
# only when it was explicitly provided; an omitted optional field is excluded
|
|
176
180
|
|
|
177
181
|
value = @data[name]
|
|
178
182
|
|
|
179
|
-
next if value.nil? && field.optional && !field.nullable
|
|
183
|
+
next if value.nil? && field.optional && (!field.nullable || !@explicit_fields&.key?(name))
|
|
180
184
|
|
|
181
185
|
if value.is_a?(::Array)
|
|
182
|
-
value = value.map { |item| item.respond_to?(:to_h) ? item.to_h : item }
|
|
183
|
-
elsif value.respond_to?(:to_h)
|
|
186
|
+
value = value.map { |item| !item.nil? && item.respond_to?(:to_h) ? item.to_h : item }
|
|
187
|
+
elsif !value.nil? && value.respond_to?(:to_h)
|
|
184
188
|
value = value.to_h
|
|
185
189
|
end
|
|
186
190
|
|
|
@@ -60,11 +60,18 @@ module Schematic
|
|
|
60
60
|
case value
|
|
61
61
|
when Numeric, String, Time
|
|
62
62
|
return value.to_i
|
|
63
|
+
when Symbol
|
|
64
|
+
# JSON object keys are parsed as symbols, so numeric map keys arrive as e.g. :"1"
|
|
65
|
+
parsed = Integer(value.to_s, 10, exception: false)
|
|
66
|
+
return parsed unless parsed.nil?
|
|
63
67
|
end
|
|
64
68
|
in ->(t) { t <= Float }
|
|
65
69
|
case value
|
|
66
70
|
when Numeric, Time, String
|
|
67
71
|
return value.to_f
|
|
72
|
+
when Symbol
|
|
73
|
+
parsed = Float(value.to_s, exception: false)
|
|
74
|
+
return parsed unless parsed.nil?
|
|
68
75
|
end
|
|
69
76
|
in ->(t) { t <= Model }
|
|
70
77
|
case value
|
|
@@ -59,7 +59,15 @@ module Schematic
|
|
|
59
59
|
(response.body.to_s.empty? ? nil : Schematic::Licenses::Types::ListLicensesResponse.load(response.body))
|
|
60
60
|
else
|
|
61
61
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
62
|
-
|
|
62
|
+
error_types = {
|
|
63
|
+
400 => Schematic::Types::ApiError,
|
|
64
|
+
401 => Schematic::Types::ApiError,
|
|
65
|
+
403 => Schematic::Types::ApiError,
|
|
66
|
+
404 => Schematic::Types::ApiError,
|
|
67
|
+
500 => Schematic::Types::ApiError
|
|
68
|
+
}
|
|
69
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
70
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
63
71
|
end
|
|
64
72
|
end
|
|
65
73
|
|
|
@@ -94,7 +102,14 @@ module Schematic
|
|
|
94
102
|
(response.body.to_s.empty? ? nil : Schematic::Licenses::Types::GetSingleLicenseResponse.load(response.body))
|
|
95
103
|
else
|
|
96
104
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
97
|
-
|
|
105
|
+
error_types = {
|
|
106
|
+
401 => Schematic::Types::ApiError,
|
|
107
|
+
403 => Schematic::Types::ApiError,
|
|
108
|
+
404 => Schematic::Types::ApiError,
|
|
109
|
+
500 => Schematic::Types::ApiError
|
|
110
|
+
}
|
|
111
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
112
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
98
113
|
end
|
|
99
114
|
end
|
|
100
115
|
|
|
@@ -147,7 +162,15 @@ module Schematic
|
|
|
147
162
|
(response.body.to_s.empty? ? nil : Schematic::Licenses::Types::CountLicensesResponse.load(response.body))
|
|
148
163
|
else
|
|
149
164
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
150
|
-
|
|
165
|
+
error_types = {
|
|
166
|
+
400 => Schematic::Types::ApiError,
|
|
167
|
+
401 => Schematic::Types::ApiError,
|
|
168
|
+
403 => Schematic::Types::ApiError,
|
|
169
|
+
404 => Schematic::Types::ApiError,
|
|
170
|
+
500 => Schematic::Types::ApiError
|
|
171
|
+
}
|
|
172
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
173
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
151
174
|
end
|
|
152
175
|
end
|
|
153
176
|
end
|
|
@@ -53,7 +53,15 @@ module Schematic
|
|
|
53
53
|
(response.body.to_s.empty? ? nil : Schematic::Planbundle::Types::CreateCustomPlanBundleResponse.load(response.body))
|
|
54
54
|
else
|
|
55
55
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
56
|
-
|
|
56
|
+
error_types = {
|
|
57
|
+
400 => Schematic::Types::ApiError,
|
|
58
|
+
401 => Schematic::Types::ApiError,
|
|
59
|
+
403 => Schematic::Types::ApiError,
|
|
60
|
+
404 => Schematic::Types::ApiError,
|
|
61
|
+
500 => Schematic::Types::ApiError
|
|
62
|
+
}
|
|
63
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
64
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
57
65
|
end
|
|
58
66
|
end
|
|
59
67
|
|
|
@@ -96,7 +104,15 @@ module Schematic
|
|
|
96
104
|
(response.body.to_s.empty? ? nil : Schematic::Planbundle::Types::CreatePlanBundleResponse.load(response.body))
|
|
97
105
|
else
|
|
98
106
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
99
|
-
|
|
107
|
+
error_types = {
|
|
108
|
+
400 => Schematic::Types::ApiError,
|
|
109
|
+
401 => Schematic::Types::ApiError,
|
|
110
|
+
403 => Schematic::Types::ApiError,
|
|
111
|
+
404 => Schematic::Types::ApiError,
|
|
112
|
+
500 => Schematic::Types::ApiError
|
|
113
|
+
}
|
|
114
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
115
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
100
116
|
end
|
|
101
117
|
end
|
|
102
118
|
|
|
@@ -144,7 +160,15 @@ module Schematic
|
|
|
144
160
|
(response.body.to_s.empty? ? nil : Schematic::Planbundle::Types::UpdatePlanBundleResponse.load(response.body))
|
|
145
161
|
else
|
|
146
162
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
147
|
-
|
|
163
|
+
error_types = {
|
|
164
|
+
400 => Schematic::Types::ApiError,
|
|
165
|
+
401 => Schematic::Types::ApiError,
|
|
166
|
+
403 => Schematic::Types::ApiError,
|
|
167
|
+
404 => Schematic::Types::ApiError,
|
|
168
|
+
500 => Schematic::Types::ApiError
|
|
169
|
+
}
|
|
170
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
171
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
148
172
|
end
|
|
149
173
|
end
|
|
150
174
|
end
|
|
@@ -45,7 +45,14 @@ module Schematic
|
|
|
45
45
|
(response.body.to_s.empty? ? nil : Schematic::Plangroups::Types::GetPlanGroupResponse.load(response.body))
|
|
46
46
|
else
|
|
47
47
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
48
|
-
|
|
48
|
+
error_types = {
|
|
49
|
+
401 => Schematic::Types::ApiError,
|
|
50
|
+
403 => Schematic::Types::ApiError,
|
|
51
|
+
404 => Schematic::Types::ApiError,
|
|
52
|
+
500 => Schematic::Types::ApiError
|
|
53
|
+
}
|
|
54
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
55
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
49
56
|
end
|
|
50
57
|
end
|
|
51
58
|
|
|
@@ -108,7 +115,15 @@ module Schematic
|
|
|
108
115
|
(response.body.to_s.empty? ? nil : Schematic::Plangroups::Types::CreatePlanGroupResponse.load(response.body))
|
|
109
116
|
else
|
|
110
117
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
111
|
-
|
|
118
|
+
error_types = {
|
|
119
|
+
400 => Schematic::Types::ApiError,
|
|
120
|
+
401 => Schematic::Types::ApiError,
|
|
121
|
+
403 => Schematic::Types::ApiError,
|
|
122
|
+
404 => Schematic::Types::ApiError,
|
|
123
|
+
500 => Schematic::Types::ApiError
|
|
124
|
+
}
|
|
125
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
126
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
112
127
|
end
|
|
113
128
|
end
|
|
114
129
|
|
|
@@ -177,7 +192,15 @@ module Schematic
|
|
|
177
192
|
(response.body.to_s.empty? ? nil : Schematic::Plangroups::Types::UpdatePlanGroupResponse.load(response.body))
|
|
178
193
|
else
|
|
179
194
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
180
|
-
|
|
195
|
+
error_types = {
|
|
196
|
+
400 => Schematic::Types::ApiError,
|
|
197
|
+
401 => Schematic::Types::ApiError,
|
|
198
|
+
403 => Schematic::Types::ApiError,
|
|
199
|
+
404 => Schematic::Types::ApiError,
|
|
200
|
+
500 => Schematic::Types::ApiError
|
|
201
|
+
}
|
|
202
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
203
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
181
204
|
end
|
|
182
205
|
end
|
|
183
206
|
end
|
|
@@ -59,7 +59,15 @@ module Schematic
|
|
|
59
59
|
(response.body.to_s.empty? ? nil : Schematic::Planmigrations::Types::ListCompanyMigrationsResponse.load(response.body))
|
|
60
60
|
else
|
|
61
61
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
62
|
-
|
|
62
|
+
error_types = {
|
|
63
|
+
400 => Schematic::Types::ApiError,
|
|
64
|
+
401 => Schematic::Types::ApiError,
|
|
65
|
+
403 => Schematic::Types::ApiError,
|
|
66
|
+
404 => Schematic::Types::ApiError,
|
|
67
|
+
500 => Schematic::Types::ApiError
|
|
68
|
+
}
|
|
69
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
70
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
63
71
|
end
|
|
64
72
|
end
|
|
65
73
|
|
|
@@ -94,7 +102,15 @@ module Schematic
|
|
|
94
102
|
(response.body.to_s.empty? ? nil : Schematic::Planmigrations::Types::RetryCompanyMigrationResponse.load(response.body))
|
|
95
103
|
else
|
|
96
104
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
97
|
-
|
|
105
|
+
error_types = {
|
|
106
|
+
400 => Schematic::Types::ApiError,
|
|
107
|
+
401 => Schematic::Types::ApiError,
|
|
108
|
+
403 => Schematic::Types::ApiError,
|
|
109
|
+
404 => Schematic::Types::ApiError,
|
|
110
|
+
500 => Schematic::Types::ApiError
|
|
111
|
+
}
|
|
112
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
113
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
98
114
|
end
|
|
99
115
|
end
|
|
100
116
|
|
|
@@ -147,7 +163,15 @@ module Schematic
|
|
|
147
163
|
(response.body.to_s.empty? ? nil : Schematic::Planmigrations::Types::CountCompanyMigrationsResponse.load(response.body))
|
|
148
164
|
else
|
|
149
165
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
150
|
-
|
|
166
|
+
error_types = {
|
|
167
|
+
400 => Schematic::Types::ApiError,
|
|
168
|
+
401 => Schematic::Types::ApiError,
|
|
169
|
+
403 => Schematic::Types::ApiError,
|
|
170
|
+
404 => Schematic::Types::ApiError,
|
|
171
|
+
500 => Schematic::Types::ApiError
|
|
172
|
+
}
|
|
173
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
174
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
151
175
|
end
|
|
152
176
|
end
|
|
153
177
|
|
|
@@ -203,7 +227,15 @@ module Schematic
|
|
|
203
227
|
(response.body.to_s.empty? ? nil : Schematic::Planmigrations::Types::ListMigrationsResponse.load(response.body))
|
|
204
228
|
else
|
|
205
229
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
206
|
-
|
|
230
|
+
error_types = {
|
|
231
|
+
400 => Schematic::Types::ApiError,
|
|
232
|
+
401 => Schematic::Types::ApiError,
|
|
233
|
+
403 => Schematic::Types::ApiError,
|
|
234
|
+
404 => Schematic::Types::ApiError,
|
|
235
|
+
500 => Schematic::Types::ApiError
|
|
236
|
+
}
|
|
237
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
238
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
207
239
|
end
|
|
208
240
|
end
|
|
209
241
|
|
|
@@ -243,7 +275,15 @@ module Schematic
|
|
|
243
275
|
(response.body.to_s.empty? ? nil : Schematic::Planmigrations::Types::CreateMigrationResponse.load(response.body))
|
|
244
276
|
else
|
|
245
277
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
246
|
-
|
|
278
|
+
error_types = {
|
|
279
|
+
400 => Schematic::Types::ApiError,
|
|
280
|
+
401 => Schematic::Types::ApiError,
|
|
281
|
+
403 => Schematic::Types::ApiError,
|
|
282
|
+
404 => Schematic::Types::ApiError,
|
|
283
|
+
500 => Schematic::Types::ApiError
|
|
284
|
+
}
|
|
285
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
286
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
247
287
|
end
|
|
248
288
|
end
|
|
249
289
|
|
|
@@ -278,7 +318,14 @@ module Schematic
|
|
|
278
318
|
(response.body.to_s.empty? ? nil : Schematic::Planmigrations::Types::GetMigrationResponse.load(response.body))
|
|
279
319
|
else
|
|
280
320
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
281
|
-
|
|
321
|
+
error_types = {
|
|
322
|
+
401 => Schematic::Types::ApiError,
|
|
323
|
+
403 => Schematic::Types::ApiError,
|
|
324
|
+
404 => Schematic::Types::ApiError,
|
|
325
|
+
500 => Schematic::Types::ApiError
|
|
326
|
+
}
|
|
327
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
328
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
282
329
|
end
|
|
283
330
|
end
|
|
284
331
|
|
|
@@ -313,7 +360,15 @@ module Schematic
|
|
|
313
360
|
(response.body.to_s.empty? ? nil : Schematic::Planmigrations::Types::CancelMigrationResponse.load(response.body))
|
|
314
361
|
else
|
|
315
362
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
316
|
-
|
|
363
|
+
error_types = {
|
|
364
|
+
400 => Schematic::Types::ApiError,
|
|
365
|
+
401 => Schematic::Types::ApiError,
|
|
366
|
+
403 => Schematic::Types::ApiError,
|
|
367
|
+
404 => Schematic::Types::ApiError,
|
|
368
|
+
500 => Schematic::Types::ApiError
|
|
369
|
+
}
|
|
370
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
371
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
317
372
|
end
|
|
318
373
|
end
|
|
319
374
|
|
|
@@ -353,7 +408,15 @@ module Schematic
|
|
|
353
408
|
(response.body.to_s.empty? ? nil : Schematic::Planmigrations::Types::CompleteMigrationNowResponse.load(response.body))
|
|
354
409
|
else
|
|
355
410
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
356
|
-
|
|
411
|
+
error_types = {
|
|
412
|
+
400 => Schematic::Types::ApiError,
|
|
413
|
+
401 => Schematic::Types::ApiError,
|
|
414
|
+
403 => Schematic::Types::ApiError,
|
|
415
|
+
404 => Schematic::Types::ApiError,
|
|
416
|
+
500 => Schematic::Types::ApiError
|
|
417
|
+
}
|
|
418
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
419
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
357
420
|
end
|
|
358
421
|
end
|
|
359
422
|
|
|
@@ -396,7 +459,15 @@ module Schematic
|
|
|
396
459
|
(response.body.to_s.empty? ? nil : Schematic::Planmigrations::Types::RetryMigrationResponse.load(response.body))
|
|
397
460
|
else
|
|
398
461
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
399
|
-
|
|
462
|
+
error_types = {
|
|
463
|
+
400 => Schematic::Types::ApiError,
|
|
464
|
+
401 => Schematic::Types::ApiError,
|
|
465
|
+
403 => Schematic::Types::ApiError,
|
|
466
|
+
404 => Schematic::Types::ApiError,
|
|
467
|
+
500 => Schematic::Types::ApiError
|
|
468
|
+
}
|
|
469
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
470
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
400
471
|
end
|
|
401
472
|
end
|
|
402
473
|
|
|
@@ -452,7 +523,15 @@ module Schematic
|
|
|
452
523
|
(response.body.to_s.empty? ? nil : Schematic::Planmigrations::Types::CountMigrationsResponse.load(response.body))
|
|
453
524
|
else
|
|
454
525
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
455
|
-
|
|
526
|
+
error_types = {
|
|
527
|
+
400 => Schematic::Types::ApiError,
|
|
528
|
+
401 => Schematic::Types::ApiError,
|
|
529
|
+
403 => Schematic::Types::ApiError,
|
|
530
|
+
404 => Schematic::Types::ApiError,
|
|
531
|
+
500 => Schematic::Types::ApiError
|
|
532
|
+
}
|
|
533
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
534
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
456
535
|
end
|
|
457
536
|
end
|
|
458
537
|
|
|
@@ -491,7 +570,15 @@ module Schematic
|
|
|
491
570
|
(response.body.to_s.empty? ? nil : Schematic::Planmigrations::Types::PreviewMigrationResponse.load(response.body))
|
|
492
571
|
else
|
|
493
572
|
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
494
|
-
|
|
573
|
+
error_types = {
|
|
574
|
+
400 => Schematic::Types::ApiError,
|
|
575
|
+
401 => Schematic::Types::ApiError,
|
|
576
|
+
403 => Schematic::Types::ApiError,
|
|
577
|
+
404 => Schematic::Types::ApiError,
|
|
578
|
+
500 => Schematic::Types::ApiError
|
|
579
|
+
}
|
|
580
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
581
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
495
582
|
end
|
|
496
583
|
end
|
|
497
584
|
end
|