Class: AdvancedBilling::InvoicePaymentMethod

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

Overview

InvoicePaymentMethod Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(details: SKIP, kind: SKIP, memo: SKIP, type: SKIP, card_brand: SKIP, card_expiration: SKIP, last_four: SKIP, masked_card_number: SKIP, additional_properties: {}) ⇒ InvoicePaymentMethod

Returns a new instance of InvoicePaymentMethod.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/advanced_billing/models/invoice_payment_method.rb', line 79

def initialize(details: SKIP, kind: SKIP, memo: SKIP, type: SKIP,
               card_brand: SKIP, card_expiration: SKIP, last_four: SKIP,
               masked_card_number: SKIP, additional_properties: {})
  @details = details unless details == SKIP
  @kind = kind unless kind == SKIP
  @memo = memo unless memo == SKIP
  @type = type unless type == SKIP
  @card_brand = card_brand unless card_brand == SKIP
  @card_expiration = card_expiration unless card_expiration == SKIP
  @last_four = last_four unless last_four == SKIP
  @masked_card_number = masked_card_number unless masked_card_number == SKIP

  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end
end

Instance Attribute Details

#card_brandString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/advanced_billing/models/invoice_payment_method.rb', line 30

def card_brand
  @card_brand
end

#card_expirationString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/advanced_billing/models/invoice_payment_method.rb', line 34

def card_expiration
  @card_expiration
end

#detailsString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/advanced_billing/models/invoice_payment_method.rb', line 14

def details
  @details
end

#kindString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/advanced_billing/models/invoice_payment_method.rb', line 18

def kind
  @kind
end

#last_fourString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/advanced_billing/models/invoice_payment_method.rb', line 38

def last_four
  @last_four
end

#masked_card_numberString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/advanced_billing/models/invoice_payment_method.rb', line 42

def masked_card_number
  @masked_card_number
end

#memoString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/advanced_billing/models/invoice_payment_method.rb', line 22

def memo
  @memo
end

#typeString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/advanced_billing/models/invoice_payment_method.rb', line 26

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
126
# File 'lib/advanced_billing/models/invoice_payment_method.rb', line 98

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  details = hash.key?('details') ? hash['details'] : SKIP
  kind = hash.key?('kind') ? hash['kind'] : SKIP
  memo = hash.key?('memo') ? hash['memo'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP
  card_brand = hash.key?('card_brand') ? hash['card_brand'] : SKIP
  card_expiration =
    hash.key?('card_expiration') ? hash['card_expiration'] : SKIP
  last_four = hash.key?('last_four') ? hash['last_four'] : SKIP
  masked_card_number =
    hash.key?('masked_card_number') ? hash['masked_card_number'] : SKIP

  # Clean out expected properties from Hash.
  names.each_value { |k| hash.delete(k) }

  # Create object from extracted values.
  InvoicePaymentMethod.new(details: details,
                           kind: kind,
                           memo: memo,
                           type: type,
                           card_brand: card_brand,
                           card_expiration: card_expiration,
                           last_four: last_four,
                           masked_card_number: masked_card_number,
                           additional_properties: hash)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/advanced_billing/models/invoice_payment_method.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['details'] = 'details'
  @_hash['kind'] = 'kind'
  @_hash['memo'] = 'memo'
  @_hash['type'] = 'type'
  @_hash['card_brand'] = 'card_brand'
  @_hash['card_expiration'] = 'card_expiration'
  @_hash['last_four'] = 'last_four'
  @_hash['masked_card_number'] = 'masked_card_number'
  @_hash
end

.nullablesObject

An array for nullable fields



73
74
75
76
77
# File 'lib/advanced_billing/models/invoice_payment_method.rb', line 73

def self.nullables
  %w[
    last_four
  ]
end

.optionalsObject

An array for optional fields



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/advanced_billing/models/invoice_payment_method.rb', line 59

def self.optionals
  %w[
    details
    kind
    memo
    type
    card_brand
    card_expiration
    last_four
    masked_card_number
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



130
131
132
133
134
135
136
# File 'lib/advanced_billing/models/invoice_payment_method.rb', line 130

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end