Class: ProtonApi::SpendingAnalysisRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/proton_api/models/spending_analysis_request.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SpendingAnalysisRequest

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
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
275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/proton_api/models/spending_analysis_request.rb', line 149

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.has_key?(:'merchant_scope')
    if (value = attributes[:'merchant_scope']).is_a?(Array)
      self.merchant_scope = value
    end
  end

  if attributes.has_key?(:'account_ids')
    if (value = attributes[:'account_ids']).is_a?(Array)
      self. = value
    end
  end

  if attributes.has_key?(:'business_ids')
    if (value = attributes[:'business_ids']).is_a?(Array)
      self.business_ids = value
    end
  end

  if attributes.has_key?(:'card_ids')
    if (value = attributes[:'card_ids']).is_a?(Array)
      self.card_ids = value
    end
  end

  if attributes.has_key?(:'show_by_merchant')
    self.show_by_merchant = attributes[:'show_by_merchant']
  else
    self.show_by_merchant = false
  end

  if attributes.has_key?(:'show_by_period')
    self.show_by_period = attributes[:'show_by_period']
  else
    self.show_by_period = false
  end

  if attributes.has_key?(:'only_cleansed')
    self.only_cleansed = attributes[:'only_cleansed']
  else
    self.only_cleansed = false
  end

  if attributes.has_key?(:'frequency')
    self.frequency = attributes[:'frequency']
  else
    self.frequency = 1
  end

  if attributes.has_key?(:'end_date')
    self.end_date = attributes[:'end_date']
  end

  if attributes.has_key?(:'as_of_date')
    self.as_of_date = attributes[:'as_of_date']
  end

  if attributes.has_key?(:'transaction_category_scope')
    if (value = attributes[:'transaction_category_scope']).is_a?(Array)
      self.transaction_category_scope = value
    end
  end

  if attributes.has_key?(:'start_date')
    self.start_date = attributes[:'start_date']
  end

  if attributes.has_key?(:'card_status_scope')
    if (value = attributes[:'card_status_scope']).is_a?(Array)
      self.card_status_scope = value
    end
  end

  if attributes.has_key?(:'only_active_clients')
    self.only_active_clients = attributes[:'only_active_clients']
  else
    self.only_active_clients = false
  end

  if attributes.has_key?(:'lookback_periods')
    self.lookback_periods = attributes[:'lookback_periods']
  else
    self.lookback_periods = 0
  end

  if attributes.has_key?(:'frequency_unit')
    self.frequency_unit = attributes[:'frequency_unit']
  end

  if attributes.has_key?(:'household_ids')
    if (value = attributes[:'household_ids']).is_a?(Array)
      self.household_ids = value
    end
  end

  if attributes.has_key?(:'aggregation_account_ids')
    if (value = attributes[:'aggregation_account_ids']).is_a?(Array)
      self. = value
    end
  end

  if attributes.has_key?(:'currency_code')
    self.currency_code = attributes[:'currency_code']
  end

  if attributes.has_key?(:'client_ids')
    if (value = attributes[:'client_ids']).is_a?(Array)
      self.client_ids = value
    end
  end

  if attributes.has_key?(:'scope')
    self.scope = attributes[:'scope']
  else
    self.scope = 'all'
  end

  if attributes.has_key?(:'currency_conversion')
    self.currency_conversion = attributes[:'currency_conversion']
  end

  if attributes.has_key?(:'transaction_status_scope')
    if (value = attributes[:'transaction_status_scope']).is_a?(Array)
      self.transaction_status_scope = value
    end
  end

  if attributes.has_key?(:'show_by_category')
    self.show_by_category = attributes[:'show_by_category']
  else
    self.show_by_category = false
  end
end

Instance Attribute Details

#account_idsObject

Returns the value of attribute account_ids.



19
20
21
# File 'lib/proton_api/models/spending_analysis_request.rb', line 19

def 
  @account_ids
end

#aggregation_account_idsObject

Returns the value of attribute aggregation_account_ids.



51
52
53
# File 'lib/proton_api/models/spending_analysis_request.rb', line 51

def 
  @aggregation_account_ids
end

#as_of_dateObject

Returns the value of attribute as_of_date.



35
36
37
# File 'lib/proton_api/models/spending_analysis_request.rb', line 35

def as_of_date
  @as_of_date
end

#business_idsObject

Returns the value of attribute business_ids.



21
22
23
# File 'lib/proton_api/models/spending_analysis_request.rb', line 21

def business_ids
  @business_ids
end

#card_idsObject

Returns the value of attribute card_ids.



23
24
25
# File 'lib/proton_api/models/spending_analysis_request.rb', line 23

def card_ids
  @card_ids
end

#card_status_scopeObject

Returns the value of attribute card_status_scope.



41
42
43
# File 'lib/proton_api/models/spending_analysis_request.rb', line 41

def card_status_scope
  @card_status_scope
end

#client_idsObject

Returns the value of attribute client_ids.



55
56
57
# File 'lib/proton_api/models/spending_analysis_request.rb', line 55

def client_ids
  @client_ids
end

#currency_codeObject

Returns the value of attribute currency_code.



53
54
55
# File 'lib/proton_api/models/spending_analysis_request.rb', line 53

def currency_code
  @currency_code
end

#currency_conversionObject

Returns the value of attribute currency_conversion.



59
60
61
# File 'lib/proton_api/models/spending_analysis_request.rb', line 59

def currency_conversion
  @currency_conversion
end

#end_dateObject

Returns the value of attribute end_date.



33
34
35
# File 'lib/proton_api/models/spending_analysis_request.rb', line 33

def end_date
  @end_date
end

#frequencyObject

Returns the value of attribute frequency.



31
32
33
# File 'lib/proton_api/models/spending_analysis_request.rb', line 31

def frequency
  @frequency
end

#frequency_unitObject

Returns the value of attribute frequency_unit.



47
48
49
# File 'lib/proton_api/models/spending_analysis_request.rb', line 47

def frequency_unit
  @frequency_unit
end

#household_idsObject

Returns the value of attribute household_ids.



49
50
51
# File 'lib/proton_api/models/spending_analysis_request.rb', line 49

def household_ids
  @household_ids
end

#lookback_periodsObject

Returns the value of attribute lookback_periods.



45
46
47
# File 'lib/proton_api/models/spending_analysis_request.rb', line 45

def lookback_periods
  @lookback_periods
end

#merchant_scopeObject

Returns the value of attribute merchant_scope.



17
18
19
# File 'lib/proton_api/models/spending_analysis_request.rb', line 17

def merchant_scope
  @merchant_scope
end

#only_active_clientsObject

Returns the value of attribute only_active_clients.



43
44
45
# File 'lib/proton_api/models/spending_analysis_request.rb', line 43

def only_active_clients
  @only_active_clients
end

#only_cleansedObject

Returns the value of attribute only_cleansed.



29
30
31
# File 'lib/proton_api/models/spending_analysis_request.rb', line 29

def only_cleansed
  @only_cleansed
end

#scopeObject

Returns the value of attribute scope.



57
58
59
# File 'lib/proton_api/models/spending_analysis_request.rb', line 57

def scope
  @scope
end

#show_by_categoryObject

Returns the value of attribute show_by_category.



63
64
65
# File 'lib/proton_api/models/spending_analysis_request.rb', line 63

def show_by_category
  @show_by_category
end

#show_by_merchantObject

Returns the value of attribute show_by_merchant.



25
26
27
# File 'lib/proton_api/models/spending_analysis_request.rb', line 25

def show_by_merchant
  @show_by_merchant
end

#show_by_periodObject

Returns the value of attribute show_by_period.



27
28
29
# File 'lib/proton_api/models/spending_analysis_request.rb', line 27

def show_by_period
  @show_by_period
end

#start_dateObject

Returns the value of attribute start_date.



39
40
41
# File 'lib/proton_api/models/spending_analysis_request.rb', line 39

def start_date
  @start_date
end

#transaction_category_scopeObject

Returns the value of attribute transaction_category_scope.



37
38
39
# File 'lib/proton_api/models/spending_analysis_request.rb', line 37

def transaction_category_scope
  @transaction_category_scope
end

#transaction_status_scopeObject

Returns the value of attribute transaction_status_scope.



61
62
63
# File 'lib/proton_api/models/spending_analysis_request.rb', line 61

def transaction_status_scope
  @transaction_status_scope
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/proton_api/models/spending_analysis_request.rb', line 88

def self.attribute_map
  {
    :'merchant_scope' => :'merchant_scope',
    :'account_ids' => :'account_ids',
    :'business_ids' => :'business_ids',
    :'card_ids' => :'card_ids',
    :'show_by_merchant' => :'show_by_merchant',
    :'show_by_period' => :'show_by_period',
    :'only_cleansed' => :'only_cleansed',
    :'frequency' => :'frequency',
    :'end_date' => :'end_date',
    :'as_of_date' => :'as_of_date',
    :'transaction_category_scope' => :'transaction_category_scope',
    :'start_date' => :'start_date',
    :'card_status_scope' => :'card_status_scope',
    :'only_active_clients' => :'only_active_clients',
    :'lookback_periods' => :'lookback_periods',
    :'frequency_unit' => :'frequency_unit',
    :'household_ids' => :'household_ids',
    :'aggregation_account_ids' => :'aggregation_account_ids',
    :'currency_code' => :'currency_code',
    :'client_ids' => :'client_ids',
    :'scope' => :'scope',
    :'currency_conversion' => :'currency_conversion',
    :'transaction_status_scope' => :'transaction_status_scope',
    :'show_by_category' => :'show_by_category'
  }
end

.swagger_typesObject

Attribute type mapping.



118
119
120
121
122
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/proton_api/models/spending_analysis_request.rb', line 118

def self.swagger_types
  {
    :'merchant_scope' => :'Array<String>',
    :'account_ids' => :'Array<String>',
    :'business_ids' => :'Array<String>',
    :'card_ids' => :'Array<String>',
    :'show_by_merchant' => :'BOOLEAN',
    :'show_by_period' => :'BOOLEAN',
    :'only_cleansed' => :'BOOLEAN',
    :'frequency' => :'Integer',
    :'end_date' => :'Date',
    :'as_of_date' => :'Date',
    :'transaction_category_scope' => :'Array<String>',
    :'start_date' => :'Date',
    :'card_status_scope' => :'Array<String>',
    :'only_active_clients' => :'BOOLEAN',
    :'lookback_periods' => :'Integer',
    :'frequency_unit' => :'String',
    :'household_ids' => :'Array<String>',
    :'aggregation_account_ids' => :'Array<String>',
    :'currency_code' => :'String',
    :'client_ids' => :'Array<String>',
    :'scope' => :'String',
    :'currency_conversion' => :'String',
    :'transaction_status_scope' => :'Array<String>',
    :'show_by_category' => :'BOOLEAN'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
# File 'lib/proton_api/models/spending_analysis_request.rb', line 362

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      merchant_scope == o.merchant_scope &&
       == o. &&
      business_ids == o.business_ids &&
      card_ids == o.card_ids &&
      show_by_merchant == o.show_by_merchant &&
      show_by_period == o.show_by_period &&
      only_cleansed == o.only_cleansed &&
      frequency == o.frequency &&
      end_date == o.end_date &&
      as_of_date == o.as_of_date &&
      transaction_category_scope == o.transaction_category_scope &&
      start_date == o.start_date &&
      card_status_scope == o.card_status_scope &&
      only_active_clients == o.only_active_clients &&
      lookback_periods == o.lookback_periods &&
      frequency_unit == o.frequency_unit &&
      household_ids == o.household_ids &&
       == o. &&
      currency_code == o.currency_code &&
      client_ids == o.client_ids &&
      scope == o.scope &&
      currency_conversion == o.currency_conversion &&
      transaction_status_scope == o.transaction_status_scope &&
      show_by_category == o.show_by_category
end

#_deserialize(type, value) ⇒ Object

Returns Deserialized data.

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
# File 'lib/proton_api/models/spending_analysis_request.rb', line 426

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    value
  when :Date
    value
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = ProtonApi.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



490
491
492
493
494
495
496
497
498
499
500
501
502
# File 'lib/proton_api/models/spending_analysis_request.rb', line 490

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
# File 'lib/proton_api/models/spending_analysis_request.rb', line 406

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


393
394
395
# File 'lib/proton_api/models/spending_analysis_request.rb', line 393

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



399
400
401
# File 'lib/proton_api/models/spending_analysis_request.rb', line 399

def hash
  [merchant_scope, , business_ids, card_ids, show_by_merchant, show_by_period, only_cleansed, frequency, end_date, as_of_date, transaction_category_scope, start_date, card_status_scope, only_active_clients, lookback_periods, frequency_unit, household_ids, , currency_code, client_ids, scope, currency_conversion, transaction_status_scope, show_by_category].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/proton_api/models/spending_analysis_request.rb', line 290

def list_invalid_properties
  invalid_properties = Array.new
  if !@frequency.nil? && @frequency < 1
    invalid_properties.push('invalid value for "frequency", must be greater than or equal to 1.')
  end

  if !@lookback_periods.nil? && @lookback_periods < 0
    invalid_properties.push('invalid value for "lookback_periods", must be greater than or equal to 0.')
  end

  if @frequency_unit.nil?
    invalid_properties.push('invalid value for "frequency_unit", frequency_unit cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



471
472
473
# File 'lib/proton_api/models/spending_analysis_request.rb', line 471

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



477
478
479
480
481
482
483
484
485
# File 'lib/proton_api/models/spending_analysis_request.rb', line 477

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns String presentation of the object.

Returns:

  • (String)

    String presentation of the object



465
466
467
# File 'lib/proton_api/models/spending_analysis_request.rb', line 465

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



309
310
311
312
313
314
315
316
317
318
# File 'lib/proton_api/models/spending_analysis_request.rb', line 309

def valid?
  return false if !@frequency.nil? && @frequency < 1
  return false if !@lookback_periods.nil? && @lookback_periods < 0
  return false if @frequency_unit.nil?
  frequency_unit_validator = EnumAttributeValidator.new('String', ['daily', 'weekly', 'bi-weekly', 'monthly', 'quarterly', 'annually'])
  return false unless frequency_unit_validator.valid?(@frequency_unit)
  scope_validator = EnumAttributeValidator.new('String', ['all', 'external', 'internal', 'cards'])
  return false unless scope_validator.valid?(@scope)
  true
end