Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .fern/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"webrick": ">= 1.0"
}
},
"originGitCommit": "3dc12b536625ca1efbb649f6c55df7da258c7e05",
"originGitCommit": "470e0f433ab9bb0e88784674fa2e1efce62ebd9b",
"sdkVersion": "1.4.2"
}
8 changes: 8 additions & 0 deletions lib/schematic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
require_relative "schematic/types/payment_method_response_data"
require_relative "schematic/billing/types/list_payment_methods_response"
require_relative "schematic/billing/types/upsert_payment_method_response"
require_relative "schematic/billing/types/delete_payment_method_by_external_id_response"
require_relative "schematic/types/billing_price_usage_type"
require_relative "schematic/types/billing_tiers_mode"
require_relative "schematic/billing/types/list_billing_prices_params"
Expand Down Expand Up @@ -174,6 +175,10 @@
require_relative "schematic/credits/types/count_billing_credits_grants_response"
require_relative "schematic/credits/types/list_grants_for_credit_params"
require_relative "schematic/credits/types/list_grants_for_credit_response"
require_relative "schematic/types/credit_lease_response_data"
require_relative "schematic/credits/types/acquire_credit_lease_response"
require_relative "schematic/credits/types/extend_credit_lease_response"
require_relative "schematic/credits/types/release_credit_lease_response"
require_relative "schematic/types/credit_ledger_period"
require_relative "schematic/credits/types/get_enriched_credit_ledger_params"
require_relative "schematic/types/billing_credit_ledger_response_data"
Expand Down Expand Up @@ -672,6 +677,7 @@
require_relative "schematic/types/plan_bundle_entitlement_request_body"
require_relative "schematic/types/plan_currency_price_request_body"
require_relative "schematic/types/proration_behavior"
require_relative "schematic/types/release_credit_lease_request_body"
require_relative "schematic/types/rule_condition_group_response_data"
require_relative "schematic/types/rule_condition_response_data"
require_relative "schematic/types/rule_response_data"
Expand Down Expand Up @@ -758,6 +764,8 @@
require_relative "schematic/credits/types/list_company_grants_request"
require_relative "schematic/credits/types/count_billing_credits_grants_request"
require_relative "schematic/credits/types/list_grants_for_credit_request"
require_relative "schematic/credits/types/acquire_credit_lease_request_body"
require_relative "schematic/credits/types/extend_credit_lease_request_body"
require_relative "schematic/credits/types/get_enriched_credit_ledger_request"
require_relative "schematic/credits/types/count_credit_ledger_request"
require_relative "schematic/credits/types/list_billing_plan_credit_grants_request"
Expand Down
32 changes: 32 additions & 0 deletions lib/schematic/billing/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,38 @@ def upsert_payment_method(request_options: {}, **params)
end
end

# @param request_options [Hash]
# @param params [Hash]
# @option request_options [String] :base_url
# @option request_options [Hash{String => Object}] :additional_headers
# @option request_options [Hash{String => Object}] :additional_query_parameters
# @option request_options [Hash{String => Object}] :additional_body_parameters
# @option request_options [Integer] :timeout_in_seconds
# @option params [String] :billing_id
#
# @return [Schematic::Billing::Types::DeletePaymentMethodByExternalIdResponse]
def delete_payment_method_by_external_id(request_options: {}, **params)
params = Schematic::Internal::Types::Utils.normalize_keys(params)
request = Schematic::Internal::JSON::Request.new(
base_url: request_options[:base_url],
method: "DELETE",
path: "billing/payment-methods/#{URI.encode_uri_component(params[:billing_id].to_s)}",
request_options: request_options
)
begin
response = @client.send(request)
rescue Net::HTTPRequestTimeout
raise Schematic::Errors::TimeoutError
end
code = response.code.to_i
if code.between?(200, 299)
Schematic::Billing::Types::DeletePaymentMethodByExternalIdResponse.load(response.body)
else
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
raise error_class.new(response.body, code: code)
end
end

# @param request_options [Hash]
# @param params [Hash]
# @option request_options [String] :base_url
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

module Schematic
module Billing
module Types
class DeletePaymentMethodByExternalIdResponse < Internal::Types::Model
field :data, -> { Schematic::Types::DeleteResponse }, optional: false, nullable: false
field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
end
end
end
end
102 changes: 102 additions & 0 deletions lib/schematic/credits/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,108 @@ def list_grants_for_credit(request_options: {}, **params)
end
end

# @param request_options [Hash]
# @param params [Schematic::Credits::Types::AcquireCreditLeaseRequestBody]
# @option request_options [String] :base_url
# @option request_options [Hash{String => Object}] :additional_headers
# @option request_options [Hash{String => Object}] :additional_query_parameters
# @option request_options [Hash{String => Object}] :additional_body_parameters
# @option request_options [Integer] :timeout_in_seconds
#
# @return [Schematic::Credits::Types::AcquireCreditLeaseResponse]
def acquire_credit_lease(request_options: {}, **params)
params = Schematic::Internal::Types::Utils.normalize_keys(params)
request = Schematic::Internal::JSON::Request.new(
base_url: request_options[:base_url],
method: "POST",
path: "billing/credits/lease",
body: Schematic::Credits::Types::AcquireCreditLeaseRequestBody.new(params).to_h,
request_options: request_options
)
begin
response = @client.send(request)
rescue Net::HTTPRequestTimeout
raise Schematic::Errors::TimeoutError
end
code = response.code.to_i
if code.between?(200, 299)
Schematic::Credits::Types::AcquireCreditLeaseResponse.load(response.body)
else
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
raise error_class.new(response.body, code: code)
end
end

# @param request_options [Hash]
# @param params [Schematic::Credits::Types::ExtendCreditLeaseRequestBody]
# @option request_options [String] :base_url
# @option request_options [Hash{String => Object}] :additional_headers
# @option request_options [Hash{String => Object}] :additional_query_parameters
# @option request_options [Hash{String => Object}] :additional_body_parameters
# @option request_options [Integer] :timeout_in_seconds
# @option params [String] :lease_id
#
# @return [Schematic::Credits::Types::ExtendCreditLeaseResponse]
def extend_credit_lease(request_options: {}, **params)
params = Schematic::Internal::Types::Utils.normalize_keys(params)
request_data = Schematic::Credits::Types::ExtendCreditLeaseRequestBody.new(params).to_h
non_body_param_names = ["lease_id"]
body = request_data.except(*non_body_param_names)

request = Schematic::Internal::JSON::Request.new(
base_url: request_options[:base_url],
method: "PUT",
path: "billing/credits/lease/#{URI.encode_uri_component(params[:lease_id].to_s)}/extend",
body: body,
request_options: request_options
)
begin
response = @client.send(request)
rescue Net::HTTPRequestTimeout
raise Schematic::Errors::TimeoutError
end
code = response.code.to_i
if code.between?(200, 299)
Schematic::Credits::Types::ExtendCreditLeaseResponse.load(response.body)
else
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
raise error_class.new(response.body, code: code)
end
end

# @param request_options [Hash]
# @param params [Schematic::Types::ReleaseCreditLeaseRequestBody]
# @option request_options [String] :base_url
# @option request_options [Hash{String => Object}] :additional_headers
# @option request_options [Hash{String => Object}] :additional_query_parameters
# @option request_options [Hash{String => Object}] :additional_body_parameters
# @option request_options [Integer] :timeout_in_seconds
# @option params [String] :lease_id
#
# @return [Schematic::Credits::Types::ReleaseCreditLeaseResponse]
def release_credit_lease(request_options: {}, **params)
params = Schematic::Internal::Types::Utils.normalize_keys(params)
request = Schematic::Internal::JSON::Request.new(
base_url: request_options[:base_url],
method: "PUT",
path: "billing/credits/lease/#{URI.encode_uri_component(params[:lease_id].to_s)}/release",
body: params,
request_options: request_options
)
begin
response = @client.send(request)
rescue Net::HTTPRequestTimeout
raise Schematic::Errors::TimeoutError
end
code = response.code.to_i
if code.between?(200, 299)
Schematic::Credits::Types::ReleaseCreditLeaseResponse.load(response.body)
else
error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
raise error_class.new(response.body, code: code)
end
end

# @param request_options [Hash]
# @param params [Hash]
# @option request_options [String] :base_url
Expand Down
14 changes: 14 additions & 0 deletions lib/schematic/credits/types/acquire_credit_lease_request_body.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

module Schematic
module Credits
module Types
class AcquireCreditLeaseRequestBody < Internal::Types::Model
field :company_id, -> { String }, optional: false, nullable: false
field :credit_type_id, -> { String }, optional: false, nullable: false
field :expires_at, -> { String }, optional: true, nullable: false
field :requested_amount, -> { Integer }, optional: false, nullable: false
end
end
end
end
12 changes: 12 additions & 0 deletions lib/schematic/credits/types/acquire_credit_lease_response.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

module Schematic
module Credits
module Types
class AcquireCreditLeaseResponse < Internal::Types::Model
field :data, -> { Schematic::Types::CreditLeaseResponseData }, optional: false, nullable: false
field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
end
end
end
end
13 changes: 13 additions & 0 deletions lib/schematic/credits/types/extend_credit_lease_request_body.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

module Schematic
module Credits
module Types
class ExtendCreditLeaseRequestBody < Internal::Types::Model
field :lease_id, -> { String }, optional: false, nullable: false
field :additional_amount, -> { Integer }, optional: false, nullable: false
field :expires_at, -> { String }, optional: true, nullable: false
end
end
end
end
12 changes: 12 additions & 0 deletions lib/schematic/credits/types/extend_credit_lease_response.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

module Schematic
module Credits
module Types
class ExtendCreditLeaseResponse < Internal::Types::Model
field :data, -> { Schematic::Types::CreditLeaseResponseData }, optional: false, nullable: false
field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
end
end
end
end
12 changes: 12 additions & 0 deletions lib/schematic/credits/types/release_credit_lease_response.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

module Schematic
module Credits
module Types
class ReleaseCreditLeaseResponse < Internal::Types::Model
field :data, -> { Schematic::Types::CreditLeaseResponseData }, optional: false, nullable: false
field :params, -> { Internal::Types::Hash[String, Object] }, optional: false, nullable: false
end
end
end
end
16 changes: 16 additions & 0 deletions lib/schematic/types/credit_lease_response_data.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

module Schematic
module Types
class CreditLeaseResponseData < Internal::Types::Model
field :company_id, -> { String }, optional: false, nullable: false
field :created_at, -> { String }, optional: false, nullable: false
field :credit_type_id, -> { String }, optional: false, nullable: false
field :expires_at, -> { String }, optional: false, nullable: false
field :granted_amount, -> { Integer }, optional: false, nullable: false
field :id, -> { String }, optional: false, nullable: false
field :released_at, -> { String }, optional: true, nullable: false
field :updated_at, -> { String }, optional: false, nullable: false
end
end
end
1 change: 1 addition & 0 deletions lib/schematic/types/event_body_track.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module Types
class EventBodyTrack < Internal::Types::Model
field :company, -> { Internal::Types::Hash[String, String] }, optional: true, nullable: false
field :event, -> { String }, optional: false, nullable: false
field :lease_id, -> { String }, optional: true, nullable: false
field :quantity, -> { Integer }, optional: true, nullable: false
field :traits, -> { Internal::Types::Hash[String, Object] }, optional: true, nullable: false
field :user, -> { Internal::Types::Hash[String, String] }, optional: true, nullable: false
Expand Down
1 change: 1 addition & 0 deletions lib/schematic/types/feature_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class FeatureView < Internal::Types::Model
field :trait, -> { Schematic::Types::EntityTraitDefinitionResponseData }, optional: true, nullable: false
field :trait_id, -> { String }, optional: true, nullable: false
field :updated_at, -> { String }, optional: false, nullable: false
field :usage_limit_trait_id, -> { String }, optional: true, nullable: false
end
end
end
23 changes: 23 additions & 0 deletions lib/schematic/types/release_credit_lease_request_body.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

module Schematic
module Types
module ReleaseCreditLeaseRequestBody
# ReleaseCreditLeaseRequestBody is an alias for Hash

# @option str [String]
#
# @return [untyped]
def self.load(str)
::JSON.parse(str)
end

# @option value [untyped]
#
# @return [String]
def self.dump(value)
::JSON.generate(value)
end
end
end
end
Loading