tremendous_ruby 5.0.0 → 5.0.1

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 (141) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tremendous/api/tremendous_api.rb +2365 -0
  3. data/lib/tremendous/api_client.rb +431 -0
  4. data/lib/tremendous/api_error.rb +58 -0
  5. data/lib/tremendous/configuration.rb +389 -0
  6. data/lib/tremendous/models/balance_transaction.rb +256 -0
  7. data/lib/tremendous/models/campaign.rb +292 -0
  8. data/lib/tremendous/models/create_api_key200_response.rb +215 -0
  9. data/lib/tremendous/models/create_invoice.rb +244 -0
  10. data/lib/tremendous/models/create_invoice200_response.rb +221 -0
  11. data/lib/tremendous/models/create_invoice_request.rb +244 -0
  12. data/lib/tremendous/models/create_member.rb +290 -0
  13. data/lib/tremendous/models/create_member200_response.rb +221 -0
  14. data/lib/tremendous/models/create_member_request.rb +290 -0
  15. data/lib/tremendous/models/create_order200_response.rb +221 -0
  16. data/lib/tremendous/models/create_order200_response_order.rb +400 -0
  17. data/lib/tremendous/models/create_order200_response_order_rewards_inner.rb +347 -0
  18. data/lib/tremendous/models/create_order200_response_order_rewards_inner_delivery.rb +296 -0
  19. data/lib/tremendous/models/create_order201_response.rb +221 -0
  20. data/lib/tremendous/models/create_order_request.rb +248 -0
  21. data/lib/tremendous/models/create_order_request_payment.rb +222 -0
  22. data/lib/tremendous/models/create_order_request_reward.rb +344 -0
  23. data/lib/tremendous/models/create_order_request_reward_delivery.rb +250 -0
  24. data/lib/tremendous/models/create_organization.rb +268 -0
  25. data/lib/tremendous/models/create_organization200_response.rb +214 -0
  26. data/lib/tremendous/models/create_organization200_response_organization.rb +334 -0
  27. data/lib/tremendous/models/create_organization_request.rb +268 -0
  28. data/lib/tremendous/models/create_organization_request_copy_settings.rb +278 -0
  29. data/lib/tremendous/models/create_webhook200_response.rb +214 -0
  30. data/lib/tremendous/models/create_webhook_request.rb +222 -0
  31. data/lib/tremendous/models/currency_codes.rb +154 -0
  32. data/lib/tremendous/models/custom_field.rb +248 -0
  33. data/lib/tremendous/models/delivery_details.rb +286 -0
  34. data/lib/tremendous/models/delivery_details_with_link.rb +296 -0
  35. data/lib/tremendous/models/delivery_method.rb +41 -0
  36. data/lib/tremendous/models/delivery_status.rb +42 -0
  37. data/lib/tremendous/models/error_model.rb +221 -0
  38. data/lib/tremendous/models/field.rb +286 -0
  39. data/lib/tremendous/models/funding_source.rb +332 -0
  40. data/lib/tremendous/models/generate_reward_link200_response.rb +221 -0
  41. data/lib/tremendous/models/generate_reward_link200_response_reward.rb +247 -0
  42. data/lib/tremendous/models/generate_reward_link403_response.rb +221 -0
  43. data/lib/tremendous/models/generate_reward_token200_response.rb +221 -0
  44. data/lib/tremendous/models/generate_reward_token200_response_reward.rb +257 -0
  45. data/lib/tremendous/models/get_campaign200_response.rb +221 -0
  46. data/lib/tremendous/models/get_funding_source200_response.rb +221 -0
  47. data/lib/tremendous/models/get_member200_response.rb +221 -0
  48. data/lib/tremendous/models/get_member200_response_member.rb +365 -0
  49. data/lib/tremendous/models/get_member200_response_member_events_inner.rb +260 -0
  50. data/lib/tremendous/models/get_organization200_response.rb +214 -0
  51. data/lib/tremendous/models/get_product200_response.rb +221 -0
  52. data/lib/tremendous/models/get_product_response.rb +221 -0
  53. data/lib/tremendous/models/get_reward200_response.rb +221 -0
  54. data/lib/tremendous/models/invoice.rb +356 -0
  55. data/lib/tremendous/models/list_balance_transactions200_response.rb +216 -0
  56. data/lib/tremendous/models/list_balance_transactions200_response_invoices_inner.rb +256 -0
  57. data/lib/tremendous/models/list_campaigns200_response.rb +223 -0
  58. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner.rb +292 -0
  59. data/lib/tremendous/models/list_fields200_response.rb +216 -0
  60. data/lib/tremendous/models/list_fields200_response_fields_inner.rb +286 -0
  61. data/lib/tremendous/models/list_funding_sources200_response.rb +223 -0
  62. data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner.rb +332 -0
  63. data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb +436 -0
  64. data/lib/tremendous/models/list_invoices200_response.rb +240 -0
  65. data/lib/tremendous/models/list_invoices200_response_invoices_inner.rb +356 -0
  66. data/lib/tremendous/models/list_members200_response.rb +223 -0
  67. data/lib/tremendous/models/list_members200_response_members_inner.rb +374 -0
  68. data/lib/tremendous/models/list_orders200_response.rb +240 -0
  69. data/lib/tremendous/models/list_orders200_response_orders_inner.rb +379 -0
  70. data/lib/tremendous/models/list_orders200_response_orders_inner_payment.rb +346 -0
  71. data/lib/tremendous/models/list_orders200_response_orders_inner_payment_refund.rb +242 -0
  72. data/lib/tremendous/models/list_organizations200_response.rb +216 -0
  73. data/lib/tremendous/models/list_organizations200_response_organizations_inner.rb +324 -0
  74. data/lib/tremendous/models/list_products200_response.rb +223 -0
  75. data/lib/tremendous/models/list_products200_response_products_inner.rb +457 -0
  76. data/lib/tremendous/models/list_products200_response_products_inner_countries_inner.rb +222 -0
  77. data/lib/tremendous/models/list_products200_response_products_inner_images_inner.rb +273 -0
  78. data/lib/tremendous/models/list_products200_response_products_inner_skus_inner.rb +277 -0
  79. data/lib/tremendous/models/list_products_response.rb +223 -0
  80. data/lib/tremendous/models/list_products_response_products_inner.rb +457 -0
  81. data/lib/tremendous/models/list_products_response_products_inner_countries_inner.rb +222 -0
  82. data/lib/tremendous/models/list_products_response_products_inner_images_inner.rb +273 -0
  83. data/lib/tremendous/models/list_products_response_products_inner_skus_inner.rb +277 -0
  84. data/lib/tremendous/models/list_rewards200_response.rb +226 -0
  85. data/lib/tremendous/models/list_rewards200_response_rewards_inner.rb +347 -0
  86. data/lib/tremendous/models/list_rewards200_response_rewards_inner_custom_fields_inner.rb +248 -0
  87. data/lib/tremendous/models/list_rewards200_response_rewards_inner_delivery.rb +286 -0
  88. data/lib/tremendous/models/list_rewards200_response_rewards_inner_recipient.rb +236 -0
  89. data/lib/tremendous/models/list_rewards200_response_rewards_inner_value.rb +273 -0
  90. data/lib/tremendous/models/list_rewards401_response.rb +221 -0
  91. data/lib/tremendous/models/list_rewards401_response_errors.rb +225 -0
  92. data/lib/tremendous/models/list_rewards429_response.rb +221 -0
  93. data/lib/tremendous/models/list_webhook_events200_response.rb +216 -0
  94. data/lib/tremendous/models/list_webhooks200_response.rb +216 -0
  95. data/lib/tremendous/models/list_webhooks200_response_webhooks_inner.rb +258 -0
  96. data/lib/tremendous/models/member.rb +374 -0
  97. data/lib/tremendous/models/member_base.rb +353 -0
  98. data/lib/tremendous/models/member_with_events.rb +365 -0
  99. data/lib/tremendous/models/member_without_events.rb +374 -0
  100. data/lib/tremendous/models/order.rb +379 -0
  101. data/lib/tremendous/models/order_base.rb +370 -0
  102. data/lib/tremendous/models/order_base_payment.rb +346 -0
  103. data/lib/tremendous/models/order_for_create.rb +248 -0
  104. data/lib/tremendous/models/order_for_create_reward.rb +416 -0
  105. data/lib/tremendous/models/order_status.rb +44 -0
  106. data/lib/tremendous/models/order_with_link.rb +400 -0
  107. data/lib/tremendous/models/order_with_link_rewards_inner.rb +406 -0
  108. data/lib/tremendous/models/order_without_link.rb +379 -0
  109. data/lib/tremendous/models/order_without_link_reward.rb +406 -0
  110. data/lib/tremendous/models/organization.rb +324 -0
  111. data/lib/tremendous/models/payment_details.rb +345 -0
  112. data/lib/tremendous/models/payment_details_refund.rb +242 -0
  113. data/lib/tremendous/models/product.rb +457 -0
  114. data/lib/tremendous/models/recipient.rb +236 -0
  115. data/lib/tremendous/models/refund_details.rb +241 -0
  116. data/lib/tremendous/models/resend_reward422_response.rb +221 -0
  117. data/lib/tremendous/models/reward.rb +406 -0
  118. data/lib/tremendous/models/reward_base.rb +397 -0
  119. data/lib/tremendous/models/reward_base_custom_fields_inner.rb +248 -0
  120. data/lib/tremendous/models/reward_for_order_create.rb +416 -0
  121. data/lib/tremendous/models/reward_link.rb +247 -0
  122. data/lib/tremendous/models/reward_token.rb +257 -0
  123. data/lib/tremendous/models/reward_value.rb +273 -0
  124. data/lib/tremendous/models/reward_with_link.rb +406 -0
  125. data/lib/tremendous/models/reward_with_link_delivery.rb +296 -0
  126. data/lib/tremendous/models/reward_without_link.rb +406 -0
  127. data/lib/tremendous/models/reward_without_link_delivery.rb +286 -0
  128. data/lib/tremendous/models/simulate_webhook_request.rb +222 -0
  129. data/lib/tremendous/models/webhook.rb +258 -0
  130. data/lib/tremendous/models/webhook_post.rb +222 -0
  131. data/lib/tremendous/version.rb +3 -0
  132. data/lib/tremendous.rb +159 -0
  133. metadata +133 -10
  134. data/spec/integration/campaigns_spec.rb +0 -27
  135. data/spec/integration/funding_sources_spec.rb +0 -18
  136. data/spec/integration/invoices_spec.rb +0 -19
  137. data/spec/integration/members_spec.rb +0 -19
  138. data/spec/integration/orders_spec.rb +0 -53
  139. data/spec/integration/products_spec.rb +0 -26
  140. data/spec/spec_helper.rb +0 -111
  141. data/spec/support/setup.rb +0 -10
@@ -0,0 +1,334 @@
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
+ # Organizations are a way to separate different parts of your business within the same Tremendous account. Your root Tremendous account is an organization itself and can have multiple sub-organizations. You can assign users in your Tremendous team as members to any organization. Users can be members of multiple organizations at once. Each organizations can have it's own API key.
18
+ class CreateOrganization200ResponseOrganization
19
+ attr_accessor :id
20
+
21
+ # Name of the organization
22
+ attr_accessor :name
23
+
24
+ # URL of the website of that organization
25
+ attr_accessor :website
26
+
27
+ # Status of the organization. Organizations need to be approved to be able to use them to send out rewards.
28
+ attr_accessor :status
29
+
30
+ # Timestamp of when the organization has been created. *This field is only returned when creating an organization.* It is not returned anymore when retrieving or listing organizations.
31
+ attr_accessor :created_at
32
+
33
+ # The API key for the created organization. This property is only returned when `with_api_key` is set to `true`.
34
+ attr_accessor :api_key
35
+
36
+ class EnumAttributeValidator
37
+ attr_reader :datatype
38
+ attr_reader :allowable_values
39
+
40
+ def initialize(datatype, allowable_values)
41
+ @allowable_values = allowable_values.map do |value|
42
+ case datatype.to_s
43
+ when /Integer/i
44
+ value.to_i
45
+ when /Float/i
46
+ value.to_f
47
+ else
48
+ value
49
+ end
50
+ end
51
+ end
52
+
53
+ def valid?(value)
54
+ !value || allowable_values.include?(value)
55
+ end
56
+ end
57
+
58
+ # Attribute mapping from ruby-style variable name to JSON key.
59
+ def self.attribute_map
60
+ {
61
+ :'id' => :'id',
62
+ :'name' => :'name',
63
+ :'website' => :'website',
64
+ :'status' => :'status',
65
+ :'created_at' => :'created_at',
66
+ :'api_key' => :'api_key'
67
+ }
68
+ end
69
+
70
+ # Returns all the JSON keys this model knows about
71
+ def self.acceptable_attributes
72
+ attribute_map.values
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.openapi_types
77
+ {
78
+ :'id' => :'String',
79
+ :'name' => :'String',
80
+ :'website' => :'String',
81
+ :'status' => :'String',
82
+ :'created_at' => :'Date',
83
+ :'api_key' => :'String'
84
+ }
85
+ end
86
+
87
+ # List of attributes with nullable: true
88
+ def self.openapi_nullable
89
+ Set.new([
90
+ ])
91
+ end
92
+
93
+ # Initializes the object
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ def initialize(attributes = {})
96
+ if (!attributes.is_a?(Hash))
97
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::CreateOrganization200ResponseOrganization` initialize method"
98
+ end
99
+
100
+ # check to see if the attribute exists and convert string to symbol for hash key
101
+ attributes = attributes.each_with_object({}) { |(k, v), h|
102
+ if (!self.class.attribute_map.key?(k.to_sym))
103
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::CreateOrganization200ResponseOrganization`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
104
+ end
105
+ h[k.to_sym] = v
106
+ }
107
+
108
+ if attributes.key?(:'id')
109
+ self.id = attributes[:'id']
110
+ end
111
+
112
+ if attributes.key?(:'name')
113
+ self.name = attributes[:'name']
114
+ else
115
+ self.name = nil
116
+ end
117
+
118
+ if attributes.key?(:'website')
119
+ self.website = attributes[:'website']
120
+ else
121
+ self.website = nil
122
+ end
123
+
124
+ if attributes.key?(:'status')
125
+ self.status = attributes[:'status']
126
+ end
127
+
128
+ if attributes.key?(:'created_at')
129
+ self.created_at = attributes[:'created_at']
130
+ end
131
+
132
+ if attributes.key?(:'api_key')
133
+ self.api_key = attributes[:'api_key']
134
+ end
135
+ end
136
+
137
+ # Show invalid properties with the reasons. Usually used together with valid?
138
+ # @return Array for valid properties with the reasons
139
+ def list_invalid_properties
140
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
141
+ invalid_properties = Array.new
142
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
143
+ if !@id.nil? && @id !~ pattern
144
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
145
+ end
146
+
147
+ if @name.nil?
148
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
149
+ end
150
+
151
+ if @website.nil?
152
+ invalid_properties.push('invalid value for "website", website cannot be nil.')
153
+ end
154
+
155
+ invalid_properties
156
+ end
157
+
158
+ # Check to see if the all the properties in the model are valid
159
+ # @return true if the model is valid
160
+ def valid?
161
+ warn '[DEPRECATED] the `valid?` method is obsolete'
162
+ return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
163
+ return false if @name.nil?
164
+ return false if @website.nil?
165
+ status_validator = EnumAttributeValidator.new('String', ["PENDING", "APPROVED", "REJECTED"])
166
+ return false unless status_validator.valid?(@status)
167
+ true
168
+ end
169
+
170
+ # Custom attribute writer method with validation
171
+ # @param [Object] id Value to be assigned
172
+ def id=(id)
173
+ if id.nil?
174
+ fail ArgumentError, 'id cannot be nil'
175
+ end
176
+
177
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
178
+ if id !~ pattern
179
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
180
+ end
181
+
182
+ @id = id
183
+ end
184
+
185
+ # Custom attribute writer method checking allowed values (enum).
186
+ # @param [Object] status Object to be assigned
187
+ def status=(status)
188
+ validator = EnumAttributeValidator.new('String', ["PENDING", "APPROVED", "REJECTED"])
189
+ unless validator.valid?(status)
190
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
191
+ end
192
+ @status = status
193
+ end
194
+
195
+ # Checks equality by comparing each attribute.
196
+ # @param [Object] Object to be compared
197
+ def ==(o)
198
+ return true if self.equal?(o)
199
+ self.class == o.class &&
200
+ id == o.id &&
201
+ name == o.name &&
202
+ website == o.website &&
203
+ status == o.status &&
204
+ created_at == o.created_at &&
205
+ api_key == o.api_key
206
+ end
207
+
208
+ # @see the `==` method
209
+ # @param [Object] Object to be compared
210
+ def eql?(o)
211
+ self == o
212
+ end
213
+
214
+ # Calculates hash code according to all attributes.
215
+ # @return [Integer] Hash code
216
+ def hash
217
+ [id, name, website, status, created_at, api_key].hash
218
+ end
219
+
220
+ # Builds the object from hash
221
+ # @param [Hash] attributes Model attributes in the form of hash
222
+ # @return [Object] Returns the model itself
223
+ def self.build_from_hash(attributes)
224
+ return nil unless attributes.is_a?(Hash)
225
+ attributes = attributes.transform_keys(&:to_sym)
226
+ transformed_hash = {}
227
+ openapi_types.each_pair do |key, type|
228
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
229
+ transformed_hash["#{key}"] = nil
230
+ elsif type =~ /\AArray<(.*)>/i
231
+ # check to ensure the input is an array given that the attribute
232
+ # is documented as an array but the input is not
233
+ if attributes[attribute_map[key]].is_a?(Array)
234
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
235
+ end
236
+ elsif !attributes[attribute_map[key]].nil?
237
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
238
+ end
239
+ end
240
+ new(transformed_hash)
241
+ end
242
+
243
+ # Deserializes the data based on type
244
+ # @param string type Data type
245
+ # @param string value Value to be deserialized
246
+ # @return [Object] Deserialized data
247
+ def self._deserialize(type, value)
248
+ case type.to_sym
249
+ when :Time
250
+ Time.parse(value)
251
+ when :Date
252
+ Date.parse(value)
253
+ when :String
254
+ value.to_s
255
+ when :Integer
256
+ value.to_i
257
+ when :Float
258
+ value.to_f
259
+ when :Boolean
260
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
261
+ true
262
+ else
263
+ false
264
+ end
265
+ when :Object
266
+ # generic object (usually a Hash), return directly
267
+ value
268
+ when /\AArray<(?<inner_type>.+)>\z/
269
+ inner_type = Regexp.last_match[:inner_type]
270
+ value.map { |v| _deserialize(inner_type, v) }
271
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
272
+ k_type = Regexp.last_match[:k_type]
273
+ v_type = Regexp.last_match[:v_type]
274
+ {}.tap do |hash|
275
+ value.each do |k, v|
276
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
277
+ end
278
+ end
279
+ else # model
280
+ # models (e.g. Pet) or oneOf
281
+ klass = Tremendous.const_get(type)
282
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
283
+ end
284
+ end
285
+
286
+ # Returns the string representation of the object
287
+ # @return [String] String presentation of the object
288
+ def to_s
289
+ to_hash.to_s
290
+ end
291
+
292
+ # to_body is an alias to to_hash (backward compatibility)
293
+ # @return [Hash] Returns the object in the form of hash
294
+ def to_body
295
+ to_hash
296
+ end
297
+
298
+ # Returns the object in the form of hash
299
+ # @return [Hash] Returns the object in the form of hash
300
+ def to_hash
301
+ hash = {}
302
+ self.class.attribute_map.each_pair do |attr, param|
303
+ value = self.send(attr)
304
+ if value.nil?
305
+ is_nullable = self.class.openapi_nullable.include?(attr)
306
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
307
+ end
308
+
309
+ hash[param] = _to_hash(value)
310
+ end
311
+ hash
312
+ end
313
+
314
+ # Outputs non-array value in the form of hash
315
+ # For object, use to_hash. Otherwise, just return the value
316
+ # @param [Object] value Any valid value
317
+ # @return [Hash] Returns the value in the form of hash
318
+ def _to_hash(value)
319
+ if value.is_a?(Array)
320
+ value.compact.map { |v| _to_hash(v) }
321
+ elsif value.is_a?(Hash)
322
+ {}.tap do |hash|
323
+ value.each { |k, v| hash[k] = _to_hash(v) }
324
+ end
325
+ elsif value.respond_to? :to_hash
326
+ value.to_hash
327
+ else
328
+ value
329
+ end
330
+ end
331
+
332
+ end
333
+
334
+ end
@@ -0,0 +1,268 @@
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 CreateOrganizationRequest
18
+ # Name of the organization
19
+ attr_accessor :name
20
+
21
+ # URL of the website of that organization
22
+ attr_accessor :website
23
+
24
+ # Default value is `false`. Set to true to also generate an API key associated to the new organization.
25
+ attr_accessor :with_api_key
26
+
27
+ attr_accessor :copy_settings
28
+
29
+ # Phone number of the organization. For non-US phone numbers, specify the country code (prefixed with +).
30
+ attr_accessor :phone
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'name' => :'name',
36
+ :'website' => :'website',
37
+ :'with_api_key' => :'with_api_key',
38
+ :'copy_settings' => :'copy_settings',
39
+ :'phone' => :'phone'
40
+ }
41
+ end
42
+
43
+ # Returns all the JSON keys this model knows about
44
+ def self.acceptable_attributes
45
+ attribute_map.values
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.openapi_types
50
+ {
51
+ :'name' => :'String',
52
+ :'website' => :'String',
53
+ :'with_api_key' => :'Boolean',
54
+ :'copy_settings' => :'CreateOrganizationRequestCopySettings',
55
+ :'phone' => :'String'
56
+ }
57
+ end
58
+
59
+ # List of attributes with nullable: true
60
+ def self.openapi_nullable
61
+ Set.new([
62
+ ])
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ if (!attributes.is_a?(Hash))
69
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::CreateOrganizationRequest` initialize method"
70
+ end
71
+
72
+ # check to see if the attribute exists and convert string to symbol for hash key
73
+ attributes = attributes.each_with_object({}) { |(k, v), h|
74
+ if (!self.class.attribute_map.key?(k.to_sym))
75
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::CreateOrganizationRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
76
+ end
77
+ h[k.to_sym] = v
78
+ }
79
+
80
+ if attributes.key?(:'name')
81
+ self.name = attributes[:'name']
82
+ else
83
+ self.name = nil
84
+ end
85
+
86
+ if attributes.key?(:'website')
87
+ self.website = attributes[:'website']
88
+ else
89
+ self.website = nil
90
+ end
91
+
92
+ if attributes.key?(:'with_api_key')
93
+ self.with_api_key = attributes[:'with_api_key']
94
+ end
95
+
96
+ if attributes.key?(:'copy_settings')
97
+ self.copy_settings = attributes[:'copy_settings']
98
+ end
99
+
100
+ if attributes.key?(:'phone')
101
+ self.phone = attributes[:'phone']
102
+ end
103
+ end
104
+
105
+ # Show invalid properties with the reasons. Usually used together with valid?
106
+ # @return Array for valid properties with the reasons
107
+ def list_invalid_properties
108
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
109
+ invalid_properties = Array.new
110
+ if @name.nil?
111
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
112
+ end
113
+
114
+ if @website.nil?
115
+ invalid_properties.push('invalid value for "website", website cannot be nil.')
116
+ end
117
+
118
+ invalid_properties
119
+ end
120
+
121
+ # Check to see if the all the properties in the model are valid
122
+ # @return true if the model is valid
123
+ def valid?
124
+ warn '[DEPRECATED] the `valid?` method is obsolete'
125
+ return false if @name.nil?
126
+ return false if @website.nil?
127
+ true
128
+ end
129
+
130
+ # Checks equality by comparing each attribute.
131
+ # @param [Object] Object to be compared
132
+ def ==(o)
133
+ return true if self.equal?(o)
134
+ self.class == o.class &&
135
+ name == o.name &&
136
+ website == o.website &&
137
+ with_api_key == o.with_api_key &&
138
+ copy_settings == o.copy_settings &&
139
+ phone == o.phone
140
+ end
141
+
142
+ # @see the `==` method
143
+ # @param [Object] Object to be compared
144
+ def eql?(o)
145
+ self == o
146
+ end
147
+
148
+ # Calculates hash code according to all attributes.
149
+ # @return [Integer] Hash code
150
+ def hash
151
+ [name, website, with_api_key, copy_settings, phone].hash
152
+ end
153
+
154
+ # Builds the object from hash
155
+ # @param [Hash] attributes Model attributes in the form of hash
156
+ # @return [Object] Returns the model itself
157
+ def self.build_from_hash(attributes)
158
+ return nil unless attributes.is_a?(Hash)
159
+ attributes = attributes.transform_keys(&:to_sym)
160
+ transformed_hash = {}
161
+ openapi_types.each_pair do |key, type|
162
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
163
+ transformed_hash["#{key}"] = nil
164
+ elsif type =~ /\AArray<(.*)>/i
165
+ # check to ensure the input is an array given that the attribute
166
+ # is documented as an array but the input is not
167
+ if attributes[attribute_map[key]].is_a?(Array)
168
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
169
+ end
170
+ elsif !attributes[attribute_map[key]].nil?
171
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
172
+ end
173
+ end
174
+ new(transformed_hash)
175
+ end
176
+
177
+ # Deserializes the data based on type
178
+ # @param string type Data type
179
+ # @param string value Value to be deserialized
180
+ # @return [Object] Deserialized data
181
+ def self._deserialize(type, value)
182
+ case type.to_sym
183
+ when :Time
184
+ Time.parse(value)
185
+ when :Date
186
+ Date.parse(value)
187
+ when :String
188
+ value.to_s
189
+ when :Integer
190
+ value.to_i
191
+ when :Float
192
+ value.to_f
193
+ when :Boolean
194
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
195
+ true
196
+ else
197
+ false
198
+ end
199
+ when :Object
200
+ # generic object (usually a Hash), return directly
201
+ value
202
+ when /\AArray<(?<inner_type>.+)>\z/
203
+ inner_type = Regexp.last_match[:inner_type]
204
+ value.map { |v| _deserialize(inner_type, v) }
205
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
206
+ k_type = Regexp.last_match[:k_type]
207
+ v_type = Regexp.last_match[:v_type]
208
+ {}.tap do |hash|
209
+ value.each do |k, v|
210
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
211
+ end
212
+ end
213
+ else # model
214
+ # models (e.g. Pet) or oneOf
215
+ klass = Tremendous.const_get(type)
216
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
217
+ end
218
+ end
219
+
220
+ # Returns the string representation of the object
221
+ # @return [String] String presentation of the object
222
+ def to_s
223
+ to_hash.to_s
224
+ end
225
+
226
+ # to_body is an alias to to_hash (backward compatibility)
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_body
229
+ to_hash
230
+ end
231
+
232
+ # Returns the object in the form of hash
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_hash
235
+ hash = {}
236
+ self.class.attribute_map.each_pair do |attr, param|
237
+ value = self.send(attr)
238
+ if value.nil?
239
+ is_nullable = self.class.openapi_nullable.include?(attr)
240
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
241
+ end
242
+
243
+ hash[param] = _to_hash(value)
244
+ end
245
+ hash
246
+ end
247
+
248
+ # Outputs non-array value in the form of hash
249
+ # For object, use to_hash. Otherwise, just return the value
250
+ # @param [Object] value Any valid value
251
+ # @return [Hash] Returns the value in the form of hash
252
+ def _to_hash(value)
253
+ if value.is_a?(Array)
254
+ value.compact.map { |v| _to_hash(v) }
255
+ elsif value.is_a?(Hash)
256
+ {}.tap do |hash|
257
+ value.each { |k, v| hash[k] = _to_hash(v) }
258
+ end
259
+ elsif value.respond_to? :to_hash
260
+ value.to_hash
261
+ else
262
+ value
263
+ end
264
+ end
265
+
266
+ end
267
+
268
+ end