Class: ShellCardManagementApIs::CreateCardGroupResponse

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

Overview

CreateCardGroupResponse Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(main_reference = SKIP, new_card_group_reference = SKIP, successful_requests = SKIP, error_cards = SKIP, error = SKIP, request_id = SKIP) ⇒ CreateCardGroupResponse

Returns a new instance of CreateCardGroupResponse.



76
77
78
79
80
81
82
83
84
85
# File 'lib/shell_card_management_ap_is/models/create_card_group_response.rb', line 76

def initialize(main_reference = SKIP, new_card_group_reference = SKIP,
               successful_requests = SKIP, error_cards = SKIP, error = SKIP,
               request_id = SKIP)
  @main_reference = main_reference unless main_reference == SKIP
  @new_card_group_reference = new_card_group_reference unless new_card_group_reference == SKIP
  @successful_requests = successful_requests unless successful_requests == SKIP
  @error_cards = error_cards unless error_cards == SKIP
  @error = error unless error == SKIP
  @request_id = request_id unless request_id == SKIP
end

Instance Attribute Details

#errorErrorStatus

List of cards that failed validation and not submitted for processing. Entity: FailedCardReference This list will be empty when the validations of new card group parameters fail.

Returns:



41
42
43
# File 'lib/shell_card_management_ap_is/models/create_card_group_response.rb', line 41

def error
  @error
end

#error_cardsArray[CreateCardGroupResponseErrorCardsItems]

List of cards that failed validation and not submitted for processing. Entity: FailedCardReference This list will be empty when the validations of new card group parameters fail.



34
35
36
# File 'lib/shell_card_management_ap_is/models/create_card_group_response.rb', line 34

def error_cards
  @error_cards
end

#main_referenceInteger

Reference number for tracking the execution of the requests – new Card Group creation and to move the cards to the new card group. Reference number will be null when the validations of new card group parameters fail.

Returns:

  • (Integer)


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

def main_reference
  @main_reference
end

#new_card_group_referenceInteger

Reference number for tracking the execution of card group creation. Reference number will be null when the validations of new card group parameters fail.

Returns:

  • (Integer)


23
24
25
# File 'lib/shell_card_management_ap_is/models/create_card_group_response.rb', line 23

def new_card_group_reference
  @new_card_group_reference
end

#request_idString

API Request Id

Returns:

  • (String)


45
46
47
# File 'lib/shell_card_management_ap_is/models/create_card_group_response.rb', line 45

def request_id
  @request_id
end

#successful_requestsArray[CreateCardGroupResponseSuccessfulRequestsItems]

List of cards validated and submitted successfully for processing.



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

def successful_requests
  @successful_requests
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/shell_card_management_ap_is/models/create_card_group_response.rb', line 88

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  main_reference = hash.key?('MainReference') ? hash['MainReference'] : SKIP
  new_card_group_reference =
    hash.key?('NewCardGroupReference') ? hash['NewCardGroupReference'] : SKIP
  # Parameter is an array, so we need to iterate through it
  successful_requests = nil
  unless hash['SuccessfulRequests'].nil?
    successful_requests = []
    hash['SuccessfulRequests'].each do |structure|
      successful_requests << (CreateCardGroupResponseSuccessfulRequestsItems.from_hash(structure) if structure)
    end
  end

  successful_requests = SKIP unless hash.key?('SuccessfulRequests')
  # Parameter is an array, so we need to iterate through it
  error_cards = nil
  unless hash['ErrorCards'].nil?
    error_cards = []
    hash['ErrorCards'].each do |structure|
      error_cards << (CreateCardGroupResponseErrorCardsItems.from_hash(structure) if structure)
    end
  end

  error_cards = SKIP unless hash.key?('ErrorCards')
  error = ErrorStatus.from_hash(hash['Error']) if hash['Error']
  request_id = hash.key?('RequestId') ? hash['RequestId'] : SKIP

  # Create object from extracted values.
  CreateCardGroupResponse.new(main_reference,
                              new_card_group_reference,
                              successful_requests,
                              error_cards,
                              error,
                              request_id)
end

.namesObject

A mapping from model property names to API property names.



48
49
50
51
52
53
54
55
56
57
# File 'lib/shell_card_management_ap_is/models/create_card_group_response.rb', line 48

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['main_reference'] = 'MainReference'
  @_hash['new_card_group_reference'] = 'NewCardGroupReference'
  @_hash['successful_requests'] = 'SuccessfulRequests'
  @_hash['error_cards'] = 'ErrorCards'
  @_hash['error'] = 'Error'
  @_hash['request_id'] = 'RequestId'
  @_hash
end

.nullablesObject

An array for nullable fields



72
73
74
# File 'lib/shell_card_management_ap_is/models/create_card_group_response.rb', line 72

def self.nullables
  []
end

.optionalsObject

An array for optional fields



60
61
62
63
64
65
66
67
68
69
# File 'lib/shell_card_management_ap_is/models/create_card_group_response.rb', line 60

def self.optionals
  %w[
    main_reference
    new_card_group_reference
    successful_requests
    error_cards
    error
    request_id
  ]
end