tremendous_ruby 5.5.0 → 5.7.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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tremendous/api/tremendous_api.rb +54 -256
  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/create_report201_response.rb +231 -0
  16. data/lib/tremendous/models/create_report201_response_report.rb +291 -0
  17. data/lib/tremendous/models/create_report_request.rb +295 -0
  18. data/lib/tremendous/models/{create_public_key200_response.rb → create_report_request_filters.rb} +12 -17
  19. data/lib/tremendous/models/{create_invoice.rb → create_report_request_filters_digital_rewards.rb} +128 -32
  20. data/lib/tremendous/models/{create_public_key.rb → create_report_request_filters_digital_rewards_amount.rb} +22 -18
  21. data/lib/tremendous/models/{public_keys_response.rb → create_report_request_filters_digital_rewards_created_at.rb} +22 -19
  22. data/lib/tremendous/models/delivery_details.rb +0 -14
  23. data/lib/tremendous/models/delivery_details_with_link.rb +296 -0
  24. data/lib/tremendous/models/error_model.rb +11 -1
  25. data/lib/tremendous/models/fraud_rule400_response.rb +11 -1
  26. data/lib/tremendous/models/fraud_rule422_response.rb +11 -1
  27. data/lib/tremendous/models/fraud_rules_list_item.rb +4 -2
  28. data/lib/tremendous/models/generate_reward_link403_response.rb +11 -1
  29. data/lib/tremendous/models/invoice.rb +10 -1
  30. data/lib/tremendous/models/list_fraud_reviews200_response.rb +21 -4
  31. data/lib/tremendous/models/list_fraud_rules200_response_fraud_rules_inner.rb +4 -2
  32. data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb +37 -7
  33. data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta_failure_details.rb +225 -0
  34. data/lib/tremendous/models/list_invoices200_response_invoices_inner.rb +10 -1
  35. data/lib/tremendous/models/list_orders200_response_orders_inner_payment.rb +4 -48
  36. data/lib/tremendous/models/list_rewards200_response_rewards_inner_delivery.rb +0 -14
  37. data/lib/tremendous/models/list_rewards401_response.rb +11 -1
  38. data/lib/tremendous/models/list_rewards401_response_errors.rb +4 -2
  39. data/lib/tremendous/models/list_rewards429_response.rb +11 -1
  40. data/lib/tremendous/models/order_base_payment.rb +4 -48
  41. data/lib/tremendous/models/order_with_link.rb +403 -0
  42. data/lib/tremendous/models/order_with_link_rewards_inner.rb +385 -0
  43. data/lib/tremendous/models/payment_details.rb +4 -48
  44. data/lib/tremendous/models/payout.rb +352 -0
  45. data/lib/tremendous/models/report.rb +291 -0
  46. data/lib/tremendous/models/resend_reward422_response.rb +11 -1
  47. data/lib/tremendous/models/resend_reward_request.rb +225 -0
  48. data/lib/tremendous/models/reward_for_order_create.rb +1 -1
  49. data/lib/tremendous/models/{single_reward_order1_reward.rb → reward_with_link.rb} +78 -16
  50. data/lib/tremendous/models/reward_with_link_delivery.rb +296 -0
  51. data/lib/tremendous/models/reward_without_link_delivery.rb +0 -14
  52. data/lib/tremendous/models/single_reward_order.rb +1 -1
  53. data/lib/tremendous/models/{single_reward_order1_payment.rb → single_reward_order_payment.rb} +3 -3
  54. data/lib/tremendous/models/single_reward_order_reward.rb +3 -75
  55. data/lib/tremendous/models/{single_reward_order1_reward_custom_fields_inner.rb → single_reward_order_reward_custom_fields_inner.rb} +3 -3
  56. data/lib/tremendous/models/{single_reward_order1_reward_delivery.rb → single_reward_order_reward_delivery.rb} +3 -3
  57. data/lib/tremendous/models/{test_public_key.rb → single_reward_order_with_link.rb} +14 -15
  58. data/lib/tremendous/models/single_reward_order_with_link_order.rb +403 -0
  59. data/lib/tremendous/version.rb +1 -1
  60. data/lib/tremendous.rb +27 -14
  61. metadata +29 -16
  62. data/lib/tremendous/models/single_reward_order1.rb +0 -242
  63. data/lib/tremendous/models/test_public_key_request.rb +0 -222
@@ -0,0 +1,225 @@
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 ResendRewardRequest
18
+ # The new email address of the recipient (only for rewards delivered via email)
19
+ attr_accessor :updated_email
20
+
21
+ # The new phone number of the recipient (only for rewards delivered via SMS)
22
+ attr_accessor :updated_phone
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'updated_email' => :'updated_email',
28
+ :'updated_phone' => :'updated_phone'
29
+ }
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'updated_email' => :'String',
41
+ :'updated_phone' => :'String'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ResendRewardRequest` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::ResendRewardRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'updated_email')
67
+ self.updated_email = attributes[:'updated_email']
68
+ end
69
+
70
+ if attributes.key?(:'updated_phone')
71
+ self.updated_phone = attributes[:'updated_phone']
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
79
+ invalid_properties = Array.new
80
+ invalid_properties
81
+ end
82
+
83
+ # Check to see if the all the properties in the model are valid
84
+ # @return true if the model is valid
85
+ def valid?
86
+ warn '[DEPRECATED] the `valid?` method is obsolete'
87
+ true
88
+ end
89
+
90
+ # Checks equality by comparing each attribute.
91
+ # @param [Object] Object to be compared
92
+ def ==(o)
93
+ return true if self.equal?(o)
94
+ self.class == o.class &&
95
+ updated_email == o.updated_email &&
96
+ updated_phone == o.updated_phone
97
+ end
98
+
99
+ # @see the `==` method
100
+ # @param [Object] Object to be compared
101
+ def eql?(o)
102
+ self == o
103
+ end
104
+
105
+ # Calculates hash code according to all attributes.
106
+ # @return [Integer] Hash code
107
+ def hash
108
+ [updated_email, updated_phone].hash
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def self.build_from_hash(attributes)
115
+ return nil unless attributes.is_a?(Hash)
116
+ attributes = attributes.transform_keys(&:to_sym)
117
+ transformed_hash = {}
118
+ openapi_types.each_pair do |key, type|
119
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
120
+ transformed_hash["#{key}"] = nil
121
+ elsif type =~ /\AArray<(.*)>/i
122
+ # check to ensure the input is an array given that the attribute
123
+ # is documented as an array but the input is not
124
+ if attributes[attribute_map[key]].is_a?(Array)
125
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
126
+ end
127
+ elsif !attributes[attribute_map[key]].nil?
128
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
129
+ end
130
+ end
131
+ new(transformed_hash)
132
+ end
133
+
134
+ # Deserializes the data based on type
135
+ # @param string type Data type
136
+ # @param string value Value to be deserialized
137
+ # @return [Object] Deserialized data
138
+ def self._deserialize(type, value)
139
+ case type.to_sym
140
+ when :Time
141
+ Time.parse(value)
142
+ when :Date
143
+ Date.parse(value)
144
+ when :String
145
+ value.to_s
146
+ when :Integer
147
+ value.to_i
148
+ when :Float
149
+ value.to_f
150
+ when :Boolean
151
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
152
+ true
153
+ else
154
+ false
155
+ end
156
+ when :Object
157
+ # generic object (usually a Hash), return directly
158
+ value
159
+ when /\AArray<(?<inner_type>.+)>\z/
160
+ inner_type = Regexp.last_match[:inner_type]
161
+ value.map { |v| _deserialize(inner_type, v) }
162
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
163
+ k_type = Regexp.last_match[:k_type]
164
+ v_type = Regexp.last_match[:v_type]
165
+ {}.tap do |hash|
166
+ value.each do |k, v|
167
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
+ end
169
+ end
170
+ else # model
171
+ # models (e.g. Pet) or oneOf
172
+ klass = Tremendous.const_get(type)
173
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
174
+ end
175
+ end
176
+
177
+ # Returns the string representation of the object
178
+ # @return [String] String presentation of the object
179
+ def to_s
180
+ to_hash.to_s
181
+ end
182
+
183
+ # to_body is an alias to to_hash (backward compatibility)
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_body
186
+ to_hash
187
+ end
188
+
189
+ # Returns the object in the form of hash
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_hash
192
+ hash = {}
193
+ self.class.attribute_map.each_pair do |attr, param|
194
+ value = self.send(attr)
195
+ if value.nil?
196
+ is_nullable = self.class.openapi_nullable.include?(attr)
197
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
198
+ end
199
+
200
+ hash[param] = _to_hash(value)
201
+ end
202
+ hash
203
+ end
204
+
205
+ # Outputs non-array value in the form of hash
206
+ # For object, use to_hash. Otherwise, just return the value
207
+ # @param [Object] value Any valid value
208
+ # @return [Hash] Returns the value in the form of hash
209
+ def _to_hash(value)
210
+ if value.is_a?(Array)
211
+ value.compact.map { |v| _to_hash(v) }
212
+ elsif value.is_a?(Hash)
213
+ {}.tap do |hash|
214
+ value.each { |k, v| hash[k] = _to_hash(v) }
215
+ end
216
+ elsif value.respond_to? :to_hash
217
+ value.to_hash
218
+ else
219
+ value
220
+ end
221
+ end
222
+
223
+ end
224
+
225
+ end
@@ -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