Class: AdvancedBilling::PaymentMethodNestedData

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

Overview

A nested data structure detailing the method of payment

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(type = 'apple_pay', masked_account_number = SKIP, masked_routing_number = SKIP, card_brand = SKIP, card_expiration = SKIP, last_four = SKIP, masked_card_number = SKIP, details = SKIP, kind = SKIP, memo = SKIP, email = SKIP) ⇒ PaymentMethodNestedData

Returns a new instance of PaymentMethodNestedData.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/advanced_billing/models/payment_method_nested_data.rb', line 97

def initialize(type = 'apple_pay',  = SKIP,
               masked_routing_number = SKIP, card_brand = SKIP,
               card_expiration = SKIP, last_four = SKIP,
               masked_card_number = SKIP, details = SKIP, kind = SKIP,
               memo = SKIP, email = SKIP)
  @type = type unless type == SKIP
  @masked_account_number =  unless  == SKIP
  @masked_routing_number = masked_routing_number unless masked_routing_number == 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
  @details = details unless details == SKIP
  @kind = kind unless kind == SKIP
  @memo = memo unless memo == SKIP
  @email = email unless email == SKIP
end

Instance Attribute Details

#card_brandString

TODO: Write general description for this method

Returns:

  • (String)


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

def card_brand
  @card_brand
end

#card_expirationString

TODO: Write general description for this method

Returns:

  • (String)


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

def card_expiration
  @card_expiration
end

#detailsString

TODO: Write general description for this method

Returns:

  • (String)


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

def details
  @details
end

#emailString

TODO: Write general description for this method

Returns:

  • (String)


54
55
56
# File 'lib/advanced_billing/models/payment_method_nested_data.rb', line 54

def email
  @email
end

#kindString

TODO: Write general description for this method

Returns:

  • (String)


46
47
48
# File 'lib/advanced_billing/models/payment_method_nested_data.rb', line 46

def kind
  @kind
end

#last_fourString

TODO: Write general description for this method

Returns:

  • (String)


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

def last_four
  @last_four
end

#masked_account_numberString

TODO: Write general description for this method

Returns:

  • (String)


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

def 
  @masked_account_number
end

#masked_card_numberString

TODO: Write general description for this method

Returns:

  • (String)


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

def masked_card_number
  @masked_card_number
end

#masked_routing_numberString

TODO: Write general description for this method

Returns:

  • (String)


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

def masked_routing_number
  @masked_routing_number
end

#memoString

TODO: Write general description for this method

Returns:

  • (String)


50
51
52
# File 'lib/advanced_billing/models/payment_method_nested_data.rb', line 50

def memo
  @memo
end

#typeString

TODO: Write general description for this method

Returns:

  • (String)


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

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
142
143
144
145
146
147
148
# File 'lib/advanced_billing/models/payment_method_nested_data.rb', line 116

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  type = hash['type'] ||= 'apple_pay'
   =
    hash.key?('masked_account_number') ? hash['masked_account_number'] : SKIP
  masked_routing_number =
    hash.key?('masked_routing_number') ? hash['masked_routing_number'] : 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
  details = hash.key?('details') ? hash['details'] : SKIP
  kind = hash.key?('kind') ? hash['kind'] : SKIP
  memo = hash.key?('memo') ? hash['memo'] : SKIP
  email = hash.key?('email') ? hash['email'] : SKIP

  # Create object from extracted values.
  PaymentMethodNestedData.new(type,
                              ,
                              masked_routing_number,
                              card_brand,
                              card_expiration,
                              last_four,
                              masked_card_number,
                              details,
                              kind,
                              memo,
                              email)
end

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



91
92
93
94
95
# File 'lib/advanced_billing/models/payment_method_nested_data.rb', line 91

def self.nullables
  %w[
    last_four
  ]
end

.optionalsObject

An array for optional fields



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/advanced_billing/models/payment_method_nested_data.rb', line 74

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