Class: AdminApi::Card

Inherits:
Object
  • Object
show all
Defined in:
lib/admin_api/models/card.rb

Overview

Card Object

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Card

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/admin_api/models/card.rb', line 176

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.has_key?(:'address')
    if (value = attributes[:'address']).is_a?(Array)
      self.address = value
    end
  end

  if attributes.has_key?(:'business_id')
    self.business_id = attributes[:'business_id']
  end

  if attributes.has_key?(:'card_holder_name')
    self.card_holder_name = attributes[:'card_holder_name']
  end

  if attributes.has_key?(:'card_image')
    self.card_image = attributes[:'card_image']
  end

  if attributes.has_key?(:'card_issuance')
    self.card_issuance = attributes[:'card_issuance']
  end

  if attributes.has_key?(:'card_name')
    self.card_name = attributes[:'card_name']
  end

  if attributes.has_key?(:'card_network')
    self.card_network = attributes[:'card_network']
  end

  if attributes.has_key?(:'card_program_id')
    self.card_program_id = attributes[:'card_program_id']
  end

  if attributes.has_key?(:'card_type')
    self.card_type = attributes[:'card_type']
  end

  if attributes.has_key?(:'client_id')
    self.client_id = attributes[:'client_id']
  end

  if attributes.has_key?(:'create_date')
    self.create_date = attributes[:'create_date']
  end

  if attributes.has_key?(:'credit_limit')
    self.credit_limit = attributes[:'credit_limit']
  end

  if attributes.has_key?(:'currency_code')
    self.currency_code = attributes[:'currency_code']
  end

  if attributes.has_key?(:'expiry_date')
    self.expiry_date = attributes[:'expiry_date']
  end

  if attributes.has_key?(:'fulfillment')
    self.fulfillment = attributes[:'fulfillment']
  end

  if attributes.has_key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.has_key?(:'institution_id')
    self.institution_id = attributes[:'institution_id']
  end

  if attributes.has_key?(:'institution_name')
    self.institution_name = attributes[:'institution_name']
  end

  if attributes.has_key?(:'is_active')
    self.is_active = attributes[:'is_active']
  end

  if attributes.has_key?(:'is_pin_set')
    self.is_pin_set = attributes[:'is_pin_set']
  end

  if attributes.has_key?(:'is_primary')
    self.is_primary = attributes[:'is_primary']
  end

  if attributes.has_key?(:'is_reloadable')
    self.is_reloadable = attributes[:'is_reloadable']
  end

  if attributes.has_key?(:'mask')
    self.mask = attributes[:'mask']
  end

  if attributes.has_key?(:'metadata')
    if (value = attributes[:'metadata']).is_a?(Hash)
      self. = value
    end
  end

  if attributes.has_key?(:'phone_number')
    self.phone_number = attributes[:'phone_number']
  end

  if attributes.has_key?(:'portfolio_id')
    self.portfolio_id = attributes[:'portfolio_id']
  end

  if attributes.has_key?(:'prepaid_amount')
    self.prepaid_amount = attributes[:'prepaid_amount']
  end

  if attributes.has_key?(:'secondary_id')
    self.secondary_id = attributes[:'secondary_id']
  end

  if attributes.has_key?(:'status')
    self.status = attributes[:'status']
  end

  if attributes.has_key?(:'update_date')
    self.update_date = attributes[:'update_date']
  end
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.



18
19
20
# File 'lib/admin_api/models/card.rb', line 18

def address
  @address
end

#business_idObject

businessId



21
22
23
# File 'lib/admin_api/models/card.rb', line 21

def business_id
  @business_id
end

#card_holder_nameObject

cardHolderName



24
25
26
# File 'lib/admin_api/models/card.rb', line 24

def card_holder_name
  @card_holder_name
end

#card_imageObject

card_image



27
28
29
# File 'lib/admin_api/models/card.rb', line 27

def card_image
  @card_image
end

#card_issuanceObject

cardIssuance



30
31
32
# File 'lib/admin_api/models/card.rb', line 30

def card_issuance
  @card_issuance
end

#card_nameObject

cardName



33
34
35
# File 'lib/admin_api/models/card.rb', line 33

def card_name
  @card_name
end

#card_networkObject

cardNetwork



36
37
38
# File 'lib/admin_api/models/card.rb', line 36

def card_network
  @card_network
end

#card_program_idObject

cardProgramId



39
40
41
# File 'lib/admin_api/models/card.rb', line 39

def card_program_id
  @card_program_id
end

#card_typeObject

cardType



42
43
44
# File 'lib/admin_api/models/card.rb', line 42

def card_type
  @card_type
end

#client_idObject

clientId



45
46
47
# File 'lib/admin_api/models/card.rb', line 45

def client_id
  @client_id
end

#create_dateObject

Returns the value of attribute create_date.



47
48
49
# File 'lib/admin_api/models/card.rb', line 47

def create_date
  @create_date
end

#credit_limitObject

creditLimit



50
51
52
# File 'lib/admin_api/models/card.rb', line 50

def credit_limit
  @credit_limit
end

#currency_codeObject

currencyCode



53
54
55
# File 'lib/admin_api/models/card.rb', line 53

def currency_code
  @currency_code
end

#expiry_dateObject

expiryDate



56
57
58
# File 'lib/admin_api/models/card.rb', line 56

def expiry_date
  @expiry_date
end

#fulfillmentObject

fulfillment



59
60
61
# File 'lib/admin_api/models/card.rb', line 59

def fulfillment
  @fulfillment
end

#idObject

Returns the value of attribute id.



61
62
63
# File 'lib/admin_api/models/card.rb', line 61

def id
  @id
end

#institution_idObject

institutionId



64
65
66
# File 'lib/admin_api/models/card.rb', line 64

def institution_id
  @institution_id
end

#institution_nameObject

institutionName



67
68
69
# File 'lib/admin_api/models/card.rb', line 67

def institution_name
  @institution_name
end

#is_activeObject

is_active



70
71
72
# File 'lib/admin_api/models/card.rb', line 70

def is_active
  @is_active
end

#is_pin_setObject

is_pin_set



73
74
75
# File 'lib/admin_api/models/card.rb', line 73

def is_pin_set
  @is_pin_set
end

#is_primaryObject

is_primary



76
77
78
# File 'lib/admin_api/models/card.rb', line 76

def is_primary
  @is_primary
end

#is_reloadableObject

is_reloadable



79
80
81
# File 'lib/admin_api/models/card.rb', line 79

def is_reloadable
  @is_reloadable
end

#maskObject

mask



82
83
84
# File 'lib/admin_api/models/card.rb', line 82

def mask
  @mask
end

#metadataObject

Returns the value of attribute metadata.



84
85
86
# File 'lib/admin_api/models/card.rb', line 84

def 
  @metadata
end

#phone_numberObject

phoneNumber



87
88
89
# File 'lib/admin_api/models/card.rb', line 87

def phone_number
  @phone_number
end

#portfolio_idObject

portfolioId



90
91
92
# File 'lib/admin_api/models/card.rb', line 90

def portfolio_id
  @portfolio_id
end

#prepaid_amountObject

prepaidAmount



93
94
95
# File 'lib/admin_api/models/card.rb', line 93

def prepaid_amount
  @prepaid_amount
end

#secondary_idObject

Returns the value of attribute secondary_id.



95
96
97
# File 'lib/admin_api/models/card.rb', line 95

def secondary_id
  @secondary_id
end

#statusObject

status



98
99
100
# File 'lib/admin_api/models/card.rb', line 98

def status
  @status
end

#update_dateObject

Returns the value of attribute update_date.



100
101
102
# File 'lib/admin_api/models/card.rb', line 100

def update_date
  @update_date
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/admin_api/models/card.rb', line 103

def self.attribute_map
  {
    :'address' => :'address',
    :'business_id' => :'business_id',
    :'card_holder_name' => :'card_holder_name',
    :'card_image' => :'card_image',
    :'card_issuance' => :'card_issuance',
    :'card_name' => :'card_name',
    :'card_network' => :'card_network',
    :'card_program_id' => :'card_program_id',
    :'card_type' => :'card_type',
    :'client_id' => :'client_id',
    :'create_date' => :'create_date',
    :'credit_limit' => :'credit_limit',
    :'currency_code' => :'currency_code',
    :'expiry_date' => :'expiry_date',
    :'fulfillment' => :'fulfillment',
    :'id' => :'id',
    :'institution_id' => :'institution_id',
    :'institution_name' => :'institution_name',
    :'is_active' => :'is_active',
    :'is_pin_set' => :'is_pin_set',
    :'is_primary' => :'is_primary',
    :'is_reloadable' => :'is_reloadable',
    :'mask' => :'mask',
    :'metadata' => :'metadata',
    :'phone_number' => :'phone_number',
    :'portfolio_id' => :'portfolio_id',
    :'prepaid_amount' => :'prepaid_amount',
    :'secondary_id' => :'secondary_id',
    :'status' => :'status',
    :'update_date' => :'update_date'
  }
end

.swagger_typesObject

Attribute type mapping.



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/admin_api/models/card.rb', line 139

def self.swagger_types
  {
    :'address' => :'Array<CardAddress>',
    :'business_id' => :'String',
    :'card_holder_name' => :'String',
    :'card_image' => :'String',
    :'card_issuance' => :'String',
    :'card_name' => :'String',
    :'card_network' => :'String',
    :'card_program_id' => :'String',
    :'card_type' => :'String',
    :'client_id' => :'String',
    :'create_date' => :'DateTime',
    :'credit_limit' => :'Float',
    :'currency_code' => :'String',
    :'expiry_date' => :'Date',
    :'fulfillment' => :'String',
    :'id' => :'String',
    :'institution_id' => :'String',
    :'institution_name' => :'String',
    :'is_active' => :'BOOLEAN',
    :'is_pin_set' => :'BOOLEAN',
    :'is_primary' => :'BOOLEAN',
    :'is_reloadable' => :'BOOLEAN',
    :'mask' => :'String',
    :'metadata' => :'Hash<String, String>',
    :'phone_number' => :'String',
    :'portfolio_id' => :'String',
    :'prepaid_amount' => :'Float',
    :'secondary_id' => :'String',
    :'status' => :'String',
    :'update_date' => :'DateTime'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
# File 'lib/admin_api/models/card.rb', line 347

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      address == o.address &&
      business_id == o.business_id &&
      card_holder_name == o.card_holder_name &&
      card_image == o.card_image &&
      card_issuance == o.card_issuance &&
      card_name == o.card_name &&
      card_network == o.card_network &&
      card_program_id == o.card_program_id &&
      card_type == o.card_type &&
      client_id == o.client_id &&
      create_date == o.create_date &&
      credit_limit == o.credit_limit &&
      currency_code == o.currency_code &&
      expiry_date == o.expiry_date &&
      fulfillment == o.fulfillment &&
      id == o.id &&
      institution_id == o.institution_id &&
      institution_name == o.institution_name &&
      is_active == o.is_active &&
      is_pin_set == o.is_pin_set &&
      is_primary == o.is_primary &&
      is_reloadable == o.is_reloadable &&
      mask == o.mask &&
       == o. &&
      phone_number == o.phone_number &&
      portfolio_id == o.portfolio_id &&
      prepaid_amount == o.prepaid_amount &&
      secondary_id == o.secondary_id &&
      status == o.status &&
      update_date == o.update_date
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
# File 'lib/admin_api/models/card.rb', line 418

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = AdminApi.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



484
485
486
487
488
489
490
491
492
493
494
495
496
# File 'lib/admin_api/models/card.rb', line 484

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
# File 'lib/admin_api/models/card.rb', line 397

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


384
385
386
# File 'lib/admin_api/models/card.rb', line 384

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



390
391
392
# File 'lib/admin_api/models/card.rb', line 390

def hash
  [address, business_id, card_holder_name, card_image, card_issuance, card_name, card_network, card_program_id, card_type, client_id, create_date, credit_limit, currency_code, expiry_date, fulfillment, id, institution_id, institution_name, is_active, is_pin_set, is_primary, is_reloadable, mask, , phone_number, portfolio_id, prepaid_amount, secondary_id, status, update_date].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/admin_api/models/card.rb', line 309

def list_invalid_properties
  invalid_properties = Array.new
  if @card_holder_name.nil?
    invalid_properties.push('invalid value for "card_holder_name", card_holder_name cannot be nil.')
  end

  if @card_issuance.nil?
    invalid_properties.push('invalid value for "card_issuance", card_issuance cannot be nil.')
  end

  if @card_name.nil?
    invalid_properties.push('invalid value for "card_name", card_name cannot be nil.')
  end

  if @card_type.nil?
    invalid_properties.push('invalid value for "card_type", card_type cannot be nil.')
  end

  if @portfolio_id.nil?
    invalid_properties.push('invalid value for "portfolio_id", portfolio_id cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



464
465
466
# File 'lib/admin_api/models/card.rb', line 464

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



470
471
472
473
474
475
476
477
478
# File 'lib/admin_api/models/card.rb', line 470

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



458
459
460
# File 'lib/admin_api/models/card.rb', line 458

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



336
337
338
339
340
341
342
343
# File 'lib/admin_api/models/card.rb', line 336

def valid?
  return false if @card_holder_name.nil?
  return false if @card_issuance.nil?
  return false if @card_name.nil?
  return false if @card_type.nil?
  return false if @portfolio_id.nil?
  true
end