Class: ShellCardManagementApIs::CancelCardRequest

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

Overview

This entity models the data that is sent in the http request body of this operation.

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) ⇒ CancelCardRequest

Returns a new instance of CancelCardRequest.



75
76
77
78
79
# File 'lib/shell_card_management_ap_is/models/cancel_card_request.rb', line 75

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:



17
18
19
# File 'lib/shell_card_management_ap_is/models/cancel_card_request.rb', line 17

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)


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

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)


48
49
50
# File 'lib/shell_card_management_ap_is/models/cancel_card_request.rb', line 48

def reason_text
  @reason_text
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

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.
  CancelCardRequest.new(cards,
                        reason_id,
                        reason_text)
end

.namesObject

A mapping from model property names to API property names.



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

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



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

def self.nullables
  %w[
    reason_id
    reason_text
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    reason_id
    reason_text
  ]
end