Class: AdvancedBilling::SubscriptionGroupCreditCard

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

Overview

SubscriptionGroupCreditCard Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(full_number: SKIP, expiration_month: SKIP, expiration_year: SKIP, chargify_token: SKIP, vault_token: SKIP, current_vault: SKIP, gateway_handle: SKIP, first_name: SKIP, last_name: SKIP, billing_address: SKIP, billing_address_2: SKIP, billing_city: SKIP, billing_state: SKIP, billing_zip: SKIP, billing_country: SKIP, last_four: SKIP, card_type: SKIP, customer_vault_token: SKIP, cvv: SKIP, payment_type: SKIP, additional_properties: {}) ⇒ SubscriptionGroupCreditCard

Returns a new instance of SubscriptionGroupCreditCard.



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/advanced_billing/models/subscription_group_credit_card.rb', line 160

def initialize(full_number: SKIP, expiration_month: SKIP,
               expiration_year: SKIP, chargify_token: SKIP,
               vault_token: SKIP, current_vault: SKIP, gateway_handle: SKIP,
               first_name: SKIP, last_name: SKIP, billing_address: SKIP,
               billing_address_2: SKIP, billing_city: SKIP,
               billing_state: SKIP, billing_zip: SKIP,
               billing_country: SKIP, last_four: SKIP, card_type: SKIP,
               customer_vault_token: SKIP, cvv: SKIP, payment_type: SKIP,
               additional_properties: {})
  @full_number = full_number unless full_number == SKIP
  @expiration_month = expiration_month unless expiration_month == SKIP
  @expiration_year = expiration_year unless expiration_year == SKIP
  @chargify_token = chargify_token unless chargify_token == SKIP
  @vault_token = vault_token unless vault_token == SKIP
  @current_vault = current_vault unless current_vault == SKIP
  @gateway_handle = gateway_handle unless gateway_handle == SKIP
  @first_name = first_name unless first_name == SKIP
  @last_name = last_name unless last_name == SKIP
  @billing_address = billing_address unless billing_address == SKIP
  @billing_address_2 = billing_address_2 unless billing_address_2 == SKIP
  @billing_city = billing_city unless billing_city == SKIP
  @billing_state = billing_state unless billing_state == SKIP
  @billing_zip = billing_zip unless billing_zip == SKIP
  @billing_country = billing_country unless billing_country == SKIP
  @last_four = last_four unless last_four == SKIP
  @card_type = card_type unless card_type == SKIP
  @customer_vault_token = customer_vault_token unless customer_vault_token == SKIP
  @cvv = cvv unless cvv == SKIP
  @payment_type = payment_type unless payment_type == SKIP

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

Instance Attribute Details

#billing_addressString

The vault that stores the payment profile with the provided ‘vault_token`. Use `bogus` for testing.

Returns:

  • (String)


55
56
57
# File 'lib/advanced_billing/models/subscription_group_credit_card.rb', line 55

def billing_address
  @billing_address
end

#billing_address_2String

The vault that stores the payment profile with the provided ‘vault_token`. Use `bogus` for testing.

Returns:

  • (String)


60
61
62
# File 'lib/advanced_billing/models/subscription_group_credit_card.rb', line 60

def billing_address_2
  @billing_address_2
end

#billing_cityString

The vault that stores the payment profile with the provided ‘vault_token`. Use `bogus` for testing.

Returns:

  • (String)


65
66
67
# File 'lib/advanced_billing/models/subscription_group_credit_card.rb', line 65

def billing_city
  @billing_city
end

#billing_countryString

The vault that stores the payment profile with the provided ‘vault_token`. Use `bogus` for testing.

Returns:

  • (String)


80
81
82
# File 'lib/advanced_billing/models/subscription_group_credit_card.rb', line 80

def billing_country
  @billing_country
end

#billing_stateString

The vault that stores the payment profile with the provided ‘vault_token`. Use `bogus` for testing.

Returns:

  • (String)


70
71
72
# File 'lib/advanced_billing/models/subscription_group_credit_card.rb', line 70

def billing_state
  @billing_state
end

#billing_zipString

The vault that stores the payment profile with the provided ‘vault_token`. Use `bogus` for testing.

Returns:

  • (String)


75
76
77
# File 'lib/advanced_billing/models/subscription_group_credit_card.rb', line 75

def billing_zip
  @billing_zip
end

#card_typeCardType

The type of card used.

Returns:



89
90
91
# File 'lib/advanced_billing/models/subscription_group_credit_card.rb', line 89

def card_type
  @card_type
end

#chargify_tokenString

TODO: Write general description for this method

Returns:

  • (String)


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

def chargify_token
  @chargify_token
end

#current_vaultCreditCardVault

The vault that stores the payment profile with the provided ‘vault_token`. Use `bogus` for testing.

Returns:



35
36
37
# File 'lib/advanced_billing/models/subscription_group_credit_card.rb', line 35

def current_vault
  @current_vault
end

#customer_vault_tokenString

The type of card used.

Returns:

  • (String)


93
94
95
# File 'lib/advanced_billing/models/subscription_group_credit_card.rb', line 93

def customer_vault_token
  @customer_vault_token
end

#cvvString

The type of card used.

Returns:

  • (String)


97
98
99
# File 'lib/advanced_billing/models/subscription_group_credit_card.rb', line 97

def cvv
  @cvv
end

#expiration_monthObject

TODO: Write general description for this method

Returns:

  • (Object)


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

def expiration_month
  @expiration_month
end

#expiration_yearObject

TODO: Write general description for this method

Returns:

  • (Object)


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

def expiration_year
  @expiration_year
end

#first_nameString

The vault that stores the payment profile with the provided ‘vault_token`. Use `bogus` for testing.

Returns:

  • (String)


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

def first_name
  @first_name
end

#full_numberObject

TODO: Write general description for this method

Returns:

  • (Object)


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

def full_number
  @full_number
end

#gateway_handleString

The vault that stores the payment profile with the provided ‘vault_token`. Use `bogus` for testing.

Returns:

  • (String)


40
41
42
# File 'lib/advanced_billing/models/subscription_group_credit_card.rb', line 40

def gateway_handle
  @gateway_handle
end

#last_fourString

The vault that stores the payment profile with the provided ‘vault_token`. Use `bogus` for testing.

Returns:

  • (String)


85
86
87
# File 'lib/advanced_billing/models/subscription_group_credit_card.rb', line 85

def last_four
  @last_four
end

#last_nameString

The vault that stores the payment profile with the provided ‘vault_token`. Use `bogus` for testing.

Returns:

  • (String)


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

def last_name
  @last_name
end

#payment_typeString

The type of card used.

Returns:

  • (String)


101
102
103
# File 'lib/advanced_billing/models/subscription_group_credit_card.rb', line 101

def payment_type
  @payment_type
end

#vault_tokenString

TODO: Write general description for this method

Returns:

  • (String)


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

def vault_token
  @vault_token
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/advanced_billing/models/subscription_group_credit_card.rb', line 197

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  full_number = hash.key?('full_number') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:SubscriptionGroupCreditCardFullNumber), hash['full_number']
  ) : SKIP
  expiration_month = hash.key?('expiration_month') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:SubscriptionGroupCreditCardExpirationMonth), hash['expiration_month']
  ) : SKIP
  expiration_year = hash.key?('expiration_year') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:SubscriptionGroupCreditCardExpirationYear), hash['expiration_year']
  ) : SKIP
  chargify_token =
    hash.key?('chargify_token') ? hash['chargify_token'] : SKIP
  vault_token = hash.key?('vault_token') ? hash['vault_token'] : SKIP
  current_vault = hash.key?('current_vault') ? hash['current_vault'] : SKIP
  gateway_handle =
    hash.key?('gateway_handle') ? hash['gateway_handle'] : SKIP
  first_name = hash.key?('first_name') ? hash['first_name'] : SKIP
  last_name = hash.key?('last_name') ? hash['last_name'] : SKIP
  billing_address =
    hash.key?('billing_address') ? hash['billing_address'] : SKIP
  billing_address_2 =
    hash.key?('billing_address_2') ? hash['billing_address_2'] : SKIP
  billing_city = hash.key?('billing_city') ? hash['billing_city'] : SKIP
  billing_state = hash.key?('billing_state') ? hash['billing_state'] : SKIP
  billing_zip = hash.key?('billing_zip') ? hash['billing_zip'] : SKIP
  billing_country =
    hash.key?('billing_country') ? hash['billing_country'] : SKIP
  last_four = hash.key?('last_four') ? hash['last_four'] : SKIP
  card_type = hash.key?('card_type') ? hash['card_type'] : SKIP
  customer_vault_token =
    hash.key?('customer_vault_token') ? hash['customer_vault_token'] : SKIP
  cvv = hash.key?('cvv') ? hash['cvv'] : SKIP
  payment_type = hash.key?('payment_type') ? hash['payment_type'] : SKIP

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

  # Create object from extracted values.
  SubscriptionGroupCreditCard.new(full_number: full_number,
                                  expiration_month: expiration_month,
                                  expiration_year: expiration_year,
                                  chargify_token: chargify_token,
                                  vault_token: vault_token,
                                  current_vault: current_vault,
                                  gateway_handle: gateway_handle,
                                  first_name: first_name,
                                  last_name: last_name,
                                  billing_address: billing_address,
                                  billing_address_2: billing_address_2,
                                  billing_city: billing_city,
                                  billing_state: billing_state,
                                  billing_zip: billing_zip,
                                  billing_country: billing_country,
                                  last_four: last_four,
                                  card_type: card_type,
                                  customer_vault_token: customer_vault_token,
                                  cvv: cvv,
                                  payment_type: payment_type,
                                  additional_properties: hash)
end

.namesObject

A mapping from model property names to API property names.



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/advanced_billing/models/subscription_group_credit_card.rb', line 104

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['full_number'] = 'full_number'
  @_hash['expiration_month'] = 'expiration_month'
  @_hash['expiration_year'] = 'expiration_year'
  @_hash['chargify_token'] = 'chargify_token'
  @_hash['vault_token'] = 'vault_token'
  @_hash['current_vault'] = 'current_vault'
  @_hash['gateway_handle'] = 'gateway_handle'
  @_hash['first_name'] = 'first_name'
  @_hash['last_name'] = 'last_name'
  @_hash['billing_address'] = 'billing_address'
  @_hash['billing_address_2'] = 'billing_address_2'
  @_hash['billing_city'] = 'billing_city'
  @_hash['billing_state'] = 'billing_state'
  @_hash['billing_zip'] = 'billing_zip'
  @_hash['billing_country'] = 'billing_country'
  @_hash['last_four'] = 'last_four'
  @_hash['card_type'] = 'card_type'
  @_hash['customer_vault_token'] = 'customer_vault_token'
  @_hash['cvv'] = 'cvv'
  @_hash['payment_type'] = 'payment_type'
  @_hash
end

.nullablesObject

An array for nullable fields



156
157
158
# File 'lib/advanced_billing/models/subscription_group_credit_card.rb', line 156

def self.nullables
  []
end

.optionalsObject

An array for optional fields



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/advanced_billing/models/subscription_group_credit_card.rb', line 130

def self.optionals
  %w[
    full_number
    expiration_month
    expiration_year
    chargify_token
    vault_token
    current_vault
    gateway_handle
    first_name
    last_name
    billing_address
    billing_address_2
    billing_city
    billing_state
    billing_zip
    billing_country
    last_four
    card_type
    customer_vault_token
    cvv
    payment_type
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



263
264
265
266
267
268
269
# File 'lib/advanced_billing/models/subscription_group_credit_card.rb', line 263

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

  return false unless value.instance_of? Hash

  true
end