Class: ShellDataReportingApIs::Tier

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

Overview

Tier Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(tier_price_list_id = SKIP, price_list_description = SKIP, tier_min = SKIP, tier_max = SKIP, tiered_pricing_group_name = SKIP, tiered_pricing_group_period = SKIP, discount_value = SKIP, price_per_unit = SKIP, price_per_unit_after_discount = SKIP) ⇒ Tier

Returns a new instance of Tier.



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_data_reporting_ap_is/models/tier.rb', line 106

def initialize(tier_price_list_id = SKIP,
               price_list_description = SKIP,
               tier_min = SKIP,
               tier_max = SKIP,
               tiered_pricing_group_name = SKIP,
               tiered_pricing_group_period = SKIP,
               discount_value = SKIP,
               price_per_unit = SKIP,
               price_per_unit_after_discount = SKIP)
  @tier_price_list_id = tier_price_list_id unless tier_price_list_id == SKIP
  @price_list_description = price_list_description unless price_list_description == SKIP
  @tier_min = tier_min unless tier_min == SKIP
  @tier_max = tier_max unless tier_max == SKIP
  unless tiered_pricing_group_name == SKIP
    @tiered_pricing_group_name =
      tiered_pricing_group_name
  end
  unless tiered_pricing_group_period == SKIP
    @tiered_pricing_group_period =
      tiered_pricing_group_period
  end
  @discount_value = discount_value unless discount_value == SKIP
  @price_per_unit = price_per_unit unless price_per_unit == SKIP
  unless price_per_unit_after_discount == SKIP
    @price_per_unit_after_discount =
      price_per_unit_after_discount
  end
end

Instance Attribute Details

#discount_valueFloat

Discount value to be applied to the List price or pump price.

Returns:

  • (Float)


47
48
49
# File 'lib/shell_data_reporting_ap_is/models/tier.rb', line 47

def discount_value
  @discount_value
end

#price_list_descriptionString

Price list description of the tier.

Returns:

  • (String)


20
21
22
# File 'lib/shell_data_reporting_ap_is/models/tier.rb', line 20

def price_list_description
  @price_list_description
end

#price_per_unitFloat

Price per unit after discount Note: This field will not contain any value for discounts on retail prices.

Returns:

  • (Float)


53
54
55
# File 'lib/shell_data_reporting_ap_is/models/tier.rb', line 53

def price_per_unit
  @price_per_unit
end

#price_per_unit_after_discountFloat

Price per unit (List Price) Note: This field will not contain any value for discounts on retail prices.

Returns:

  • (Float)


59
60
61
# File 'lib/shell_data_reporting_ap_is/models/tier.rb', line 59

def price_per_unit_after_discount
  @price_per_unit_after_discount
end

#tier_maxInteger

Maximum tier volume E.g., 1000

Returns:

  • (Integer)


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

def tier_max
  @tier_max
end

#tier_minInteger

Minimum tier volume E.g., 500

Returns:

  • (Integer)


25
26
27
# File 'lib/shell_data_reporting_ap_is/models/tier.rb', line 25

def tier_min
  @tier_min
end

#tier_price_list_idInteger

The price list if reference price is list price. Only used when the Price Rule category is set to. ‘Tiered Pricing’.

Returns:

  • (Integer)


16
17
18
# File 'lib/shell_data_reporting_ap_is/models/tier.rb', line 16

def tier_price_list_id
  @tier_price_list_id
end

#tiered_pricing_group_nameString

Pricing group name of tier

Returns:

  • (String)


34
35
36
# File 'lib/shell_data_reporting_ap_is/models/tier.rb', line 34

def tiered_pricing_group_name
  @tiered_pricing_group_name
end

#tiered_pricing_group_periodString

Tiered pricing group period. Possible Values 1. Monthly 2. Quarterly 3. Semi Annually 4. Annual

Returns:

  • (String)


43
44
45
# File 'lib/shell_data_reporting_ap_is/models/tier.rb', line 43

def tiered_pricing_group_period
  @tiered_pricing_group_period
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/shell_data_reporting_ap_is/models/tier.rb', line 136

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  tier_price_list_id =
    hash.key?('TierPriceListId') ? hash['TierPriceListId'] : SKIP
  price_list_description =
    hash.key?('PriceListDescription') ? hash['PriceListDescription'] : SKIP
  tier_min = hash.key?('TierMin') ? hash['TierMin'] : SKIP
  tier_max = hash.key?('TierMax') ? hash['TierMax'] : SKIP
  tiered_pricing_group_name =
    hash.key?('TieredPricingGroupName') ? hash['TieredPricingGroupName'] : SKIP
  tiered_pricing_group_period =
    hash.key?('TieredPricingGroupPeriod') ? hash['TieredPricingGroupPeriod'] : SKIP
  discount_value = hash.key?('DiscountValue') ? hash['DiscountValue'] : SKIP
  price_per_unit = hash.key?('PricePerUnit') ? hash['PricePerUnit'] : SKIP
  price_per_unit_after_discount =
    hash.key?('PricePerUnitAfterDiscount') ? hash['PricePerUnitAfterDiscount'] : SKIP

  # Create object from extracted values.
  Tier.new(tier_price_list_id,
           price_list_description,
           tier_min,
           tier_max,
           tiered_pricing_group_name,
           tiered_pricing_group_period,
           discount_value,
           price_per_unit,
           price_per_unit_after_discount)
end

.namesObject

A mapping from model property names to API property names.



62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/shell_data_reporting_ap_is/models/tier.rb', line 62

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['tier_price_list_id'] = 'TierPriceListId'
  @_hash['price_list_description'] = 'PriceListDescription'
  @_hash['tier_min'] = 'TierMin'
  @_hash['tier_max'] = 'TierMax'
  @_hash['tiered_pricing_group_name'] = 'TieredPricingGroupName'
  @_hash['tiered_pricing_group_period'] = 'TieredPricingGroupPeriod'
  @_hash['discount_value'] = 'DiscountValue'
  @_hash['price_per_unit'] = 'PricePerUnit'
  @_hash['price_per_unit_after_discount'] = 'PricePerUnitAfterDiscount'
  @_hash
end

.nullablesObject

An array for nullable fields



92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/shell_data_reporting_ap_is/models/tier.rb', line 92

def self.nullables
  %w[
    tier_price_list_id
    price_list_description
    tier_min
    tier_max
    tiered_pricing_group_name
    tiered_pricing_group_period
    discount_value
    price_per_unit
    price_per_unit_after_discount
  ]
end

.optionalsObject

An array for optional fields



77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/shell_data_reporting_ap_is/models/tier.rb', line 77

def self.optionals
  %w[
    tier_price_list_id
    price_list_description
    tier_min
    tier_max
    tiered_pricing_group_name
    tiered_pricing_group_period
    discount_value
    price_per_unit
    price_per_unit_after_discount
  ]
end