Class: ShellDataReportingApIs::FeeRuleProduct

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_data_reporting_ap_is/models/fee_rule_product.rb

Overview

FeeRuleProduct Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(product_group_id = SKIP, product_group_name = SKIP, product_code = SKIP, product_id = SKIP, product_name = SKIP) ⇒ FeeRuleProduct

Returns a new instance of FeeRuleProduct.



65
66
67
68
69
70
71
72
# File 'lib/shell_data_reporting_ap_is/models/fee_rule_product.rb', line 65

def initialize(product_group_id = SKIP, product_group_name = SKIP,
               product_code = SKIP, product_id = SKIP, product_name = SKIP)
  @product_group_id = product_group_id unless product_group_id == SKIP
  @product_group_name = product_group_name unless product_group_name == SKIP
  @product_code = product_code unless product_code == SKIP
  @product_id = product_id unless product_id == SKIP
  @product_name = product_name unless product_name == SKIP
end

Instance Attribute Details

#product_codeString

Client Product Code

Returns:

  • (String)


22
23
24
# File 'lib/shell_data_reporting_ap_is/models/fee_rule_product.rb', line 22

def product_code
  @product_code
end

#product_group_idInteger

Product Group Id

Returns:

  • (Integer)


14
15
16
# File 'lib/shell_data_reporting_ap_is/models/fee_rule_product.rb', line 14

def product_group_id
  @product_group_id
end

#product_group_nameString

Product Group name

Returns:

  • (String)


18
19
20
# File 'lib/shell_data_reporting_ap_is/models/fee_rule_product.rb', line 18

def product_group_name
  @product_group_name
end

#product_idInteger

Product Id

Returns:

  • (Integer)


26
27
28
# File 'lib/shell_data_reporting_ap_is/models/fee_rule_product.rb', line 26

def product_id
  @product_id
end

#product_nameString

Product name in English

Returns:

  • (String)


30
31
32
# File 'lib/shell_data_reporting_ap_is/models/fee_rule_product.rb', line 30

def product_name
  @product_name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/shell_data_reporting_ap_is/models/fee_rule_product.rb', line 75

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  product_group_id =
    hash.key?('ProductGroupId') ? hash['ProductGroupId'] : SKIP
  product_group_name =
    hash.key?('ProductGroupName') ? hash['ProductGroupName'] : SKIP
  product_code = hash.key?('ProductCode') ? hash['ProductCode'] : SKIP
  product_id = hash.key?('ProductId') ? hash['ProductId'] : SKIP
  product_name = hash.key?('ProductName') ? hash['ProductName'] : SKIP

  # Create object from extracted values.
  FeeRuleProduct.new(product_group_id,
                     product_group_name,
                     product_code,
                     product_id,
                     product_name)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
# File 'lib/shell_data_reporting_ap_is/models/fee_rule_product.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['product_group_id'] = 'ProductGroupId'
  @_hash['product_group_name'] = 'ProductGroupName'
  @_hash['product_code'] = 'ProductCode'
  @_hash['product_id'] = 'ProductId'
  @_hash['product_name'] = 'ProductName'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
58
59
60
61
62
63
# File 'lib/shell_data_reporting_ap_is/models/fee_rule_product.rb', line 55

def self.nullables
  %w[
    product_group_id
    product_group_name
    product_code
    product_id
    product_name
  ]
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
51
52
# File 'lib/shell_data_reporting_ap_is/models/fee_rule_product.rb', line 44

def self.optionals
  %w[
    product_group_id
    product_group_name
    product_code
    product_id
    product_name
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



104
105
106
107
108
109
# File 'lib/shell_data_reporting_ap_is/models/fee_rule_product.rb', line 104

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} product_group_id: #{@product_group_id.inspect}, product_group_name:"\
  " #{@product_group_name.inspect}, product_code: #{@product_code.inspect}, product_id:"\
  " #{@product_id.inspect}, product_name: #{@product_name.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



96
97
98
99
100
101
# File 'lib/shell_data_reporting_ap_is/models/fee_rule_product.rb', line 96

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} product_group_id: #{@product_group_id}, product_group_name:"\
  " #{@product_group_name}, product_code: #{@product_code}, product_id: #{@product_id},"\
  " product_name: #{@product_name}>"
end