talon_one 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -6
- data/docs/AccountAnalytics.md +1 -0
- data/docs/AccountLimits.md +1 -0
- data/docs/Application.md +1 -0
- data/docs/AttributesMandatory.md +9 -0
- data/docs/AttributesSettings.md +8 -0
- data/docs/BaseSamlConnection.md +15 -0
- data/docs/CampaignAnalytics.md +9 -3
- data/docs/CampaignCopy.md +4 -0
- data/docs/Change.md +2 -2
- data/docs/CustomerInventory.md +9 -0
- data/docs/InlineResponse20020.md +1 -1
- data/docs/InlineResponse20021.md +1 -1
- data/docs/InlineResponse20022.md +1 -1
- data/docs/InlineResponse20023.md +1 -1
- data/docs/InlineResponse20024.md +1 -1
- data/docs/InlineResponse20025.md +2 -3
- data/docs/InlineResponse20026.md +3 -2
- data/docs/InlineResponse20027.md +1 -1
- data/docs/InlineResponse20028.md +1 -1
- data/docs/InlineResponse20029.md +9 -0
- data/docs/IntegrationApi.md +66 -0
- data/docs/ManagementApi.md +162 -101
- data/docs/NewApplication.md +1 -0
- data/docs/NewSamlConnection.md +3 -2
- data/docs/SamlConnection.md +4 -5
- data/docs/SamlConnectionMetadata.md +11 -0
- data/docs/UpdateApplication.md +1 -0
- data/lib/talon_one.rb +6 -0
- data/lib/talon_one/api/integration_api.rb +60 -0
- data/lib/talon_one/api/management_api.rb +177 -119
- data/lib/talon_one/models/account_analytics.rb +19 -4
- data/lib/talon_one/models/account_limits.rb +11 -1
- data/lib/talon_one/models/application.rb +10 -1
- data/lib/talon_one/models/attributes_mandatory.rb +199 -0
- data/lib/talon_one/models/attributes_settings.rb +184 -0
- data/lib/talon_one/models/base_saml_connection.rb +336 -0
- data/lib/talon_one/models/campaign_analytics.rb +94 -4
- data/lib/talon_one/models/campaign_copy.rb +46 -4
- data/lib/talon_one/models/change.rb +2 -2
- data/lib/talon_one/models/customer_inventory.rb +194 -0
- data/lib/talon_one/models/inline_response_200_20.rb +1 -1
- data/lib/talon_one/models/inline_response_200_21.rb +1 -1
- data/lib/talon_one/models/inline_response_200_22.rb +1 -1
- data/lib/talon_one/models/inline_response_200_23.rb +1 -1
- data/lib/talon_one/models/inline_response_200_24.rb +1 -1
- data/lib/talon_one/models/inline_response_200_25.rb +7 -11
- data/lib/talon_one/models/inline_response_200_26.rb +11 -7
- data/lib/talon_one/models/inline_response_200_27.rb +1 -1
- data/lib/talon_one/models/inline_response_200_28.rb +1 -1
- data/lib/talon_one/models/inline_response_200_29.rb +204 -0
- data/lib/talon_one/models/new_application.rb +10 -1
- data/lib/talon_one/models/new_saml_connection.rb +58 -43
- data/lib/talon_one/models/saml_connection.rb +45 -78
- data/lib/talon_one/models/saml_connection_metadata.rb +271 -0
- data/lib/talon_one/models/update_application.rb +13 -4
- data/lib/talon_one/version.rb +1 -1
- data/spec/api/integration_api_spec.rb +14 -0
- data/spec/api/management_api_spec.rb +50 -36
- data/spec/models/account_analytics_spec.rb +6 -0
- data/spec/models/account_limits_spec.rb +6 -0
- data/spec/models/application_spec.rb +6 -0
- data/spec/models/attributes_mandatory_spec.rb +47 -0
- data/spec/models/attributes_settings_spec.rb +41 -0
- data/spec/models/base_saml_connection_spec.rb +83 -0
- data/spec/models/campaign_analytics_spec.rb +36 -0
- data/spec/models/campaign_copy_spec.rb +24 -0
- data/spec/models/customer_inventory_spec.rb +47 -0
- data/spec/models/inline_response_200_25_spec.rb +0 -6
- data/spec/models/inline_response_200_26_spec.rb +6 -0
- data/spec/models/inline_response_200_29_spec.rb +47 -0
- data/spec/models/new_application_spec.rb +6 -0
- data/spec/models/new_saml_connection_spec.rb +13 -7
- data/spec/models/saml_connection_metadata_spec.rb +59 -0
- data/spec/models/saml_connection_spec.rb +9 -15
- data/spec/models/update_application_spec.rb +6 -0
- data/talon_one-1.3.0.gem +0 -0
- metadata +27 -2
@@ -15,17 +15,12 @@ require 'date'
|
|
15
15
|
module TalonOne
|
16
16
|
#
|
17
17
|
class SamlConnection
|
18
|
-
attr_accessor :id
|
19
|
-
|
20
|
-
# Unix timestamp indicating when the session was first created.
|
21
|
-
attr_accessor :created
|
22
|
-
|
23
|
-
# The ID of the account that owns this SAML Service.
|
24
|
-
attr_accessor :account_id
|
25
|
-
|
26
18
|
# The location where the SAML assertion is sent with a HTTP POST.
|
27
19
|
attr_accessor :assertion_consumer_service_url
|
28
20
|
|
21
|
+
# The ID of the account that owns this entity.
|
22
|
+
attr_accessor :account_id
|
23
|
+
|
29
24
|
# ID of the SAML service.
|
30
25
|
attr_accessor :name
|
31
26
|
|
@@ -44,45 +39,46 @@ module TalonOne
|
|
44
39
|
# Metadata URL.
|
45
40
|
attr_accessor :metadata_url
|
46
41
|
|
47
|
-
#
|
48
|
-
attr_accessor :
|
42
|
+
# The application-defined unique identifier that is the intended audience of the SAML assertion. This is most often the SP Entity ID of your application. When not specified, the ACS URL will be used.
|
43
|
+
attr_accessor :audience_uri
|
44
|
+
|
45
|
+
# Unique ID for this entity.
|
46
|
+
attr_accessor :id
|
49
47
|
|
50
|
-
# The
|
51
|
-
attr_accessor :
|
48
|
+
# The exact moment this entity was created.
|
49
|
+
attr_accessor :created
|
52
50
|
|
53
51
|
# Attribute mapping from ruby-style variable name to JSON key.
|
54
52
|
def self.attribute_map
|
55
53
|
{
|
56
|
-
:'id' => :'id',
|
57
|
-
:'created' => :'created',
|
58
|
-
:'account_id' => :'accountId',
|
59
54
|
:'assertion_consumer_service_url' => :'assertionConsumerServiceURL',
|
55
|
+
:'account_id' => :'accountId',
|
60
56
|
:'name' => :'name',
|
61
57
|
:'enabled' => :'enabled',
|
62
58
|
:'issuer' => :'issuer',
|
63
59
|
:'sign_on_url' => :'signOnURL',
|
64
60
|
:'sign_out_url' => :'signOutURL',
|
65
61
|
:'metadata_url' => :'metadataURL',
|
66
|
-
:'
|
67
|
-
:'
|
62
|
+
:'audience_uri' => :'audienceURI',
|
63
|
+
:'id' => :'id',
|
64
|
+
:'created' => :'created'
|
68
65
|
}
|
69
66
|
end
|
70
67
|
|
71
68
|
# Attribute type mapping.
|
72
69
|
def self.swagger_types
|
73
70
|
{
|
74
|
-
:'id' => :'Integer',
|
75
|
-
:'created' => :'DateTime',
|
76
|
-
:'account_id' => :'Integer',
|
77
71
|
:'assertion_consumer_service_url' => :'String',
|
72
|
+
:'account_id' => :'Integer',
|
78
73
|
:'name' => :'String',
|
79
74
|
:'enabled' => :'BOOLEAN',
|
80
75
|
:'issuer' => :'String',
|
81
76
|
:'sign_on_url' => :'String',
|
82
77
|
:'sign_out_url' => :'String',
|
83
78
|
:'metadata_url' => :'String',
|
84
|
-
:'
|
85
|
-
:'
|
79
|
+
:'audience_uri' => :'String',
|
80
|
+
:'id' => :'Integer',
|
81
|
+
:'created' => :'DateTime'
|
86
82
|
}
|
87
83
|
end
|
88
84
|
|
@@ -94,22 +90,14 @@ module TalonOne
|
|
94
90
|
# convert string to symbol for hash key
|
95
91
|
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
96
92
|
|
97
|
-
if attributes.has_key?(:'
|
98
|
-
self.
|
99
|
-
end
|
100
|
-
|
101
|
-
if attributes.has_key?(:'created')
|
102
|
-
self.created = attributes[:'created']
|
93
|
+
if attributes.has_key?(:'assertionConsumerServiceURL')
|
94
|
+
self.assertion_consumer_service_url = attributes[:'assertionConsumerServiceURL']
|
103
95
|
end
|
104
96
|
|
105
97
|
if attributes.has_key?(:'accountId')
|
106
98
|
self.account_id = attributes[:'accountId']
|
107
99
|
end
|
108
100
|
|
109
|
-
if attributes.has_key?(:'assertionConsumerServiceURL')
|
110
|
-
self.assertion_consumer_service_url = attributes[:'assertionConsumerServiceURL']
|
111
|
-
end
|
112
|
-
|
113
101
|
if attributes.has_key?(:'name')
|
114
102
|
self.name = attributes[:'name']
|
115
103
|
end
|
@@ -134,12 +122,16 @@ module TalonOne
|
|
134
122
|
self.metadata_url = attributes[:'metadataURL']
|
135
123
|
end
|
136
124
|
|
137
|
-
if attributes.has_key?(:'
|
138
|
-
self.
|
125
|
+
if attributes.has_key?(:'audienceURI')
|
126
|
+
self.audience_uri = attributes[:'audienceURI']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.has_key?(:'id')
|
130
|
+
self.id = attributes[:'id']
|
139
131
|
end
|
140
132
|
|
141
|
-
if attributes.has_key?(:'
|
142
|
-
self.
|
133
|
+
if attributes.has_key?(:'created')
|
134
|
+
self.created = attributes[:'created']
|
143
135
|
end
|
144
136
|
end
|
145
137
|
|
@@ -147,22 +139,14 @@ module TalonOne
|
|
147
139
|
# @return Array for valid properties with the reasons
|
148
140
|
def list_invalid_properties
|
149
141
|
invalid_properties = Array.new
|
150
|
-
if @
|
151
|
-
invalid_properties.push('invalid value for "
|
152
|
-
end
|
153
|
-
|
154
|
-
if @created.nil?
|
155
|
-
invalid_properties.push('invalid value for "created", created cannot be nil.')
|
142
|
+
if @assertion_consumer_service_url.nil?
|
143
|
+
invalid_properties.push('invalid value for "assertion_consumer_service_url", assertion_consumer_service_url cannot be nil.')
|
156
144
|
end
|
157
145
|
|
158
146
|
if @account_id.nil?
|
159
147
|
invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
|
160
148
|
end
|
161
149
|
|
162
|
-
if @assertion_consumer_service_url.nil?
|
163
|
-
invalid_properties.push('invalid value for "assertion_consumer_service_url", assertion_consumer_service_url cannot be nil.')
|
164
|
-
end
|
165
|
-
|
166
150
|
if @name.nil?
|
167
151
|
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
168
152
|
end
|
@@ -191,16 +175,16 @@ module TalonOne
|
|
191
175
|
invalid_properties.push('invalid value for "sign_on_url", the character length must be great than or equal to 1.')
|
192
176
|
end
|
193
177
|
|
194
|
-
if @
|
195
|
-
invalid_properties.push('invalid value for "
|
178
|
+
if @audience_uri.nil?
|
179
|
+
invalid_properties.push('invalid value for "audience_uri", audience_uri cannot be nil.')
|
196
180
|
end
|
197
181
|
|
198
|
-
if @
|
199
|
-
invalid_properties.push('invalid value for "
|
182
|
+
if @id.nil?
|
183
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
200
184
|
end
|
201
185
|
|
202
|
-
if @
|
203
|
-
invalid_properties.push('invalid value for "
|
186
|
+
if @created.nil?
|
187
|
+
invalid_properties.push('invalid value for "created", created cannot be nil.')
|
204
188
|
end
|
205
189
|
|
206
190
|
invalid_properties
|
@@ -209,10 +193,8 @@ module TalonOne
|
|
209
193
|
# Check to see if the all the properties in the model are valid
|
210
194
|
# @return true if the model is valid
|
211
195
|
def valid?
|
212
|
-
return false if @id.nil?
|
213
|
-
return false if @created.nil?
|
214
|
-
return false if @account_id.nil?
|
215
196
|
return false if @assertion_consumer_service_url.nil?
|
197
|
+
return false if @account_id.nil?
|
216
198
|
return false if @name.nil?
|
217
199
|
return false if @name.to_s.length < 1
|
218
200
|
return false if @enabled.nil?
|
@@ -220,9 +202,9 @@ module TalonOne
|
|
220
202
|
return false if @issuer.to_s.length < 1
|
221
203
|
return false if @sign_on_url.nil?
|
222
204
|
return false if @sign_on_url.to_s.length < 1
|
223
|
-
return false if @
|
224
|
-
return false if @
|
225
|
-
return false if @
|
205
|
+
return false if @audience_uri.nil?
|
206
|
+
return false if @id.nil?
|
207
|
+
return false if @created.nil?
|
226
208
|
true
|
227
209
|
end
|
228
210
|
|
@@ -268,37 +250,22 @@ module TalonOne
|
|
268
250
|
@sign_on_url = sign_on_url
|
269
251
|
end
|
270
252
|
|
271
|
-
# Custom attribute writer method with validation
|
272
|
-
# @param [Object] x509certificate Value to be assigned
|
273
|
-
def x509certificate=(x509certificate)
|
274
|
-
if x509certificate.nil?
|
275
|
-
fail ArgumentError, 'x509certificate cannot be nil'
|
276
|
-
end
|
277
|
-
|
278
|
-
if x509certificate.to_s.length < 1
|
279
|
-
fail ArgumentError, 'invalid value for "x509certificate", the character length must be great than or equal to 1.'
|
280
|
-
end
|
281
|
-
|
282
|
-
@x509certificate = x509certificate
|
283
|
-
end
|
284
|
-
|
285
253
|
# Checks equality by comparing each attribute.
|
286
254
|
# @param [Object] Object to be compared
|
287
255
|
def ==(o)
|
288
256
|
return true if self.equal?(o)
|
289
257
|
self.class == o.class &&
|
290
|
-
id == o.id &&
|
291
|
-
created == o.created &&
|
292
|
-
account_id == o.account_id &&
|
293
258
|
assertion_consumer_service_url == o.assertion_consumer_service_url &&
|
259
|
+
account_id == o.account_id &&
|
294
260
|
name == o.name &&
|
295
261
|
enabled == o.enabled &&
|
296
262
|
issuer == o.issuer &&
|
297
263
|
sign_on_url == o.sign_on_url &&
|
298
264
|
sign_out_url == o.sign_out_url &&
|
299
265
|
metadata_url == o.metadata_url &&
|
300
|
-
|
301
|
-
|
266
|
+
audience_uri == o.audience_uri &&
|
267
|
+
id == o.id &&
|
268
|
+
created == o.created
|
302
269
|
end
|
303
270
|
|
304
271
|
# @see the `==` method
|
@@ -310,7 +277,7 @@ module TalonOne
|
|
310
277
|
# Calculates hash code according to all attributes.
|
311
278
|
# @return [Fixnum] Hash code
|
312
279
|
def hash
|
313
|
-
[
|
280
|
+
[assertion_consumer_service_url, account_id, name, enabled, issuer, sign_on_url, sign_out_url, metadata_url, audience_uri, id, created].hash
|
314
281
|
end
|
315
282
|
|
316
283
|
# Builds the object from hash
|
@@ -0,0 +1,271 @@
|
|
1
|
+
=begin
|
2
|
+
#Talon.One API
|
3
|
+
|
4
|
+
#The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. ### Where is the API? The API is available at the same hostname as these docs. For example, if you are reading this page at `https://mycompany.talon.one/docs/api/`, the URL for the [updateCustomerProfile][] operation is `https://mycompany.talon.one/v1/customer_profiles/id` [updateCustomerProfile]: #operation--v1-customer_profiles--integrationId--put
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.7
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module TalonOne
|
16
|
+
class SamlConnectionMetadata
|
17
|
+
# ID of the SAML service.
|
18
|
+
attr_accessor :name
|
19
|
+
|
20
|
+
# Determines if this SAML connection active.
|
21
|
+
attr_accessor :enabled
|
22
|
+
|
23
|
+
attr_accessor :account_id
|
24
|
+
|
25
|
+
# Identity Provider metadata XML document.
|
26
|
+
attr_accessor :metadata_document
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'name' => :'name',
|
32
|
+
:'enabled' => :'enabled',
|
33
|
+
:'account_id' => :'accountId',
|
34
|
+
:'metadata_document' => :'metadataDocument'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.swagger_types
|
40
|
+
{
|
41
|
+
:'name' => :'String',
|
42
|
+
:'enabled' => :'BOOLEAN',
|
43
|
+
:'account_id' => :'Float',
|
44
|
+
:'metadata_document' => :'String'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# Initializes the object
|
49
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
50
|
+
def initialize(attributes = {})
|
51
|
+
return unless attributes.is_a?(Hash)
|
52
|
+
|
53
|
+
# convert string to symbol for hash key
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
55
|
+
|
56
|
+
if attributes.has_key?(:'name')
|
57
|
+
self.name = attributes[:'name']
|
58
|
+
end
|
59
|
+
|
60
|
+
if attributes.has_key?(:'enabled')
|
61
|
+
self.enabled = attributes[:'enabled']
|
62
|
+
end
|
63
|
+
|
64
|
+
if attributes.has_key?(:'accountId')
|
65
|
+
self.account_id = attributes[:'accountId']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.has_key?(:'metadataDocument')
|
69
|
+
self.metadata_document = attributes[:'metadataDocument']
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
74
|
+
# @return Array for valid properties with the reasons
|
75
|
+
def list_invalid_properties
|
76
|
+
invalid_properties = Array.new
|
77
|
+
if @name.nil?
|
78
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
79
|
+
end
|
80
|
+
|
81
|
+
if @name.to_s.length < 1
|
82
|
+
invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
|
83
|
+
end
|
84
|
+
|
85
|
+
if @enabled.nil?
|
86
|
+
invalid_properties.push('invalid value for "enabled", enabled cannot be nil.')
|
87
|
+
end
|
88
|
+
|
89
|
+
if @account_id.nil?
|
90
|
+
invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
|
91
|
+
end
|
92
|
+
|
93
|
+
if @metadata_document.nil?
|
94
|
+
invalid_properties.push('invalid value for "metadata_document", metadata_document cannot be nil.')
|
95
|
+
end
|
96
|
+
|
97
|
+
if @metadata_document.to_s.length < 1
|
98
|
+
invalid_properties.push('invalid value for "metadata_document", the character length must be great than or equal to 1.')
|
99
|
+
end
|
100
|
+
|
101
|
+
invalid_properties
|
102
|
+
end
|
103
|
+
|
104
|
+
# Check to see if the all the properties in the model are valid
|
105
|
+
# @return true if the model is valid
|
106
|
+
def valid?
|
107
|
+
return false if @name.nil?
|
108
|
+
return false if @name.to_s.length < 1
|
109
|
+
return false if @enabled.nil?
|
110
|
+
return false if @account_id.nil?
|
111
|
+
return false if @metadata_document.nil?
|
112
|
+
return false if @metadata_document.to_s.length < 1
|
113
|
+
true
|
114
|
+
end
|
115
|
+
|
116
|
+
# Custom attribute writer method with validation
|
117
|
+
# @param [Object] name Value to be assigned
|
118
|
+
def name=(name)
|
119
|
+
if name.nil?
|
120
|
+
fail ArgumentError, 'name cannot be nil'
|
121
|
+
end
|
122
|
+
|
123
|
+
if name.to_s.length < 1
|
124
|
+
fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
|
125
|
+
end
|
126
|
+
|
127
|
+
@name = name
|
128
|
+
end
|
129
|
+
|
130
|
+
# Custom attribute writer method with validation
|
131
|
+
# @param [Object] metadata_document Value to be assigned
|
132
|
+
def metadata_document=(metadata_document)
|
133
|
+
if metadata_document.nil?
|
134
|
+
fail ArgumentError, 'metadata_document cannot be nil'
|
135
|
+
end
|
136
|
+
|
137
|
+
if metadata_document.to_s.length < 1
|
138
|
+
fail ArgumentError, 'invalid value for "metadata_document", the character length must be great than or equal to 1.'
|
139
|
+
end
|
140
|
+
|
141
|
+
@metadata_document = metadata_document
|
142
|
+
end
|
143
|
+
|
144
|
+
# Checks equality by comparing each attribute.
|
145
|
+
# @param [Object] Object to be compared
|
146
|
+
def ==(o)
|
147
|
+
return true if self.equal?(o)
|
148
|
+
self.class == o.class &&
|
149
|
+
name == o.name &&
|
150
|
+
enabled == o.enabled &&
|
151
|
+
account_id == o.account_id &&
|
152
|
+
metadata_document == o.metadata_document
|
153
|
+
end
|
154
|
+
|
155
|
+
# @see the `==` method
|
156
|
+
# @param [Object] Object to be compared
|
157
|
+
def eql?(o)
|
158
|
+
self == o
|
159
|
+
end
|
160
|
+
|
161
|
+
# Calculates hash code according to all attributes.
|
162
|
+
# @return [Fixnum] Hash code
|
163
|
+
def hash
|
164
|
+
[name, enabled, account_id, metadata_document].hash
|
165
|
+
end
|
166
|
+
|
167
|
+
# Builds the object from hash
|
168
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
169
|
+
# @return [Object] Returns the model itself
|
170
|
+
def build_from_hash(attributes)
|
171
|
+
return nil unless attributes.is_a?(Hash)
|
172
|
+
self.class.swagger_types.each_pair do |key, type|
|
173
|
+
if type =~ /\AArray<(.*)>/i
|
174
|
+
# check to ensure the input is an array given that the the attribute
|
175
|
+
# is documented as an array but the input is not
|
176
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
177
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
178
|
+
end
|
179
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
180
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
181
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
182
|
+
end
|
183
|
+
|
184
|
+
self
|
185
|
+
end
|
186
|
+
|
187
|
+
# Deserializes the data based on type
|
188
|
+
# @param string type Data type
|
189
|
+
# @param string value Value to be deserialized
|
190
|
+
# @return [Object] Deserialized data
|
191
|
+
def _deserialize(type, value)
|
192
|
+
case type.to_sym
|
193
|
+
when :DateTime
|
194
|
+
DateTime.parse(value)
|
195
|
+
when :Date
|
196
|
+
Date.parse(value)
|
197
|
+
when :String
|
198
|
+
value.to_s
|
199
|
+
when :Integer
|
200
|
+
value.to_i
|
201
|
+
when :Float
|
202
|
+
value.to_f
|
203
|
+
when :BOOLEAN
|
204
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
205
|
+
true
|
206
|
+
else
|
207
|
+
false
|
208
|
+
end
|
209
|
+
when :Object
|
210
|
+
# generic object (usually a Hash), return directly
|
211
|
+
value
|
212
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
213
|
+
inner_type = Regexp.last_match[:inner_type]
|
214
|
+
value.map { |v| _deserialize(inner_type, v) }
|
215
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
216
|
+
k_type = Regexp.last_match[:k_type]
|
217
|
+
v_type = Regexp.last_match[:v_type]
|
218
|
+
{}.tap do |hash|
|
219
|
+
value.each do |k, v|
|
220
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
221
|
+
end
|
222
|
+
end
|
223
|
+
else # model
|
224
|
+
temp_model = TalonOne.const_get(type).new
|
225
|
+
temp_model.build_from_hash(value)
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
# Returns the string representation of the object
|
230
|
+
# @return [String] String presentation of the object
|
231
|
+
def to_s
|
232
|
+
to_hash.to_s
|
233
|
+
end
|
234
|
+
|
235
|
+
# to_body is an alias to to_hash (backward compatibility)
|
236
|
+
# @return [Hash] Returns the object in the form of hash
|
237
|
+
def to_body
|
238
|
+
to_hash
|
239
|
+
end
|
240
|
+
|
241
|
+
# Returns the object in the form of hash
|
242
|
+
# @return [Hash] Returns the object in the form of hash
|
243
|
+
def to_hash
|
244
|
+
hash = {}
|
245
|
+
self.class.attribute_map.each_pair do |attr, param|
|
246
|
+
value = self.send(attr)
|
247
|
+
next if value.nil?
|
248
|
+
hash[param] = _to_hash(value)
|
249
|
+
end
|
250
|
+
hash
|
251
|
+
end
|
252
|
+
|
253
|
+
# Outputs non-array value in the form of hash
|
254
|
+
# For object, use to_hash. Otherwise, just return the value
|
255
|
+
# @param [Object] value Any valid value
|
256
|
+
# @return [Hash] Returns the value in the form of hash
|
257
|
+
def _to_hash(value)
|
258
|
+
if value.is_a?(Array)
|
259
|
+
value.compact.map { |v| _to_hash(v) }
|
260
|
+
elsif value.is_a?(Hash)
|
261
|
+
{}.tap do |hash|
|
262
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
263
|
+
end
|
264
|
+
elsif value.respond_to? :to_hash
|
265
|
+
value.to_hash
|
266
|
+
else
|
267
|
+
value
|
268
|
+
end
|
269
|
+
end
|
270
|
+
end
|
271
|
+
end
|