Class: BoxxLoki::RecommendationRequestDataQuery

Inherits:
Object
  • Object
show all
Defined in:
lib/boxx_loki/models/recommendation_request_data_query.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ RecommendationRequestDataQuery

Initializes the object

Parameters:

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

    Model attributes in the form of hash



129
130
131
132
133
134
135
136
137
138
139
140
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
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
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 129

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?(:'userid')
    self.userid = attributes[:'userid']
  end

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

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

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

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

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

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

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

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

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

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

  if attributes.has_key?(:'repeat')
    self.repeat = attributes[:'repeat']
  else
    self.repeat = true
  end

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

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

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

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

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

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

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

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

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

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

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

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

end

Instance Attribute Details

#boxx_token_idObject

Returns the value of attribute boxx_token_id.



20
21
22
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 20

def boxx_token_id
  @boxx_token_id
end

#dont_repeat_transaction_typesObject

Returns the value of attribute dont_repeat_transaction_types.



54
55
56
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 54

def dont_repeat_transaction_types
  @dont_repeat_transaction_types
end

#excludeObject

Returns the value of attribute exclude.



42
43
44
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 42

def exclude
  @exclude
end

#get_product_propertiesObject

Returns the value of attribute get_product_properties.



22
23
24
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 22

def get_product_properties
  @get_product_properties
end

#group_by_attributeObject

Returns the value of attribute group_by_attribute.



30
31
32
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 30

def group_by_attribute
  @group_by_attribute
end

#ignore_filtersObject

Returns the value of attribute ignore_filters.



64
65
66
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 64

def ignore_filters
  @ignore_filters
end

#item_filtersObject

Returns the value of attribute item_filters.



36
37
38
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 36

def item_filters
  @item_filters
end

#latest_transactionsObject

Returns the value of attribute latest_transactions.



62
63
64
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 62

def latest_transactions
  @latest_transactions
end

#locationObject

Returns the value of attribute location.



32
33
34
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 32

def location
  @location
end

#maximizeObject

Returns the value of attribute maximize.



60
61
62
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 60

def maximize
  @maximize
end

#numObject

Returns the value of attribute num.



24
25
26
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 24

def num
  @num
end

#num_out_ofObject

Returns the value of attribute num_out_of.



44
45
46
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 44

def num_out_of
  @num_out_of
end

#offsetObject

Returns the value of attribute offset.



46
47
48
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 46

def offset
  @offset
end

#page_numObject

Returns the value of attribute page_num.



58
59
60
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 58

def page_num
  @page_num
end

#product_idsObject

Returns the value of attribute product_ids.



56
57
58
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 56

def product_ids
  @product_ids
end

#radiusObject

Returns the value of attribute radius.



34
35
36
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 34

def radius
  @radius
end

#randomObject

Returns the value of attribute random.



48
49
50
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 48

def random
  @random
end

#recent_actionsObject

Returns the value of attribute recent_actions.



38
39
40
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 38

def recent_actions
  @recent_actions
end

Returns the value of attribute related_action_type.



52
53
54
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 52

def related_action_type
  @related_action_type
end

Returns the value of attribute related_products.



50
51
52
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 50

def related_products
  @related_products
end

#repeatObject

Returns the value of attribute repeat.



40
41
42
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 40

def repeat
  @repeat
end

#transaction_weightObject

Returns the value of attribute transaction_weight.



28
29
30
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 28

def transaction_weight
  @transaction_weight
end

#user_attribute_weightObject

Returns the value of attribute user_attribute_weight.



26
27
28
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 26

def user_attribute_weight
  @user_attribute_weight
end

#useridObject

Returns the value of attribute userid.



18
19
20
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 18

def userid
  @userid
end

Class Method Details

.attribute_mapObject

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



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 68

def self.attribute_map
  {
    :'userid' => :'userid',
    :'boxx_token_id' => :'boxx_token_id',
    :'get_product_properties' => :'get_product_properties',
    :'num' => :'num',
    :'user_attribute_weight' => :'user_attribute_weight',
    :'transaction_weight' => :'transaction_weight',
    :'group_by_attribute' => :'group_by_attribute',
    :'location' => :'location',
    :'radius' => :'radius',
    :'item_filters' => :'item_filters',
    :'recent_actions' => :'recent_actions',
    :'repeat' => :'repeat',
    :'exclude' => :'exclude',
    :'num_out_of' => :'num_out_of',
    :'offset' => :'offset',
    :'random' => :'random',
    :'related_products' => :'related_products',
    :'related_action_type' => :'related_action_type',
    :'dont_repeat_transaction_types' => :'dont_repeat_transaction_types',
    :'product_ids' => :'product_ids',
    :'page_num' => :'page_num',
    :'maximize' => :'maximize',
    :'latest_transactions' => :'latest_transactions',
    :'ignore_filters' => :'ignore_filters'
  }
end

.swagger_typesObject

Attribute type mapping.



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 98

def self.swagger_types
  {
    :'userid' => :'String',
    :'boxx_token_id' => :'String',
    :'get_product_properties' => :'BOOLEAN',
    :'num' => :'Integer',
    :'user_attribute_weight' => :'Float',
    :'transaction_weight' => :'Float',
    :'group_by_attribute' => :'BOOLEAN',
    :'location' => :'Array<Float>',
    :'radius' => :'Integer',
    :'item_filters' => :'Object',
    :'recent_actions' => :'Object',
    :'repeat' => :'BOOLEAN',
    :'exclude' => :'Array<String>',
    :'num_out_of' => :'Float',
    :'offset' => :'Float',
    :'random' => :'Float',
    :'related_products' => :'Array<String>',
    :'related_action_type' => :'String',
    :'dont_repeat_transaction_types' => :'Array<String>',
    :'product_ids' => :'Array<String>',
    :'page_num' => :'Float',
    :'maximize' => :'String',
    :'latest_transactions' => :'BOOLEAN',
    :'ignore_filters' => :'BOOLEAN'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 373

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      userid == o.userid &&
      boxx_token_id == o.boxx_token_id &&
      get_product_properties == o.get_product_properties &&
      num == o.num &&
      user_attribute_weight == o.user_attribute_weight &&
      transaction_weight == o.transaction_weight &&
      group_by_attribute == o.group_by_attribute &&
      location == o.location &&
      radius == o.radius &&
      item_filters == o.item_filters &&
      recent_actions == o.recent_actions &&
      repeat == o.repeat &&
      exclude == o.exclude &&
      num_out_of == o.num_out_of &&
      offset == o.offset &&
      random == o.random &&
      related_products == o.related_products &&
      related_action_type == o.related_action_type &&
      dont_repeat_transaction_types == o.dont_repeat_transaction_types &&
      product_ids == o.product_ids &&
      page_num == o.page_num &&
      maximize == o.maximize &&
      latest_transactions == o.latest_transactions &&
      ignore_filters == o.ignore_filters
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



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
463
464
465
466
467
468
469
470
471
472
473
474
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 438

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(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 = BoxxLoki.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of 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



504
505
506
507
508
509
510
511
512
513
514
515
516
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 504

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



417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 417

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 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


404
405
406
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 404

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



410
411
412
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 410

def hash
  [userid, boxx_token_id, get_product_properties, num, user_attribute_weight, transaction_weight, group_by_attribute, location, radius, item_filters, recent_actions, repeat, exclude, num_out_of, offset, random, related_products, related_action_type, dont_repeat_transaction_types, product_ids, page_num, maximize, latest_transactions, ignore_filters].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
287
288
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 253

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

  if !@user_attribute_weight.nil? && @user_attribute_weight > 1
    invalid_properties.push("invalid value for 'user_attribute_weight', must be smaller than or equal to 1.")
  end

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

  if !@transaction_weight.nil? && @transaction_weight > 1
    invalid_properties.push("invalid value for 'transaction_weight', must be smaller than or equal to 1.")
  end

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

  if !@random.nil? && @random > 1
    invalid_properties.push("invalid value for 'random', must be smaller than or equal to 1.")
  end

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

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

  return 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



484
485
486
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 484

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



490
491
492
493
494
495
496
497
498
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 490

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 the string representation of the object

Returns:

  • (String)

    String presentation of the object



478
479
480
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 478

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



292
293
294
295
296
297
298
299
300
301
302
# File 'lib/boxx_loki/models/recommendation_request_data_query.rb', line 292

def valid?
  return false if !@num.nil? && @num < 0
  return false if !@user_attribute_weight.nil? && @user_attribute_weight > 1
  return false if !@user_attribute_weight.nil? && @user_attribute_weight < 0
  return false if !@transaction_weight.nil? && @transaction_weight > 1
  return false if !@transaction_weight.nil? && @transaction_weight < 0
  return false if !@random.nil? && @random > 1
  return false if !@random.nil? && @random < 0
  return false if !@page_num.nil? && @page_num < 1
  return true
end