Class: ShellDataReportingApIs::FuelConsumptionRequest

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

Overview

FuelConsumptionRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(col_co_id = SKIP, col_co_code = SKIP, payer_id = SKIP, payer_number = SKIP, accounts = SKIP, card_group_id = SKIP, card_group_name = SKIP, cards = SKIP, from_date = SKIP, to_date = SKIP, period = SKIP) ⇒ FuelConsumptionRequest

Returns a new instance of FuelConsumptionRequest.



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_request.rb', line 123

def initialize(col_co_id = SKIP, col_co_code = SKIP, payer_id = SKIP,
               payer_number = SKIP, accounts = SKIP, card_group_id = SKIP,
               card_group_name = SKIP, cards = SKIP, from_date = SKIP,
               to_date = SKIP, period = SKIP)
  @col_co_id = col_co_id unless col_co_id == SKIP
  @col_co_code = col_co_code unless col_co_code == SKIP
  @payer_id = payer_id unless payer_id == SKIP
  @payer_number = payer_number unless payer_number == SKIP
  @accounts = accounts unless accounts == SKIP
  @card_group_id = card_group_id unless card_group_id == SKIP
  @card_group_name = card_group_name unless card_group_name == SKIP
  @cards = cards unless cards == SKIP
  @from_date = from_date unless from_date == SKIP
  @to_date = to_date unless to_date == SKIP
  @period = period unless period == SKIP
end

Instance Attribute Details

#accountsArray[Accounts]

Payer Number of the selected payer. Optional if PayerId is passed else Mandatory

Returns:



42
43
44
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_request.rb', line 42

def accounts
  @accounts
end

#card_group_idInteger

Card Group Id in GFN Optional Example: 200

Returns:

  • (Integer)


48
49
50
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_request.rb', line 48

def card_group_id
  @card_group_id
end

#card_group_nameString

Card Group Name Optional This input is a search criterion, if given.

Returns:

  • (String)


54
55
56
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_request.rb', line 54

def card_group_name
  @card_group_name
end

#cardsArray[FuelConsumptionCard]

Card Group Name Optional This input is a search criterion, if given.

Returns:



60
61
62
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_request.rb', line 60

def cards
  @cards
end

#col_co_codeInteger

Collecting Company Code of the selected payer. Mandatory for serviced OUs such as Romania, Latvia, Lithuania, Estonia, Ukraine etc. It is optional for other countries if ColCoID is provided. Example: 86 for Philippines 5 for UK

Returns:

  • (Integer)


27
28
29
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_request.rb', line 27

def col_co_code
  @col_co_code
end

#col_co_idInteger

Collecting Company Id of the selected payer. Optional if ColCoCode is passed else Mandatory. Example: 1 for Philippines 5 for UK

Returns:

  • (Integer)


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

def col_co_id
  @col_co_id
end

#from_dateString

Transactions from Date Optional – ‘Period’ will be considered when this field is not provided.

Returns:

  • (String)


65
66
67
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_request.rb', line 65

def from_date
  @from_date
end

#payer_idInteger

Payer Id of the selected payer. Optional if PayerNumber is passed else Mandatory

Returns:

  • (Integer)


32
33
34
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_request.rb', line 32

def payer_id
  @payer_id
end

#payer_numberString

Payer Number of the selected payer. Optional if PayerId is passed else Mandatory

Returns:

  • (String)


37
38
39
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_request.rb', line 37

def payer_number
  @payer_number
end

#periodInteger

Transactions Period. This is ignored when FromDate is supplied on the request Allowed values :

  1. Last 7 Days

  2. Last 30 Days

  3. Last 90 Days

Optional - When FromDate/ToDate and Period are not provided, ‘Last 7 Days’ value is considered as default Period.

Returns:

  • (Integer)


82
83
84
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_request.rb', line 82

def period
  @period
end

#to_dateString

Transactions to Date Optional Format: yyyyMMdd

Returns:

  • (String)


71
72
73
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_request.rb', line 71

def to_date
  @to_date
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_request.rb', line 141

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  col_co_id = hash.key?('ColCoId') ? hash['ColCoId'] : SKIP
  col_co_code = hash.key?('ColCoCode') ? hash['ColCoCode'] : SKIP
  payer_id = hash.key?('PayerId') ? hash['PayerId'] : SKIP
  payer_number = hash.key?('PayerNumber') ? hash['PayerNumber'] : SKIP
  # Parameter is an array, so we need to iterate through it
  accounts = nil
  unless hash['Accounts'].nil?
    accounts = []
    hash['Accounts'].each do |structure|
      accounts << (Accounts.from_hash(structure) if structure)
    end
  end

  accounts = SKIP unless hash.key?('Accounts')
  card_group_id = hash.key?('CardGroupId') ? hash['CardGroupId'] : SKIP
  card_group_name =
    hash.key?('CardGroupName') ? hash['CardGroupName'] : SKIP
  # Parameter is an array, so we need to iterate through it
  cards = nil
  unless hash['Cards'].nil?
    cards = []
    hash['Cards'].each do |structure|
      cards << (FuelConsumptionCard.from_hash(structure) if structure)
    end
  end

  cards = SKIP unless hash.key?('Cards')
  from_date = hash.key?('FromDate') ? hash['FromDate'] : SKIP
  to_date = hash.key?('ToDate') ? hash['ToDate'] : SKIP
  period = hash.key?('Period') ? hash['Period'] : SKIP

  # Create object from extracted values.
  FuelConsumptionRequest.new(col_co_id,
                             col_co_code,
                             payer_id,
                             payer_number,
                             accounts,
                             card_group_id,
                             card_group_name,
                             cards,
                             from_date,
                             to_date,
                             period)
end

.namesObject

A mapping from model property names to API property names.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_request.rb', line 85

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['col_co_id'] = 'ColCoId'
  @_hash['col_co_code'] = 'ColCoCode'
  @_hash['payer_id'] = 'PayerId'
  @_hash['payer_number'] = 'PayerNumber'
  @_hash['accounts'] = 'Accounts'
  @_hash['card_group_id'] = 'CardGroupId'
  @_hash['card_group_name'] = 'CardGroupName'
  @_hash['cards'] = 'Cards'
  @_hash['from_date'] = 'FromDate'
  @_hash['to_date'] = 'ToDate'
  @_hash['period'] = 'Period'
  @_hash
end

.nullablesObject

An array for nullable fields



119
120
121
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_request.rb', line 119

def self.nullables
  []
end

.optionalsObject

An array for optional fields



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_request.rb', line 102

def self.optionals
  %w[
    col_co_id
    col_co_code
    payer_id
    payer_number
    accounts
    card_group_id
    card_group_name
    cards
    from_date
    to_date
    period
  ]
end