Class: ShellCardManagementApIs::CardGroupResponse

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

Overview

CardGroupResponse Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(card_groups = SKIP, current_page = SKIP, row_count = SKIP, total_pages = SKIP, error = SKIP, request_id = SKIP) ⇒ CardGroupResponse

Returns a new instance of CardGroupResponse.



65
66
67
68
69
70
71
72
73
# File 'lib/shell_card_management_ap_is/models/card_group_response.rb', line 65

def initialize(card_groups = SKIP, current_page = SKIP, row_count = SKIP,
               total_pages = SKIP, error = SKIP, request_id = SKIP)
  @card_groups = card_groups unless card_groups == SKIP
  @current_page = current_page unless current_page == SKIP
  @row_count = row_count unless row_count == SKIP
  @total_pages = total_pages unless total_pages == SKIP
  @error = error unless error == SKIP
  @request_id = request_id unless request_id == SKIP
end

Instance Attribute Details

#card_groupsArray[CardGroupResponseCardGroupsItems]

TODO: Write general description for this method



14
15
16
# File 'lib/shell_card_management_ap_is/models/card_group_response.rb', line 14

def card_groups
  @card_groups
end

#current_pageInteger

current page

Returns:

  • (Integer)


18
19
20
# File 'lib/shell_card_management_ap_is/models/card_group_response.rb', line 18

def current_page
  @current_page
end

#errorErrorStatus

Total pages available

Returns:



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

def error
  @error
end

#request_idString

API Request id

Returns:

  • (String)


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

def request_id
  @request_id
end

#row_countInteger

number of records in current response

Returns:

  • (Integer)


22
23
24
# File 'lib/shell_card_management_ap_is/models/card_group_response.rb', line 22

def row_count
  @row_count
end

#total_pagesInteger

Total pages available

Returns:

  • (Integer)


26
27
28
# File 'lib/shell_card_management_ap_is/models/card_group_response.rb', line 26

def total_pages
  @total_pages
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



76
77
78
79
80
81
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/card_group_response.rb', line 76

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
  card_groups = nil
  unless hash['CardGroups'].nil?
    card_groups = []
    hash['CardGroups'].each do |structure|
      card_groups << (CardGroupResponseCardGroupsItems.from_hash(structure) if structure)
    end
  end

  card_groups = SKIP unless hash.key?('CardGroups')
  current_page = hash.key?('CurrentPage') ? hash['CurrentPage'] : SKIP
  row_count = hash.key?('RowCount') ? hash['RowCount'] : SKIP
  total_pages = hash.key?('TotalPages') ? hash['TotalPages'] : SKIP
  error = ErrorStatus.from_hash(hash['Error']) if hash['Error']
  request_id = hash.key?('RequestId') ? hash['RequestId'] : SKIP

  # Create object from extracted values.
  CardGroupResponse.new(card_groups,
                        current_page,
                        row_count,
                        total_pages,
                        error,
                        request_id)
end

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
43
44
45
46
# File 'lib/shell_card_management_ap_is/models/card_group_response.rb', line 37

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['card_groups'] = 'CardGroups'
  @_hash['current_page'] = 'CurrentPage'
  @_hash['row_count'] = 'RowCount'
  @_hash['total_pages'] = 'TotalPages'
  @_hash['error'] = 'Error'
  @_hash['request_id'] = 'RequestId'
  @_hash
end

.nullablesObject

An array for nullable fields



61
62
63
# File 'lib/shell_card_management_ap_is/models/card_group_response.rb', line 61

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    card_groups
    current_page
    row_count
    total_pages
    error
    request_id
  ]
end