Class: ShellCardManagementApIs::SearchCard

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

Overview

SearchCard

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(card_id = SKIP, pan = SKIP, panid = SKIP) ⇒ SearchCard

Returns a new instance of SearchCard.



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

def initialize(card_id = SKIP, pan = SKIP, panid = SKIP)
  @card_id = card_id unless card_id == SKIP
  @pan = pan unless pan == SKIP
  @panid = panid unless panid == SKIP
end

Instance Attribute Details

#card_idInteger

Unique Card Id Optional if PAN is given, else mandatory.

Returns:

  • (Integer)


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

def card_id
  @card_id
end

#panString

Card PAN. Optional if CardId is given, else mandatory. Note: PAN is ignored if CardId is given.

Returns:

  • (String)


21
22
23
# File 'lib/shell_card_management_ap_is/models/search_card.rb', line 21

def pan
  @pan
end

#panidFloat

Card PANID

optional id cardid given, else mandatory

Note: PANID is ignored if CardId is given.

Returns:

  • (Float)


27
28
29
# File 'lib/shell_card_management_ap_is/models/search_card.rb', line 27

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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  card_id = hash.key?('CardId') ? hash['CardId'] : SKIP
  pan = hash.key?('PAN') ? hash['PAN'] : SKIP
  panid = hash.key?('PANID') ? hash['PANID'] : SKIP

  # Create object from extracted values.
  SearchCard.new(card_id,
                 pan,
                 panid)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['card_id'] = 'CardId'
  @_hash['pan'] = 'PAN'
  @_hash['panid'] = 'PANID'
  @_hash
end

.nullablesObject

An array for nullable fields



48
49
50
51
52
53
# File 'lib/shell_card_management_ap_is/models/search_card.rb', line 48

def self.nullables
  %w[
    card_id
    pan
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    card_id
    pan
    panid
  ]
end