Class: AdvancedBilling::CreatePrepayment
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::CreatePrepayment
- Defined in:
- lib/advanced_billing/models/create_prepayment.rb
Overview
CreatePrepayment Model.
Instance Attribute Summary collapse
-
#amount ⇒ Float
TODO: Write general description for this method.
-
#details ⇒ String
TODO: Write general description for this method.
-
#memo ⇒ String
TODO: Write general description for this method.
-
#method ⇒ CreatePrepaymentMethod
:- When the ‘method` specified is `“credit_card_on_file”`, the prepayment amount will be collected using the default credit card payment profile and applied to the prepayment account balance.
-
#payment_profile_id ⇒ Integer
:- When the ‘method` specified is `“credit_card_on_file”`, the prepayment amount will be collected using the default credit card payment profile and applied to the prepayment account balance.
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(amount:, details:, memo:, method:, payment_profile_id: SKIP, additional_properties: {}) ⇒ CreatePrepayment
constructor
A new instance of CreatePrepayment.
Methods inherited from BaseModel
Constructor Details
#initialize(amount:, details:, memo:, method:, payment_profile_id: SKIP, additional_properties: {}) ⇒ CreatePrepayment
Returns a new instance of CreatePrepayment.
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/advanced_billing/models/create_prepayment.rb', line 61 def initialize(amount:, details:, memo:, method:, payment_profile_id: SKIP, additional_properties: {}) @amount = amount @details = details @memo = memo @method = method @payment_profile_id = payment_profile_id unless payment_profile_id == SKIP # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#amount ⇒ Float
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/create_prepayment.rb', line 14 def amount @amount end |
#details ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/create_prepayment.rb', line 18 def details @details end |
#memo ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/create_prepayment.rb', line 22 def memo @memo end |
#method ⇒ CreatePrepaymentMethod
:- When the ‘method` specified is `“credit_card_on_file”`, the prepayment amount will be collected using the default credit card payment profile and applied to the prepayment account balance. This is especially useful for manual replenishment of prepaid subscriptions.
29 30 31 |
# File 'lib/advanced_billing/models/create_prepayment.rb', line 29 def method @method end |
#payment_profile_id ⇒ Integer
:- When the ‘method` specified is `“credit_card_on_file”`, the prepayment amount will be collected using the default credit card payment profile and applied to the prepayment account balance. This is especially useful for manual replenishment of prepaid subscriptions.
36 37 38 |
# File 'lib/advanced_billing/models/create_prepayment.rb', line 36 def payment_profile_id @payment_profile_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/advanced_billing/models/create_prepayment.rb', line 76 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. amount = hash.key?('amount') ? hash['amount'] : nil details = hash.key?('details') ? hash['details'] : nil memo = hash.key?('memo') ? hash['memo'] : nil method = hash.key?('method') ? hash['method'] : nil payment_profile_id = hash.key?('payment_profile_id') ? hash['payment_profile_id'] : SKIP # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. CreatePrepayment.new(amount: amount, details: details, memo: memo, method: method, payment_profile_id: payment_profile_id, additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
39 40 41 42 43 44 45 46 47 |
# File 'lib/advanced_billing/models/create_prepayment.rb', line 39 def self.names @_hash = {} if @_hash.nil? @_hash['amount'] = 'amount' @_hash['details'] = 'details' @_hash['memo'] = 'memo' @_hash['method'] = 'method' @_hash['payment_profile_id'] = 'payment_profile_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
57 58 59 |
# File 'lib/advanced_billing/models/create_prepayment.rb', line 57 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
50 51 52 53 54 |
# File 'lib/advanced_billing/models/create_prepayment.rb', line 50 def self.optionals %w[ payment_profile_id ] end |