Class: AdvancedBilling::InvoiceRefund
- Defined in:
- lib/advanced_billing/models/invoice_refund.rb
Overview
InvoiceRefund Model.
Instance Attribute Summary collapse
-
#applied_amount ⇒ String
TODO: Write general description for this method.
-
#gateway_transaction_id ⇒ String
The transaction ID for the refund as returned from the payment gateway.
-
#memo ⇒ String
TODO: Write general description for this method.
-
#original_amount ⇒ String
TODO: Write general description for this method.
-
#payment_id ⇒ Integer
TODO: Write general description for this method.
-
#transaction_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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(transaction_id = SKIP, payment_id = SKIP, memo = SKIP, original_amount = SKIP, applied_amount = SKIP, gateway_transaction_id = SKIP) ⇒ InvoiceRefund
constructor
A new instance of InvoiceRefund.
Methods inherited from BaseModel
Constructor Details
#initialize(transaction_id = SKIP, payment_id = SKIP, memo = SKIP, original_amount = SKIP, applied_amount = SKIP, gateway_transaction_id = SKIP) ⇒ InvoiceRefund
Returns a new instance of InvoiceRefund.
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 67 def initialize(transaction_id = SKIP, payment_id = SKIP, memo = SKIP, original_amount = SKIP, applied_amount = SKIP, gateway_transaction_id = SKIP) @transaction_id = transaction_id unless transaction_id == SKIP @payment_id = payment_id unless payment_id == SKIP @memo = memo unless memo == SKIP @original_amount = original_amount unless original_amount == SKIP @applied_amount = applied_amount unless applied_amount == SKIP @gateway_transaction_id = gateway_transaction_id unless gateway_transaction_id == SKIP end |
Instance Attribute Details
#applied_amount ⇒ String
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 30 def applied_amount @applied_amount end |
#gateway_transaction_id ⇒ String
The transaction ID for the refund as returned from the payment gateway
34 35 36 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 34 def gateway_transaction_id @gateway_transaction_id end |
#memo ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 22 def memo @memo end |
#original_amount ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 26 def original_amount @original_amount end |
#payment_id ⇒ Integer
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 18 def payment_id @payment_id end |
#transaction_id ⇒ Integer
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 14 def transaction_id @transaction_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 79 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. transaction_id = hash.key?('transaction_id') ? hash['transaction_id'] : SKIP payment_id = hash.key?('payment_id') ? hash['payment_id'] : SKIP memo = hash.key?('memo') ? hash['memo'] : SKIP original_amount = hash.key?('original_amount') ? hash['original_amount'] : SKIP applied_amount = hash.key?('applied_amount') ? hash['applied_amount'] : SKIP gateway_transaction_id = hash.key?('gateway_transaction_id') ? hash['gateway_transaction_id'] : SKIP # Create object from extracted values. InvoiceRefund.new(transaction_id, payment_id, memo, original_amount, applied_amount, gateway_transaction_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['transaction_id'] = 'transaction_id' @_hash['payment_id'] = 'payment_id' @_hash['memo'] = 'memo' @_hash['original_amount'] = 'original_amount' @_hash['applied_amount'] = 'applied_amount' @_hash['gateway_transaction_id'] = 'gateway_transaction_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 64 65 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 61 def self.nullables %w[ gateway_transaction_id ] end |
.optionals ⇒ Object
An array for optional fields
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 49 def self.optionals %w[ transaction_id payment_id memo original_amount applied_amount gateway_transaction_id ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
105 106 107 108 109 110 111 |
# File 'lib/advanced_billing/models/invoice_refund.rb', line 105 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |