tremendous_ruby 5.9.0 → 5.10.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.
- checksums.yaml +4 -4
- data/lib/tremendous/api/tremendous_api.rb +522 -53
- data/lib/tremendous/models/connected_organization.rb +287 -0
- data/lib/tremendous/models/connected_organization_member.rb +330 -0
- data/lib/tremendous/models/connected_organization_member_member.rb +366 -0
- data/lib/tremendous/models/connected_organization_member_session.rb +311 -0
- data/lib/tremendous/models/connected_organization_organization.rb +324 -0
- data/lib/tremendous/models/create_campaign200_response.rb +221 -0
- data/lib/tremendous/models/create_connected_organization200_response.rb +221 -0
- data/lib/tremendous/models/create_connected_organization_member200_response.rb +221 -0
- data/lib/tremendous/models/create_connected_organization_member_request.rb +222 -0
- data/lib/tremendous/models/create_connected_organization_member_session200_response.rb +221 -0
- data/lib/tremendous/models/create_connected_organization_member_session200_response_connected_organization_member_session.rb +311 -0
- data/lib/tremendous/models/create_connected_organization_member_session_request.rb +222 -0
- data/lib/tremendous/models/create_connected_organization_request.rb +222 -0
- data/lib/tremendous/models/create_order200_response_order_rewards_inner_delivery.rb +1 -1
- data/lib/tremendous/models/create_organization_request_copy_settings.rb +16 -4
- data/lib/tremendous/models/create_report200_response.rb +231 -0
- data/lib/tremendous/models/create_report200_response_report.rb +291 -0
- data/lib/tremendous/models/delivery_details.rb +1 -1
- data/lib/tremendous/models/delivery_details_with_link.rb +1 -1
- data/lib/tremendous/models/funding_source.rb +35 -1
- data/lib/tremendous/models/list_connected_organization_members200_response.rb +240 -0
- data/lib/tremendous/models/list_connected_organization_members200_response_connected_organization_members_inner.rb +330 -0
- data/lib/tremendous/models/list_connected_organization_members200_response_connected_organization_members_inner_member.rb +366 -0
- data/lib/tremendous/models/list_connected_organizations200_response.rb +240 -0
- data/lib/tremendous/models/list_connected_organizations200_response_connected_organizations_inner.rb +287 -0
- data/lib/tremendous/models/list_connected_organizations200_response_connected_organizations_inner_organization.rb +324 -0
- data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner.rb +35 -1
- data/lib/tremendous/models/list_products_response_products_inner.rb +27 -7
- data/lib/tremendous/models/list_products_response_products_inner_documents.rb +236 -0
- data/lib/tremendous/models/list_products_response_products_inner_images_inner.rb +15 -4
- data/lib/tremendous/models/list_rewards200_response_rewards_inner_delivery.rb +1 -1
- data/lib/tremendous/models/product.rb +27 -7
- data/lib/tremendous/models/product_documents.rb +236 -0
- data/lib/tremendous/models/reward_with_link_delivery.rb +1 -1
- data/lib/tremendous/models/reward_without_link_delivery.rb +1 -1
- data/lib/tremendous/version.rb +1 -1
- data/lib/tremendous.rb +23 -5
- metadata +26 -7
@@ -0,0 +1,366 @@
|
|
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 its 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
|
+
# Associated `member`. `null` until the registration flow for the connected organization has been completed.
|
18
|
+
class ConnectedOrganizationMemberMember
|
19
|
+
attr_accessor :id
|
20
|
+
|
21
|
+
# Email address of the member
|
22
|
+
attr_accessor :email
|
23
|
+
|
24
|
+
# Full name of the member
|
25
|
+
attr_accessor :name
|
26
|
+
|
27
|
+
# Is this member currently active in the organization. If `false`, the member will not be able to access the organization.
|
28
|
+
attr_accessor :active
|
29
|
+
|
30
|
+
# The role ID associated with the member within the organization.
|
31
|
+
attr_accessor :role
|
32
|
+
|
33
|
+
# Current status of the member's account. When creating a member it starts out in the status `INVITED`. As soon as that member open the invitation link and registers an account, the status switches to `REGISTERED`.
|
34
|
+
attr_accessor :status
|
35
|
+
|
36
|
+
# Timestamp when this member was created. The `created_at` timestamp is **NOT** returned when retrieving a member (but is part of the response when listing or creating members).
|
37
|
+
attr_accessor :created_at
|
38
|
+
|
39
|
+
# Timestamp when this member most recently logged into the dashboard of the organization associated with this API key.
|
40
|
+
attr_accessor :last_login_at
|
41
|
+
|
42
|
+
class EnumAttributeValidator
|
43
|
+
attr_reader :datatype
|
44
|
+
attr_reader :allowable_values
|
45
|
+
|
46
|
+
def initialize(datatype, allowable_values)
|
47
|
+
@allowable_values = allowable_values.map do |value|
|
48
|
+
case datatype.to_s
|
49
|
+
when /Integer/i
|
50
|
+
value.to_i
|
51
|
+
when /Float/i
|
52
|
+
value.to_f
|
53
|
+
else
|
54
|
+
value
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def valid?(value)
|
60
|
+
!value || allowable_values.include?(value)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
65
|
+
def self.attribute_map
|
66
|
+
{
|
67
|
+
:'id' => :'id',
|
68
|
+
:'email' => :'email',
|
69
|
+
:'name' => :'name',
|
70
|
+
:'active' => :'active',
|
71
|
+
:'role' => :'role',
|
72
|
+
:'status' => :'status',
|
73
|
+
:'created_at' => :'created_at',
|
74
|
+
:'last_login_at' => :'last_login_at'
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
# Returns all the JSON keys this model knows about
|
79
|
+
def self.acceptable_attributes
|
80
|
+
attribute_map.values
|
81
|
+
end
|
82
|
+
|
83
|
+
# Attribute type mapping.
|
84
|
+
def self.openapi_types
|
85
|
+
{
|
86
|
+
:'id' => :'String',
|
87
|
+
:'email' => :'String',
|
88
|
+
:'name' => :'String',
|
89
|
+
:'active' => :'Boolean',
|
90
|
+
:'role' => :'String',
|
91
|
+
:'status' => :'String',
|
92
|
+
:'created_at' => :'Time',
|
93
|
+
:'last_login_at' => :'Time'
|
94
|
+
}
|
95
|
+
end
|
96
|
+
|
97
|
+
# List of attributes with nullable: true
|
98
|
+
def self.openapi_nullable
|
99
|
+
Set.new([
|
100
|
+
:'name',
|
101
|
+
:'role',
|
102
|
+
:'last_login_at'
|
103
|
+
])
|
104
|
+
end
|
105
|
+
|
106
|
+
# Initializes the object
|
107
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
108
|
+
def initialize(attributes = {})
|
109
|
+
if (!attributes.is_a?(Hash))
|
110
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ConnectedOrganizationMemberMember` initialize method"
|
111
|
+
end
|
112
|
+
|
113
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
114
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
115
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
116
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::ConnectedOrganizationMemberMember`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
117
|
+
end
|
118
|
+
h[k.to_sym] = v
|
119
|
+
}
|
120
|
+
|
121
|
+
if attributes.key?(:'id')
|
122
|
+
self.id = attributes[:'id']
|
123
|
+
else
|
124
|
+
self.id = nil
|
125
|
+
end
|
126
|
+
|
127
|
+
if attributes.key?(:'email')
|
128
|
+
self.email = attributes[:'email']
|
129
|
+
else
|
130
|
+
self.email = nil
|
131
|
+
end
|
132
|
+
|
133
|
+
if attributes.key?(:'name')
|
134
|
+
self.name = attributes[:'name']
|
135
|
+
else
|
136
|
+
self.name = nil
|
137
|
+
end
|
138
|
+
|
139
|
+
if attributes.key?(:'active')
|
140
|
+
self.active = attributes[:'active']
|
141
|
+
end
|
142
|
+
|
143
|
+
if attributes.key?(:'role')
|
144
|
+
self.role = attributes[:'role']
|
145
|
+
end
|
146
|
+
|
147
|
+
if attributes.key?(:'status')
|
148
|
+
self.status = attributes[:'status']
|
149
|
+
else
|
150
|
+
self.status = nil
|
151
|
+
end
|
152
|
+
|
153
|
+
if attributes.key?(:'created_at')
|
154
|
+
self.created_at = attributes[:'created_at']
|
155
|
+
end
|
156
|
+
|
157
|
+
if attributes.key?(:'last_login_at')
|
158
|
+
self.last_login_at = attributes[:'last_login_at']
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
163
|
+
# @return Array for valid properties with the reasons
|
164
|
+
def list_invalid_properties
|
165
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
166
|
+
invalid_properties = Array.new
|
167
|
+
if @id.nil?
|
168
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
169
|
+
end
|
170
|
+
|
171
|
+
pattern = Regexp.new(/[A-Z0-9]{4,20}/)
|
172
|
+
if @id !~ pattern
|
173
|
+
invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
|
174
|
+
end
|
175
|
+
|
176
|
+
if @email.nil?
|
177
|
+
invalid_properties.push('invalid value for "email", email cannot be nil.')
|
178
|
+
end
|
179
|
+
|
180
|
+
if @status.nil?
|
181
|
+
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
182
|
+
end
|
183
|
+
|
184
|
+
invalid_properties
|
185
|
+
end
|
186
|
+
|
187
|
+
# Check to see if the all the properties in the model are valid
|
188
|
+
# @return true if the model is valid
|
189
|
+
def valid?
|
190
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
191
|
+
return false if @id.nil?
|
192
|
+
return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
|
193
|
+
return false if @email.nil?
|
194
|
+
return false if @status.nil?
|
195
|
+
status_validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"])
|
196
|
+
return false unless status_validator.valid?(@status)
|
197
|
+
true
|
198
|
+
end
|
199
|
+
|
200
|
+
# Custom attribute writer method with validation
|
201
|
+
# @param [Object] id Value to be assigned
|
202
|
+
def id=(id)
|
203
|
+
if id.nil?
|
204
|
+
fail ArgumentError, 'id cannot be nil'
|
205
|
+
end
|
206
|
+
|
207
|
+
pattern = Regexp.new(/[A-Z0-9]{4,20}/)
|
208
|
+
if id !~ pattern
|
209
|
+
fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
|
210
|
+
end
|
211
|
+
|
212
|
+
@id = id
|
213
|
+
end
|
214
|
+
|
215
|
+
# Custom attribute writer method checking allowed values (enum).
|
216
|
+
# @param [Object] status Object to be assigned
|
217
|
+
def status=(status)
|
218
|
+
validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"])
|
219
|
+
unless validator.valid?(status)
|
220
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
221
|
+
end
|
222
|
+
@status = status
|
223
|
+
end
|
224
|
+
|
225
|
+
# Checks equality by comparing each attribute.
|
226
|
+
# @param [Object] Object to be compared
|
227
|
+
def ==(o)
|
228
|
+
return true if self.equal?(o)
|
229
|
+
self.class == o.class &&
|
230
|
+
id == o.id &&
|
231
|
+
email == o.email &&
|
232
|
+
name == o.name &&
|
233
|
+
active == o.active &&
|
234
|
+
role == o.role &&
|
235
|
+
status == o.status &&
|
236
|
+
created_at == o.created_at &&
|
237
|
+
last_login_at == o.last_login_at
|
238
|
+
end
|
239
|
+
|
240
|
+
# @see the `==` method
|
241
|
+
# @param [Object] Object to be compared
|
242
|
+
def eql?(o)
|
243
|
+
self == o
|
244
|
+
end
|
245
|
+
|
246
|
+
# Calculates hash code according to all attributes.
|
247
|
+
# @return [Integer] Hash code
|
248
|
+
def hash
|
249
|
+
[id, email, name, active, role, status, created_at, last_login_at].hash
|
250
|
+
end
|
251
|
+
|
252
|
+
# Builds the object from hash
|
253
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
254
|
+
# @return [Object] Returns the model itself
|
255
|
+
def self.build_from_hash(attributes)
|
256
|
+
return nil unless attributes.is_a?(Hash)
|
257
|
+
attributes = attributes.transform_keys(&:to_sym)
|
258
|
+
transformed_hash = {}
|
259
|
+
openapi_types.each_pair do |key, type|
|
260
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
261
|
+
transformed_hash["#{key}"] = nil
|
262
|
+
elsif type =~ /\AArray<(.*)>/i
|
263
|
+
# check to ensure the input is an array given that the attribute
|
264
|
+
# is documented as an array but the input is not
|
265
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
266
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
267
|
+
end
|
268
|
+
elsif !attributes[attribute_map[key]].nil?
|
269
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
270
|
+
end
|
271
|
+
end
|
272
|
+
new(transformed_hash)
|
273
|
+
end
|
274
|
+
|
275
|
+
# Deserializes the data based on type
|
276
|
+
# @param string type Data type
|
277
|
+
# @param string value Value to be deserialized
|
278
|
+
# @return [Object] Deserialized data
|
279
|
+
def self._deserialize(type, value)
|
280
|
+
case type.to_sym
|
281
|
+
when :Time
|
282
|
+
Time.parse(value)
|
283
|
+
when :Date
|
284
|
+
Date.parse(value)
|
285
|
+
when :String
|
286
|
+
value.to_s
|
287
|
+
when :Integer
|
288
|
+
value.to_i
|
289
|
+
when :Float
|
290
|
+
value.to_f
|
291
|
+
when :Boolean
|
292
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
293
|
+
true
|
294
|
+
else
|
295
|
+
false
|
296
|
+
end
|
297
|
+
when :Object
|
298
|
+
# generic object (usually a Hash), return directly
|
299
|
+
value
|
300
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
301
|
+
inner_type = Regexp.last_match[:inner_type]
|
302
|
+
value.map { |v| _deserialize(inner_type, v) }
|
303
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
304
|
+
k_type = Regexp.last_match[:k_type]
|
305
|
+
v_type = Regexp.last_match[:v_type]
|
306
|
+
{}.tap do |hash|
|
307
|
+
value.each do |k, v|
|
308
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
309
|
+
end
|
310
|
+
end
|
311
|
+
else # model
|
312
|
+
# models (e.g. Pet) or oneOf
|
313
|
+
klass = Tremendous.const_get(type)
|
314
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
# Returns the string representation of the object
|
319
|
+
# @return [String] String presentation of the object
|
320
|
+
def to_s
|
321
|
+
to_hash.to_s
|
322
|
+
end
|
323
|
+
|
324
|
+
# to_body is an alias to to_hash (backward compatibility)
|
325
|
+
# @return [Hash] Returns the object in the form of hash
|
326
|
+
def to_body
|
327
|
+
to_hash
|
328
|
+
end
|
329
|
+
|
330
|
+
# Returns the object in the form of hash
|
331
|
+
# @return [Hash] Returns the object in the form of hash
|
332
|
+
def to_hash
|
333
|
+
hash = {}
|
334
|
+
self.class.attribute_map.each_pair do |attr, param|
|
335
|
+
value = self.send(attr)
|
336
|
+
if value.nil?
|
337
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
338
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
339
|
+
end
|
340
|
+
|
341
|
+
hash[param] = _to_hash(value)
|
342
|
+
end
|
343
|
+
hash
|
344
|
+
end
|
345
|
+
|
346
|
+
# Outputs non-array value in the form of hash
|
347
|
+
# For object, use to_hash. Otherwise, just return the value
|
348
|
+
# @param [Object] value Any valid value
|
349
|
+
# @return [Hash] Returns the value in the form of hash
|
350
|
+
def _to_hash(value)
|
351
|
+
if value.is_a?(Array)
|
352
|
+
value.compact.map { |v| _to_hash(v) }
|
353
|
+
elsif value.is_a?(Hash)
|
354
|
+
{}.tap do |hash|
|
355
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
356
|
+
end
|
357
|
+
elsif value.respond_to? :to_hash
|
358
|
+
value.to_hash
|
359
|
+
else
|
360
|
+
value
|
361
|
+
end
|
362
|
+
end
|
363
|
+
|
364
|
+
end
|
365
|
+
|
366
|
+
end
|
@@ -0,0 +1,311 @@
|
|
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 its 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 ConnectedOrganizationMemberSession
|
18
|
+
# Tremendous' identifier for the connected organization member.
|
19
|
+
attr_accessor :connected_organization_member_id
|
20
|
+
|
21
|
+
# The URL to start the \"Tremendous for Platforms\" flow.
|
22
|
+
attr_accessor :url
|
23
|
+
|
24
|
+
# The URL used for links that redirect the user back to your site when they've completed their actions on Tremendous.
|
25
|
+
attr_accessor :return_url
|
26
|
+
|
27
|
+
# Timestamp of when the session will expire.
|
28
|
+
attr_accessor :expires_at
|
29
|
+
|
30
|
+
# Timestamp of when the session was created.
|
31
|
+
attr_accessor :created_at
|
32
|
+
|
33
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
34
|
+
def self.attribute_map
|
35
|
+
{
|
36
|
+
:'connected_organization_member_id' => :'connected_organization_member_id',
|
37
|
+
:'url' => :'url',
|
38
|
+
:'return_url' => :'return_url',
|
39
|
+
:'expires_at' => :'expires_at',
|
40
|
+
:'created_at' => :'created_at'
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
# Returns all the JSON keys this model knows about
|
45
|
+
def self.acceptable_attributes
|
46
|
+
attribute_map.values
|
47
|
+
end
|
48
|
+
|
49
|
+
# Attribute type mapping.
|
50
|
+
def self.openapi_types
|
51
|
+
{
|
52
|
+
:'connected_organization_member_id' => :'String',
|
53
|
+
:'url' => :'String',
|
54
|
+
:'return_url' => :'String',
|
55
|
+
:'expires_at' => :'Time',
|
56
|
+
:'created_at' => :'Time'
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
# List of attributes with nullable: true
|
61
|
+
def self.openapi_nullable
|
62
|
+
Set.new([
|
63
|
+
])
|
64
|
+
end
|
65
|
+
|
66
|
+
# Initializes the object
|
67
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
68
|
+
def initialize(attributes = {})
|
69
|
+
if (!attributes.is_a?(Hash))
|
70
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ConnectedOrganizationMemberSession` initialize method"
|
71
|
+
end
|
72
|
+
|
73
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
74
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
75
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
76
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::ConnectedOrganizationMemberSession`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
77
|
+
end
|
78
|
+
h[k.to_sym] = v
|
79
|
+
}
|
80
|
+
|
81
|
+
if attributes.key?(:'connected_organization_member_id')
|
82
|
+
self.connected_organization_member_id = attributes[:'connected_organization_member_id']
|
83
|
+
else
|
84
|
+
self.connected_organization_member_id = nil
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.key?(:'url')
|
88
|
+
self.url = attributes[:'url']
|
89
|
+
else
|
90
|
+
self.url = nil
|
91
|
+
end
|
92
|
+
|
93
|
+
if attributes.key?(:'return_url')
|
94
|
+
self.return_url = attributes[:'return_url']
|
95
|
+
else
|
96
|
+
self.return_url = nil
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.key?(:'expires_at')
|
100
|
+
self.expires_at = attributes[:'expires_at']
|
101
|
+
else
|
102
|
+
self.expires_at = nil
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.key?(:'created_at')
|
106
|
+
self.created_at = attributes[:'created_at']
|
107
|
+
else
|
108
|
+
self.created_at = nil
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
113
|
+
# @return Array for valid properties with the reasons
|
114
|
+
def list_invalid_properties
|
115
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
116
|
+
invalid_properties = Array.new
|
117
|
+
if @connected_organization_member_id.nil?
|
118
|
+
invalid_properties.push('invalid value for "connected_organization_member_id", connected_organization_member_id cannot be nil.')
|
119
|
+
end
|
120
|
+
|
121
|
+
pattern = Regexp.new(/[A-Z0-9]{4,20}/)
|
122
|
+
if @connected_organization_member_id !~ pattern
|
123
|
+
invalid_properties.push("invalid value for \"connected_organization_member_id\", must conform to the pattern #{pattern}.")
|
124
|
+
end
|
125
|
+
|
126
|
+
if @url.nil?
|
127
|
+
invalid_properties.push('invalid value for "url", url cannot be nil.')
|
128
|
+
end
|
129
|
+
|
130
|
+
if @return_url.nil?
|
131
|
+
invalid_properties.push('invalid value for "return_url", return_url cannot be nil.')
|
132
|
+
end
|
133
|
+
|
134
|
+
if @expires_at.nil?
|
135
|
+
invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
|
136
|
+
end
|
137
|
+
|
138
|
+
if @created_at.nil?
|
139
|
+
invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
|
140
|
+
end
|
141
|
+
|
142
|
+
invalid_properties
|
143
|
+
end
|
144
|
+
|
145
|
+
# Check to see if the all the properties in the model are valid
|
146
|
+
# @return true if the model is valid
|
147
|
+
def valid?
|
148
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
149
|
+
return false if @connected_organization_member_id.nil?
|
150
|
+
return false if @connected_organization_member_id !~ Regexp.new(/[A-Z0-9]{4,20}/)
|
151
|
+
return false if @url.nil?
|
152
|
+
return false if @return_url.nil?
|
153
|
+
return false if @expires_at.nil?
|
154
|
+
return false if @created_at.nil?
|
155
|
+
true
|
156
|
+
end
|
157
|
+
|
158
|
+
# Custom attribute writer method with validation
|
159
|
+
# @param [Object] connected_organization_member_id Value to be assigned
|
160
|
+
def connected_organization_member_id=(connected_organization_member_id)
|
161
|
+
if connected_organization_member_id.nil?
|
162
|
+
fail ArgumentError, 'connected_organization_member_id cannot be nil'
|
163
|
+
end
|
164
|
+
|
165
|
+
pattern = Regexp.new(/[A-Z0-9]{4,20}/)
|
166
|
+
if connected_organization_member_id !~ pattern
|
167
|
+
fail ArgumentError, "invalid value for \"connected_organization_member_id\", must conform to the pattern #{pattern}."
|
168
|
+
end
|
169
|
+
|
170
|
+
@connected_organization_member_id = connected_organization_member_id
|
171
|
+
end
|
172
|
+
|
173
|
+
# Checks equality by comparing each attribute.
|
174
|
+
# @param [Object] Object to be compared
|
175
|
+
def ==(o)
|
176
|
+
return true if self.equal?(o)
|
177
|
+
self.class == o.class &&
|
178
|
+
connected_organization_member_id == o.connected_organization_member_id &&
|
179
|
+
url == o.url &&
|
180
|
+
return_url == o.return_url &&
|
181
|
+
expires_at == o.expires_at &&
|
182
|
+
created_at == o.created_at
|
183
|
+
end
|
184
|
+
|
185
|
+
# @see the `==` method
|
186
|
+
# @param [Object] Object to be compared
|
187
|
+
def eql?(o)
|
188
|
+
self == o
|
189
|
+
end
|
190
|
+
|
191
|
+
# Calculates hash code according to all attributes.
|
192
|
+
# @return [Integer] Hash code
|
193
|
+
def hash
|
194
|
+
[connected_organization_member_id, url, return_url, expires_at, created_at].hash
|
195
|
+
end
|
196
|
+
|
197
|
+
# Builds the object from hash
|
198
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
199
|
+
# @return [Object] Returns the model itself
|
200
|
+
def self.build_from_hash(attributes)
|
201
|
+
return nil unless attributes.is_a?(Hash)
|
202
|
+
attributes = attributes.transform_keys(&:to_sym)
|
203
|
+
transformed_hash = {}
|
204
|
+
openapi_types.each_pair do |key, type|
|
205
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
206
|
+
transformed_hash["#{key}"] = nil
|
207
|
+
elsif type =~ /\AArray<(.*)>/i
|
208
|
+
# check to ensure the input is an array given that the attribute
|
209
|
+
# is documented as an array but the input is not
|
210
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
211
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
212
|
+
end
|
213
|
+
elsif !attributes[attribute_map[key]].nil?
|
214
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
215
|
+
end
|
216
|
+
end
|
217
|
+
new(transformed_hash)
|
218
|
+
end
|
219
|
+
|
220
|
+
# Deserializes the data based on type
|
221
|
+
# @param string type Data type
|
222
|
+
# @param string value Value to be deserialized
|
223
|
+
# @return [Object] Deserialized data
|
224
|
+
def self._deserialize(type, value)
|
225
|
+
case type.to_sym
|
226
|
+
when :Time
|
227
|
+
Time.parse(value)
|
228
|
+
when :Date
|
229
|
+
Date.parse(value)
|
230
|
+
when :String
|
231
|
+
value.to_s
|
232
|
+
when :Integer
|
233
|
+
value.to_i
|
234
|
+
when :Float
|
235
|
+
value.to_f
|
236
|
+
when :Boolean
|
237
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
238
|
+
true
|
239
|
+
else
|
240
|
+
false
|
241
|
+
end
|
242
|
+
when :Object
|
243
|
+
# generic object (usually a Hash), return directly
|
244
|
+
value
|
245
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
246
|
+
inner_type = Regexp.last_match[:inner_type]
|
247
|
+
value.map { |v| _deserialize(inner_type, v) }
|
248
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
249
|
+
k_type = Regexp.last_match[:k_type]
|
250
|
+
v_type = Regexp.last_match[:v_type]
|
251
|
+
{}.tap do |hash|
|
252
|
+
value.each do |k, v|
|
253
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
254
|
+
end
|
255
|
+
end
|
256
|
+
else # model
|
257
|
+
# models (e.g. Pet) or oneOf
|
258
|
+
klass = Tremendous.const_get(type)
|
259
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
# Returns the string representation of the object
|
264
|
+
# @return [String] String presentation of the object
|
265
|
+
def to_s
|
266
|
+
to_hash.to_s
|
267
|
+
end
|
268
|
+
|
269
|
+
# to_body is an alias to to_hash (backward compatibility)
|
270
|
+
# @return [Hash] Returns the object in the form of hash
|
271
|
+
def to_body
|
272
|
+
to_hash
|
273
|
+
end
|
274
|
+
|
275
|
+
# Returns the object in the form of hash
|
276
|
+
# @return [Hash] Returns the object in the form of hash
|
277
|
+
def to_hash
|
278
|
+
hash = {}
|
279
|
+
self.class.attribute_map.each_pair do |attr, param|
|
280
|
+
value = self.send(attr)
|
281
|
+
if value.nil?
|
282
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
283
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
284
|
+
end
|
285
|
+
|
286
|
+
hash[param] = _to_hash(value)
|
287
|
+
end
|
288
|
+
hash
|
289
|
+
end
|
290
|
+
|
291
|
+
# Outputs non-array value in the form of hash
|
292
|
+
# For object, use to_hash. Otherwise, just return the value
|
293
|
+
# @param [Object] value Any valid value
|
294
|
+
# @return [Hash] Returns the value in the form of hash
|
295
|
+
def _to_hash(value)
|
296
|
+
if value.is_a?(Array)
|
297
|
+
value.compact.map { |v| _to_hash(v) }
|
298
|
+
elsif value.is_a?(Hash)
|
299
|
+
{}.tap do |hash|
|
300
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
301
|
+
end
|
302
|
+
elsif value.respond_to? :to_hash
|
303
|
+
value.to_hash
|
304
|
+
else
|
305
|
+
value
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
end
|
310
|
+
|
311
|
+
end
|