Class: ShellDataReportingApIs::CardUsageRestrictions

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

Overview

CardUsageRestrictions Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(level = SKIP, daily_spend_limit = SKIP, weekly_spend_limit = SKIP, monthly_spend_limit = SKIP, annual_spend_limit = SKIP, life_time_spend_limit = SKIP, daily_volume_limit = SKIP, weekly_volume_limit = SKIP, monthly_volume_limit = SKIP, annual_volume_limit = 0, life_time_volume_limit = SKIP, transaction_spend_limit = SKIP, transaction_volume_limit = SKIP, daily_transaction_count = SKIP, weekly_transaction_count = SKIP, monthly_transaction_count = SKIP, annual_transaction_count = SKIP, life_time_transaction_count = SKIP, is_velocity_ceiling = SKIP) ⇒ CardUsageRestrictions

Returns a new instance of CardUsageRestrictions.



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/shell_data_reporting_ap_is/models/card_usage_restrictions.rb', line 171

def initialize(level = SKIP, daily_spend_limit = SKIP,
               weekly_spend_limit = SKIP, monthly_spend_limit = SKIP,
               annual_spend_limit = SKIP, life_time_spend_limit = SKIP,
               daily_volume_limit = SKIP, weekly_volume_limit = SKIP,
               monthly_volume_limit = SKIP, annual_volume_limit = 0,
               life_time_volume_limit = SKIP,
               transaction_spend_limit = SKIP,
               transaction_volume_limit = SKIP,
               daily_transaction_count = SKIP,
               weekly_transaction_count = SKIP,
               monthly_transaction_count = SKIP,
               annual_transaction_count = SKIP,
               life_time_transaction_count = SKIP,
               is_velocity_ceiling = SKIP)
  @level = level unless level == SKIP
  @daily_spend_limit = daily_spend_limit unless daily_spend_limit == SKIP
  @weekly_spend_limit = weekly_spend_limit unless weekly_spend_limit == SKIP
  @monthly_spend_limit = monthly_spend_limit unless monthly_spend_limit == SKIP
  @annual_spend_limit = annual_spend_limit unless annual_spend_limit == SKIP
  @life_time_spend_limit = life_time_spend_limit unless life_time_spend_limit == SKIP
  @daily_volume_limit = daily_volume_limit unless daily_volume_limit == SKIP
  @weekly_volume_limit = weekly_volume_limit unless weekly_volume_limit == SKIP
  @monthly_volume_limit = monthly_volume_limit unless monthly_volume_limit == SKIP
  @annual_volume_limit = annual_volume_limit unless annual_volume_limit == SKIP
  @life_time_volume_limit = life_time_volume_limit unless life_time_volume_limit == SKIP
  @transaction_spend_limit = transaction_spend_limit unless transaction_spend_limit == SKIP
  @transaction_volume_limit = transaction_volume_limit unless transaction_volume_limit == SKIP
  @daily_transaction_count = daily_transaction_count unless daily_transaction_count == SKIP
  @weekly_transaction_count = weekly_transaction_count unless weekly_transaction_count == SKIP
  unless monthly_transaction_count == SKIP
    @monthly_transaction_count =
      monthly_transaction_count
  end
  @annual_transaction_count = annual_transaction_count unless annual_transaction_count == SKIP
  unless life_time_transaction_count == SKIP
    @life_time_transaction_count =
      life_time_transaction_count
  end
  @is_velocity_ceiling = is_velocity_ceiling unless is_velocity_ceiling == SKIP
end

Instance Attribute Details

#annual_spend_limitFloat

Maximum amount that can be spend on the card in a year.

Returns:

  • (Float)


33
34
35
# File 'lib/shell_data_reporting_ap_is/models/card_usage_restrictions.rb', line 33

def annual_spend_limit
  @annual_spend_limit
end

#annual_transaction_countFloat

Maximum number of transactions allowed on the card in a year.

Returns:

  • (Float)


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

def annual_transaction_count
  @annual_transaction_count
end

#annual_volume_limitFloat

Maximum volume of fuel that can be bought on the card in a year.

Returns:

  • (Float)


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

def annual_volume_limit
  @annual_volume_limit
end

#daily_spend_limitFloat

Maximum amount that can be spend on the card in a day.

Returns:

  • (Float)


21
22
23
# File 'lib/shell_data_reporting_ap_is/models/card_usage_restrictions.rb', line 21

def daily_spend_limit
  @daily_spend_limit
end

#daily_transaction_countFloat

Maximum number of transactions allowed on a card in a day.

Returns:

  • (Float)


70
71
72
# File 'lib/shell_data_reporting_ap_is/models/card_usage_restrictions.rb', line 70

def daily_transaction_count
  @daily_transaction_count
end

#daily_volume_limitFloat

Maximum volume of fuel that can be bought on the card in a day.

Returns:

  • (Float)


41
42
43
# File 'lib/shell_data_reporting_ap_is/models/card_usage_restrictions.rb', line 41

def daily_volume_limit
  @daily_volume_limit
end

#is_velocity_ceilingTrueClass | FalseClass

IsVelocityCeiling flag Note: When “True”, the velocity defaults configured in MS DB will be considered as the Max Limits for velocity changes. When ‘false’ max allowed limits will be 999999999999 for Type “Count” and 9999999999.99 for Type ‘Value’.

Returns:

  • (TrueClass | FalseClass)


95
96
97
# File 'lib/shell_data_reporting_ap_is/models/card_usage_restrictions.rb', line 95

def is_velocity_ceiling
  @is_velocity_ceiling
end

#levelString

Describes at which level the restriction is set at. Possible values: OU = Restriction set at ColCo card type Customer = Restriction set at customer card type

Returns:

  • (String)


17
18
19
# File 'lib/shell_data_reporting_ap_is/models/card_usage_restrictions.rb', line 17

def level
  @level
end

#life_time_spend_limitFloat

Maximum amount that can be spend on the card in the card’s life time.

Returns:

  • (Float)


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

def life_time_spend_limit
  @life_time_spend_limit
end

#life_time_transaction_countFloat

Maximum number of transactions allowed on the card in the card’s life time.

Returns:

  • (Float)


87
88
89
# File 'lib/shell_data_reporting_ap_is/models/card_usage_restrictions.rb', line 87

def life_time_transaction_count
  @life_time_transaction_count
end

#life_time_volume_limitFloat

Maximum volume of fuel that can be bought on the card in the card’s life time.

Returns:

  • (Float)


58
59
60
# File 'lib/shell_data_reporting_ap_is/models/card_usage_restrictions.rb', line 58

def life_time_volume_limit
  @life_time_volume_limit
end

#monthly_spend_limitFloat

Maximum amount that can be spend on the card in a month.

Returns:

  • (Float)


29
30
31
# File 'lib/shell_data_reporting_ap_is/models/card_usage_restrictions.rb', line 29

def monthly_spend_limit
  @monthly_spend_limit
end

#monthly_transaction_countFloat

Maximum number of transactions allowed on a card in a month.

Returns:

  • (Float)


78
79
80
# File 'lib/shell_data_reporting_ap_is/models/card_usage_restrictions.rb', line 78

def monthly_transaction_count
  @monthly_transaction_count
end

#monthly_volume_limitFloat

Maximum volume of fuel that can be bought on the card in a month.

Returns:

  • (Float)


49
50
51
# File 'lib/shell_data_reporting_ap_is/models/card_usage_restrictions.rb', line 49

def monthly_volume_limit
  @monthly_volume_limit
end

#transaction_spend_limitFloat

Maximum amount that can be spend on the card in a transaction.

Returns:

  • (Float)


62
63
64
# File 'lib/shell_data_reporting_ap_is/models/card_usage_restrictions.rb', line 62

def transaction_spend_limit
  @transaction_spend_limit
end

#transaction_volume_limitFloat

Maximum volume of fuel that can be bought on the card in a transaction.

Returns:

  • (Float)


66
67
68
# File 'lib/shell_data_reporting_ap_is/models/card_usage_restrictions.rb', line 66

def transaction_volume_limit
  @transaction_volume_limit
end

#weekly_spend_limitFloat

Maximum amount that can be spend on the card in a week.

Returns:

  • (Float)


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

def weekly_spend_limit
  @weekly_spend_limit
end

#weekly_transaction_countFloat

Maximum number of transactions allowed on a card in a week.

Returns:

  • (Float)


74
75
76
# File 'lib/shell_data_reporting_ap_is/models/card_usage_restrictions.rb', line 74

def weekly_transaction_count
  @weekly_transaction_count
end

#weekly_volume_limitFloat

Maximum volume of fuel that can be bought on the card in a week.

Returns:

  • (Float)


45
46
47
# File 'lib/shell_data_reporting_ap_is/models/card_usage_restrictions.rb', line 45

def weekly_volume_limit
  @weekly_volume_limit
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/shell_data_reporting_ap_is/models/card_usage_restrictions.rb', line 213

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  level = hash.key?('Level') ? hash['Level'] : SKIP
  daily_spend_limit =
    hash.key?('DailySpendLimit') ? hash['DailySpendLimit'] : SKIP
  weekly_spend_limit =
    hash.key?('WeeklySpendLimit') ? hash['WeeklySpendLimit'] : SKIP
  monthly_spend_limit =
    hash.key?('MonthlySpendLimit') ? hash['MonthlySpendLimit'] : SKIP
  annual_spend_limit =
    hash.key?('AnnualSpendLimit') ? hash['AnnualSpendLimit'] : SKIP
  life_time_spend_limit =
    hash.key?('LifeTimeSpendLimit') ? hash['LifeTimeSpendLimit'] : SKIP
  daily_volume_limit =
    hash.key?('DailyVolumeLimit') ? hash['DailyVolumeLimit'] : SKIP
  weekly_volume_limit =
    hash.key?('WeeklyVolumeLimit') ? hash['WeeklyVolumeLimit'] : SKIP
  monthly_volume_limit =
    hash.key?('MonthlyVolumeLimit') ? hash['MonthlyVolumeLimit'] : SKIP
  annual_volume_limit = hash['AnnualVolumeLimit'] ||= 0
  life_time_volume_limit =
    hash.key?('LifeTimeVolumeLimit') ? hash['LifeTimeVolumeLimit'] : SKIP
  transaction_spend_limit =
    hash.key?('TransactionSpendLimit') ? hash['TransactionSpendLimit'] : SKIP
  transaction_volume_limit =
    hash.key?('TransactionVolumeLimit') ? hash['TransactionVolumeLimit'] : SKIP
  daily_transaction_count =
    hash.key?('DailyTransactionCount') ? hash['DailyTransactionCount'] : SKIP
  weekly_transaction_count =
    hash.key?('WeeklyTransactionCount') ? hash['WeeklyTransactionCount'] : SKIP
  monthly_transaction_count =
    hash.key?('MonthlyTransactionCount') ? hash['MonthlyTransactionCount'] : SKIP
  annual_transaction_count =
    hash.key?('AnnualTransactionCount') ? hash['AnnualTransactionCount'] : SKIP
  life_time_transaction_count =
    hash.key?('LifeTimeTransactionCount') ? hash['LifeTimeTransactionCount'] : SKIP
  is_velocity_ceiling =
    hash.key?('IsVelocityCeiling') ? hash['IsVelocityCeiling'] : SKIP

  # Create object from extracted values.
  CardUsageRestrictions.new(level,
                            daily_spend_limit,
                            weekly_spend_limit,
                            monthly_spend_limit,
                            annual_spend_limit,
                            life_time_spend_limit,
                            daily_volume_limit,
                            weekly_volume_limit,
                            monthly_volume_limit,
                            annual_volume_limit,
                            life_time_volume_limit,
                            transaction_spend_limit,
                            transaction_volume_limit,
                            daily_transaction_count,
                            weekly_transaction_count,
                            monthly_transaction_count,
                            annual_transaction_count,
                            life_time_transaction_count,
                            is_velocity_ceiling)
end

.namesObject

A mapping from model property names to API property names.



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/shell_data_reporting_ap_is/models/card_usage_restrictions.rb', line 98

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['level'] = 'Level'
  @_hash['daily_spend_limit'] = 'DailySpendLimit'
  @_hash['weekly_spend_limit'] = 'WeeklySpendLimit'
  @_hash['monthly_spend_limit'] = 'MonthlySpendLimit'
  @_hash['annual_spend_limit'] = 'AnnualSpendLimit'
  @_hash['life_time_spend_limit'] = 'LifeTimeSpendLimit'
  @_hash['daily_volume_limit'] = 'DailyVolumeLimit'
  @_hash['weekly_volume_limit'] = 'WeeklyVolumeLimit'
  @_hash['monthly_volume_limit'] = 'MonthlyVolumeLimit'
  @_hash['annual_volume_limit'] = 'AnnualVolumeLimit'
  @_hash['life_time_volume_limit'] = 'LifeTimeVolumeLimit'
  @_hash['transaction_spend_limit'] = 'TransactionSpendLimit'
  @_hash['transaction_volume_limit'] = 'TransactionVolumeLimit'
  @_hash['daily_transaction_count'] = 'DailyTransactionCount'
  @_hash['weekly_transaction_count'] = 'WeeklyTransactionCount'
  @_hash['monthly_transaction_count'] = 'MonthlyTransactionCount'
  @_hash['annual_transaction_count'] = 'AnnualTransactionCount'
  @_hash['life_time_transaction_count'] = 'LifeTimeTransactionCount'
  @_hash['is_velocity_ceiling'] = 'IsVelocityCeiling'
  @_hash
end

.nullablesObject

An array for nullable fields



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/shell_data_reporting_ap_is/models/card_usage_restrictions.rb', line 148

def self.nullables
  %w[
    level
    daily_spend_limit
    weekly_spend_limit
    monthly_spend_limit
    annual_spend_limit
    life_time_spend_limit
    daily_volume_limit
    weekly_volume_limit
    monthly_volume_limit
    annual_volume_limit
    life_time_volume_limit
    transaction_spend_limit
    transaction_volume_limit
    daily_transaction_count
    weekly_transaction_count
    monthly_transaction_count
    annual_transaction_count
    life_time_transaction_count
  ]
end

.optionalsObject

An array for optional fields



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/shell_data_reporting_ap_is/models/card_usage_restrictions.rb', line 123

def self.optionals
  %w[
    level
    daily_spend_limit
    weekly_spend_limit
    monthly_spend_limit
    annual_spend_limit
    life_time_spend_limit
    daily_volume_limit
    weekly_volume_limit
    monthly_volume_limit
    annual_volume_limit
    life_time_volume_limit
    transaction_spend_limit
    transaction_volume_limit
    daily_transaction_count
    weekly_transaction_count
    monthly_transaction_count
    annual_transaction_count
    life_time_transaction_count
    is_velocity_ceiling
  ]
end