Class: ShellCardManagementApIs::CardManagementV1CancelRequest

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

Overview

CardManagementV1CancelRequest Model.

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, reason_id = SKIP, reason_text = SKIP) ⇒ CardManagementV1CancelRequest

Returns a new instance of CardManagementV1CancelRequest.



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

def initialize(cards = 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
end

Instance Attribute Details

#cardsArray[UpdateCard]

List of CancelCardRequest entity. Each card in the list will be Cancelled. The details of the entity are given below.

Returns:



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

def cards
  @cards
end

#reason_idInteger

Reason id for cancelling the card.<br /> Optional if ReasonText is passed, else mandatory<br /> When passed, the reason Id will be validated with the allowed reason id’s configured for the card type of the card.<br /> If the reason Id is not allowed, then it will be included on the error cards response. Possible values: 1 (Lost) 2 (Stolen) 3 (Card no longer required)

Returns:

  • (Integer)


29
30
31
# File 'lib/shell_card_management_ap_is/models/card_management_v1_cancel_request.rb', line 29

def reason_id
  @reason_id
end

#reason_textString

Reason text for cancelling the card.<br /> Optional if ReasonId is passed, else mandatory<br /> When Reason Id is not known to the client, the reason text can be passed.<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. If the text is not allowed, then it will be included on the error cards response. However, if the Target status is Temporary block or Unblock then the text will be submitted Possible Values: 1) Lost 2) Stolen 3) Card no longer required

Returns:

  • (String)


47
48
49
# File 'lib/shell_card_management_ap_is/models/card_management_v1_cancel_request.rb', line 47

def reason_text
  @reason_text
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/shell_card_management_ap_is/models/card_management_v1_cancel_request.rb', line 81

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')
  reason_id = hash.key?('ReasonId') ? hash['ReasonId'] : SKIP
  reason_text = hash.key?('ReasonText') ? hash['ReasonText'] : SKIP

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

.namesObject

A mapping from model property names to API property names.



50
51
52
53
54
55
56
# File 'lib/shell_card_management_ap_is/models/card_management_v1_cancel_request.rb', line 50

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

.nullablesObject

An array for nullable fields



67
68
69
70
71
72
# File 'lib/shell_card_management_ap_is/models/card_management_v1_cancel_request.rb', line 67

def self.nullables
  %w[
    reason_id
    reason_text
  ]
end

.optionalsObject

An array for optional fields



59
60
61
62
63
64
# File 'lib/shell_card_management_ap_is/models/card_management_v1_cancel_request.rb', line 59

def self.optionals
  %w[
    reason_id
    reason_text
  ]
end