Class: AdvancedBilling::InvoicePaymentApplication

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/advanced_billing/models/invoice_payment_application.rb

Overview

InvoicePaymentApplication Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(invoice_uid: SKIP, application_uid: SKIP, applied_amount: SKIP, additional_properties: {}) ⇒ InvoicePaymentApplication

Returns a new instance of InvoicePaymentApplication.



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/advanced_billing/models/invoice_payment_application.rb', line 49

def initialize(invoice_uid: SKIP, application_uid: SKIP,
               applied_amount: SKIP, additional_properties: {})
  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end

  @invoice_uid = invoice_uid unless invoice_uid == SKIP
  @application_uid = application_uid unless application_uid == SKIP
  @applied_amount = applied_amount unless applied_amount == SKIP
end

Instance Attribute Details

#application_uidString

Unique identifier for the payment. It has the prefix “pmt_” followed by alphanumeric characters.

Returns:

  • (String)


20
21
22
# File 'lib/advanced_billing/models/invoice_payment_application.rb', line 20

def application_uid
  @application_uid
end

#applied_amountString

Dollar amount of the paid invoice.

Returns:

  • (String)


24
25
26
# File 'lib/advanced_billing/models/invoice_payment_application.rb', line 24

def applied_amount
  @applied_amount
end

#invoice_uidString

Unique identifier for the paid invoice. It has the prefix “inv_” followed by alphanumeric characters.

Returns:

  • (String)


15
16
17
# File 'lib/advanced_billing/models/invoice_payment_application.rb', line 15

def invoice_uid
  @invoice_uid
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/advanced_billing/models/invoice_payment_application.rb', line 62

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  invoice_uid = hash.key?('invoice_uid') ? hash['invoice_uid'] : SKIP
  application_uid =
    hash.key?('application_uid') ? hash['application_uid'] : SKIP
  applied_amount =
    hash.key?('applied_amount') ? hash['applied_amount'] : SKIP

  # Clean out expected properties from Hash.
  additional_properties = hash.reject { |k, _| names.value?(k) }

  # Create object from extracted values.
  InvoicePaymentApplication.new(invoice_uid: invoice_uid,
                                application_uid: application_uid,
                                applied_amount: applied_amount,
                                additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



27
28
29
30
31
32
33
# File 'lib/advanced_billing/models/invoice_payment_application.rb', line 27

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['invoice_uid'] = 'invoice_uid'
  @_hash['application_uid'] = 'application_uid'
  @_hash['applied_amount'] = 'applied_amount'
  @_hash
end

.nullablesObject

An array for nullable fields



45
46
47
# File 'lib/advanced_billing/models/invoice_payment_application.rb', line 45

def self.nullables
  []
end

.optionalsObject

An array for optional fields



36
37
38
39
40
41
42
# File 'lib/advanced_billing/models/invoice_payment_application.rb', line 36

def self.optionals
  %w[
    invoice_uid
    application_uid
    applied_amount
  ]
end