talon_one 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +7 -4
  3. data/docs/Application.md +1 -1
  4. data/docs/Campaign.md +2 -0
  5. data/docs/InlineResponse20025.md +2 -1
  6. data/docs/IntegrationState.md +1 -0
  7. data/docs/ManagementApi.md +11 -1
  8. data/docs/NewApplication.md +1 -1
  9. data/docs/NewSamlConnection.md +15 -0
  10. data/docs/SamlConnection.md +19 -0
  11. data/docs/UpdateApplication.md +14 -0
  12. data/docs/User.md +1 -0
  13. data/lib/talon_one.rb +3 -0
  14. data/lib/talon_one/api/management_api.rb +15 -0
  15. data/lib/talon_one/models/application.rb +53 -53
  16. data/lib/talon_one/models/campaign.rb +21 -1
  17. data/lib/talon_one/models/inline_response_200_25.rb +10 -6
  18. data/lib/talon_one/models/integration_state.rb +13 -4
  19. data/lib/talon_one/models/limit_config.rb +2 -2
  20. data/lib/talon_one/models/new_application.rb +48 -56
  21. data/lib/talon_one/models/new_saml_connection.rb +356 -0
  22. data/lib/talon_one/models/saml_connection.rb +420 -0
  23. data/lib/talon_one/models/update_application.rb +352 -0
  24. data/lib/talon_one/models/user.rb +14 -4
  25. data/lib/talon_one/version.rb +1 -1
  26. data/spec/api/management_api_spec.rb +5 -0
  27. data/spec/models/application_spec.rb +6 -6
  28. data/spec/models/campaign_spec.rb +12 -0
  29. data/spec/models/inline_response_200_25_spec.rb +6 -0
  30. data/spec/models/integration_state_spec.rb +6 -0
  31. data/spec/models/limit_config_spec.rb +1 -1
  32. data/spec/models/new_application_spec.rb +6 -6
  33. data/spec/models/new_saml_connection_spec.rb +83 -0
  34. data/spec/models/saml_connection_spec.rb +107 -0
  35. data/spec/models/update_application_spec.rb +81 -0
  36. data/spec/models/user_spec.rb +6 -0
  37. data/talon_one-1.2.0.gem +0 -0
  38. metadata +28 -16
@@ -70,6 +70,12 @@ module TalonOne
70
70
  # Total amount of discounts redeemed in the campaign.
71
71
  attr_accessor :discount_count
72
72
 
73
+ # Total number of times discounts were redeemed in this campaign.
74
+ attr_accessor :discount_effect_count
75
+
76
+ # Total number of coupons created by rules in this campaign.
77
+ attr_accessor :coupon_creation_count
78
+
73
79
  # Timestamp of the most recent event received by this campaign.
74
80
  attr_accessor :last_activity
75
81
 
@@ -126,6 +132,8 @@ module TalonOne
126
132
  :'coupon_redemption_count' => :'couponRedemptionCount',
127
133
  :'referral_redemption_count' => :'referralRedemptionCount',
128
134
  :'discount_count' => :'discountCount',
135
+ :'discount_effect_count' => :'discountEffectCount',
136
+ :'coupon_creation_count' => :'couponCreationCount',
129
137
  :'last_activity' => :'lastActivity',
130
138
  :'updated' => :'updated',
131
139
  :'created_by' => :'createdBy',
@@ -155,6 +163,8 @@ module TalonOne
155
163
  :'coupon_redemption_count' => :'Integer',
156
164
  :'referral_redemption_count' => :'Integer',
157
165
  :'discount_count' => :'Integer',
166
+ :'discount_effect_count' => :'Integer',
167
+ :'coupon_creation_count' => :'Integer',
158
168
  :'last_activity' => :'DateTime',
159
169
  :'updated' => :'DateTime',
160
170
  :'created_by' => :'String',
@@ -254,6 +264,14 @@ module TalonOne
254
264
  self.discount_count = attributes[:'discountCount']
255
265
  end
256
266
 
267
+ if attributes.has_key?(:'discountEffectCount')
268
+ self.discount_effect_count = attributes[:'discountEffectCount']
269
+ end
270
+
271
+ if attributes.has_key?(:'couponCreationCount')
272
+ self.coupon_creation_count = attributes[:'couponCreationCount']
273
+ end
274
+
257
275
  if attributes.has_key?(:'lastActivity')
258
276
  self.last_activity = attributes[:'lastActivity']
259
277
  end
@@ -389,6 +407,8 @@ module TalonOne
389
407
  coupon_redemption_count == o.coupon_redemption_count &&
390
408
  referral_redemption_count == o.referral_redemption_count &&
391
409
  discount_count == o.discount_count &&
410
+ discount_effect_count == o.discount_effect_count &&
411
+ coupon_creation_count == o.coupon_creation_count &&
392
412
  last_activity == o.last_activity &&
393
413
  updated == o.updated &&
394
414
  created_by == o.created_by &&
@@ -404,7 +424,7 @@ module TalonOne
404
424
  # Calculates hash code according to all attributes.
405
425
  # @return [Fixnum] Hash code
406
426
  def hash
407
- [id, created, application_id, user_id, name, description, start_time, end_time, attributes, state, active_ruleset_id, tags, features, coupon_settings, referral_settings, limits, coupon_redemption_count, referral_redemption_count, discount_count, last_activity, updated, created_by, updated_by].hash
427
+ [id, created, application_id, user_id, name, description, start_time, end_time, attributes, state, active_ruleset_id, tags, features, coupon_settings, referral_settings, limits, coupon_redemption_count, referral_redemption_count, discount_count, discount_effect_count, coupon_creation_count, last_activity, updated, created_by, updated_by].hash
408
428
  end
409
429
 
410
430
  # Builds the object from hash
@@ -16,12 +16,15 @@ module TalonOne
16
16
  class InlineResponse20025
17
17
  attr_accessor :total_result_size
18
18
 
19
+ attr_accessor :has_more
20
+
19
21
  attr_accessor :data
20
22
 
21
23
  # Attribute mapping from ruby-style variable name to JSON key.
22
24
  def self.attribute_map
23
25
  {
24
26
  :'total_result_size' => :'totalResultSize',
27
+ :'has_more' => :'hasMore',
25
28
  :'data' => :'data'
26
29
  }
27
30
  end
@@ -30,6 +33,7 @@ module TalonOne
30
33
  def self.swagger_types
31
34
  {
32
35
  :'total_result_size' => :'Integer',
36
+ :'has_more' => :'BOOLEAN',
33
37
  :'data' => :'Array<Change>'
34
38
  }
35
39
  end
@@ -46,6 +50,10 @@ module TalonOne
46
50
  self.total_result_size = attributes[:'totalResultSize']
47
51
  end
48
52
 
53
+ if attributes.has_key?(:'hasMore')
54
+ self.has_more = attributes[:'hasMore']
55
+ end
56
+
49
57
  if attributes.has_key?(:'data')
50
58
  if (value = attributes[:'data']).is_a?(Array)
51
59
  self.data = value
@@ -57,10 +65,6 @@ module TalonOne
57
65
  # @return Array for valid properties with the reasons
58
66
  def list_invalid_properties
59
67
  invalid_properties = Array.new
60
- if @total_result_size.nil?
61
- invalid_properties.push('invalid value for "total_result_size", total_result_size cannot be nil.')
62
- end
63
-
64
68
  if @data.nil?
65
69
  invalid_properties.push('invalid value for "data", data cannot be nil.')
66
70
  end
@@ -71,7 +75,6 @@ module TalonOne
71
75
  # Check to see if the all the properties in the model are valid
72
76
  # @return true if the model is valid
73
77
  def valid?
74
- return false if @total_result_size.nil?
75
78
  return false if @data.nil?
76
79
  true
77
80
  end
@@ -82,6 +85,7 @@ module TalonOne
82
85
  return true if self.equal?(o)
83
86
  self.class == o.class &&
84
87
  total_result_size == o.total_result_size &&
88
+ has_more == o.has_more &&
85
89
  data == o.data
86
90
  end
87
91
 
@@ -94,7 +98,7 @@ module TalonOne
94
98
  # Calculates hash code according to all attributes.
95
99
  # @return [Fixnum] Hash code
96
100
  def hash
97
- [total_result_size, data].hash
101
+ [total_result_size, has_more, data].hash
98
102
  end
99
103
 
100
104
  # Builds the object from hash
@@ -23,13 +23,16 @@ module TalonOne
23
23
 
24
24
  attr_accessor :loyalty
25
25
 
26
+ attr_accessor :coupon
27
+
26
28
  # Attribute mapping from ruby-style variable name to JSON key.
27
29
  def self.attribute_map
28
30
  {
29
31
  :'session' => :'session',
30
32
  :'profile' => :'profile',
31
33
  :'event' => :'event',
32
- :'loyalty' => :'loyalty'
34
+ :'loyalty' => :'loyalty',
35
+ :'coupon' => :'coupon'
33
36
  }
34
37
  end
35
38
 
@@ -39,7 +42,8 @@ module TalonOne
39
42
  :'session' => :'CustomerSession',
40
43
  :'profile' => :'CustomerProfile',
41
44
  :'event' => :'Event',
42
- :'loyalty' => :'Loyalty'
45
+ :'loyalty' => :'Loyalty',
46
+ :'coupon' => :'Coupon'
43
47
  }
44
48
  end
45
49
 
@@ -66,6 +70,10 @@ module TalonOne
66
70
  if attributes.has_key?(:'loyalty')
67
71
  self.loyalty = attributes[:'loyalty']
68
72
  end
73
+
74
+ if attributes.has_key?(:'coupon')
75
+ self.coupon = attributes[:'coupon']
76
+ end
69
77
  end
70
78
 
71
79
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -104,7 +112,8 @@ module TalonOne
104
112
  session == o.session &&
105
113
  profile == o.profile &&
106
114
  event == o.event &&
107
- loyalty == o.loyalty
115
+ loyalty == o.loyalty &&
116
+ coupon == o.coupon
108
117
  end
109
118
 
110
119
  # @see the `==` method
@@ -116,7 +125,7 @@ module TalonOne
116
125
  # Calculates hash code according to all attributes.
117
126
  # @return [Fixnum] Hash code
118
127
  def hash
119
- [session, profile, event, loyalty].hash
128
+ [session, profile, event, loyalty, coupon].hash
120
129
  end
121
130
 
122
131
  # Builds the object from hash
@@ -113,7 +113,7 @@ module TalonOne
113
113
  # @return true if the model is valid
114
114
  def valid?
115
115
  return false if @action.nil?
116
- action_validator = EnumAttributeValidator.new('String', ['redeemCoupon', 'redeemReferral', 'setDiscount', 'createCoupon'])
116
+ action_validator = EnumAttributeValidator.new('String', ['redeemCoupon', 'redeemReferral', 'setDiscount', 'createCoupon', 'setDiscountEffect'])
117
117
  return false unless action_validator.valid?(@action)
118
118
  return false if @limit.nil?
119
119
  return false if @limit < 0
@@ -124,7 +124,7 @@ module TalonOne
124
124
  # Custom attribute writer method checking allowed values (enum).
125
125
  # @param [Object] action Object to be assigned
126
126
  def action=(action)
127
- validator = EnumAttributeValidator.new('String', ['redeemCoupon', 'redeemReferral', 'setDiscount', 'createCoupon'])
127
+ validator = EnumAttributeValidator.new('String', ['redeemCoupon', 'redeemReferral', 'setDiscount', 'createCoupon', 'setDiscountEffect'])
128
128
  unless validator.valid?(action)
129
129
  fail ArgumentError, 'invalid value for "action", must be one of #{validator.allowable_values}.'
130
130
  end
@@ -13,6 +13,7 @@ Swagger Codegen version: 2.4.7
13
13
  require 'date'
14
14
 
15
15
  module TalonOne
16
+ #
16
17
  class NewApplication
17
18
  # The name of this application.
18
19
  attr_accessor :name
@@ -20,9 +21,6 @@ module TalonOne
20
21
  # A longer description of the application.
21
22
  attr_accessor :description
22
23
 
23
- # Hex key for HMAC-signing API calls as coming from this application (16 hex digits)
24
- attr_accessor :key
25
-
26
24
  # A string containing an IANA timezone descriptor.
27
25
  attr_accessor :timezone
28
26
 
@@ -38,6 +36,9 @@ module TalonOne
38
36
  # Default limits for campaigns created in this application
39
37
  attr_accessor :limits
40
38
 
39
+ # Hex key for HMAC-signing API calls as coming from this application (16 hex digits)
40
+ attr_accessor :key
41
+
41
42
  class EnumAttributeValidator
42
43
  attr_reader :datatype
43
44
  attr_reader :allowable_values
@@ -65,12 +66,12 @@ module TalonOne
65
66
  {
66
67
  :'name' => :'name',
67
68
  :'description' => :'description',
68
- :'key' => :'key',
69
69
  :'timezone' => :'timezone',
70
70
  :'currency' => :'currency',
71
71
  :'case_sensitivity' => :'caseSensitivity',
72
72
  :'attributes' => :'attributes',
73
- :'limits' => :'limits'
73
+ :'limits' => :'limits',
74
+ :'key' => :'key'
74
75
  }
75
76
  end
76
77
 
@@ -79,12 +80,12 @@ module TalonOne
79
80
  {
80
81
  :'name' => :'String',
81
82
  :'description' => :'String',
82
- :'key' => :'String',
83
83
  :'timezone' => :'String',
84
84
  :'currency' => :'String',
85
85
  :'case_sensitivity' => :'String',
86
86
  :'attributes' => :'Object',
87
- :'limits' => :'Array<LimitConfig>'
87
+ :'limits' => :'Array<LimitConfig>',
88
+ :'key' => :'String'
88
89
  }
89
90
  end
90
91
 
@@ -104,10 +105,6 @@ module TalonOne
104
105
  self.description = attributes[:'description']
105
106
  end
106
107
 
107
- if attributes.has_key?(:'key')
108
- self.key = attributes[:'key']
109
- end
110
-
111
108
  if attributes.has_key?(:'timezone')
112
109
  self.timezone = attributes[:'timezone']
113
110
  end
@@ -129,6 +126,10 @@ module TalonOne
129
126
  self.limits = value
130
127
  end
131
128
  end
129
+
130
+ if attributes.has_key?(:'key')
131
+ self.key = attributes[:'key']
132
+ end
132
133
  end
133
134
 
134
135
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -143,22 +144,6 @@ module TalonOne
143
144
  invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
144
145
  end
145
146
 
146
- if @key.nil?
147
- invalid_properties.push('invalid value for "key", key cannot be nil.')
148
- end
149
-
150
- if @key.to_s.length > 16
151
- invalid_properties.push('invalid value for "key", the character length must be smaller than or equal to 16.')
152
- end
153
-
154
- if @key.to_s.length < 16
155
- invalid_properties.push('invalid value for "key", the character length must be great than or equal to 16.')
156
- end
157
-
158
- if @key !~ Regexp.new(/^[a-fA-F0-9]{16}$/)
159
- invalid_properties.push('invalid value for "key", must conform to the pattern /^[a-fA-F0-9]{16}$/.')
160
- end
161
-
162
147
  if @timezone.nil?
163
148
  invalid_properties.push('invalid value for "timezone", timezone cannot be nil.')
164
149
  end
@@ -175,6 +160,18 @@ module TalonOne
175
160
  invalid_properties.push('invalid value for "currency", the character length must be great than or equal to 1.')
176
161
  end
177
162
 
163
+ if !@key.nil? && @key.to_s.length > 16
164
+ invalid_properties.push('invalid value for "key", the character length must be smaller than or equal to 16.')
165
+ end
166
+
167
+ if !@key.nil? && @key.to_s.length < 16
168
+ invalid_properties.push('invalid value for "key", the character length must be great than or equal to 16.')
169
+ end
170
+
171
+ if !@key.nil? && @key !~ Regexp.new(/^[a-fA-F0-9]{16}$/)
172
+ invalid_properties.push('invalid value for "key", must conform to the pattern /^[a-fA-F0-9]{16}$/.')
173
+ end
174
+
178
175
  invalid_properties
179
176
  end
180
177
 
@@ -183,16 +180,15 @@ module TalonOne
183
180
  def valid?
184
181
  return false if @name.nil?
185
182
  return false if @name.to_s.length < 1
186
- return false if @key.nil?
187
- return false if @key.to_s.length > 16
188
- return false if @key.to_s.length < 16
189
- return false if @key !~ Regexp.new(/^[a-fA-F0-9]{16}$/)
190
183
  return false if @timezone.nil?
191
184
  return false if @timezone.to_s.length < 1
192
185
  return false if @currency.nil?
193
186
  return false if @currency.to_s.length < 1
194
187
  case_sensitivity_validator = EnumAttributeValidator.new('String', ['sensitive', 'insensitive-uppercase', 'insensitive-lowercase'])
195
188
  return false unless case_sensitivity_validator.valid?(@case_sensitivity)
189
+ return false if !@key.nil? && @key.to_s.length > 16
190
+ return false if !@key.nil? && @key.to_s.length < 16
191
+ return false if !@key.nil? && @key !~ Regexp.new(/^[a-fA-F0-9]{16}$/)
196
192
  true
197
193
  end
198
194
 
@@ -210,28 +206,6 @@ module TalonOne
210
206
  @name = name
211
207
  end
212
208
 
213
- # Custom attribute writer method with validation
214
- # @param [Object] key Value to be assigned
215
- def key=(key)
216
- if key.nil?
217
- fail ArgumentError, 'key cannot be nil'
218
- end
219
-
220
- if key.to_s.length > 16
221
- fail ArgumentError, 'invalid value for "key", the character length must be smaller than or equal to 16.'
222
- end
223
-
224
- if key.to_s.length < 16
225
- fail ArgumentError, 'invalid value for "key", the character length must be great than or equal to 16.'
226
- end
227
-
228
- if key !~ Regexp.new(/^[a-fA-F0-9]{16}$/)
229
- fail ArgumentError, 'invalid value for "key", must conform to the pattern /^[a-fA-F0-9]{16}$/.'
230
- end
231
-
232
- @key = key
233
- end
234
-
235
209
  # Custom attribute writer method with validation
236
210
  # @param [Object] timezone Value to be assigned
237
211
  def timezone=(timezone)
@@ -270,6 +244,24 @@ module TalonOne
270
244
  @case_sensitivity = case_sensitivity
271
245
  end
272
246
 
247
+ # Custom attribute writer method with validation
248
+ # @param [Object] key Value to be assigned
249
+ def key=(key)
250
+ if !key.nil? && key.to_s.length > 16
251
+ fail ArgumentError, 'invalid value for "key", the character length must be smaller than or equal to 16.'
252
+ end
253
+
254
+ if !key.nil? && key.to_s.length < 16
255
+ fail ArgumentError, 'invalid value for "key", the character length must be great than or equal to 16.'
256
+ end
257
+
258
+ if !key.nil? && key !~ Regexp.new(/^[a-fA-F0-9]{16}$/)
259
+ fail ArgumentError, 'invalid value for "key", must conform to the pattern /^[a-fA-F0-9]{16}$/.'
260
+ end
261
+
262
+ @key = key
263
+ end
264
+
273
265
  # Checks equality by comparing each attribute.
274
266
  # @param [Object] Object to be compared
275
267
  def ==(o)
@@ -277,12 +269,12 @@ module TalonOne
277
269
  self.class == o.class &&
278
270
  name == o.name &&
279
271
  description == o.description &&
280
- key == o.key &&
281
272
  timezone == o.timezone &&
282
273
  currency == o.currency &&
283
274
  case_sensitivity == o.case_sensitivity &&
284
275
  attributes == o.attributes &&
285
- limits == o.limits
276
+ limits == o.limits &&
277
+ key == o.key
286
278
  end
287
279
 
288
280
  # @see the `==` method
@@ -294,7 +286,7 @@ module TalonOne
294
286
  # Calculates hash code according to all attributes.
295
287
  # @return [Fixnum] Hash code
296
288
  def hash
297
- [name, description, key, timezone, currency, case_sensitivity, attributes, limits].hash
289
+ [name, description, timezone, currency, case_sensitivity, attributes, limits, key].hash
298
290
  end
299
291
 
300
292
  # Builds the object from hash
@@ -0,0 +1,356 @@
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
+ # A new SAML 2.0 connection.
17
+ class NewSamlConnection
18
+ # ID of the SAML service.
19
+ attr_accessor :name
20
+
21
+ # Determines if this SAML connection active.
22
+ attr_accessor :enabled
23
+
24
+ # Identity Provider Entity ID.
25
+ attr_accessor :issuer
26
+
27
+ # Single Sign-On URL.
28
+ attr_accessor :sign_on_url
29
+
30
+ # Single Sign-Out URL.
31
+ attr_accessor :sign_out_url
32
+
33
+ # Metadata URL.
34
+ attr_accessor :metadata_url
35
+
36
+ # X.509 Certificate.
37
+ attr_accessor :x509certificate
38
+
39
+ # 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.
40
+ attr_accessor :audience
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'name' => :'name',
46
+ :'enabled' => :'enabled',
47
+ :'issuer' => :'issuer',
48
+ :'sign_on_url' => :'signOnURL',
49
+ :'sign_out_url' => :'signOutURL',
50
+ :'metadata_url' => :'metadataURL',
51
+ :'x509certificate' => :'x509certificate',
52
+ :'audience' => :'audience'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.swagger_types
58
+ {
59
+ :'name' => :'String',
60
+ :'enabled' => :'BOOLEAN',
61
+ :'issuer' => :'String',
62
+ :'sign_on_url' => :'String',
63
+ :'sign_out_url' => :'String',
64
+ :'metadata_url' => :'String',
65
+ :'x509certificate' => :'String',
66
+ :'audience' => :'String'
67
+ }
68
+ end
69
+
70
+ # Initializes the object
71
+ # @param [Hash] attributes Model attributes in the form of hash
72
+ def initialize(attributes = {})
73
+ return unless attributes.is_a?(Hash)
74
+
75
+ # convert string to symbol for hash key
76
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
77
+
78
+ if attributes.has_key?(:'name')
79
+ self.name = attributes[:'name']
80
+ end
81
+
82
+ if attributes.has_key?(:'enabled')
83
+ self.enabled = attributes[:'enabled']
84
+ end
85
+
86
+ if attributes.has_key?(:'issuer')
87
+ self.issuer = attributes[:'issuer']
88
+ end
89
+
90
+ if attributes.has_key?(:'signOnURL')
91
+ self.sign_on_url = attributes[:'signOnURL']
92
+ end
93
+
94
+ if attributes.has_key?(:'signOutURL')
95
+ self.sign_out_url = attributes[:'signOutURL']
96
+ end
97
+
98
+ if attributes.has_key?(:'metadataURL')
99
+ self.metadata_url = attributes[:'metadataURL']
100
+ end
101
+
102
+ if attributes.has_key?(:'x509certificate')
103
+ self.x509certificate = attributes[:'x509certificate']
104
+ end
105
+
106
+ if attributes.has_key?(:'audience')
107
+ self.audience = attributes[:'audience']
108
+ end
109
+ end
110
+
111
+ # Show invalid properties with the reasons. Usually used together with valid?
112
+ # @return Array for valid properties with the reasons
113
+ def list_invalid_properties
114
+ invalid_properties = Array.new
115
+ if @name.nil?
116
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
117
+ end
118
+
119
+ if @name.to_s.length < 1
120
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
121
+ end
122
+
123
+ if @enabled.nil?
124
+ invalid_properties.push('invalid value for "enabled", enabled cannot be nil.')
125
+ end
126
+
127
+ if @issuer.nil?
128
+ invalid_properties.push('invalid value for "issuer", issuer cannot be nil.')
129
+ end
130
+
131
+ if @issuer.to_s.length < 1
132
+ invalid_properties.push('invalid value for "issuer", the character length must be great than or equal to 1.')
133
+ end
134
+
135
+ if @sign_on_url.nil?
136
+ invalid_properties.push('invalid value for "sign_on_url", sign_on_url cannot be nil.')
137
+ end
138
+
139
+ if @sign_on_url.to_s.length < 1
140
+ invalid_properties.push('invalid value for "sign_on_url", the character length must be great than or equal to 1.')
141
+ end
142
+
143
+ if @x509certificate.nil?
144
+ invalid_properties.push('invalid value for "x509certificate", x509certificate cannot be nil.')
145
+ end
146
+
147
+ if @x509certificate.to_s.length < 1
148
+ invalid_properties.push('invalid value for "x509certificate", the character length must be great than or equal to 1.')
149
+ end
150
+
151
+ invalid_properties
152
+ end
153
+
154
+ # Check to see if the all the properties in the model are valid
155
+ # @return true if the model is valid
156
+ def valid?
157
+ return false if @name.nil?
158
+ return false if @name.to_s.length < 1
159
+ return false if @enabled.nil?
160
+ return false if @issuer.nil?
161
+ return false if @issuer.to_s.length < 1
162
+ return false if @sign_on_url.nil?
163
+ return false if @sign_on_url.to_s.length < 1
164
+ return false if @x509certificate.nil?
165
+ return false if @x509certificate.to_s.length < 1
166
+ true
167
+ end
168
+
169
+ # Custom attribute writer method with validation
170
+ # @param [Object] name Value to be assigned
171
+ def name=(name)
172
+ if name.nil?
173
+ fail ArgumentError, 'name cannot be nil'
174
+ end
175
+
176
+ if name.to_s.length < 1
177
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
178
+ end
179
+
180
+ @name = name
181
+ end
182
+
183
+ # Custom attribute writer method with validation
184
+ # @param [Object] issuer Value to be assigned
185
+ def issuer=(issuer)
186
+ if issuer.nil?
187
+ fail ArgumentError, 'issuer cannot be nil'
188
+ end
189
+
190
+ if issuer.to_s.length < 1
191
+ fail ArgumentError, 'invalid value for "issuer", the character length must be great than or equal to 1.'
192
+ end
193
+
194
+ @issuer = issuer
195
+ end
196
+
197
+ # Custom attribute writer method with validation
198
+ # @param [Object] sign_on_url Value to be assigned
199
+ def sign_on_url=(sign_on_url)
200
+ if sign_on_url.nil?
201
+ fail ArgumentError, 'sign_on_url cannot be nil'
202
+ end
203
+
204
+ if sign_on_url.to_s.length < 1
205
+ fail ArgumentError, 'invalid value for "sign_on_url", the character length must be great than or equal to 1.'
206
+ end
207
+
208
+ @sign_on_url = sign_on_url
209
+ end
210
+
211
+ # Custom attribute writer method with validation
212
+ # @param [Object] x509certificate Value to be assigned
213
+ def x509certificate=(x509certificate)
214
+ if x509certificate.nil?
215
+ fail ArgumentError, 'x509certificate cannot be nil'
216
+ end
217
+
218
+ if x509certificate.to_s.length < 1
219
+ fail ArgumentError, 'invalid value for "x509certificate", the character length must be great than or equal to 1.'
220
+ end
221
+
222
+ @x509certificate = x509certificate
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
+ name == o.name &&
231
+ enabled == o.enabled &&
232
+ issuer == o.issuer &&
233
+ sign_on_url == o.sign_on_url &&
234
+ sign_out_url == o.sign_out_url &&
235
+ metadata_url == o.metadata_url &&
236
+ x509certificate == o.x509certificate &&
237
+ audience == o.audience
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 [Fixnum] Hash code
248
+ def hash
249
+ [name, enabled, issuer, sign_on_url, sign_out_url, metadata_url, x509certificate, audience].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 build_from_hash(attributes)
256
+ return nil unless attributes.is_a?(Hash)
257
+ self.class.swagger_types.each_pair do |key, type|
258
+ if type =~ /\AArray<(.*)>/i
259
+ # check to ensure the input is an array given that the the attribute
260
+ # is documented as an array but the input is not
261
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
262
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
263
+ end
264
+ elsif !attributes[self.class.attribute_map[key]].nil?
265
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
266
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
267
+ end
268
+
269
+ self
270
+ end
271
+
272
+ # Deserializes the data based on type
273
+ # @param string type Data type
274
+ # @param string value Value to be deserialized
275
+ # @return [Object] Deserialized data
276
+ def _deserialize(type, value)
277
+ case type.to_sym
278
+ when :DateTime
279
+ DateTime.parse(value)
280
+ when :Date
281
+ Date.parse(value)
282
+ when :String
283
+ value.to_s
284
+ when :Integer
285
+ value.to_i
286
+ when :Float
287
+ value.to_f
288
+ when :BOOLEAN
289
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
290
+ true
291
+ else
292
+ false
293
+ end
294
+ when :Object
295
+ # generic object (usually a Hash), return directly
296
+ value
297
+ when /\AArray<(?<inner_type>.+)>\z/
298
+ inner_type = Regexp.last_match[:inner_type]
299
+ value.map { |v| _deserialize(inner_type, v) }
300
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
301
+ k_type = Regexp.last_match[:k_type]
302
+ v_type = Regexp.last_match[:v_type]
303
+ {}.tap do |hash|
304
+ value.each do |k, v|
305
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
306
+ end
307
+ end
308
+ else # model
309
+ temp_model = TalonOne.const_get(type).new
310
+ temp_model.build_from_hash(value)
311
+ end
312
+ end
313
+
314
+ # Returns the string representation of the object
315
+ # @return [String] String presentation of the object
316
+ def to_s
317
+ to_hash.to_s
318
+ end
319
+
320
+ # to_body is an alias to to_hash (backward compatibility)
321
+ # @return [Hash] Returns the object in the form of hash
322
+ def to_body
323
+ to_hash
324
+ end
325
+
326
+ # Returns the object in the form of hash
327
+ # @return [Hash] Returns the object in the form of hash
328
+ def to_hash
329
+ hash = {}
330
+ self.class.attribute_map.each_pair do |attr, param|
331
+ value = self.send(attr)
332
+ next if value.nil?
333
+ hash[param] = _to_hash(value)
334
+ end
335
+ hash
336
+ end
337
+
338
+ # Outputs non-array value in the form of hash
339
+ # For object, use to_hash. Otherwise, just return the value
340
+ # @param [Object] value Any valid value
341
+ # @return [Hash] Returns the value in the form of hash
342
+ def _to_hash(value)
343
+ if value.is_a?(Array)
344
+ value.compact.map { |v| _to_hash(v) }
345
+ elsif value.is_a?(Hash)
346
+ {}.tap do |hash|
347
+ value.each { |k, v| hash[k] = _to_hash(v) }
348
+ end
349
+ elsif value.respond_to? :to_hash
350
+ value.to_hash
351
+ else
352
+ value
353
+ end
354
+ end
355
+ end
356
+ end