Class: ShellDataReportingApIs::UsageSummary
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ShellDataReportingApIs::UsageSummary
- Defined in:
- lib/shell_data_reporting_ap_is/models/usage_summary.rb
Overview
UsageSummary Model.
Instance Attribute Summary collapse
-
#currency_code ⇒ String
Customer Currency Code.
-
#currency_symbol ⇒ String
Customer Currency Symbol.
-
#date ⇒ String
Transaction date.
-
#is_fuel_product ⇒ TrueClass | FalseClass
Whether the product is fuel or non-fuel.
-
#product_code ⇒ String
Client Product code.
-
#product_group_id ⇒ Integer
Product group ID.
-
#product_group_name ⇒ String
Product group Name.
-
#product_id ⇒ Integer
Product Id.
-
#product_name ⇒ String
Product name in English.
-
#site_group_id ⇒ Integer
Site Group Id.
-
#site_group_name ⇒ String
Site Group Name.
-
#total_gross ⇒ Float
Total Gross in Customer Currency.
-
#total_net ⇒ Float
Total Net in Customer Currency.
-
#total_volume ⇒ Float
Total Volume.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(date = SKIP, product_id = SKIP, product_code = SKIP, product_name = SKIP, is_fuel_product = SKIP, site_group_id = SKIP, site_group_name = SKIP, total_volume = SKIP, total_gross = SKIP, total_net = SKIP, currency_code = SKIP, currency_symbol = SKIP, product_group_id = SKIP, product_group_name = SKIP) ⇒ UsageSummary
constructor
A new instance of UsageSummary.
Methods inherited from BaseModel
Constructor Details
#initialize(date = SKIP, product_id = SKIP, product_code = SKIP, product_name = SKIP, is_fuel_product = SKIP, site_group_id = SKIP, site_group_name = SKIP, total_volume = SKIP, total_gross = SKIP, total_net = SKIP, currency_code = SKIP, currency_symbol = SKIP, product_group_id = SKIP, product_group_name = SKIP) ⇒ UsageSummary
Returns a new instance of UsageSummary.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/shell_data_reporting_ap_is/models/usage_summary.rb', line 130 def initialize(date = SKIP, product_id = SKIP, product_code = SKIP, product_name = SKIP, is_fuel_product = SKIP, site_group_id = SKIP, site_group_name = SKIP, total_volume = SKIP, total_gross = SKIP, total_net = SKIP, currency_code = SKIP, currency_symbol = SKIP, product_group_id = SKIP, product_group_name = SKIP) @date = date unless date == SKIP @product_id = product_id unless product_id == SKIP @product_code = product_code unless product_code == SKIP @product_name = product_name unless product_name == SKIP @is_fuel_product = is_fuel_product unless is_fuel_product == SKIP @site_group_id = site_group_id unless site_group_id == SKIP @site_group_name = site_group_name unless site_group_name == SKIP @total_volume = total_volume unless total_volume == SKIP @total_gross = total_gross unless total_gross == SKIP @total_net = total_net unless total_net == SKIP @currency_code = currency_code unless currency_code == SKIP @currency_symbol = currency_symbol unless currency_symbol == SKIP @product_group_id = product_group_id unless product_group_id == SKIP @product_group_name = product_group_name unless product_group_name == SKIP end |
Instance Attribute Details
#currency_code ⇒ String
Customer Currency Code
56 57 58 |
# File 'lib/shell_data_reporting_ap_is/models/usage_summary.rb', line 56 def currency_code @currency_code end |
#currency_symbol ⇒ String
Customer Currency Symbol
60 61 62 |
# File 'lib/shell_data_reporting_ap_is/models/usage_summary.rb', line 60 def currency_symbol @currency_symbol end |
#date ⇒ String
Transaction date. The records will be sorted by this field in ascending order. Format: yyyyMMdd
16 17 18 |
# File 'lib/shell_data_reporting_ap_is/models/usage_summary.rb', line 16 def date @date end |
#is_fuel_product ⇒ TrueClass | FalseClass
Whether the product is fuel or non-fuel
32 33 34 |
# File 'lib/shell_data_reporting_ap_is/models/usage_summary.rb', line 32 def is_fuel_product @is_fuel_product end |
#product_code ⇒ String
Client Product code
24 25 26 |
# File 'lib/shell_data_reporting_ap_is/models/usage_summary.rb', line 24 def product_code @product_code end |
#product_group_id ⇒ Integer
Product group ID
64 65 66 |
# File 'lib/shell_data_reporting_ap_is/models/usage_summary.rb', line 64 def product_group_id @product_group_id end |
#product_group_name ⇒ String
Product group Name
68 69 70 |
# File 'lib/shell_data_reporting_ap_is/models/usage_summary.rb', line 68 def product_group_name @product_group_name end |
#product_id ⇒ Integer
Product Id
20 21 22 |
# File 'lib/shell_data_reporting_ap_is/models/usage_summary.rb', line 20 def product_id @product_id end |
#product_name ⇒ String
Product name in English
28 29 30 |
# File 'lib/shell_data_reporting_ap_is/models/usage_summary.rb', line 28 def product_name @product_name end |
#site_group_id ⇒ Integer
Site Group Id
36 37 38 |
# File 'lib/shell_data_reporting_ap_is/models/usage_summary.rb', line 36 def site_group_id @site_group_id end |
#site_group_name ⇒ String
Site Group Name
40 41 42 |
# File 'lib/shell_data_reporting_ap_is/models/usage_summary.rb', line 40 def site_group_name @site_group_name end |
#total_gross ⇒ Float
Total Gross in Customer Currency
48 49 50 |
# File 'lib/shell_data_reporting_ap_is/models/usage_summary.rb', line 48 def total_gross @total_gross end |
#total_net ⇒ Float
Total Net in Customer Currency
52 53 54 |
# File 'lib/shell_data_reporting_ap_is/models/usage_summary.rb', line 52 def total_net @total_net end |
#total_volume ⇒ Float
Total Volume
44 45 46 |
# File 'lib/shell_data_reporting_ap_is/models/usage_summary.rb', line 44 def total_volume @total_volume end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/shell_data_reporting_ap_is/models/usage_summary.rb', line 153 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. date = hash.key?('Date') ? hash['Date'] : SKIP product_id = hash.key?('ProductId') ? hash['ProductId'] : SKIP product_code = hash.key?('ProductCode') ? hash['ProductCode'] : SKIP product_name = hash.key?('ProductName') ? hash['ProductName'] : SKIP is_fuel_product = hash.key?('IsFuelProduct') ? hash['IsFuelProduct'] : SKIP site_group_id = hash.key?('SiteGroupId') ? hash['SiteGroupId'] : SKIP site_group_name = hash.key?('SiteGroupName') ? hash['SiteGroupName'] : SKIP total_volume = hash.key?('TotalVolume') ? hash['TotalVolume'] : SKIP total_gross = hash.key?('TotalGross') ? hash['TotalGross'] : SKIP total_net = hash.key?('TotalNet') ? hash['TotalNet'] : SKIP currency_code = hash.key?('CurrencyCode') ? hash['CurrencyCode'] : SKIP currency_symbol = hash.key?('CurrencySymbol') ? hash['CurrencySymbol'] : SKIP product_group_id = hash.key?('ProductGroupID') ? hash['ProductGroupID'] : SKIP product_group_name = hash.key?('ProductGroupName') ? hash['ProductGroupName'] : SKIP # Create object from extracted values. UsageSummary.new(date, product_id, product_code, product_name, is_fuel_product, site_group_id, site_group_name, total_volume, total_gross, total_net, currency_code, currency_symbol, product_group_id, product_group_name) end |
.names ⇒ Object
A mapping from model property names to API property names.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/shell_data_reporting_ap_is/models/usage_summary.rb', line 71 def self.names @_hash = {} if @_hash.nil? @_hash['date'] = 'Date' @_hash['product_id'] = 'ProductId' @_hash['product_code'] = 'ProductCode' @_hash['product_name'] = 'ProductName' @_hash['is_fuel_product'] = 'IsFuelProduct' @_hash['site_group_id'] = 'SiteGroupId' @_hash['site_group_name'] = 'SiteGroupName' @_hash['total_volume'] = 'TotalVolume' @_hash['total_gross'] = 'TotalGross' @_hash['total_net'] = 'TotalNet' @_hash['currency_code'] = 'CurrencyCode' @_hash['currency_symbol'] = 'CurrencySymbol' @_hash['product_group_id'] = 'ProductGroupID' @_hash['product_group_name'] = 'ProductGroupName' @_hash end |
.nullables ⇒ Object
An array for nullable fields
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/shell_data_reporting_ap_is/models/usage_summary.rb', line 111 def self.nullables %w[ date product_id product_code product_name is_fuel_product site_group_id site_group_name total_volume total_gross total_net currency_code currency_symbol product_group_id product_group_name ] end |
.optionals ⇒ Object
An array for optional fields
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/shell_data_reporting_ap_is/models/usage_summary.rb', line 91 def self.optionals %w[ date product_id product_code product_name is_fuel_product site_group_id site_group_name total_volume total_gross total_net currency_code currency_symbol product_group_id product_group_name ] end |