schematichq 1.5.5 → 1.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.fern/metadata.json +4 -4
- data/.fern/replay.lock +7 -1
- data/lib/schematic/accounts/client.rb +0 -271
- data/lib/schematic/billing/client.rb +40 -16
- data/lib/schematic/billing/types/{count_native_invoices_params.rb → count_billing_invoices_params.rb} +9 -1
- data/lib/schematic/billing/types/{count_native_invoices_request.rb → count_billing_invoices_request.rb} +9 -1
- data/lib/schematic/billing/types/{count_native_invoices_response.rb → count_billing_invoices_response.rb} +2 -2
- data/lib/schematic/billing/types/create_payment_method_request_body.rb +2 -0
- data/lib/schematic/billing/types/{get_native_invoice_response.rb → get_billing_invoice_response.rb} +1 -1
- data/lib/schematic/billing/types/{list_native_invoices_params.rb → list_billing_invoices_params.rb} +9 -1
- data/lib/schematic/billing/types/{list_native_invoices_request.rb → list_billing_invoices_request.rb} +9 -1
- data/lib/schematic/billing/types/{list_native_invoices_response.rb → list_billing_invoices_response.rb} +2 -2
- data/lib/schematic/billing/types/{mark_native_invoice_paid_response.rb → mark_billing_invoice_paid_response.rb} +1 -1
- data/lib/schematic/catalogs/client.rb +82 -0
- data/lib/schematic/{accounts/types/create_api_key_response.rb → catalogs/types/get_public_catalog_by_id_response.rb} +3 -3
- data/lib/schematic/{accounts/types/delete_api_key_response.rb → catalogs/types/get_public_catalog_response.rb} +3 -3
- data/lib/schematic/client.rb +195 -1
- data/lib/schematic/credits/client.rb +48 -0
- data/lib/schematic/credits/types/count_credit_event_ledger_params.rb +2 -0
- data/lib/schematic/credits/types/count_credit_event_ledger_request.rb +2 -0
- data/lib/schematic/{accounts/types/create_environment_response.rb → credits/types/get_credit_event_ledger_entry_response.rb} +3 -3
- data/lib/schematic/credits/types/list_credit_event_ledger_params.rb +2 -0
- data/lib/schematic/credits/types/list_credit_event_ledger_request.rb +2 -0
- data/lib/schematic/planbundle/types/create_custom_plan_bundle_request_body.rb +2 -0
- data/lib/schematic/planbundle/types/create_plan_bundle_request_body.rb +2 -0
- data/lib/schematic/planbundle/types/update_plan_bundle_request_body.rb +2 -0
- data/lib/schematic/plans/types/retry_custom_plan_billing_request_body.rb +2 -0
- data/lib/schematic/types/billing_invoice_address_response_data.rb +19 -0
- data/lib/schematic/types/billing_invoice_billing_details_response_data.rb +15 -0
- data/lib/schematic/types/billing_invoice_detail_response_data.rb +20 -4
- data/lib/schematic/types/billing_invoice_line_response_data.rb +5 -1
- data/lib/schematic/types/billing_invoice_response_data.rb +12 -4
- data/lib/schematic/types/billing_invoice_settlement_response_data.rb +1 -1
- data/lib/schematic/types/billing_invoice_tax_id_response_data.rb +11 -0
- data/lib/schematic/types/billing_invoice_terms_response_data.rb +2 -0
- data/lib/schematic/types/billing_plan_credit_grant_response_data.rb +2 -0
- data/lib/schematic/types/billing_plan_credit_grant_warning_tier_response_data.rb +13 -0
- data/lib/schematic/types/catalog_bundle_currency_price_response_data.rb +13 -0
- data/lib/schematic/types/catalog_capabilities_response_data.rb +11 -0
- data/lib/schematic/types/catalog_credit_bundle_response_data.rb +39 -0
- data/lib/schematic/types/catalog_credit_grant_response_data.rb +29 -0
- data/lib/schematic/types/catalog_currency_prices_response_data.rb +17 -0
- data/lib/schematic/types/catalog_custom_plan_cta_response_data.rb +13 -0
- data/lib/schematic/types/catalog_detail_response_data.rb +23 -0
- data/lib/schematic/types/catalog_entitlement_response_data.rb +61 -0
- data/lib/schematic/types/catalog_plan_entitlement_response_data.rb +63 -0
- data/lib/schematic/types/catalog_plan_response_data.rb +41 -0
- data/lib/schematic/types/catalog_price_response_data.rb +29 -0
- data/lib/schematic/types/catalog_price_tier_response_data.rb +17 -0
- data/lib/schematic/types/checkout_charge_timing.rb +13 -0
- data/lib/schematic/types/checkout_problem_code.rb +4 -0
- data/lib/schematic/types/create_billing_plan_credit_grant_request_body.rb +2 -0
- data/lib/schematic/types/credit_spend_window_unit.rb +2 -0
- data/lib/schematic/types/custom_plan_billing_response_data.rb +2 -0
- data/lib/schematic/types/entitlement_type.rb +1 -0
- data/lib/schematic/types/event_body.rb +3 -3
- data/lib/schematic/types/payment_method_billing_details_request_body.rb +13 -0
- data/lib/schematic/types/plan_credit_grant_warning_tier_request_body.rb +11 -0
- data/lib/schematic/types/plan_version_migration_preview_company_response_data.rb +2 -0
- data/lib/schematic/types/plan_version_migration_preview_note_response_data.rb +13 -0
- data/lib/schematic/types/plan_version_response_data.rb +2 -0
- data/lib/schematic/types/preview_subscription_finance_response_data.rb +6 -0
- data/lib/schematic/types/preview_subscription_proration_line_response_data.rb +21 -0
- data/lib/schematic/types/preview_subscription_proration_response_data.rb +21 -0
- data/lib/schematic/types/proration_line_kind.rb +12 -0
- data/lib/schematic/types/public_catalog_response_data.rb +29 -0
- data/lib/schematic/types/publish_plan_version_request_body.rb +2 -0
- data/lib/schematic/types/publish_preview_response_data.rb +2 -0
- data/lib/schematic/types/renewal_policy.rb +13 -0
- data/lib/schematic/types/update_billing_plan_credit_grant_request_body.rb +2 -0
- data/lib/schematic/types/webhook_request_type.rb +1 -0
- data/lib/schematic/version.rb +1 -1
- data/lib/schematic.rb +38 -22
- data/reference.md +434 -275
- metadata +38 -22
- data/lib/schematic/accounts/types/create_api_key_request_body.rb +0 -19
- data/lib/schematic/accounts/types/create_environment_request_body.rb +0 -13
- data/lib/schematic/accounts/types/delete_environment_response.rb +0 -13
- data/lib/schematic/accounts/types/update_api_key_request_body.rb +0 -17
- data/lib/schematic/accounts/types/update_api_key_response.rb +0 -13
- data/lib/schematic/accounts/types/update_environment_request_body.rb +0 -17
- data/lib/schematic/accounts/types/update_environment_response.rb +0 -13
- data/lib/schematic/types/api_key_create_response_data.rb +0 -33
- data/lib/schematic/types/environment_detail_response_data.rb +0 -21
|
@@ -639,6 +639,88 @@ module Schematic
|
|
|
639
639
|
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
640
640
|
raise error_class.new(response.body, code: code, body: error_body)
|
|
641
641
|
end
|
|
642
|
+
|
|
643
|
+
# @param request_options [Hash]
|
|
644
|
+
# @param _params [Hash]
|
|
645
|
+
# @option request_options [String] :base_url
|
|
646
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
647
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
648
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
649
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
650
|
+
#
|
|
651
|
+
# @example
|
|
652
|
+
# client.catalogs.get_public_catalog
|
|
653
|
+
#
|
|
654
|
+
# @return [Schematic::Catalogs::Types::GetPublicCatalogResponse]
|
|
655
|
+
def get_public_catalog(request_options: {}, **_params)
|
|
656
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
657
|
+
base_url: request_options[:base_url],
|
|
658
|
+
method: "GET",
|
|
659
|
+
path: "public/catalog",
|
|
660
|
+
request_options: request_options
|
|
661
|
+
)
|
|
662
|
+
begin
|
|
663
|
+
response = @client.send(request)
|
|
664
|
+
rescue Net::HTTPRequestTimeout
|
|
665
|
+
raise Schematic::Errors::TimeoutError
|
|
666
|
+
end
|
|
667
|
+
code = response.code.to_i
|
|
668
|
+
if code.between?(200, 299)
|
|
669
|
+
(response.body.to_s.empty? ? nil : Schematic::Catalogs::Types::GetPublicCatalogResponse.load(response.body))
|
|
670
|
+
else
|
|
671
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
672
|
+
error_types = {
|
|
673
|
+
401 => Schematic::Types::ApiError,
|
|
674
|
+
403 => Schematic::Types::ApiError,
|
|
675
|
+
404 => Schematic::Types::ApiError,
|
|
676
|
+
500 => Schematic::Types::ApiError
|
|
677
|
+
}
|
|
678
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
679
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
680
|
+
end
|
|
681
|
+
end
|
|
682
|
+
|
|
683
|
+
# @param request_options [Hash]
|
|
684
|
+
# @param params [Hash]
|
|
685
|
+
# @option request_options [String] :base_url
|
|
686
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
687
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
688
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
689
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
690
|
+
# @option params [String] :catalog_id
|
|
691
|
+
#
|
|
692
|
+
# @example
|
|
693
|
+
# client.catalogs.get_public_catalog_by_id(catalog_id: "catalog_id")
|
|
694
|
+
#
|
|
695
|
+
# @return [Schematic::Catalogs::Types::GetPublicCatalogByIdResponse]
|
|
696
|
+
def get_public_catalog_by_id(request_options: {}, **params)
|
|
697
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
698
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
699
|
+
base_url: request_options[:base_url],
|
|
700
|
+
method: "GET",
|
|
701
|
+
path: "public/catalogs/#{URI.encode_uri_component(params[:catalog_id].to_s)}",
|
|
702
|
+
request_options: request_options
|
|
703
|
+
)
|
|
704
|
+
begin
|
|
705
|
+
response = @client.send(request)
|
|
706
|
+
rescue Net::HTTPRequestTimeout
|
|
707
|
+
raise Schematic::Errors::TimeoutError
|
|
708
|
+
end
|
|
709
|
+
code = response.code.to_i
|
|
710
|
+
if code.between?(200, 299)
|
|
711
|
+
(response.body.to_s.empty? ? nil : Schematic::Catalogs::Types::GetPublicCatalogByIdResponse.load(response.body))
|
|
712
|
+
else
|
|
713
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
714
|
+
error_types = {
|
|
715
|
+
401 => Schematic::Types::ApiError,
|
|
716
|
+
403 => Schematic::Types::ApiError,
|
|
717
|
+
404 => Schematic::Types::ApiError,
|
|
718
|
+
500 => Schematic::Types::ApiError
|
|
719
|
+
}
|
|
720
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
721
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
722
|
+
end
|
|
723
|
+
end
|
|
642
724
|
end
|
|
643
725
|
end
|
|
644
726
|
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Schematic
|
|
4
|
-
module
|
|
4
|
+
module Catalogs
|
|
5
5
|
module Types
|
|
6
|
-
class
|
|
7
|
-
field :data, -> { Schematic::Types::
|
|
6
|
+
class GetPublicCatalogByIdResponse < Internal::Types::Model
|
|
7
|
+
field :data, -> { Schematic::Types::PublicCatalogResponseData }, optional: false, nullable: false
|
|
8
8
|
|
|
9
9
|
field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
|
|
10
10
|
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Schematic
|
|
4
|
-
module
|
|
4
|
+
module Catalogs
|
|
5
5
|
module Types
|
|
6
|
-
class
|
|
7
|
-
field :data, -> { Schematic::Types::
|
|
6
|
+
class GetPublicCatalogResponse < Internal::Types::Model
|
|
7
|
+
field :data, -> { Schematic::Types::PublicCatalogResponseData }, optional: false, nullable: false
|
|
8
8
|
|
|
9
9
|
field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
|
|
10
10
|
end
|
data/lib/schematic/client.rb
CHANGED
|
@@ -2,6 +2,200 @@
|
|
|
2
2
|
|
|
3
3
|
module Schematic
|
|
4
4
|
class Client
|
|
5
|
+
# @param request_options [Hash]
|
|
6
|
+
# @param _params [Hash]
|
|
7
|
+
# @option request_options [String] :base_url
|
|
8
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
9
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
10
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
11
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
12
|
+
#
|
|
13
|
+
# @example
|
|
14
|
+
# client.post_api_keys
|
|
15
|
+
#
|
|
16
|
+
# @return [untyped]
|
|
17
|
+
def post_api_keys(request_options: {}, **_params)
|
|
18
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
19
|
+
base_url: request_options[:base_url],
|
|
20
|
+
method: "POST",
|
|
21
|
+
path: "api-keys",
|
|
22
|
+
request_options: request_options
|
|
23
|
+
)
|
|
24
|
+
begin
|
|
25
|
+
response = @client.send(request)
|
|
26
|
+
rescue Net::HTTPRequestTimeout
|
|
27
|
+
raise Schematic::Errors::TimeoutError
|
|
28
|
+
end
|
|
29
|
+
code = response.code.to_i
|
|
30
|
+
return if code.between?(200, 299)
|
|
31
|
+
|
|
32
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
33
|
+
raise error_class.new(response.body, code: code)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# @param request_options [Hash]
|
|
37
|
+
# @param params [Hash]
|
|
38
|
+
# @option request_options [String] :base_url
|
|
39
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
40
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
41
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
42
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
43
|
+
# @option params [String] :api_key_id
|
|
44
|
+
#
|
|
45
|
+
# @example
|
|
46
|
+
# client.put_api_keys_api_key_id(api_key_id: "api_key_id")
|
|
47
|
+
#
|
|
48
|
+
# @return [untyped]
|
|
49
|
+
def put_api_keys_api_key_id(request_options: {}, **params)
|
|
50
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
51
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
52
|
+
base_url: request_options[:base_url],
|
|
53
|
+
method: "PUT",
|
|
54
|
+
path: "api-keys/#{URI.encode_uri_component(params[:api_key_id].to_s)}",
|
|
55
|
+
request_options: request_options
|
|
56
|
+
)
|
|
57
|
+
begin
|
|
58
|
+
response = @client.send(request)
|
|
59
|
+
rescue Net::HTTPRequestTimeout
|
|
60
|
+
raise Schematic::Errors::TimeoutError
|
|
61
|
+
end
|
|
62
|
+
code = response.code.to_i
|
|
63
|
+
return if code.between?(200, 299)
|
|
64
|
+
|
|
65
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
66
|
+
raise error_class.new(response.body, code: code)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# @param request_options [Hash]
|
|
70
|
+
# @param params [Hash]
|
|
71
|
+
# @option request_options [String] :base_url
|
|
72
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
73
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
74
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
75
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
76
|
+
# @option params [String] :api_key_id
|
|
77
|
+
#
|
|
78
|
+
# @example
|
|
79
|
+
# client.delete_api_keys_api_key_id(api_key_id: "api_key_id")
|
|
80
|
+
#
|
|
81
|
+
# @return [untyped]
|
|
82
|
+
def delete_api_keys_api_key_id(request_options: {}, **params)
|
|
83
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
84
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
85
|
+
base_url: request_options[:base_url],
|
|
86
|
+
method: "DELETE",
|
|
87
|
+
path: "api-keys/#{URI.encode_uri_component(params[:api_key_id].to_s)}",
|
|
88
|
+
request_options: request_options
|
|
89
|
+
)
|
|
90
|
+
begin
|
|
91
|
+
response = @client.send(request)
|
|
92
|
+
rescue Net::HTTPRequestTimeout
|
|
93
|
+
raise Schematic::Errors::TimeoutError
|
|
94
|
+
end
|
|
95
|
+
code = response.code.to_i
|
|
96
|
+
return if code.between?(200, 299)
|
|
97
|
+
|
|
98
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
99
|
+
raise error_class.new(response.body, code: code)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# @param request_options [Hash]
|
|
103
|
+
# @param _params [Hash]
|
|
104
|
+
# @option request_options [String] :base_url
|
|
105
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
106
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
107
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
108
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
109
|
+
#
|
|
110
|
+
# @example
|
|
111
|
+
# client.post_environments
|
|
112
|
+
#
|
|
113
|
+
# @return [untyped]
|
|
114
|
+
def post_environments(request_options: {}, **_params)
|
|
115
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
116
|
+
base_url: request_options[:base_url],
|
|
117
|
+
method: "POST",
|
|
118
|
+
path: "environments",
|
|
119
|
+
request_options: request_options
|
|
120
|
+
)
|
|
121
|
+
begin
|
|
122
|
+
response = @client.send(request)
|
|
123
|
+
rescue Net::HTTPRequestTimeout
|
|
124
|
+
raise Schematic::Errors::TimeoutError
|
|
125
|
+
end
|
|
126
|
+
code = response.code.to_i
|
|
127
|
+
return if code.between?(200, 299)
|
|
128
|
+
|
|
129
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
130
|
+
raise error_class.new(response.body, code: code)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# @param request_options [Hash]
|
|
134
|
+
# @param params [Hash]
|
|
135
|
+
# @option request_options [String] :base_url
|
|
136
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
137
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
138
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
139
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
140
|
+
# @option params [String] :environment_id
|
|
141
|
+
#
|
|
142
|
+
# @example
|
|
143
|
+
# client.put_environments_environment_id(environment_id: "environment_id")
|
|
144
|
+
#
|
|
145
|
+
# @return [untyped]
|
|
146
|
+
def put_environments_environment_id(request_options: {}, **params)
|
|
147
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
148
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
149
|
+
base_url: request_options[:base_url],
|
|
150
|
+
method: "PUT",
|
|
151
|
+
path: "environments/#{URI.encode_uri_component(params[:environment_id].to_s)}",
|
|
152
|
+
request_options: request_options
|
|
153
|
+
)
|
|
154
|
+
begin
|
|
155
|
+
response = @client.send(request)
|
|
156
|
+
rescue Net::HTTPRequestTimeout
|
|
157
|
+
raise Schematic::Errors::TimeoutError
|
|
158
|
+
end
|
|
159
|
+
code = response.code.to_i
|
|
160
|
+
return if code.between?(200, 299)
|
|
161
|
+
|
|
162
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
163
|
+
raise error_class.new(response.body, code: code)
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# @param request_options [Hash]
|
|
167
|
+
# @param params [Hash]
|
|
168
|
+
# @option request_options [String] :base_url
|
|
169
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
170
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
171
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
172
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
173
|
+
# @option params [String] :environment_id
|
|
174
|
+
#
|
|
175
|
+
# @example
|
|
176
|
+
# client.delete_environments_environment_id(environment_id: "environment_id")
|
|
177
|
+
#
|
|
178
|
+
# @return [untyped]
|
|
179
|
+
def delete_environments_environment_id(request_options: {}, **params)
|
|
180
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
181
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
182
|
+
base_url: request_options[:base_url],
|
|
183
|
+
method: "DELETE",
|
|
184
|
+
path: "environments/#{URI.encode_uri_component(params[:environment_id].to_s)}",
|
|
185
|
+
request_options: request_options
|
|
186
|
+
)
|
|
187
|
+
begin
|
|
188
|
+
response = @client.send(request)
|
|
189
|
+
rescue Net::HTTPRequestTimeout
|
|
190
|
+
raise Schematic::Errors::TimeoutError
|
|
191
|
+
end
|
|
192
|
+
code = response.code.to_i
|
|
193
|
+
return if code.between?(200, 299)
|
|
194
|
+
|
|
195
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
196
|
+
raise error_class.new(response.body, code: code)
|
|
197
|
+
end
|
|
198
|
+
|
|
5
199
|
# @param request_options [Hash]
|
|
6
200
|
# @param _params [Hash]
|
|
7
201
|
# @option request_options [String] :base_url
|
|
@@ -43,7 +237,7 @@ module Schematic
|
|
|
43
237
|
@raw_client = Schematic::Internal::Http::RawClient.new(
|
|
44
238
|
base_url: base_url || Schematic::Environment::DEFAULT,
|
|
45
239
|
headers: {
|
|
46
|
-
"User-Agent" => "schematichq/1.5.
|
|
240
|
+
"User-Agent" => "schematichq/1.5.6",
|
|
47
241
|
"X-Fern-Language" => "Ruby",
|
|
48
242
|
"X-Schematic-Api-Key" => api_key.to_s
|
|
49
243
|
},
|
|
@@ -2005,6 +2005,7 @@ module Schematic
|
|
|
2005
2005
|
# @option params [String, nil] :end_time
|
|
2006
2006
|
# @option params [Schematic::Types::CreditEventType, nil] :event_type
|
|
2007
2007
|
# @option params [String, nil] :feature_id
|
|
2008
|
+
# @option params [String, nil] :source_event_id
|
|
2008
2009
|
# @option params [String, nil] :start_time
|
|
2009
2010
|
# @option params [Integer, nil] :limit
|
|
2010
2011
|
# @option params [Integer, nil] :offset
|
|
@@ -2016,6 +2017,7 @@ module Schematic
|
|
|
2016
2017
|
# end_time: "end_time",
|
|
2017
2018
|
# event_type: "adjustment",
|
|
2018
2019
|
# feature_id: "feature_id",
|
|
2020
|
+
# source_event_id: "source_event_id",
|
|
2019
2021
|
# start_time: "start_time",
|
|
2020
2022
|
# limit: 1000000,
|
|
2021
2023
|
# offset: 1000000
|
|
@@ -2030,6 +2032,7 @@ module Schematic
|
|
|
2030
2032
|
query_params["end_time"] = params[:end_time] if params.key?(:end_time)
|
|
2031
2033
|
query_params["event_type"] = params[:event_type] if params.key?(:event_type)
|
|
2032
2034
|
query_params["feature_id"] = params[:feature_id] if params.key?(:feature_id)
|
|
2035
|
+
query_params["source_event_id"] = params[:source_event_id] if params.key?(:source_event_id)
|
|
2033
2036
|
query_params["start_time"] = params[:start_time] if params.key?(:start_time)
|
|
2034
2037
|
query_params["limit"] = params[:limit] if params.key?(:limit)
|
|
2035
2038
|
query_params["offset"] = params[:offset] if params.key?(:offset)
|
|
@@ -2063,6 +2066,48 @@ module Schematic
|
|
|
2063
2066
|
end
|
|
2064
2067
|
end
|
|
2065
2068
|
|
|
2069
|
+
# @param request_options [Hash]
|
|
2070
|
+
# @param params [Hash]
|
|
2071
|
+
# @option request_options [String] :base_url
|
|
2072
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
2073
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
2074
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
2075
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
2076
|
+
# @option params [String] :ledger_entry_id
|
|
2077
|
+
#
|
|
2078
|
+
# @example
|
|
2079
|
+
# client.credits.get_credit_event_ledger_entry(ledger_entry_id: "ledger_entry_id")
|
|
2080
|
+
#
|
|
2081
|
+
# @return [Schematic::Credits::Types::GetCreditEventLedgerEntryResponse]
|
|
2082
|
+
def get_credit_event_ledger_entry(request_options: {}, **params)
|
|
2083
|
+
params = Schematic::Internal::Types::Utils.normalize_keys(params)
|
|
2084
|
+
request = Schematic::Internal::JSON::Request.new(
|
|
2085
|
+
base_url: request_options[:base_url],
|
|
2086
|
+
method: "GET",
|
|
2087
|
+
path: "v2/billing/credits/ledger/#{URI.encode_uri_component(params[:ledger_entry_id].to_s)}",
|
|
2088
|
+
request_options: request_options
|
|
2089
|
+
)
|
|
2090
|
+
begin
|
|
2091
|
+
response = @client.send(request)
|
|
2092
|
+
rescue Net::HTTPRequestTimeout
|
|
2093
|
+
raise Schematic::Errors::TimeoutError
|
|
2094
|
+
end
|
|
2095
|
+
code = response.code.to_i
|
|
2096
|
+
if code.between?(200, 299)
|
|
2097
|
+
(response.body.to_s.empty? ? nil : Schematic::Credits::Types::GetCreditEventLedgerEntryResponse.load(response.body))
|
|
2098
|
+
else
|
|
2099
|
+
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
|
|
2100
|
+
error_types = {
|
|
2101
|
+
401 => Schematic::Types::ApiError,
|
|
2102
|
+
403 => Schematic::Types::ApiError,
|
|
2103
|
+
404 => Schematic::Types::ApiError,
|
|
2104
|
+
500 => Schematic::Types::ApiError
|
|
2105
|
+
}
|
|
2106
|
+
error_body = Schematic::Errors::ResponseError.load_error_body(code, response.body, error_types)
|
|
2107
|
+
raise error_class.new(response.body, code: code, body: error_body)
|
|
2108
|
+
end
|
|
2109
|
+
end
|
|
2110
|
+
|
|
2066
2111
|
# @param request_options [Hash]
|
|
2067
2112
|
# @param params [Hash]
|
|
2068
2113
|
# @option request_options [String] :base_url
|
|
@@ -2075,6 +2120,7 @@ module Schematic
|
|
|
2075
2120
|
# @option params [String, nil] :end_time
|
|
2076
2121
|
# @option params [Schematic::Types::CreditEventType, nil] :event_type
|
|
2077
2122
|
# @option params [String, nil] :feature_id
|
|
2123
|
+
# @option params [String, nil] :source_event_id
|
|
2078
2124
|
# @option params [String, nil] :start_time
|
|
2079
2125
|
# @option params [Integer, nil] :limit
|
|
2080
2126
|
# @option params [Integer, nil] :offset
|
|
@@ -2086,6 +2132,7 @@ module Schematic
|
|
|
2086
2132
|
# end_time: "end_time",
|
|
2087
2133
|
# event_type: "adjustment",
|
|
2088
2134
|
# feature_id: "feature_id",
|
|
2135
|
+
# source_event_id: "source_event_id",
|
|
2089
2136
|
# start_time: "start_time",
|
|
2090
2137
|
# limit: 1000000,
|
|
2091
2138
|
# offset: 1000000
|
|
@@ -2100,6 +2147,7 @@ module Schematic
|
|
|
2100
2147
|
query_params["end_time"] = params[:end_time] if params.key?(:end_time)
|
|
2101
2148
|
query_params["event_type"] = params[:event_type] if params.key?(:event_type)
|
|
2102
2149
|
query_params["feature_id"] = params[:feature_id] if params.key?(:feature_id)
|
|
2150
|
+
query_params["source_event_id"] = params[:source_event_id] if params.key?(:source_event_id)
|
|
2103
2151
|
query_params["start_time"] = params[:start_time] if params.key?(:start_time)
|
|
2104
2152
|
query_params["limit"] = params[:limit] if params.key?(:limit)
|
|
2105
2153
|
query_params["offset"] = params[:offset] if params.key?(:offset)
|
|
@@ -14,6 +14,8 @@ module Schematic
|
|
|
14
14
|
|
|
15
15
|
field :feature_id, -> { String }, optional: true, nullable: false
|
|
16
16
|
|
|
17
|
+
field :source_event_id, -> { String }, optional: true, nullable: false
|
|
18
|
+
|
|
17
19
|
field :start_time, -> { String }, optional: true, nullable: false
|
|
18
20
|
|
|
19
21
|
field :limit, -> { Integer }, optional: true, nullable: false
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Schematic
|
|
4
|
-
module
|
|
4
|
+
module Credits
|
|
5
5
|
module Types
|
|
6
|
-
class
|
|
7
|
-
field :data, -> { Schematic::Types::
|
|
6
|
+
class GetCreditEventLedgerEntryResponse < Internal::Types::Model
|
|
7
|
+
field :data, -> { Schematic::Types::CreditEventLedgerResponseData }, optional: false, nullable: false
|
|
8
8
|
|
|
9
9
|
field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
|
|
10
10
|
end
|
|
@@ -14,6 +14,8 @@ module Schematic
|
|
|
14
14
|
|
|
15
15
|
field :feature_id, -> { String }, optional: true, nullable: false
|
|
16
16
|
|
|
17
|
+
field :source_event_id, -> { String }, optional: true, nullable: false
|
|
18
|
+
|
|
17
19
|
field :start_time, -> { String }, optional: true, nullable: false
|
|
18
20
|
|
|
19
21
|
field :limit, -> { Integer }, optional: true, nullable: false
|
|
@@ -11,6 +11,8 @@ module Schematic
|
|
|
11
11
|
field :entitlements, -> { Internal::Types::Array[Schematic::Types::PlanBundleEntitlementRequestBody] }, optional: false, nullable: false
|
|
12
12
|
|
|
13
13
|
field :plan, -> { Schematic::Types::CreateCustomPlanBundlePlanRequestBody }, optional: false, nullable: false
|
|
14
|
+
|
|
15
|
+
field :renewal_policy, -> { Schematic::Types::RenewalPolicy }, optional: true, nullable: false
|
|
14
16
|
end
|
|
15
17
|
end
|
|
16
18
|
end
|
|
@@ -11,6 +11,8 @@ module Schematic
|
|
|
11
11
|
field :entitlements, -> { Internal::Types::Array[Schematic::Types::PlanBundleEntitlementRequestBody] }, optional: false, nullable: false
|
|
12
12
|
|
|
13
13
|
field :plan, -> { Schematic::Types::CreatePlanRequestBody }, optional: false, nullable: false
|
|
14
|
+
|
|
15
|
+
field :renewal_policy, -> { Schematic::Types::RenewalPolicy }, optional: true, nullable: false
|
|
14
16
|
end
|
|
15
17
|
end
|
|
16
18
|
end
|
|
@@ -15,6 +15,8 @@ module Schematic
|
|
|
15
15
|
field :plan, -> { Schematic::Types::UpdatePlanRequestBody }, optional: false, nullable: false
|
|
16
16
|
|
|
17
17
|
field :plan_version_id, -> { String }, optional: true, nullable: false
|
|
18
|
+
|
|
19
|
+
field :renewal_policy, -> { Schematic::Types::RenewalPolicy }, optional: true, nullable: false
|
|
18
20
|
end
|
|
19
21
|
end
|
|
20
22
|
end
|
|
@@ -16,6 +16,8 @@ module Schematic
|
|
|
16
16
|
|
|
17
17
|
field :days_until_due, -> { Integer }, optional: true, nullable: false
|
|
18
18
|
|
|
19
|
+
field :end_date, -> { String }, optional: true, nullable: false
|
|
20
|
+
|
|
19
21
|
field :prorate_first_period, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
20
22
|
|
|
21
23
|
field :send_invoice, -> { Internal::Types::Boolean }, optional: true, nullable: false
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Types
|
|
5
|
+
class BillingInvoiceAddressResponseData < Internal::Types::Model
|
|
6
|
+
field :city, -> { String }, optional: false, nullable: false
|
|
7
|
+
|
|
8
|
+
field :country, -> { String }, optional: false, nullable: false
|
|
9
|
+
|
|
10
|
+
field :line_1, -> { String }, optional: false, nullable: false, api_name: "line1"
|
|
11
|
+
|
|
12
|
+
field :line_2, -> { String }, optional: false, nullable: false, api_name: "line2"
|
|
13
|
+
|
|
14
|
+
field :postal_code, -> { String }, optional: false, nullable: false
|
|
15
|
+
|
|
16
|
+
field :state, -> { String }, optional: false, nullable: false
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Schematic
|
|
4
|
+
module Types
|
|
5
|
+
class BillingInvoiceBillingDetailsResponseData < Internal::Types::Model
|
|
6
|
+
field :address, -> { Schematic::Types::BillingInvoiceAddressResponseData }, optional: true, nullable: false
|
|
7
|
+
|
|
8
|
+
field :email, -> { String }, optional: true, nullable: false
|
|
9
|
+
|
|
10
|
+
field :phone, -> { String }, optional: true, nullable: false
|
|
11
|
+
|
|
12
|
+
field :tax_ids, -> { Internal::Types::Array[Schematic::Types::BillingInvoiceTaxIdResponseData] }, optional: false, nullable: false
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -13,16 +13,20 @@ module Schematic
|
|
|
13
13
|
|
|
14
14
|
field :company_id, -> { String }, optional: false, nullable: false
|
|
15
15
|
|
|
16
|
-
field :contract_id, -> { String }, optional:
|
|
16
|
+
field :contract_id, -> { String }, optional: true, nullable: false
|
|
17
17
|
|
|
18
18
|
field :created_at, -> { String }, optional: false, nullable: false
|
|
19
19
|
|
|
20
20
|
field :currency, -> { Schematic::Types::Currency }, optional: false, nullable: false
|
|
21
21
|
|
|
22
|
-
field :
|
|
22
|
+
field :discount, -> { Integer }, optional: false, nullable: false
|
|
23
|
+
|
|
24
|
+
field :document_state, -> { Schematic::Types::InvoiceDocumentState }, optional: true, nullable: false
|
|
23
25
|
|
|
24
26
|
field :due_at, -> { String }, optional: true, nullable: false
|
|
25
27
|
|
|
28
|
+
field :external_id, -> { String }, optional: true, nullable: false
|
|
29
|
+
|
|
26
30
|
field :finalized_at, -> { String }, optional: true, nullable: false
|
|
27
31
|
|
|
28
32
|
field :id, -> { String }, optional: false, nullable: false
|
|
@@ -31,19 +35,31 @@ module Schematic
|
|
|
31
35
|
|
|
32
36
|
field :number, -> { String }, optional: true, nullable: false
|
|
33
37
|
|
|
34
|
-
field :
|
|
38
|
+
field :pdf_url, -> { String }, optional: true, nullable: false
|
|
39
|
+
|
|
40
|
+
field :period_end, -> { String }, optional: true, nullable: false
|
|
41
|
+
|
|
42
|
+
field :period_start, -> { String }, optional: true, nullable: false
|
|
35
43
|
|
|
36
|
-
field :
|
|
44
|
+
field :provider_type, -> { Schematic::Types::BillingProviderType }, optional: false, nullable: false
|
|
37
45
|
|
|
38
46
|
field :settlements, -> { Internal::Types::Array[Schematic::Types::BillingInvoiceSettlementResponseData] }, optional: false, nullable: false
|
|
39
47
|
|
|
40
48
|
field :status, -> { Schematic::Types::InvoiceStatus }, optional: false, nullable: false
|
|
41
49
|
|
|
50
|
+
field :subscription_external_id, -> { String }, optional: true, nullable: false
|
|
51
|
+
|
|
52
|
+
field :subscription_id, -> { String }, optional: true, nullable: false
|
|
53
|
+
|
|
42
54
|
field :subtotal, -> { Integer }, optional: false, nullable: false
|
|
43
55
|
|
|
56
|
+
field :tax, -> { Integer }, optional: false, nullable: false
|
|
57
|
+
|
|
44
58
|
field :terms, -> { Schematic::Types::BillingInvoiceTermsResponseData }, optional: true, nullable: false
|
|
45
59
|
|
|
46
60
|
field :total, -> { Integer }, optional: false, nullable: false
|
|
61
|
+
|
|
62
|
+
field :url, -> { String }, optional: true, nullable: false
|
|
47
63
|
end
|
|
48
64
|
end
|
|
49
65
|
end
|
|
@@ -7,7 +7,11 @@ module Schematic
|
|
|
7
7
|
|
|
8
8
|
field :charge_ids, -> { Internal::Types::Array[String] }, optional: false, nullable: false
|
|
9
9
|
|
|
10
|
-
field :
|
|
10
|
+
field :description, -> { String }, optional: true, nullable: false
|
|
11
|
+
|
|
12
|
+
field :external_id, -> { String }, optional: true, nullable: false
|
|
13
|
+
|
|
14
|
+
field :id, -> { String }, optional: true, nullable: false
|
|
11
15
|
|
|
12
16
|
field :kind, -> { Schematic::Types::InvoiceLineKind }, optional: false, nullable: false
|
|
13
17
|
|
|
@@ -13,31 +13,39 @@ module Schematic
|
|
|
13
13
|
|
|
14
14
|
field :company_id, -> { String }, optional: false, nullable: false
|
|
15
15
|
|
|
16
|
-
field :contract_id, -> { String }, optional:
|
|
16
|
+
field :contract_id, -> { String }, optional: true, nullable: false
|
|
17
17
|
|
|
18
18
|
field :created_at, -> { String }, optional: false, nullable: false
|
|
19
19
|
|
|
20
20
|
field :currency, -> { Schematic::Types::Currency }, optional: false, nullable: false
|
|
21
21
|
|
|
22
|
-
field :document_state, -> { Schematic::Types::InvoiceDocumentState }, optional:
|
|
22
|
+
field :document_state, -> { Schematic::Types::InvoiceDocumentState }, optional: true, nullable: false
|
|
23
23
|
|
|
24
24
|
field :due_at, -> { String }, optional: true, nullable: false
|
|
25
25
|
|
|
26
|
+
field :external_id, -> { String }, optional: true, nullable: false
|
|
27
|
+
|
|
26
28
|
field :finalized_at, -> { String }, optional: true, nullable: false
|
|
27
29
|
|
|
28
30
|
field :id, -> { String }, optional: false, nullable: false
|
|
29
31
|
|
|
30
32
|
field :number, -> { String }, optional: true, nullable: false
|
|
31
33
|
|
|
32
|
-
field :period_end, -> { String }, optional:
|
|
34
|
+
field :period_end, -> { String }, optional: true, nullable: false
|
|
35
|
+
|
|
36
|
+
field :period_start, -> { String }, optional: true, nullable: false
|
|
33
37
|
|
|
34
|
-
field :
|
|
38
|
+
field :provider_type, -> { Schematic::Types::BillingProviderType }, optional: false, nullable: false
|
|
35
39
|
|
|
36
40
|
field :status, -> { Schematic::Types::InvoiceStatus }, optional: false, nullable: false
|
|
37
41
|
|
|
42
|
+
field :subscription_external_id, -> { String }, optional: true, nullable: false
|
|
43
|
+
|
|
38
44
|
field :subtotal, -> { Integer }, optional: false, nullable: false
|
|
39
45
|
|
|
40
46
|
field :total, -> { Integer }, optional: false, nullable: false
|
|
47
|
+
|
|
48
|
+
field :url, -> { String }, optional: true, nullable: false
|
|
41
49
|
end
|
|
42
50
|
end
|
|
43
51
|
end
|