talon_one 1.1.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +21 -12
  3. data/docs/AccountAnalytics.md +1 -0
  4. data/docs/AccountLimits.md +1 -0
  5. data/docs/Application.md +2 -1
  6. data/docs/ApplicationCustomer.md +1 -1
  7. data/docs/ApplicationSession.md +2 -1
  8. data/docs/Attribute.md +0 -2
  9. data/docs/AttributesMandatory.md +9 -0
  10. data/docs/AttributesSettings.md +8 -0
  11. data/docs/BaseSamlConnection.md +15 -0
  12. data/docs/Campaign.md +2 -0
  13. data/docs/CampaignAnalytics.md +9 -3
  14. data/docs/CampaignCopy.md +4 -0
  15. data/docs/Change.md +2 -2
  16. data/docs/CustomerInventory.md +9 -0
  17. data/docs/CustomerProfile.md +1 -1
  18. data/docs/ErrorSource.md +1 -0
  19. data/docs/Event.md +1 -1
  20. data/docs/InlineResponse20020.md +1 -1
  21. data/docs/InlineResponse20021.md +1 -1
  22. data/docs/InlineResponse20022.md +1 -1
  23. data/docs/InlineResponse20023.md +1 -1
  24. data/docs/InlineResponse20024.md +1 -1
  25. data/docs/InlineResponse20025.md +1 -1
  26. data/docs/InlineResponse20026.md +3 -2
  27. data/docs/InlineResponse20027.md +1 -1
  28. data/docs/InlineResponse20028.md +1 -1
  29. data/docs/InlineResponse20029.md +9 -0
  30. data/docs/IntegrationApi.md +66 -0
  31. data/docs/IntegrationEvent.md +10 -0
  32. data/docs/IntegrationState.md +1 -0
  33. data/docs/ManagementApi.md +175 -104
  34. data/docs/Meta.md +1 -0
  35. data/docs/NewApplication.md +2 -1
  36. data/docs/NewEvent.md +1 -1
  37. data/docs/NewSamlConnection.md +16 -0
  38. data/docs/Notification.md +10 -0
  39. data/docs/{ApplicationStorageData.md → Notifications.md} +1 -1
  40. data/docs/ReferralRejectionReason.md +10 -0
  41. data/docs/SamlConnection.md +18 -0
  42. data/docs/SamlConnectionMetadata.md +11 -0
  43. data/docs/UpdateApplication.md +15 -0
  44. data/docs/UpdateUser.md +1 -0
  45. data/docs/User.md +2 -0
  46. data/docs/Webhook.md +0 -1
  47. data/lib/talon_one.rb +13 -6
  48. data/lib/talon_one/api/integration_api.rb +60 -0
  49. data/lib/talon_one/api/management_api.rb +194 -121
  50. data/lib/talon_one/models/account_analytics.rb +19 -4
  51. data/lib/talon_one/models/account_limits.rb +11 -1
  52. data/lib/talon_one/models/application.rb +62 -53
  53. data/lib/talon_one/models/application_customer.rb +0 -5
  54. data/lib/talon_one/models/application_session.rb +12 -2
  55. data/lib/talon_one/models/attribute.rb +4 -38
  56. data/lib/talon_one/models/attributes_mandatory.rb +199 -0
  57. data/lib/talon_one/models/{new_application_storage_data.rb → attributes_settings.rb} +13 -4
  58. data/lib/talon_one/models/{application_storage.rb → base_saml_connection.rb} +122 -78
  59. data/lib/talon_one/models/campaign.rb +21 -1
  60. data/lib/talon_one/models/campaign_analytics.rb +94 -4
  61. data/lib/talon_one/models/campaign_copy.rb +46 -4
  62. data/lib/talon_one/models/change.rb +2 -2
  63. data/lib/talon_one/models/coupon_rejection_reason.rb +2 -2
  64. data/lib/talon_one/models/customer_inventory.rb +194 -0
  65. data/lib/talon_one/models/customer_profile.rb +0 -5
  66. data/lib/talon_one/models/error_source.rb +14 -4
  67. data/lib/talon_one/models/event.rb +11 -35
  68. data/lib/talon_one/models/inline_response_200_20.rb +1 -1
  69. data/lib/talon_one/models/inline_response_200_21.rb +1 -1
  70. data/lib/talon_one/models/inline_response_200_22.rb +1 -1
  71. data/lib/talon_one/models/inline_response_200_23.rb +1 -1
  72. data/lib/talon_one/models/inline_response_200_24.rb +1 -1
  73. data/lib/talon_one/models/inline_response_200_25.rb +1 -1
  74. data/lib/talon_one/models/inline_response_200_26.rb +11 -7
  75. data/lib/talon_one/models/inline_response_200_27.rb +1 -1
  76. data/lib/talon_one/models/inline_response_200_28.rb +1 -1
  77. data/lib/talon_one/models/{new_application_storage_tuple.rb → inline_response_200_29.rb} +22 -40
  78. data/lib/talon_one/models/integration_event.rb +234 -0
  79. data/lib/talon_one/models/integration_state.rb +13 -4
  80. data/lib/talon_one/models/limit_config.rb +2 -2
  81. data/lib/talon_one/models/meta.rb +10 -1
  82. data/lib/talon_one/models/new_application.rb +57 -56
  83. data/lib/talon_one/models/new_event.rb +38 -38
  84. data/lib/talon_one/models/new_saml_connection.rb +371 -0
  85. data/lib/talon_one/models/{new_application_storage.rb → notification.rb} +22 -17
  86. data/lib/talon_one/models/{application_storage_data.rb → notifications.rb} +1 -2
  87. data/lib/talon_one/models/referral_rejection_reason.rb +251 -0
  88. data/lib/talon_one/models/saml_connection.rb +387 -0
  89. data/lib/talon_one/models/{application_storage_tuple.rb → saml_connection_metadata.rb} +68 -80
  90. data/lib/talon_one/models/update_application.rb +361 -0
  91. data/lib/talon_one/models/update_user.rb +13 -4
  92. data/lib/talon_one/models/user.rb +23 -4
  93. data/lib/talon_one/models/webhook.rb +4 -21
  94. data/lib/talon_one/version.rb +1 -1
  95. data/spec/api/integration_api_spec.rb +14 -0
  96. data/spec/api/management_api_spec.rb +56 -37
  97. data/spec/models/account_analytics_spec.rb +6 -0
  98. data/spec/models/account_limits_spec.rb +6 -0
  99. data/spec/models/application_session_spec.rb +6 -0
  100. data/spec/models/application_spec.rb +12 -6
  101. data/spec/models/attribute_spec.rb +0 -12
  102. data/spec/models/{new_application_storage_tuple_spec.rb → attributes_mandatory_spec.rb} +8 -8
  103. data/spec/models/{new_application_storage_data_spec.rb → attributes_settings_spec.rb} +12 -6
  104. data/spec/models/{application_storage_spec.rb → base_saml_connection_spec.rb} +14 -14
  105. data/spec/models/campaign_analytics_spec.rb +36 -0
  106. data/spec/models/campaign_copy_spec.rb +24 -0
  107. data/spec/models/campaign_spec.rb +12 -0
  108. data/spec/models/coupon_rejection_reason_spec.rb +1 -1
  109. data/spec/models/customer_inventory_spec.rb +47 -0
  110. data/spec/models/error_source_spec.rb +6 -0
  111. data/spec/models/event_spec.rb +3 -3
  112. data/spec/models/inline_response_200_26_spec.rb +6 -0
  113. data/spec/models/inline_response_200_29_spec.rb +47 -0
  114. data/spec/models/integration_event_spec.rb +53 -0
  115. data/spec/models/integration_state_spec.rb +6 -0
  116. data/spec/models/limit_config_spec.rb +1 -1
  117. data/spec/models/meta_spec.rb +6 -0
  118. data/spec/models/new_application_spec.rb +12 -6
  119. data/spec/models/new_event_spec.rb +3 -3
  120. data/spec/models/new_saml_connection_spec.rb +89 -0
  121. data/spec/models/{new_application_storage_spec.rb → notification_spec.rb} +8 -8
  122. data/spec/models/{application_storage_data_spec.rb → notifications_spec.rb} +6 -6
  123. data/spec/models/referral_rejection_reason_spec.rb +57 -0
  124. data/spec/models/{application_storage_tuple_spec.rb → saml_connection_metadata_spec.rb} +10 -22
  125. data/spec/models/saml_connection_spec.rb +101 -0
  126. data/spec/models/update_application_spec.rb +87 -0
  127. data/spec/models/update_user_spec.rb +6 -0
  128. data/spec/models/user_spec.rb +12 -0
  129. data/spec/models/webhook_spec.rb +0 -6
  130. data/talon_one-1.0.0.gem +0 -0
  131. data/talon_one-1.1.0.gem +0 -0
  132. data/talon_one-1.1.1.gem +0 -0
  133. data/talon_one-1.1.2.gem +0 -0
  134. data/talon_one-1.2.0.gem +0 -0
  135. data/talon_one-1.3.0.gem +0 -0
  136. data/talon_one.gemspec +1 -1
  137. metadata +74 -42
  138. data/docs/ApplicationStorage.md +0 -15
  139. data/docs/ApplicationStorageTuple.md +0 -13
  140. data/docs/NewApplicationStorage.md +0 -10
  141. data/docs/NewApplicationStorageData.md +0 -7
  142. data/docs/NewApplicationStorageTuple.md +0 -9
  143. data/fck.rb +0 -64
@@ -13,46 +13,35 @@ Swagger Codegen version: 2.4.7
13
13
  require 'date'
14
14
 
15
15
  module TalonOne
16
- #
17
- class ApplicationStorageTuple
18
- # Unique ID for this entity.
19
- attr_accessor :id
16
+ class SamlConnectionMetadata
17
+ # ID of the SAML service.
18
+ attr_accessor :name
20
19
 
21
- # The exact moment this entity was created.
22
- attr_accessor :created
20
+ # Determines if this SAML connection active.
21
+ attr_accessor :enabled
23
22
 
24
- # The exact moment this entity was last modified.
25
- attr_accessor :modified
23
+ attr_accessor :account_id
26
24
 
27
- # Key information that will map to a value, e.g. SKU number \"LEV-JN-SL-36-GN\".
28
- attr_accessor :key
29
-
30
- attr_accessor :value
31
-
32
- # ID of the storage in which the data resides
33
- attr_accessor :storage_id
25
+ # Identity Provider metadata XML document.
26
+ attr_accessor :metadata_document
34
27
 
35
28
  # Attribute mapping from ruby-style variable name to JSON key.
36
29
  def self.attribute_map
37
30
  {
38
- :'id' => :'id',
39
- :'created' => :'created',
40
- :'modified' => :'modified',
41
- :'key' => :'key',
42
- :'value' => :'value',
43
- :'storage_id' => :'storageId'
31
+ :'name' => :'name',
32
+ :'enabled' => :'enabled',
33
+ :'account_id' => :'accountId',
34
+ :'metadata_document' => :'metadataDocument'
44
35
  }
45
36
  end
46
37
 
47
38
  # Attribute type mapping.
48
39
  def self.swagger_types
49
40
  {
50
- :'id' => :'Integer',
51
- :'created' => :'DateTime',
52
- :'modified' => :'DateTime',
53
- :'key' => :'String',
54
- :'value' => :'Object',
55
- :'storage_id' => :'Integer'
41
+ :'name' => :'String',
42
+ :'enabled' => :'BOOLEAN',
43
+ :'account_id' => :'Float',
44
+ :'metadata_document' => :'String'
56
45
  }
57
46
  end
58
47
 
@@ -64,28 +53,20 @@ module TalonOne
64
53
  # convert string to symbol for hash key
65
54
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
66
55
 
67
- if attributes.has_key?(:'id')
68
- self.id = attributes[:'id']
69
- end
70
-
71
- if attributes.has_key?(:'created')
72
- self.created = attributes[:'created']
56
+ if attributes.has_key?(:'name')
57
+ self.name = attributes[:'name']
73
58
  end
74
59
 
75
- if attributes.has_key?(:'modified')
76
- self.modified = attributes[:'modified']
60
+ if attributes.has_key?(:'enabled')
61
+ self.enabled = attributes[:'enabled']
77
62
  end
78
63
 
79
- if attributes.has_key?(:'key')
80
- self.key = attributes[:'key']
64
+ if attributes.has_key?(:'accountId')
65
+ self.account_id = attributes[:'accountId']
81
66
  end
82
67
 
83
- if attributes.has_key?(:'value')
84
- self.value = attributes[:'value']
85
- end
86
-
87
- if attributes.has_key?(:'storageId')
88
- self.storage_id = attributes[:'storageId']
68
+ if attributes.has_key?(:'metadataDocument')
69
+ self.metadata_document = attributes[:'metadataDocument']
89
70
  end
90
71
  end
91
72
 
@@ -93,32 +74,28 @@ module TalonOne
93
74
  # @return Array for valid properties with the reasons
94
75
  def list_invalid_properties
95
76
  invalid_properties = Array.new
96
- if @id.nil?
97
- invalid_properties.push('invalid value for "id", id cannot be nil.')
98
- end
99
-
100
- if @created.nil?
101
- invalid_properties.push('invalid value for "created", created cannot be nil.')
77
+ if @name.nil?
78
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
102
79
  end
103
80
 
104
- if @modified.nil?
105
- invalid_properties.push('invalid value for "modified", modified cannot be nil.')
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.')
106
83
  end
107
84
 
108
- if @key.nil?
109
- invalid_properties.push('invalid value for "key", key cannot be nil.')
85
+ if @enabled.nil?
86
+ invalid_properties.push('invalid value for "enabled", enabled cannot be nil.')
110
87
  end
111
88
 
112
- if @key.to_s.length < 1
113
- invalid_properties.push('invalid value for "key", the character length must be great than or equal to 1.')
89
+ if @account_id.nil?
90
+ invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
114
91
  end
115
92
 
116
- if @value.nil?
117
- invalid_properties.push('invalid value for "value", value cannot be nil.')
93
+ if @metadata_document.nil?
94
+ invalid_properties.push('invalid value for "metadata_document", metadata_document cannot be nil.')
118
95
  end
119
96
 
120
- if @storage_id.nil?
121
- invalid_properties.push('invalid value for "storage_id", storage_id cannot be nil.')
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.')
122
99
  end
123
100
 
124
101
  invalid_properties
@@ -127,28 +104,41 @@ module TalonOne
127
104
  # Check to see if the all the properties in the model are valid
128
105
  # @return true if the model is valid
129
106
  def valid?
130
- return false if @id.nil?
131
- return false if @created.nil?
132
- return false if @modified.nil?
133
- return false if @key.nil?
134
- return false if @key.to_s.length < 1
135
- return false if @value.nil?
136
- return false if @storage_id.nil?
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
137
113
  true
138
114
  end
139
115
 
140
116
  # Custom attribute writer method with validation
141
- # @param [Object] key Value to be assigned
142
- def key=(key)
143
- if key.nil?
144
- fail ArgumentError, 'key cannot be nil'
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'
145
135
  end
146
136
 
147
- if key.to_s.length < 1
148
- fail ArgumentError, 'invalid value for "key", the character length must be great than or equal to 1.'
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.'
149
139
  end
150
140
 
151
- @key = key
141
+ @metadata_document = metadata_document
152
142
  end
153
143
 
154
144
  # Checks equality by comparing each attribute.
@@ -156,12 +146,10 @@ module TalonOne
156
146
  def ==(o)
157
147
  return true if self.equal?(o)
158
148
  self.class == o.class &&
159
- id == o.id &&
160
- created == o.created &&
161
- modified == o.modified &&
162
- key == o.key &&
163
- value == o.value &&
164
- storage_id == o.storage_id
149
+ name == o.name &&
150
+ enabled == o.enabled &&
151
+ account_id == o.account_id &&
152
+ metadata_document == o.metadata_document
165
153
  end
166
154
 
167
155
  # @see the `==` method
@@ -173,7 +161,7 @@ module TalonOne
173
161
  # Calculates hash code according to all attributes.
174
162
  # @return [Fixnum] Hash code
175
163
  def hash
176
- [id, created, modified, key, value, storage_id].hash
164
+ [name, enabled, account_id, metadata_document].hash
177
165
  end
178
166
 
179
167
  # Builds the object from hash
@@ -0,0 +1,361 @@
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 UpdateApplication
17
+ # The name of this application.
18
+ attr_accessor :name
19
+
20
+ # A longer description of the application.
21
+ attr_accessor :description
22
+
23
+ # A string containing an IANA timezone descriptor.
24
+ attr_accessor :timezone
25
+
26
+ # A string describing a default currency for new customer sessions.
27
+ attr_accessor :currency
28
+
29
+ # A string indicating how should campaigns in this application deal with case sensitivity on coupon codes.
30
+ attr_accessor :case_sensitivity
31
+
32
+ # Arbitrary properties associated with this campaign
33
+ attr_accessor :attributes
34
+
35
+ # Default limits for campaigns created in this application
36
+ attr_accessor :limits
37
+
38
+ attr_accessor :attributes_settings
39
+
40
+ class EnumAttributeValidator
41
+ attr_reader :datatype
42
+ attr_reader :allowable_values
43
+
44
+ def initialize(datatype, allowable_values)
45
+ @allowable_values = allowable_values.map do |value|
46
+ case datatype.to_s
47
+ when /Integer/i
48
+ value.to_i
49
+ when /Float/i
50
+ value.to_f
51
+ else
52
+ value
53
+ end
54
+ end
55
+ end
56
+
57
+ def valid?(value)
58
+ !value || allowable_values.include?(value)
59
+ end
60
+ end
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+ :'name' => :'name',
66
+ :'description' => :'description',
67
+ :'timezone' => :'timezone',
68
+ :'currency' => :'currency',
69
+ :'case_sensitivity' => :'caseSensitivity',
70
+ :'attributes' => :'attributes',
71
+ :'limits' => :'limits',
72
+ :'attributes_settings' => :'attributesSettings'
73
+ }
74
+ end
75
+
76
+ # Attribute type mapping.
77
+ def self.swagger_types
78
+ {
79
+ :'name' => :'String',
80
+ :'description' => :'String',
81
+ :'timezone' => :'String',
82
+ :'currency' => :'String',
83
+ :'case_sensitivity' => :'String',
84
+ :'attributes' => :'Object',
85
+ :'limits' => :'Array<LimitConfig>',
86
+ :'attributes_settings' => :'AttributesSettings'
87
+ }
88
+ end
89
+
90
+ # Initializes the object
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ def initialize(attributes = {})
93
+ return unless attributes.is_a?(Hash)
94
+
95
+ # convert string to symbol for hash key
96
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
97
+
98
+ if attributes.has_key?(:'name')
99
+ self.name = attributes[:'name']
100
+ end
101
+
102
+ if attributes.has_key?(:'description')
103
+ self.description = attributes[:'description']
104
+ end
105
+
106
+ if attributes.has_key?(:'timezone')
107
+ self.timezone = attributes[:'timezone']
108
+ end
109
+
110
+ if attributes.has_key?(:'currency')
111
+ self.currency = attributes[:'currency']
112
+ end
113
+
114
+ if attributes.has_key?(:'caseSensitivity')
115
+ self.case_sensitivity = attributes[:'caseSensitivity']
116
+ end
117
+
118
+ if attributes.has_key?(:'attributes')
119
+ self.attributes = attributes[:'attributes']
120
+ end
121
+
122
+ if attributes.has_key?(:'limits')
123
+ if (value = attributes[:'limits']).is_a?(Array)
124
+ self.limits = value
125
+ end
126
+ end
127
+
128
+ if attributes.has_key?(:'attributesSettings')
129
+ self.attributes_settings = attributes[:'attributesSettings']
130
+ end
131
+ end
132
+
133
+ # Show invalid properties with the reasons. Usually used together with valid?
134
+ # @return Array for valid properties with the reasons
135
+ def list_invalid_properties
136
+ invalid_properties = Array.new
137
+ if @name.nil?
138
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
139
+ end
140
+
141
+ if @name.to_s.length < 1
142
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
143
+ end
144
+
145
+ if @timezone.nil?
146
+ invalid_properties.push('invalid value for "timezone", timezone cannot be nil.')
147
+ end
148
+
149
+ if @timezone.to_s.length < 1
150
+ invalid_properties.push('invalid value for "timezone", the character length must be great than or equal to 1.')
151
+ end
152
+
153
+ if @currency.nil?
154
+ invalid_properties.push('invalid value for "currency", currency cannot be nil.')
155
+ end
156
+
157
+ if @currency.to_s.length < 1
158
+ invalid_properties.push('invalid value for "currency", the character length must be great than or equal to 1.')
159
+ end
160
+
161
+ invalid_properties
162
+ end
163
+
164
+ # Check to see if the all the properties in the model are valid
165
+ # @return true if the model is valid
166
+ def valid?
167
+ return false if @name.nil?
168
+ return false if @name.to_s.length < 1
169
+ return false if @timezone.nil?
170
+ return false if @timezone.to_s.length < 1
171
+ return false if @currency.nil?
172
+ return false if @currency.to_s.length < 1
173
+ case_sensitivity_validator = EnumAttributeValidator.new('String', ['sensitive', 'insensitive-uppercase', 'insensitive-lowercase'])
174
+ return false unless case_sensitivity_validator.valid?(@case_sensitivity)
175
+ true
176
+ end
177
+
178
+ # Custom attribute writer method with validation
179
+ # @param [Object] name Value to be assigned
180
+ def name=(name)
181
+ if name.nil?
182
+ fail ArgumentError, 'name cannot be nil'
183
+ end
184
+
185
+ if name.to_s.length < 1
186
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
187
+ end
188
+
189
+ @name = name
190
+ end
191
+
192
+ # Custom attribute writer method with validation
193
+ # @param [Object] timezone Value to be assigned
194
+ def timezone=(timezone)
195
+ if timezone.nil?
196
+ fail ArgumentError, 'timezone cannot be nil'
197
+ end
198
+
199
+ if timezone.to_s.length < 1
200
+ fail ArgumentError, 'invalid value for "timezone", the character length must be great than or equal to 1.'
201
+ end
202
+
203
+ @timezone = timezone
204
+ end
205
+
206
+ # Custom attribute writer method with validation
207
+ # @param [Object] currency Value to be assigned
208
+ def currency=(currency)
209
+ if currency.nil?
210
+ fail ArgumentError, 'currency cannot be nil'
211
+ end
212
+
213
+ if currency.to_s.length < 1
214
+ fail ArgumentError, 'invalid value for "currency", the character length must be great than or equal to 1.'
215
+ end
216
+
217
+ @currency = currency
218
+ end
219
+
220
+ # Custom attribute writer method checking allowed values (enum).
221
+ # @param [Object] case_sensitivity Object to be assigned
222
+ def case_sensitivity=(case_sensitivity)
223
+ validator = EnumAttributeValidator.new('String', ['sensitive', 'insensitive-uppercase', 'insensitive-lowercase'])
224
+ unless validator.valid?(case_sensitivity)
225
+ fail ArgumentError, 'invalid value for "case_sensitivity", must be one of #{validator.allowable_values}.'
226
+ end
227
+ @case_sensitivity = case_sensitivity
228
+ end
229
+
230
+ # Checks equality by comparing each attribute.
231
+ # @param [Object] Object to be compared
232
+ def ==(o)
233
+ return true if self.equal?(o)
234
+ self.class == o.class &&
235
+ name == o.name &&
236
+ description == o.description &&
237
+ timezone == o.timezone &&
238
+ currency == o.currency &&
239
+ case_sensitivity == o.case_sensitivity &&
240
+ attributes == o.attributes &&
241
+ limits == o.limits &&
242
+ attributes_settings == o.attributes_settings
243
+ end
244
+
245
+ # @see the `==` method
246
+ # @param [Object] Object to be compared
247
+ def eql?(o)
248
+ self == o
249
+ end
250
+
251
+ # Calculates hash code according to all attributes.
252
+ # @return [Fixnum] Hash code
253
+ def hash
254
+ [name, description, timezone, currency, case_sensitivity, attributes, limits, attributes_settings].hash
255
+ end
256
+
257
+ # Builds the object from hash
258
+ # @param [Hash] attributes Model attributes in the form of hash
259
+ # @return [Object] Returns the model itself
260
+ def build_from_hash(attributes)
261
+ return nil unless attributes.is_a?(Hash)
262
+ self.class.swagger_types.each_pair do |key, type|
263
+ if type =~ /\AArray<(.*)>/i
264
+ # check to ensure the input is an array given that the the attribute
265
+ # is documented as an array but the input is not
266
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
267
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
268
+ end
269
+ elsif !attributes[self.class.attribute_map[key]].nil?
270
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
271
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
272
+ end
273
+
274
+ self
275
+ end
276
+
277
+ # Deserializes the data based on type
278
+ # @param string type Data type
279
+ # @param string value Value to be deserialized
280
+ # @return [Object] Deserialized data
281
+ def _deserialize(type, value)
282
+ case type.to_sym
283
+ when :DateTime
284
+ DateTime.parse(value)
285
+ when :Date
286
+ Date.parse(value)
287
+ when :String
288
+ value.to_s
289
+ when :Integer
290
+ value.to_i
291
+ when :Float
292
+ value.to_f
293
+ when :BOOLEAN
294
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
295
+ true
296
+ else
297
+ false
298
+ end
299
+ when :Object
300
+ # generic object (usually a Hash), return directly
301
+ value
302
+ when /\AArray<(?<inner_type>.+)>\z/
303
+ inner_type = Regexp.last_match[:inner_type]
304
+ value.map { |v| _deserialize(inner_type, v) }
305
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
306
+ k_type = Regexp.last_match[:k_type]
307
+ v_type = Regexp.last_match[:v_type]
308
+ {}.tap do |hash|
309
+ value.each do |k, v|
310
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
311
+ end
312
+ end
313
+ else # model
314
+ temp_model = TalonOne.const_get(type).new
315
+ temp_model.build_from_hash(value)
316
+ end
317
+ end
318
+
319
+ # Returns the string representation of the object
320
+ # @return [String] String presentation of the object
321
+ def to_s
322
+ to_hash.to_s
323
+ end
324
+
325
+ # to_body is an alias to to_hash (backward compatibility)
326
+ # @return [Hash] Returns the object in the form of hash
327
+ def to_body
328
+ to_hash
329
+ end
330
+
331
+ # Returns the object in the form of hash
332
+ # @return [Hash] Returns the object in the form of hash
333
+ def to_hash
334
+ hash = {}
335
+ self.class.attribute_map.each_pair do |attr, param|
336
+ value = self.send(attr)
337
+ next if value.nil?
338
+ hash[param] = _to_hash(value)
339
+ end
340
+ hash
341
+ end
342
+
343
+ # Outputs non-array value in the form of hash
344
+ # For object, use to_hash. Otherwise, just return the value
345
+ # @param [Object] value Any valid value
346
+ # @return [Hash] Returns the value in the form of hash
347
+ def _to_hash(value)
348
+ if value.is_a?(Array)
349
+ value.compact.map { |v| _to_hash(v) }
350
+ elsif value.is_a?(Hash)
351
+ {}.tap do |hash|
352
+ value.each { |k, v| hash[k] = _to_hash(v) }
353
+ end
354
+ elsif value.respond_to? :to_hash
355
+ value.to_hash
356
+ else
357
+ value
358
+ end
359
+ end
360
+ end
361
+ end