Class: ShellCardManagementApIs::UpdateCardStatusRequest

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

Overview

UpdateStatus Request

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(cards = nil, target_status = nil, reason_id = SKIP, reason_text = SKIP) ⇒ UpdateCardStatusRequest

Returns a new instance of UpdateCardStatusRequest.



88
89
90
91
92
93
94
# File 'lib/shell_card_management_ap_is/models/update_card_status_request.rb', line 88

def initialize(cards = nil, target_status = nil, reason_id = SKIP,
               reason_text = SKIP)
  @cards = cards
  @reason_id = reason_id unless reason_id == SKIP
  @reason_text = reason_text unless reason_text == SKIP
  @target_status = target_status
end

Instance Attribute Details

#cardsArray[UpdateCard]

List of UpdateCardRequest entity. Each card in the list will be updated to the given target status. The details of the entity are given below.

Returns:



15
16
17
# File 'lib/shell_card_management_ap_is/models/update_card_status_request.rb', line 15

def cards
  @cards
end

#reason_idInteger

Reason id for updating the card status.<br /> Optional<br /> Either Reason ID or Text is madatory when TargetStatus is ‘Block’ or ‘Damaged’. Else ignored.<br /> Possible values:<br /> -Lost <br /> -Stolen <br /> -Card no longer required<br /> When passed, the reason Id will be validated with the allowed reason ids configured for the card type of the card.<br /> . If the given reason Id is not allowed for certain card types, then the request will be rejected as invalid ResonId.

Returns:

  • (Integer)


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

def reason_id
  @reason_id
end

#reason_textString

Reason text for updating the card status.<br /> Optional Either Reason ID or Text is madatory when TargetStatus is ‘Block’ or ‘Damaged’. Else ignored.<br /> Possible values:<br /> -Lost <br /> -Stolen <br /> -Card no longer required <br />

Optional – However, either Reason ID or Text is madatory when

TargetStatus is ‘Block’ or ‘Damaged’.<br />

When Reason Text is passed and the Target Status is either Block or

Damaged, the text will be validated with the allowed list of values configured for the card type of the card.<br />

If the text is not allowed, request will be rejected as invaid

ResonText.<br />

Note:<br />
Customer blocked’ will be used as the reason for ‘Temporary Block’.

Returns:

  • (String)


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

def reason_text
  @reason_text
end

#target_statusString

The list of cards passed in Cards parameter will be updated to this status.<br /> Mandatory<br /> Allowed values:<br /> -TemporaryBlock<br /> -Unblock<br /> -Block<br /> -Damaged<br />

Returns:

  • (String)


60
61
62
# File 'lib/shell_card_management_ap_is/models/update_card_status_request.rb', line 60

def target_status
  @target_status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/shell_card_management_ap_is/models/update_card_status_request.rb', line 97

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  # Parameter is an array, so we need to iterate through it
  cards = nil
  unless hash['Cards'].nil?
    cards = []
    hash['Cards'].each do |structure|
      cards << (UpdateCard.from_hash(structure) if structure)
    end
  end

  cards = nil unless hash.key?('Cards')
  target_status = hash.key?('TargetStatus') ? hash['TargetStatus'] : nil
  reason_id = hash.key?('ReasonId') ? hash['ReasonId'] : SKIP
  reason_text = hash.key?('ReasonText') ? hash['ReasonText'] : SKIP

  # Create object from extracted values.
  UpdateCardStatusRequest.new(cards,
                              target_status,
                              reason_id,
                              reason_text)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['cards'] = 'Cards'
  @_hash['reason_id'] = 'ReasonId'
  @_hash['reason_text'] = 'ReasonText'
  @_hash['target_status'] = 'TargetStatus'
  @_hash
end

.nullablesObject

An array for nullable fields



81
82
83
84
85
86
# File 'lib/shell_card_management_ap_is/models/update_card_status_request.rb', line 81

def self.nullables
  %w[
    reason_id
    reason_text
  ]
end

.optionalsObject

An array for optional fields



73
74
75
76
77
78
# File 'lib/shell_card_management_ap_is/models/update_card_status_request.rb', line 73

def self.optionals
  %w[
    reason_id
    reason_text
  ]
end