Class: ShellDataReportingApIs::FuelConsumptionCard

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

Overview

FuelConsumptionCard Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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_idInteger

Card Id Optional, when PAN is provided else mandatory.

Returns:

  • (Integer)


15
16
17
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_card.rb', line 15

def card_id
  @card_id
end

#expiry_dateString

Card Expiry Date Format: yyyyMMdd

Returns:

  • (String)


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

def expiry_date
  @expiry_date
end

#panString

Full Card PAN Optional, when CardId is provided else mandatory.

Returns:

  • (String)


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

.namesObject

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

.nullablesObject

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

.optionalsObject

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