Class: AdvancedBilling::Prepayment
- Defined in:
- lib/advanced_billing/models/prepayment.rb
Overview
Prepayment Model.
Instance Attribute Summary collapse
-
#amount_in_cents ⇒ Integer
TODO: Write general description for this method.
-
#created_at ⇒ DateTime
The payment type of the prepayment.
-
#details ⇒ String
TODO: Write general description for this method.
-
#external ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#id ⇒ Integer
TODO: Write general description for this method.
-
#memo ⇒ String
TODO: Write general description for this method.
-
#payment_type ⇒ PrepaymentMethod
The payment type of the prepayment.
-
#refunded_amount_in_cents ⇒ Integer
TODO: Write general description for this method.
-
#remaining_amount_in_cents ⇒ Integer
TODO: Write general description for this method.
-
#subscription_id ⇒ Integer
TODO: Write general description for this method.
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(id:, subscription_id:, amount_in_cents:, remaining_amount_in_cents:, external:, memo:, created_at:, refunded_amount_in_cents: SKIP, details: SKIP, payment_type: SKIP, additional_properties: {}) ⇒ Prepayment
constructor
A new instance of Prepayment.
- #to_custom_created_at ⇒ 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(id:, subscription_id:, amount_in_cents:, remaining_amount_in_cents:, external:, memo:, created_at:, refunded_amount_in_cents: SKIP, details: SKIP, payment_type: SKIP, additional_properties: {}) ⇒ Prepayment
Returns a new instance of Prepayment.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/advanced_billing/models/prepayment.rb', line 83 def initialize(id:, subscription_id:, amount_in_cents:, remaining_amount_in_cents:, external:, memo:, created_at:, refunded_amount_in_cents: SKIP, details: SKIP, payment_type: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @id = id @subscription_id = subscription_id @amount_in_cents = amount_in_cents @remaining_amount_in_cents = remaining_amount_in_cents @refunded_amount_in_cents = refunded_amount_in_cents unless refunded_amount_in_cents == SKIP @details = details unless details == SKIP @external = external @memo = memo @payment_type = payment_type unless payment_type == SKIP @created_at = created_at end |
Instance Attribute Details
#amount_in_cents ⇒ Integer
TODO: Write general description for this method
23 24 25 |
# File 'lib/advanced_billing/models/prepayment.rb', line 23 def amount_in_cents @amount_in_cents end |
#created_at ⇒ DateTime
The payment type of the prepayment.
51 52 53 |
# File 'lib/advanced_billing/models/prepayment.rb', line 51 def created_at @created_at end |
#details ⇒ String
TODO: Write general description for this method
35 36 37 |
# File 'lib/advanced_billing/models/prepayment.rb', line 35 def details @details end |
#external ⇒ TrueClass | FalseClass
TODO: Write general description for this method
39 40 41 |
# File 'lib/advanced_billing/models/prepayment.rb', line 39 def external @external end |
#id ⇒ Integer
TODO: Write general description for this method
15 16 17 |
# File 'lib/advanced_billing/models/prepayment.rb', line 15 def id @id end |
#memo ⇒ String
TODO: Write general description for this method
43 44 45 |
# File 'lib/advanced_billing/models/prepayment.rb', line 43 def memo @memo end |
#payment_type ⇒ PrepaymentMethod
The payment type of the prepayment.
47 48 49 |
# File 'lib/advanced_billing/models/prepayment.rb', line 47 def payment_type @payment_type end |
#refunded_amount_in_cents ⇒ Integer
TODO: Write general description for this method
31 32 33 |
# File 'lib/advanced_billing/models/prepayment.rb', line 31 def refunded_amount_in_cents @refunded_amount_in_cents end |
#remaining_amount_in_cents ⇒ Integer
TODO: Write general description for this method
27 28 29 |
# File 'lib/advanced_billing/models/prepayment.rb', line 27 def remaining_amount_in_cents @remaining_amount_in_cents end |
#subscription_id ⇒ Integer
TODO: Write general description for this method
19 20 21 |
# File 'lib/advanced_billing/models/prepayment.rb', line 19 def subscription_id @subscription_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/advanced_billing/models/prepayment.rb', line 105 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : nil subscription_id = hash.key?('subscription_id') ? hash['subscription_id'] : nil amount_in_cents = hash.key?('amount_in_cents') ? hash['amount_in_cents'] : nil remaining_amount_in_cents = hash.key?('remaining_amount_in_cents') ? hash['remaining_amount_in_cents'] : nil external = hash.key?('external') ? hash['external'] : nil memo = hash.key?('memo') ? hash['memo'] : nil created_at = if hash.key?('created_at') (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) end refunded_amount_in_cents = hash.key?('refunded_amount_in_cents') ? hash['refunded_amount_in_cents'] : SKIP details = hash.key?('details') ? hash['details'] : SKIP payment_type = hash.key?('payment_type') ? hash['payment_type'] : SKIP # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. Prepayment.new(id: id, subscription_id: subscription_id, amount_in_cents: amount_in_cents, remaining_amount_in_cents: remaining_amount_in_cents, external: external, memo: memo, created_at: created_at, refunded_amount_in_cents: refunded_amount_in_cents, details: details, payment_type: payment_type, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/advanced_billing/models/prepayment.rb', line 54 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['subscription_id'] = 'subscription_id' @_hash['amount_in_cents'] = 'amount_in_cents' @_hash['remaining_amount_in_cents'] = 'remaining_amount_in_cents' @_hash['refunded_amount_in_cents'] = 'refunded_amount_in_cents' @_hash['details'] = 'details' @_hash['external'] = 'external' @_hash['memo'] = 'memo' @_hash['payment_type'] = 'payment_type' @_hash['created_at'] = 'created_at' @_hash end |
.nullables ⇒ Object
An array for nullable fields
79 80 81 |
# File 'lib/advanced_billing/models/prepayment.rb', line 79 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
70 71 72 73 74 75 76 |
# File 'lib/advanced_billing/models/prepayment.rb', line 70 def self.optionals %w[ refunded_amount_in_cents details payment_type ] end |
Instance Method Details
#to_custom_created_at ⇒ Object
143 144 145 |
# File 'lib/advanced_billing/models/prepayment.rb', line 143 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |