Class: ShellCardManagementApIs::DeliveryAddressUpdate

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

Overview

List of cards for delivery address update. Maximum number of cards that can be provided in the list is 50

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(use_customer_default_address = nil, card_id = SKIP, pan = SKIP, card_expiry_date = SKIP, update_card_renewal_address = SKIP) ⇒ DeliveryAddressUpdate

Returns a new instance of DeliveryAddressUpdate.



78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/shell_card_management_ap_is/models/delivery_address_update.rb', line 78

def initialize(use_customer_default_address = nil, card_id = SKIP,
               pan = SKIP, card_expiry_date = SKIP,
               update_card_renewal_address = SKIP)
  @card_id = card_id unless card_id == SKIP
  @pan = pan unless pan == SKIP
  @card_expiry_date = card_expiry_date unless card_expiry_date == SKIP
  @use_customer_default_address = use_customer_default_address
  unless update_card_renewal_address == SKIP
    @update_card_renewal_address =
      update_card_renewal_address
  end
end

Instance Attribute Details

#card_expiry_dateString

Expiry date of the card. Mandatory if PAN is passed, else optional. Format: yyyyMMdd

Returns:

  • (String)


30
31
32
# File 'lib/shell_card_management_ap_is/models/delivery_address_update.rb', line 30

def card_expiry_date
  @card_expiry_date
end

#card_idInteger

Card Id of the card. Optional if PAN is passed, else Mandatory.

Returns:

  • (Integer)


16
17
18
# File 'lib/shell_card_management_ap_is/models/delivery_address_update.rb', line 16

def card_id
  @card_id
end

#panString

PAN of the card. Optional if CardId is passed, else Mandatory. Note: - PAN & ExpiryDate parameters will be considered only if CardId & PANID are not provided.

Returns:

  • (String)


24
25
26
# File 'lib/shell_card_management_ap_is/models/delivery_address_update.rb', line 24

def pan
  @pan
end

#update_card_renewal_addressUpdateCardRenewalAddress2

Whether to use the default delivery address configured at customer (or card group) level as the delivery address for this card. Mandatory Note: If value is false then ‘UpdateCardRenewalAddress’ is mandatory. If value set to ‘True’ then ‘UpdateCardRenewalAddress’ may be null/empty. It will be ignored if provided.



50
51
52
# File 'lib/shell_card_management_ap_is/models/delivery_address_update.rb', line 50

def update_card_renewal_address
  @update_card_renewal_address
end

#use_customer_default_addressTrueClass | FalseClass

Whether to use the default delivery address configured at customer (or card group) level as the delivery address for this card. Mandatory Note: If value is false then ‘UpdateCardRenewalAddress’ is mandatory. If value set to ‘True’ then ‘UpdateCardRenewalAddress’ may be null/empty. It will be ignored if provided.

Returns:

  • (TrueClass | FalseClass)


40
41
42
# File 'lib/shell_card_management_ap_is/models/delivery_address_update.rb', line 40

def use_customer_default_address
  @use_customer_default_address
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/shell_card_management_ap_is/models/delivery_address_update.rb', line 92

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  use_customer_default_address =
    hash.key?('UseCustomerDefaultAddress') ? hash['UseCustomerDefaultAddress'] : nil
  card_id = hash.key?('CardId') ? hash['CardId'] : SKIP
  pan = hash.key?('PAN') ? hash['PAN'] : SKIP
  card_expiry_date =
    hash.key?('CardExpiryDate') ? hash['CardExpiryDate'] : SKIP
  if hash['UpdateCardRenewalAddress']
    update_card_renewal_address = UpdateCardRenewalAddress2.from_hash(hash['UpdateCardRenewalAddress'])
  end

  # Create object from extracted values.
  DeliveryAddressUpdate.new(use_customer_default_address,
                            card_id,
                            pan,
                            card_expiry_date,
                            update_card_renewal_address)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['card_id'] = 'CardId'
  @_hash['pan'] = 'PAN'
  @_hash['card_expiry_date'] = 'CardExpiryDate'
  @_hash['use_customer_default_address'] = 'UseCustomerDefaultAddress'
  @_hash['update_card_renewal_address'] = 'UpdateCardRenewalAddress'
  @_hash
end

.nullablesObject

An array for nullable fields



74
75
76
# File 'lib/shell_card_management_ap_is/models/delivery_address_update.rb', line 74

def self.nullables
  []
end

.optionalsObject

An array for optional fields



64
65
66
67
68
69
70
71
# File 'lib/shell_card_management_ap_is/models/delivery_address_update.rb', line 64

def self.optionals
  %w[
    card_id
    pan
    card_expiry_date
    update_card_renewal_address
  ]
end