Class: ShellCardManagementApIs::PurchaseCategory1AllOf0

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

Overview

PurchaseCategory1AllOf0 Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(id = nil, code = nil, name = nil, is_visible = nil, product_groups = nil, title = SKIP, description = SKIP) ⇒ PurchaseCategory1AllOf0

Returns a new instance of PurchaseCategory1AllOf0.



92
93
94
95
96
97
98
99
100
101
# File 'lib/shell_card_management_ap_is/models/purchase_category1_all_of0.rb', line 92

def initialize(id = nil, code = nil, name = nil, is_visible = nil,
               product_groups = nil, title = SKIP, description = SKIP)
  @id = id
  @code = code
  @name = name
  @is_visible = is_visible
  @product_groups = product_groups
  @title = title unless title == SKIP
  @description = description unless description == SKIP
end

Instance Attribute Details

#codeString

Purchase category code

Returns:

  • (String)


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

def code
  @code
end

#descriptionString

Purchase category description by given language code. Example: 0 - Diesel Products and TMF 1 - All Fuel Products and TMF 2 - All Fuels Products, Car related items and TMF 3 - No Restriction 0 - Diesel Products + LNG and TMF 1 - All Fuel Products + LNG and TMF 2 - All Fuels Products + LNG, Car related items and TMF 3 - No Restriction + LNG Note: Purchase Category name (GFN) is returned when Title does not exist for the given language Code and default language code (en-GB).

Returns:

  • (String)


60
61
62
# File 'lib/shell_card_management_ap_is/models/purchase_category1_all_of0.rb', line 60

def description
  @description
end

#idInteger

Purchase category ID

Returns:

  • (Integer)


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

def id
  @id
end

#is_visibleTrueClass | FalseClass

PurchaseCategory can be used while submitting new order cards requests if true else will not be used for ordering cards.

Returns:

  • (TrueClass | FalseClass)


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

def is_visible
  @is_visible
end

#nameString

Name of Purchase category .

Returns:

  • (String)


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

def name
  @name
end

#product_groupsArray[ProductGroup]

List of product sets

Returns:



31
32
33
# File 'lib/shell_card_management_ap_is/models/purchase_category1_all_of0.rb', line 31

def product_groups
  @product_groups
end

#titleString

Purchase category Title by given language code.

  1. Basic

  2. Essentials

  3. Extra

  4. Premium

  5. Basic and LNG

  6. Essentials and LNG

  7. Extra and LNG

  8. Premium and LNG

Note: Purchase Category name (GFN) is returned when Title does not exist for the given language Code and default language code (en-GB).

Returns:

  • (String)


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

def title
  @title
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/shell_card_management_ap_is/models/purchase_category1_all_of0.rb', line 104

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('Id') ? hash['Id'] : nil
  code = hash.key?('Code') ? hash['Code'] : nil
  name = hash.key?('Name') ? hash['Name'] : nil
  is_visible = hash.key?('IsVisible') ? hash['IsVisible'] : nil
  # Parameter is an array, so we need to iterate through it
  product_groups = nil
  unless hash['ProductGroups'].nil?
    product_groups = []
    hash['ProductGroups'].each do |structure|
      product_groups << (ProductGroup.from_hash(structure) if structure)
    end
  end

  product_groups = nil unless hash.key?('ProductGroups')
  title = hash.key?('Title') ? hash['Title'] : SKIP
  description = hash.key?('Description') ? hash['Description'] : SKIP

  # Create object from extracted values.
  PurchaseCategory1AllOf0.new(id,
                              code,
                              name,
                              is_visible,
                              product_groups,
                              title,
                              description)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'Id'
  @_hash['code'] = 'Code'
  @_hash['name'] = 'Name'
  @_hash['is_visible'] = 'IsVisible'
  @_hash['product_groups'] = 'ProductGroups'
  @_hash['title'] = 'Title'
  @_hash['description'] = 'Description'
  @_hash
end

.nullablesObject

An array for nullable fields



84
85
86
87
88
89
90
# File 'lib/shell_card_management_ap_is/models/purchase_category1_all_of0.rb', line 84

def self.nullables
  %w[
    id
    code
    name
  ]
end

.optionalsObject

An array for optional fields



76
77
78
79
80
81
# File 'lib/shell_card_management_ap_is/models/purchase_category1_all_of0.rb', line 76

def self.optionals
  %w[
    title
    description
  ]
end