Class: ApiReference::AddCreditTopUpRequestParams
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::AddCreditTopUpRequestParams
- Defined in:
- lib/api_reference/models/add_credit_top_up_request_params.rb
Overview
AddCreditTopUpRequestParams Model.
Instance Attribute Summary collapse
-
#active_from ⇒ DateTime
The date from which the top-up is active.
-
#amount ⇒ String
The amount to increment when the threshold is reached.
-
#currency ⇒ String
The currency or custom pricing unit to use for this top-up.
-
#expires_after ⇒ Integer
The number of days or months after which the top-up expires.
-
#expires_after_unit ⇒ ExpiresAfterUnit
The unit of expires_after.
-
#invoice_settings ⇒ NewTopUpInvoiceSettings2
Settings for invoices generated by triggered top-ups.
-
#per_unit_cost_basis ⇒ String
How much, in the customer's currency, to charge for each unit.
-
#threshold ⇒ String
The threshold at which to trigger the top-up.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(currency:, threshold:, amount:, per_unit_cost_basis:, invoice_settings:, expires_after: SKIP, expires_after_unit: SKIP, active_from: SKIP) ⇒ AddCreditTopUpRequestParams
constructor
A new instance of AddCreditTopUpRequestParams.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_active_from ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(currency:, threshold:, amount:, per_unit_cost_basis:, invoice_settings:, expires_after: SKIP, expires_after_unit: SKIP, active_from: SKIP) ⇒ AddCreditTopUpRequestParams
Returns a new instance of AddCreditTopUpRequestParams.
82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/api_reference/models/add_credit_top_up_request_params.rb', line 82 def initialize(currency:, threshold:, amount:, per_unit_cost_basis:, invoice_settings:, expires_after: SKIP, expires_after_unit: SKIP, active_from: SKIP) @currency = currency @threshold = threshold @amount = amount @per_unit_cost_basis = per_unit_cost_basis @invoice_settings = invoice_settings @expires_after = expires_after unless expires_after == SKIP @expires_after_unit = expires_after_unit unless expires_after_unit == SKIP @active_from = active_from unless active_from == SKIP end |
Instance Attribute Details
#active_from ⇒ DateTime
The date from which the top-up is active. If unspecified, the top-up is active immediately. This should not be more than 10 days in the past.
48 49 50 |
# File 'lib/api_reference/models/add_credit_top_up_request_params.rb', line 48 def active_from @active_from end |
#amount ⇒ String
The amount to increment when the threshold is reached.
25 26 27 |
# File 'lib/api_reference/models/add_credit_top_up_request_params.rb', line 25 def amount @amount end |
#currency ⇒ String
The currency or custom pricing unit to use for this top-up. If this is a real-world currency, it must match the customer's invoicing currency.
16 17 18 |
# File 'lib/api_reference/models/add_credit_top_up_request_params.rb', line 16 def currency @currency end |
#expires_after ⇒ Integer
The number of days or months after which the top-up expires. If unspecified, it does not expire.
38 39 40 |
# File 'lib/api_reference/models/add_credit_top_up_request_params.rb', line 38 def expires_after @expires_after end |
#expires_after_unit ⇒ ExpiresAfterUnit
The unit of expires_after.
42 43 44 |
# File 'lib/api_reference/models/add_credit_top_up_request_params.rb', line 42 def expires_after_unit @expires_after_unit end |
#invoice_settings ⇒ NewTopUpInvoiceSettings2
Settings for invoices generated by triggered top-ups.
33 34 35 |
# File 'lib/api_reference/models/add_credit_top_up_request_params.rb', line 33 def invoice_settings @invoice_settings end |
#per_unit_cost_basis ⇒ String
How much, in the customer's currency, to charge for each unit.
29 30 31 |
# File 'lib/api_reference/models/add_credit_top_up_request_params.rb', line 29 def per_unit_cost_basis @per_unit_cost_basis end |
#threshold ⇒ String
The threshold at which to trigger the top-up. If the balance is at or below this threshold, the top-up will be triggered.
21 22 23 |
# File 'lib/api_reference/models/add_credit_top_up_request_params.rb', line 21 def threshold @threshold end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/api_reference/models/add_credit_top_up_request_params.rb', line 96 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. currency = hash.key?('currency') ? hash['currency'] : nil threshold = hash.key?('threshold') ? hash['threshold'] : nil amount = hash.key?('amount') ? hash['amount'] : nil per_unit_cost_basis = hash.key?('per_unit_cost_basis') ? hash['per_unit_cost_basis'] : nil invoice_settings = NewTopUpInvoiceSettings2.from_hash(hash['invoice_settings']) if hash['invoice_settings'] expires_after = hash.key?('expires_after') ? hash['expires_after'] : SKIP expires_after_unit = hash.key?('expires_after_unit') ? hash['expires_after_unit'] : SKIP active_from = if hash.key?('active_from') (DateTimeHelper.from_rfc3339(hash['active_from']) if hash['active_from']) else SKIP end # Create object from extracted values. AddCreditTopUpRequestParams.new(currency: currency, threshold: threshold, amount: amount, per_unit_cost_basis: per_unit_cost_basis, invoice_settings: invoice_settings, expires_after: expires_after, expires_after_unit: expires_after_unit, active_from: active_from) end |
.names ⇒ Object
A mapping from model property names to API property names.
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/api_reference/models/add_credit_top_up_request_params.rb', line 51 def self.names @_hash = {} if @_hash.nil? @_hash['currency'] = 'currency' @_hash['threshold'] = 'threshold' @_hash['amount'] = 'amount' @_hash['per_unit_cost_basis'] = 'per_unit_cost_basis' @_hash['invoice_settings'] = 'invoice_settings' @_hash['expires_after'] = 'expires_after' @_hash['expires_after_unit'] = 'expires_after_unit' @_hash['active_from'] = 'active_from' @_hash end |
.nullables ⇒ Object
An array for nullable fields
74 75 76 77 78 79 80 |
# File 'lib/api_reference/models/add_credit_top_up_request_params.rb', line 74 def self.nullables %w[ expires_after expires_after_unit active_from ] end |
.optionals ⇒ Object
An array for optional fields
65 66 67 68 69 70 71 |
# File 'lib/api_reference/models/add_credit_top_up_request_params.rb', line 65 def self.optionals %w[ expires_after expires_after_unit active_from ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
141 142 143 144 145 146 147 |
# File 'lib/api_reference/models/add_credit_top_up_request_params.rb', line 141 def inspect class_name = self.class.name.split('::').last "<#{class_name} currency: #{@currency.inspect}, threshold: #{@threshold.inspect}, amount:"\ " #{@amount.inspect}, per_unit_cost_basis: #{@per_unit_cost_basis.inspect},"\ " invoice_settings: #{@invoice_settings.inspect}, expires_after: #{@expires_after.inspect},"\ " expires_after_unit: #{@expires_after_unit.inspect}, active_from: #{@active_from.inspect}>" end |
#to_custom_active_from ⇒ Object
127 128 129 |
# File 'lib/api_reference/models/add_credit_top_up_request_params.rb', line 127 def to_custom_active_from DateTimeHelper.to_rfc3339(active_from) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
132 133 134 135 136 137 138 |
# File 'lib/api_reference/models/add_credit_top_up_request_params.rb', line 132 def to_s class_name = self.class.name.split('::').last "<#{class_name} currency: #{@currency}, threshold: #{@threshold}, amount: #{@amount},"\ " per_unit_cost_basis: #{@per_unit_cost_basis}, invoice_settings: #{@invoice_settings},"\ " expires_after: #{@expires_after}, expires_after_unit: #{@expires_after_unit}, active_from:"\ " #{@active_from}>" end |