tremendous_ruby 5.0.1 → 5.3.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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tremendous/api/tremendous_api.rb +677 -9
  3. data/lib/tremendous/models/campaign.rb +25 -14
  4. data/lib/tremendous/models/campaign_base.rb +287 -0
  5. data/lib/tremendous/models/{get_campaign200_response.rb → create_campaign201_response.rb} +3 -3
  6. data/lib/tremendous/models/create_campaign_request.rb +273 -0
  7. data/lib/tremendous/models/create_member.rb +2 -53
  8. data/lib/tremendous/models/create_member_request.rb +2 -53
  9. data/lib/tremendous/models/create_order_request_reward.rb +1 -1
  10. data/lib/tremendous/models/create_order_request_reward_custom_fields_inner.rb +248 -0
  11. data/lib/tremendous/models/create_organization_request_copy_settings.rb +29 -5
  12. data/lib/tremendous/models/{list_products200_response_products_inner_countries_inner.rb → create_public_key.rb} +15 -15
  13. data/lib/tremendous/models/create_public_key200_response.rb +221 -0
  14. data/lib/tremendous/models/create_public_key_request.rb +222 -0
  15. data/lib/tremendous/models/custom_field.rb +15 -5
  16. data/lib/tremendous/models/get_member200_response_member.rb +13 -21
  17. data/lib/tremendous/models/invoice.rb +2 -2
  18. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner.rb +25 -14
  19. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner_email_style.rb +270 -0
  20. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner_webpage_style.rb +270 -0
  21. data/lib/tremendous/models/{get_product200_response.rb → list_forex_response.rb} +16 -14
  22. data/lib/tremendous/models/list_invoices200_response_invoices_inner.rb +2 -2
  23. data/lib/tremendous/models/list_members200_response_members_inner.rb +13 -21
  24. data/lib/tremendous/models/list_rewards200_response_rewards_inner_custom_fields_inner.rb +15 -5
  25. data/lib/tremendous/models/{list_products200_response.rb → list_roles200_response.rb} +15 -15
  26. data/lib/tremendous/models/{list_products200_response_products_inner_images_inner.rb → list_roles200_response_roles_inner.rb} +59 -57
  27. data/lib/tremendous/models/member.rb +13 -21
  28. data/lib/tremendous/models/member_base.rb +13 -21
  29. data/lib/tremendous/models/member_with_events.rb +13 -21
  30. data/lib/tremendous/models/member_without_events.rb +13 -21
  31. data/lib/tremendous/models/public_key.rb +257 -0
  32. data/lib/tremendous/models/public_keys_response.rb +223 -0
  33. data/lib/tremendous/models/public_keys_response_public_keys_inner.rb +257 -0
  34. data/lib/tremendous/models/reward_base_custom_fields_inner.rb +15 -5
  35. data/lib/tremendous/models/{list_products200_response_products_inner_skus_inner.rb → role.rb} +51 -53
  36. data/lib/tremendous/models/test_public_key.rb +222 -0
  37. data/lib/tremendous/models/test_public_key_request.rb +222 -0
  38. data/lib/tremendous/models/update_campaign.rb +287 -0
  39. data/lib/tremendous/models/update_campaign_request.rb +257 -0
  40. data/lib/tremendous/version.rb +1 -1
  41. data/lib/tremendous.rb +20 -1
  42. metadata +23 -10
  43. data/lib/tremendous/models/list_products200_response_products_inner.rb +0 -457
@@ -0,0 +1,223 @@
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
+ OpenAPI Generator version: 7.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Tremendous
17
+ class PublicKeysResponse
18
+ attr_accessor :public_keys
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'public_keys' => :'public_keys'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'public_keys' => :'Array<PublicKeysResponsePublicKeysInner>'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::PublicKeysResponse` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::PublicKeysResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'public_keys')
61
+ if (value = attributes[:'public_keys']).is_a?(Array)
62
+ self.public_keys = value
63
+ end
64
+ else
65
+ self.public_keys = nil
66
+ end
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properties with the reasons
71
+ def list_invalid_properties
72
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
73
+ invalid_properties = Array.new
74
+ if @public_keys.nil?
75
+ invalid_properties.push('invalid value for "public_keys", public_keys cannot be nil.')
76
+ end
77
+
78
+ invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ warn '[DEPRECATED] the `valid?` method is obsolete'
85
+ return false if @public_keys.nil?
86
+ true
87
+ end
88
+
89
+ # Checks equality by comparing each attribute.
90
+ # @param [Object] Object to be compared
91
+ def ==(o)
92
+ return true if self.equal?(o)
93
+ self.class == o.class &&
94
+ public_keys == o.public_keys
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Integer] Hash code
105
+ def hash
106
+ [public_keys].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def self.build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+ attributes = attributes.transform_keys(&:to_sym)
115
+ transformed_hash = {}
116
+ openapi_types.each_pair do |key, type|
117
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = nil
119
+ elsif type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[attribute_map[key]].is_a?(Array)
123
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
124
+ end
125
+ elsif !attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
127
+ end
128
+ end
129
+ new(transformed_hash)
130
+ end
131
+
132
+ # Deserializes the data based on type
133
+ # @param string type Data type
134
+ # @param string value Value to be deserialized
135
+ # @return [Object] Deserialized data
136
+ def self._deserialize(type, value)
137
+ case type.to_sym
138
+ when :Time
139
+ Time.parse(value)
140
+ when :Date
141
+ Date.parse(value)
142
+ when :String
143
+ value.to_s
144
+ when :Integer
145
+ value.to_i
146
+ when :Float
147
+ value.to_f
148
+ when :Boolean
149
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
+ true
151
+ else
152
+ false
153
+ end
154
+ when :Object
155
+ # generic object (usually a Hash), return directly
156
+ value
157
+ when /\AArray<(?<inner_type>.+)>\z/
158
+ inner_type = Regexp.last_match[:inner_type]
159
+ value.map { |v| _deserialize(inner_type, v) }
160
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
+ k_type = Regexp.last_match[:k_type]
162
+ v_type = Regexp.last_match[:v_type]
163
+ {}.tap do |hash|
164
+ value.each do |k, v|
165
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
+ end
167
+ end
168
+ else # model
169
+ # models (e.g. Pet) or oneOf
170
+ klass = Tremendous.const_get(type)
171
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ if value.nil?
194
+ is_nullable = self.class.openapi_nullable.include?(attr)
195
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
196
+ end
197
+
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+
221
+ end
222
+
223
+ end
@@ -0,0 +1,257 @@
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
+ OpenAPI Generator version: 7.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Tremendous
17
+ # To authenticate your requests using asymmetric key pairs (e.g., for signing embed requests), you need to share your public key with us. The public key resource allows you to manage your active public keys and track their last usage.
18
+ class PublicKeysResponsePublicKeysInner
19
+ attr_accessor :id
20
+
21
+ # Your public key, PEM encoded
22
+ attr_accessor :pem
23
+
24
+ # The last time your public key was used to sign a request
25
+ attr_accessor :last_used_at
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'id' => :'id',
31
+ :'pem' => :'pem',
32
+ :'last_used_at' => :'last_used_at'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'id' => :'String',
45
+ :'pem' => :'String',
46
+ :'last_used_at' => :'Time'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ :'last_used_at'
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::PublicKeysResponsePublicKeysInner` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::PublicKeysResponsePublicKeysInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'id')
73
+ self.id = attributes[:'id']
74
+ end
75
+
76
+ if attributes.key?(:'pem')
77
+ self.pem = attributes[:'pem']
78
+ end
79
+
80
+ if attributes.key?(:'last_used_at')
81
+ self.last_used_at = attributes[:'last_used_at']
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
89
+ invalid_properties = Array.new
90
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
91
+ if !@id.nil? && @id !~ pattern
92
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
93
+ end
94
+
95
+ invalid_properties
96
+ end
97
+
98
+ # Check to see if the all the properties in the model are valid
99
+ # @return true if the model is valid
100
+ def valid?
101
+ warn '[DEPRECATED] the `valid?` method is obsolete'
102
+ return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
103
+ true
104
+ end
105
+
106
+ # Custom attribute writer method with validation
107
+ # @param [Object] id Value to be assigned
108
+ def id=(id)
109
+ if id.nil?
110
+ fail ArgumentError, 'id cannot be nil'
111
+ end
112
+
113
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
114
+ if id !~ pattern
115
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
116
+ end
117
+
118
+ @id = id
119
+ end
120
+
121
+ # Checks equality by comparing each attribute.
122
+ # @param [Object] Object to be compared
123
+ def ==(o)
124
+ return true if self.equal?(o)
125
+ self.class == o.class &&
126
+ id == o.id &&
127
+ pem == o.pem &&
128
+ last_used_at == o.last_used_at
129
+ end
130
+
131
+ # @see the `==` method
132
+ # @param [Object] Object to be compared
133
+ def eql?(o)
134
+ self == o
135
+ end
136
+
137
+ # Calculates hash code according to all attributes.
138
+ # @return [Integer] Hash code
139
+ def hash
140
+ [id, pem, last_used_at].hash
141
+ end
142
+
143
+ # Builds the object from hash
144
+ # @param [Hash] attributes Model attributes in the form of hash
145
+ # @return [Object] Returns the model itself
146
+ def self.build_from_hash(attributes)
147
+ return nil unless attributes.is_a?(Hash)
148
+ attributes = attributes.transform_keys(&:to_sym)
149
+ transformed_hash = {}
150
+ openapi_types.each_pair do |key, type|
151
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
152
+ transformed_hash["#{key}"] = nil
153
+ elsif type =~ /\AArray<(.*)>/i
154
+ # check to ensure the input is an array given that the attribute
155
+ # is documented as an array but the input is not
156
+ if attributes[attribute_map[key]].is_a?(Array)
157
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
158
+ end
159
+ elsif !attributes[attribute_map[key]].nil?
160
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
161
+ end
162
+ end
163
+ new(transformed_hash)
164
+ end
165
+
166
+ # Deserializes the data based on type
167
+ # @param string type Data type
168
+ # @param string value Value to be deserialized
169
+ # @return [Object] Deserialized data
170
+ def self._deserialize(type, value)
171
+ case type.to_sym
172
+ when :Time
173
+ Time.parse(value)
174
+ when :Date
175
+ Date.parse(value)
176
+ when :String
177
+ value.to_s
178
+ when :Integer
179
+ value.to_i
180
+ when :Float
181
+ value.to_f
182
+ when :Boolean
183
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
184
+ true
185
+ else
186
+ false
187
+ end
188
+ when :Object
189
+ # generic object (usually a Hash), return directly
190
+ value
191
+ when /\AArray<(?<inner_type>.+)>\z/
192
+ inner_type = Regexp.last_match[:inner_type]
193
+ value.map { |v| _deserialize(inner_type, v) }
194
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
195
+ k_type = Regexp.last_match[:k_type]
196
+ v_type = Regexp.last_match[:v_type]
197
+ {}.tap do |hash|
198
+ value.each do |k, v|
199
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
200
+ end
201
+ end
202
+ else # model
203
+ # models (e.g. Pet) or oneOf
204
+ klass = Tremendous.const_get(type)
205
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
206
+ end
207
+ end
208
+
209
+ # Returns the string representation of the object
210
+ # @return [String] String presentation of the object
211
+ def to_s
212
+ to_hash.to_s
213
+ end
214
+
215
+ # to_body is an alias to to_hash (backward compatibility)
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_body
218
+ to_hash
219
+ end
220
+
221
+ # Returns the object in the form of hash
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_hash
224
+ hash = {}
225
+ self.class.attribute_map.each_pair do |attr, param|
226
+ value = self.send(attr)
227
+ if value.nil?
228
+ is_nullable = self.class.openapi_nullable.include?(attr)
229
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
230
+ end
231
+
232
+ hash[param] = _to_hash(value)
233
+ end
234
+ hash
235
+ end
236
+
237
+ # Outputs non-array value in the form of hash
238
+ # For object, use to_hash. Otherwise, just return the value
239
+ # @param [Object] value Any valid value
240
+ # @return [Hash] Returns the value in the form of hash
241
+ def _to_hash(value)
242
+ if value.is_a?(Array)
243
+ value.compact.map { |v| _to_hash(v) }
244
+ elsif value.is_a?(Hash)
245
+ {}.tap do |hash|
246
+ value.each { |k, v| hash[k] = _to_hash(v) }
247
+ end
248
+ elsif value.respond_to? :to_hash
249
+ value.to_hash
250
+ else
251
+ value
252
+ end
253
+ end
254
+
255
+ end
256
+
257
+ end
@@ -22,11 +22,15 @@ module Tremendous
22
22
  # Value of the custom field
23
23
  attr_accessor :value
24
24
 
25
+ # Label of the custom field
26
+ attr_accessor :label
27
+
25
28
  # Attribute mapping from ruby-style variable name to JSON key.
26
29
  def self.attribute_map
27
30
  {
28
31
  :'id' => :'id',
29
- :'value' => :'value'
32
+ :'value' => :'value',
33
+ :'label' => :'label'
30
34
  }
31
35
  end
32
36
 
@@ -39,14 +43,15 @@ module Tremendous
39
43
  def self.openapi_types
40
44
  {
41
45
  :'id' => :'String',
42
- :'value' => :'String'
46
+ :'value' => :'String',
47
+ :'label' => :'String'
43
48
  }
44
49
  end
45
50
 
46
51
  # List of attributes with nullable: true
47
52
  def self.openapi_nullable
48
53
  Set.new([
49
- :'value'
54
+ :'value',
50
55
  ])
51
56
  end
52
57
 
@@ -72,6 +77,10 @@ module Tremendous
72
77
  if attributes.key?(:'value')
73
78
  self.value = attributes[:'value']
74
79
  end
80
+
81
+ if attributes.key?(:'label')
82
+ self.label = attributes[:'label']
83
+ end
75
84
  end
76
85
 
77
86
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -116,7 +125,8 @@ module Tremendous
116
125
  return true if self.equal?(o)
117
126
  self.class == o.class &&
118
127
  id == o.id &&
119
- value == o.value
128
+ value == o.value &&
129
+ label == o.label
120
130
  end
121
131
 
122
132
  # @see the `==` method
@@ -128,7 +138,7 @@ module Tremendous
128
138
  # Calculates hash code according to all attributes.
129
139
  # @return [Integer] Hash code
130
140
  def hash
131
- [id, value].hash
141
+ [id, value, label].hash
132
142
  end
133
143
 
134
144
  # Builds the object from hash