tremendous_ruby 5.5.0 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tremendous/api/tremendous_api.rb +9 -349
  3. data/lib/tremendous/models/base_order_for_create.rb +1 -1
  4. data/lib/tremendous/models/create_order200_response.rb +1 -1
  5. data/lib/tremendous/models/create_order200_response_order.rb +403 -0
  6. data/lib/tremendous/models/create_order200_response_order_rewards_inner.rb +326 -0
  7. data/lib/tremendous/models/create_order200_response_order_rewards_inner_delivery.rb +296 -0
  8. data/lib/tremendous/models/{create_public_key_request.rb → create_order201_response.rb} +14 -15
  9. data/lib/tremendous/models/create_order_request.rb +1 -1
  10. data/lib/tremendous/models/create_organization.rb +51 -4
  11. data/lib/tremendous/models/create_organization200_response_organization.rb +20 -45
  12. data/lib/tremendous/models/{public_keys_response_public_keys_inner.rb → create_organization_for_response.rb} +72 -20
  13. data/lib/tremendous/models/{public_key.rb → create_organization_properties.rb} +57 -20
  14. data/lib/tremendous/models/create_organization_request.rb +7 -0
  15. data/lib/tremendous/models/delivery_details.rb +0 -14
  16. data/lib/tremendous/models/delivery_details_with_link.rb +296 -0
  17. data/lib/tremendous/models/error_model.rb +11 -1
  18. data/lib/tremendous/models/fraud_rule400_response.rb +11 -1
  19. data/lib/tremendous/models/fraud_rule422_response.rb +11 -1
  20. data/lib/tremendous/models/fraud_rules_list_item.rb +4 -2
  21. data/lib/tremendous/models/generate_reward_link403_response.rb +11 -1
  22. data/lib/tremendous/models/invoice.rb +10 -1
  23. data/lib/tremendous/models/list_fraud_reviews200_response.rb +21 -4
  24. data/lib/tremendous/models/list_fraud_rules200_response_fraud_rules_inner.rb +4 -2
  25. data/lib/tremendous/models/list_invoices200_response_invoices_inner.rb +10 -1
  26. data/lib/tremendous/models/list_orders200_response_orders_inner_payment.rb +4 -48
  27. data/lib/tremendous/models/list_rewards200_response_rewards_inner_delivery.rb +0 -14
  28. data/lib/tremendous/models/list_rewards401_response.rb +11 -1
  29. data/lib/tremendous/models/list_rewards401_response_errors.rb +4 -2
  30. data/lib/tremendous/models/list_rewards429_response.rb +11 -1
  31. data/lib/tremendous/models/order_base_payment.rb +4 -48
  32. data/lib/tremendous/models/order_with_link.rb +403 -0
  33. data/lib/tremendous/models/order_with_link_rewards_inner.rb +385 -0
  34. data/lib/tremendous/models/payment_details.rb +4 -48
  35. data/lib/tremendous/models/payout.rb +340 -0
  36. data/lib/tremendous/models/resend_reward422_response.rb +11 -1
  37. data/lib/tremendous/models/reward_for_order_create.rb +1 -1
  38. data/lib/tremendous/models/{single_reward_order1_reward.rb → reward_with_link.rb} +78 -16
  39. data/lib/tremendous/models/reward_with_link_delivery.rb +296 -0
  40. data/lib/tremendous/models/reward_without_link_delivery.rb +0 -14
  41. data/lib/tremendous/models/single_reward_order.rb +1 -1
  42. data/lib/tremendous/models/{single_reward_order1_payment.rb → single_reward_order_payment.rb} +3 -3
  43. data/lib/tremendous/models/single_reward_order_reward.rb +3 -75
  44. data/lib/tremendous/models/{single_reward_order1_reward_custom_fields_inner.rb → single_reward_order_reward_custom_fields_inner.rb} +3 -3
  45. data/lib/tremendous/models/{single_reward_order1_reward_delivery.rb → single_reward_order_reward_delivery.rb} +3 -3
  46. data/lib/tremendous/models/{test_public_key.rb → single_reward_order_with_link.rb} +14 -15
  47. data/lib/tremendous/models/single_reward_order_with_link_order.rb +403 -0
  48. data/lib/tremendous/version.rb +1 -1
  49. data/lib/tremendous.rb +17 -14
  50. metadata +19 -16
  51. data/lib/tremendous/models/create_invoice.rb +0 -244
  52. data/lib/tremendous/models/create_public_key.rb +0 -222
  53. data/lib/tremendous/models/create_public_key200_response.rb +0 -221
  54. data/lib/tremendous/models/public_keys_response.rb +0 -223
  55. data/lib/tremendous/models/single_reward_order1.rb +0 -242
  56. data/lib/tremendous/models/test_public_key_request.rb +0 -222
@@ -0,0 +1,340 @@
1
+ =begin
2
+ #API Endpoints
3
+
4
+ #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API.
5
+
6
+ The version of the OpenAPI document: 2
7
+ Contact: developers@tremendous.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Tremendous
17
+ class Payout
18
+ # Tremendous ID of the payout
19
+ attr_accessor :id
20
+
21
+ attr_accessor :status
22
+
23
+ # Tremendous ID of the paid out product
24
+ attr_accessor :product_id
25
+
26
+ # Name of the paid out Product
27
+ attr_accessor :product_name
28
+
29
+ # Date the payout was created
30
+ attr_accessor :created_at
31
+
32
+ # Date the payout was executed
33
+ attr_accessor :executed_at
34
+
35
+ class EnumAttributeValidator
36
+ attr_reader :datatype
37
+ attr_reader :allowable_values
38
+
39
+ def initialize(datatype, allowable_values)
40
+ @allowable_values = allowable_values.map do |value|
41
+ case datatype.to_s
42
+ when /Integer/i
43
+ value.to_i
44
+ when /Float/i
45
+ value.to_f
46
+ else
47
+ value
48
+ end
49
+ end
50
+ end
51
+
52
+ def valid?(value)
53
+ !value || allowable_values.include?(value)
54
+ end
55
+ end
56
+
57
+ # Attribute mapping from ruby-style variable name to JSON key.
58
+ def self.attribute_map
59
+ {
60
+ :'id' => :'id',
61
+ :'status' => :'status',
62
+ :'product_id' => :'product_id',
63
+ :'product_name' => :'product_name',
64
+ :'created_at' => :'created_at',
65
+ :'executed_at' => :'executed_at'
66
+ }
67
+ end
68
+
69
+ # Returns all the JSON keys this model knows about
70
+ def self.acceptable_attributes
71
+ attribute_map.values
72
+ end
73
+
74
+ # Attribute type mapping.
75
+ def self.openapi_types
76
+ {
77
+ :'id' => :'String',
78
+ :'status' => :'String',
79
+ :'product_id' => :'String',
80
+ :'product_name' => :'String',
81
+ :'created_at' => :'Time',
82
+ :'executed_at' => :'Time'
83
+ }
84
+ end
85
+
86
+ # List of attributes with nullable: true
87
+ def self.openapi_nullable
88
+ Set.new([
89
+ ])
90
+ end
91
+
92
+ # Initializes the object
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ def initialize(attributes = {})
95
+ if (!attributes.is_a?(Hash))
96
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::Payout` initialize method"
97
+ end
98
+
99
+ # check to see if the attribute exists and convert string to symbol for hash key
100
+ attributes = attributes.each_with_object({}) { |(k, v), h|
101
+ if (!self.class.attribute_map.key?(k.to_sym))
102
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::Payout`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
103
+ end
104
+ h[k.to_sym] = v
105
+ }
106
+
107
+ if attributes.key?(:'id')
108
+ self.id = attributes[:'id']
109
+ end
110
+
111
+ if attributes.key?(:'status')
112
+ self.status = attributes[:'status']
113
+ end
114
+
115
+ if attributes.key?(:'product_id')
116
+ self.product_id = attributes[:'product_id']
117
+ end
118
+
119
+ if attributes.key?(:'product_name')
120
+ self.product_name = attributes[:'product_name']
121
+ end
122
+
123
+ if attributes.key?(:'created_at')
124
+ self.created_at = attributes[:'created_at']
125
+ end
126
+
127
+ if attributes.key?(:'executed_at')
128
+ self.executed_at = attributes[:'executed_at']
129
+ end
130
+ end
131
+
132
+ # Show invalid properties with the reasons. Usually used together with valid?
133
+ # @return Array for valid properties with the reasons
134
+ def list_invalid_properties
135
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
136
+ invalid_properties = Array.new
137
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
138
+ if !@id.nil? && @id !~ pattern
139
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
140
+ end
141
+
142
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
143
+ if !@product_id.nil? && @product_id !~ pattern
144
+ invalid_properties.push("invalid value for \"product_id\", must conform to the pattern #{pattern}.")
145
+ end
146
+
147
+ invalid_properties
148
+ end
149
+
150
+ # Check to see if the all the properties in the model are valid
151
+ # @return true if the model is valid
152
+ def valid?
153
+ warn '[DEPRECATED] the `valid?` method is obsolete'
154
+ return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
155
+ status_validator = EnumAttributeValidator.new('String', ["UNEXECUTED", "COMPLETED", "FAILED", "CANCELED", "ORGANIZATION_REVIEW", "ADMIN_HELD"])
156
+ return false unless status_validator.valid?(@status)
157
+ return false if !@product_id.nil? && @product_id !~ Regexp.new(/[A-Z0-9]{4,20}/)
158
+ true
159
+ end
160
+
161
+ # Custom attribute writer method with validation
162
+ # @param [Object] id Value to be assigned
163
+ def id=(id)
164
+ if id.nil?
165
+ fail ArgumentError, 'id cannot be nil'
166
+ end
167
+
168
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
169
+ if id !~ pattern
170
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
171
+ end
172
+
173
+ @id = id
174
+ end
175
+
176
+ # Custom attribute writer method checking allowed values (enum).
177
+ # @param [Object] status Object to be assigned
178
+ def status=(status)
179
+ validator = EnumAttributeValidator.new('String', ["UNEXECUTED", "COMPLETED", "FAILED", "CANCELED", "ORGANIZATION_REVIEW", "ADMIN_HELD"])
180
+ unless validator.valid?(status)
181
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
182
+ end
183
+ @status = status
184
+ end
185
+
186
+ # Custom attribute writer method with validation
187
+ # @param [Object] product_id Value to be assigned
188
+ def product_id=(product_id)
189
+ if product_id.nil?
190
+ fail ArgumentError, 'product_id cannot be nil'
191
+ end
192
+
193
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
194
+ if product_id !~ pattern
195
+ fail ArgumentError, "invalid value for \"product_id\", must conform to the pattern #{pattern}."
196
+ end
197
+
198
+ @product_id = product_id
199
+ end
200
+
201
+ # Checks equality by comparing each attribute.
202
+ # @param [Object] Object to be compared
203
+ def ==(o)
204
+ return true if self.equal?(o)
205
+ self.class == o.class &&
206
+ id == o.id &&
207
+ status == o.status &&
208
+ product_id == o.product_id &&
209
+ product_name == o.product_name &&
210
+ created_at == o.created_at &&
211
+ executed_at == o.executed_at
212
+ end
213
+
214
+ # @see the `==` method
215
+ # @param [Object] Object to be compared
216
+ def eql?(o)
217
+ self == o
218
+ end
219
+
220
+ # Calculates hash code according to all attributes.
221
+ # @return [Integer] Hash code
222
+ def hash
223
+ [id, status, product_id, product_name, created_at, executed_at].hash
224
+ end
225
+
226
+ # Builds the object from hash
227
+ # @param [Hash] attributes Model attributes in the form of hash
228
+ # @return [Object] Returns the model itself
229
+ def self.build_from_hash(attributes)
230
+ return nil unless attributes.is_a?(Hash)
231
+ attributes = attributes.transform_keys(&:to_sym)
232
+ transformed_hash = {}
233
+ openapi_types.each_pair do |key, type|
234
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
235
+ transformed_hash["#{key}"] = nil
236
+ elsif type =~ /\AArray<(.*)>/i
237
+ # check to ensure the input is an array given that the attribute
238
+ # is documented as an array but the input is not
239
+ if attributes[attribute_map[key]].is_a?(Array)
240
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
241
+ end
242
+ elsif !attributes[attribute_map[key]].nil?
243
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
244
+ end
245
+ end
246
+ new(transformed_hash)
247
+ end
248
+
249
+ # Deserializes the data based on type
250
+ # @param string type Data type
251
+ # @param string value Value to be deserialized
252
+ # @return [Object] Deserialized data
253
+ def self._deserialize(type, value)
254
+ case type.to_sym
255
+ when :Time
256
+ Time.parse(value)
257
+ when :Date
258
+ Date.parse(value)
259
+ when :String
260
+ value.to_s
261
+ when :Integer
262
+ value.to_i
263
+ when :Float
264
+ value.to_f
265
+ when :Boolean
266
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
267
+ true
268
+ else
269
+ false
270
+ end
271
+ when :Object
272
+ # generic object (usually a Hash), return directly
273
+ value
274
+ when /\AArray<(?<inner_type>.+)>\z/
275
+ inner_type = Regexp.last_match[:inner_type]
276
+ value.map { |v| _deserialize(inner_type, v) }
277
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
278
+ k_type = Regexp.last_match[:k_type]
279
+ v_type = Regexp.last_match[:v_type]
280
+ {}.tap do |hash|
281
+ value.each do |k, v|
282
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
283
+ end
284
+ end
285
+ else # model
286
+ # models (e.g. Pet) or oneOf
287
+ klass = Tremendous.const_get(type)
288
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
289
+ end
290
+ end
291
+
292
+ # Returns the string representation of the object
293
+ # @return [String] String presentation of the object
294
+ def to_s
295
+ to_hash.to_s
296
+ end
297
+
298
+ # to_body is an alias to to_hash (backward compatibility)
299
+ # @return [Hash] Returns the object in the form of hash
300
+ def to_body
301
+ to_hash
302
+ end
303
+
304
+ # Returns the object in the form of hash
305
+ # @return [Hash] Returns the object in the form of hash
306
+ def to_hash
307
+ hash = {}
308
+ self.class.attribute_map.each_pair do |attr, param|
309
+ value = self.send(attr)
310
+ if value.nil?
311
+ is_nullable = self.class.openapi_nullable.include?(attr)
312
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
313
+ end
314
+
315
+ hash[param] = _to_hash(value)
316
+ end
317
+ hash
318
+ end
319
+
320
+ # Outputs non-array value in the form of hash
321
+ # For object, use to_hash. Otherwise, just return the value
322
+ # @param [Object] value Any valid value
323
+ # @return [Hash] Returns the value in the form of hash
324
+ def _to_hash(value)
325
+ if value.is_a?(Array)
326
+ value.compact.map { |v| _to_hash(v) }
327
+ elsif value.is_a?(Hash)
328
+ {}.tap do |hash|
329
+ value.each { |k, v| hash[k] = _to_hash(v) }
330
+ end
331
+ elsif value.respond_to? :to_hash
332
+ value.to_hash
333
+ else
334
+ value
335
+ end
336
+ end
337
+
338
+ end
339
+
340
+ end
@@ -15,11 +15,15 @@ require 'time'
15
15
 
16
16
  module Tremendous
17
17
  class ResendReward422Response
18
+ # HTTP status code of the response
19
+ attr_accessor :status
20
+
18
21
  attr_accessor :errors
19
22
 
20
23
  # Attribute mapping from ruby-style variable name to JSON key.
21
24
  def self.attribute_map
22
25
  {
26
+ :'status' => :'status',
23
27
  :'errors' => :'errors'
24
28
  }
25
29
  end
@@ -32,6 +36,7 @@ module Tremendous
32
36
  # Attribute type mapping.
33
37
  def self.openapi_types
34
38
  {
39
+ :'status' => :'Integer',
35
40
  :'errors' => :'ListRewards401ResponseErrors'
36
41
  }
37
42
  end
@@ -57,6 +62,10 @@ module Tremendous
57
62
  h[k.to_sym] = v
58
63
  }
59
64
 
65
+ if attributes.key?(:'status')
66
+ self.status = attributes[:'status']
67
+ end
68
+
60
69
  if attributes.key?(:'errors')
61
70
  self.errors = attributes[:'errors']
62
71
  else
@@ -89,6 +98,7 @@ module Tremendous
89
98
  def ==(o)
90
99
  return true if self.equal?(o)
91
100
  self.class == o.class &&
101
+ status == o.status &&
92
102
  errors == o.errors
93
103
  end
94
104
 
@@ -101,7 +111,7 @@ module Tremendous
101
111
  # Calculates hash code according to all attributes.
102
112
  # @return [Integer] Hash code
103
113
  def hash
104
- [errors].hash
114
+ [status, errors].hash
105
115
  end
106
116
 
107
117
  # Builds the object from hash
@@ -80,7 +80,7 @@ module Tremendous
80
80
  :'deliver_at' => :'Date',
81
81
  :'custom_fields' => :'Array<RewardBaseCustomFieldsInner>',
82
82
  :'language' => :'String',
83
- :'delivery' => :'SingleRewardOrder1RewardDelivery'
83
+ :'delivery' => :'SingleRewardOrderRewardDelivery'
84
84
  }
85
85
  end
86
86
 
@@ -15,7 +15,16 @@ require 'time'
15
15
 
16
16
  module Tremendous
17
17
  # A single reward, sent to a recipient. A reward is always part of an order. Either `products` or `campaign_id` must be specified.
18
- class SingleRewardOrder1Reward
18
+ class RewardWithLink
19
+ # Tremendous ID of the reward
20
+ attr_accessor :id
21
+
22
+ # Tremendous ID of the order this reward is part of.
23
+ attr_accessor :order_id
24
+
25
+ # Date the reward was created
26
+ attr_accessor :created_at
27
+
19
28
  # ID of the campaign in your account, that defines the available products (different gift cards, charity, etc.) that the recipient can choose from.
20
29
  attr_accessor :campaign_id
21
30
 
@@ -31,21 +40,20 @@ module Tremendous
31
40
 
32
41
  attr_accessor :custom_fields
33
42
 
34
- # Set this to translate the redemption experience for this reward. Pass a 2-letter [ISO-639-1 code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) for the desired language. Defaults to `en`.
35
- attr_accessor :language
36
-
37
43
  attr_accessor :delivery
38
44
 
39
45
  # Attribute mapping from ruby-style variable name to JSON key.
40
46
  def self.attribute_map
41
47
  {
48
+ :'id' => :'id',
49
+ :'order_id' => :'order_id',
50
+ :'created_at' => :'created_at',
42
51
  :'campaign_id' => :'campaign_id',
43
52
  :'products' => :'products',
44
53
  :'value' => :'value',
45
54
  :'recipient' => :'recipient',
46
55
  :'deliver_at' => :'deliver_at',
47
56
  :'custom_fields' => :'custom_fields',
48
- :'language' => :'language',
49
57
  :'delivery' => :'delivery'
50
58
  }
51
59
  end
@@ -58,14 +66,16 @@ module Tremendous
58
66
  # Attribute type mapping.
59
67
  def self.openapi_types
60
68
  {
69
+ :'id' => :'String',
70
+ :'order_id' => :'String',
71
+ :'created_at' => :'Time',
61
72
  :'campaign_id' => :'String',
62
73
  :'products' => :'Array<String>',
63
74
  :'value' => :'ListRewards200ResponseRewardsInnerValue',
64
75
  :'recipient' => :'ListRewards200ResponseRewardsInnerRecipient',
65
76
  :'deliver_at' => :'Date',
66
- :'custom_fields' => :'Array<SingleRewardOrder1RewardCustomFieldsInner>',
67
- :'language' => :'String',
68
- :'delivery' => :'SingleRewardOrder1RewardDelivery'
77
+ :'custom_fields' => :'Array<RewardBaseCustomFieldsInner>',
78
+ :'delivery' => :'RewardWithLinkDelivery'
69
79
  }
70
80
  end
71
81
 
@@ -80,17 +90,29 @@ module Tremendous
80
90
  # @param [Hash] attributes Model attributes in the form of hash
81
91
  def initialize(attributes = {})
82
92
  if (!attributes.is_a?(Hash))
83
- fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::SingleRewardOrder1Reward` initialize method"
93
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::RewardWithLink` initialize method"
84
94
  end
85
95
 
86
96
  # check to see if the attribute exists and convert string to symbol for hash key
87
97
  attributes = attributes.each_with_object({}) { |(k, v), h|
88
98
  if (!self.class.attribute_map.key?(k.to_sym))
89
- fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::SingleRewardOrder1Reward`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
99
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::RewardWithLink`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
100
  end
91
101
  h[k.to_sym] = v
92
102
  }
93
103
 
104
+ if attributes.key?(:'id')
105
+ self.id = attributes[:'id']
106
+ end
107
+
108
+ if attributes.key?(:'order_id')
109
+ self.order_id = attributes[:'order_id']
110
+ end
111
+
112
+ if attributes.key?(:'created_at')
113
+ self.created_at = attributes[:'created_at']
114
+ end
115
+
94
116
  if attributes.key?(:'campaign_id')
95
117
  self.campaign_id = attributes[:'campaign_id']
96
118
  end
@@ -119,10 +141,6 @@ module Tremendous
119
141
  end
120
142
  end
121
143
 
122
- if attributes.key?(:'language')
123
- self.language = attributes[:'language']
124
- end
125
-
126
144
  if attributes.key?(:'delivery')
127
145
  self.delivery = attributes[:'delivery']
128
146
  end
@@ -133,6 +151,16 @@ module Tremendous
133
151
  def list_invalid_properties
134
152
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
135
153
  invalid_properties = Array.new
154
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
155
+ if !@id.nil? && @id !~ pattern
156
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
157
+ end
158
+
159
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
160
+ if !@order_id.nil? && @order_id !~ pattern
161
+ invalid_properties.push("invalid value for \"order_id\", must conform to the pattern #{pattern}.")
162
+ end
163
+
136
164
  pattern = Regexp.new(/[A-Z0-9]{4,20}/)
137
165
  if !@campaign_id.nil? && @campaign_id !~ pattern
138
166
  invalid_properties.push("invalid value for \"campaign_id\", must conform to the pattern #{pattern}.")
@@ -149,11 +177,43 @@ module Tremendous
149
177
  # @return true if the model is valid
150
178
  def valid?
151
179
  warn '[DEPRECATED] the `valid?` method is obsolete'
180
+ return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
181
+ return false if !@order_id.nil? && @order_id !~ Regexp.new(/[A-Z0-9]{4,20}/)
152
182
  return false if !@campaign_id.nil? && @campaign_id !~ Regexp.new(/[A-Z0-9]{4,20}/)
153
183
  return false if !@products.nil? && @products.length < 1
154
184
  true
155
185
  end
156
186
 
187
+ # Custom attribute writer method with validation
188
+ # @param [Object] id Value to be assigned
189
+ def id=(id)
190
+ if id.nil?
191
+ fail ArgumentError, 'id cannot be nil'
192
+ end
193
+
194
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
195
+ if id !~ pattern
196
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
197
+ end
198
+
199
+ @id = id
200
+ end
201
+
202
+ # Custom attribute writer method with validation
203
+ # @param [Object] order_id Value to be assigned
204
+ def order_id=(order_id)
205
+ if order_id.nil?
206
+ fail ArgumentError, 'order_id cannot be nil'
207
+ end
208
+
209
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
210
+ if order_id !~ pattern
211
+ fail ArgumentError, "invalid value for \"order_id\", must conform to the pattern #{pattern}."
212
+ end
213
+
214
+ @order_id = order_id
215
+ end
216
+
157
217
  # Custom attribute writer method with validation
158
218
  # @param [Object] campaign_id Value to be assigned
159
219
  def campaign_id=(campaign_id)
@@ -184,13 +244,15 @@ module Tremendous
184
244
  def ==(o)
185
245
  return true if self.equal?(o)
186
246
  self.class == o.class &&
247
+ id == o.id &&
248
+ order_id == o.order_id &&
249
+ created_at == o.created_at &&
187
250
  campaign_id == o.campaign_id &&
188
251
  products == o.products &&
189
252
  value == o.value &&
190
253
  recipient == o.recipient &&
191
254
  deliver_at == o.deliver_at &&
192
255
  custom_fields == o.custom_fields &&
193
- language == o.language &&
194
256
  delivery == o.delivery
195
257
  end
196
258
 
@@ -203,7 +265,7 @@ module Tremendous
203
265
  # Calculates hash code according to all attributes.
204
266
  # @return [Integer] Hash code
205
267
  def hash
206
- [campaign_id, products, value, recipient, deliver_at, custom_fields, language, delivery].hash
268
+ [id, order_id, created_at, campaign_id, products, value, recipient, deliver_at, custom_fields, delivery].hash
207
269
  end
208
270
 
209
271
  # Builds the object from hash