Class: ShellCardManagementApIs::CardBundle

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_card_management_ap_is/models/card_bundle.rb

Overview

CardBundle Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(bundle_id = SKIP, external_bundle_id = SKIP, description = SKIP, total_cards = SKIP) ⇒ CardBundle

Returns a new instance of CardBundle.



53
54
55
56
57
58
59
# File 'lib/shell_card_management_ap_is/models/card_bundle.rb', line 53

def initialize(bundle_id = SKIP, external_bundle_id = SKIP,
               description = SKIP, total_cards = SKIP)
  @bundle_id = bundle_id unless bundle_id == SKIP
  @external_bundle_id = external_bundle_id unless external_bundle_id == SKIP
  @description = description unless description == SKIP
  @total_cards = total_cards unless total_cards == SKIP
end

Instance Attribute Details

#bundle_idString

Unique identifier for the Card Bundle

Returns:

  • (String)


14
15
16
# File 'lib/shell_card_management_ap_is/models/card_bundle.rb', line 14

def bundle_id
  @bundle_id
end

#descriptionString

DescriptionCard Bundle Description.

Returns:

  • (String)


22
23
24
# File 'lib/shell_card_management_ap_is/models/card_bundle.rb', line 22

def description
  @description
end

#external_bundle_idString

External system allocated Card Bundle identifier for Card Bundle.

Returns:

  • (String)


18
19
20
# File 'lib/shell_card_management_ap_is/models/card_bundle.rb', line 18

def external_bundle_id
  @external_bundle_id
end

#total_cardsInteger

No of Card PAN added to the card bundle.

Returns:

  • (Integer)


26
27
28
# File 'lib/shell_card_management_ap_is/models/card_bundle.rb', line 26

def total_cards
  @total_cards
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
# File 'lib/shell_card_management_ap_is/models/card_bundle.rb', line 62

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  bundle_id = hash.key?('BundleId') ? hash['BundleId'] : SKIP
  external_bundle_id =
    hash.key?('ExternalBundleId') ? hash['ExternalBundleId'] : SKIP
  description = hash.key?('Description') ? hash['Description'] : SKIP
  total_cards = hash.key?('TotalCards') ? hash['TotalCards'] : SKIP

  # Create object from extracted values.
  CardBundle.new(bundle_id,
                 external_bundle_id,
                 description,
                 total_cards)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/shell_card_management_ap_is/models/card_bundle.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['bundle_id'] = 'BundleId'
  @_hash['external_bundle_id'] = 'ExternalBundleId'
  @_hash['description'] = 'Description'
  @_hash['total_cards'] = 'TotalCards'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
# File 'lib/shell_card_management_ap_is/models/card_bundle.rb', line 49

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
42
43
44
45
46
# File 'lib/shell_card_management_ap_is/models/card_bundle.rb', line 39

def self.optionals
  %w[
    bundle_id
    external_bundle_id
    description
    total_cards
  ]
end