Class: ShellDataReportingApIs::FuelConsumptionCard
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ShellDataReportingApIs::FuelConsumptionCard
- Defined in:
- lib/shell_data_reporting_ap_is/models/fuel_consumption_card.rb
Overview
FuelConsumptionCard Model.
Instance Attribute Summary collapse
-
#card_id ⇒ Integer
Card Id Optional, when PAN is provided else mandatory.
-
#expiry_date ⇒ String
Card Expiry Date Format: yyyyMMdd.
-
#pan ⇒ String
Full Card PAN Optional, when CardId is provided else mandatory.
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(card_id = SKIP, pan = SKIP, expiry_date = SKIP) ⇒ FuelConsumptionCard
constructor
A new instance of FuelConsumptionCard.
Methods inherited from BaseModel
Constructor Details
#initialize(card_id = SKIP, pan = SKIP, expiry_date = SKIP) ⇒ FuelConsumptionCard
Returns a new instance of FuelConsumptionCard.
50 51 52 53 54 |
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_card.rb', line 50 def initialize(card_id = SKIP, pan = SKIP, expiry_date = SKIP) @card_id = card_id unless card_id == SKIP @pan = pan unless pan == SKIP @expiry_date = expiry_date unless expiry_date == SKIP end |
Instance Attribute Details
#card_id ⇒ Integer
Card Id Optional, when PAN is provided else mandatory.
15 16 17 |
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_card.rb', line 15 def card_id @card_id end |
#expiry_date ⇒ String
Card Expiry Date Format: yyyyMMdd
25 26 27 |
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_card.rb', line 25 def expiry_date @expiry_date end |
#pan ⇒ String
Full Card PAN Optional, when CardId is provided else mandatory.
20 21 22 |
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_card.rb', line 20 def pan @pan end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_card.rb', line 57 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. card_id = hash.key?('CardId') ? hash['CardId'] : SKIP pan = hash.key?('PAN') ? hash['PAN'] : SKIP expiry_date = hash.key?('ExpiryDate') ? hash['ExpiryDate'] : SKIP # Create object from extracted values. FuelConsumptionCard.new(card_id, pan, expiry_date) end |
.names ⇒ Object
A mapping from model property names to API property names.
28 29 30 31 32 33 34 |
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_card.rb', line 28 def self.names @_hash = {} if @_hash.nil? @_hash['card_id'] = 'CardId' @_hash['pan'] = 'PAN' @_hash['expiry_date'] = 'ExpiryDate' @_hash end |
.nullables ⇒ Object
An array for nullable fields
46 47 48 |
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_card.rb', line 46 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
37 38 39 40 41 42 43 |
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_card.rb', line 37 def self.optionals %w[ card_id pan expiry_date ] end |