talon_one 1.1.2 → 1.2.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 +4 -4
  2. data/README.md +7 -4
  3. data/docs/ApplicationSession.md +2 -1
  4. data/docs/Attribute.md +0 -2
  5. data/docs/ErrorSource.md +1 -0
  6. data/docs/Meta.md +1 -0
  7. data/docs/Notification.md +10 -0
  8. data/docs/Notifications.md +7 -0
  9. data/docs/ReferralRejectionReason.md +10 -0
  10. data/docs/UpdateUser.md +1 -0
  11. data/docs/User.md +1 -0
  12. data/docs/Webhook.md +0 -1
  13. data/lib/talon_one.rb +3 -0
  14. data/lib/talon_one/models/application_session.rb +12 -2
  15. data/lib/talon_one/models/attribute.rb +4 -38
  16. data/lib/talon_one/models/coupon_rejection_reason.rb +2 -2
  17. data/lib/talon_one/models/error_source.rb +14 -4
  18. data/lib/talon_one/models/meta.rb +10 -1
  19. data/lib/talon_one/models/notification.rb +219 -0
  20. data/lib/talon_one/models/notifications.rb +174 -0
  21. data/lib/talon_one/models/referral_rejection_reason.rb +251 -0
  22. data/lib/talon_one/models/update_user.rb +13 -4
  23. data/lib/talon_one/models/user.rb +13 -4
  24. data/lib/talon_one/models/webhook.rb +4 -21
  25. data/lib/talon_one/version.rb +1 -1
  26. data/spec/models/application_session_spec.rb +6 -0
  27. data/spec/models/attribute_spec.rb +0 -12
  28. data/spec/models/coupon_rejection_reason_spec.rb +1 -1
  29. data/spec/models/error_source_spec.rb +6 -0
  30. data/spec/models/meta_spec.rb +6 -0
  31. data/spec/models/notification_spec.rb +53 -0
  32. data/spec/models/notifications_spec.rb +35 -0
  33. data/spec/models/referral_rejection_reason_spec.rb +57 -0
  34. data/spec/models/update_user_spec.rb +6 -0
  35. data/spec/models/user_spec.rb +6 -0
  36. data/spec/models/webhook_spec.rb +0 -6
  37. data/talon_one-1.1.2.gem +0 -0
  38. metadata +15 -2
@@ -0,0 +1,174 @@
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 Notifications
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ }
21
+ end
22
+
23
+ # Attribute type mapping.
24
+ def self.swagger_types
25
+ {
26
+ }
27
+ end
28
+
29
+ # Initializes the object
30
+ # @param [Hash] attributes Model attributes in the form of hash
31
+ def initialize(attributes = {})
32
+ return unless attributes.is_a?(Hash)
33
+
34
+ # convert string to symbol for hash key
35
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
36
+ end
37
+
38
+ # Show invalid properties with the reasons. Usually used together with valid?
39
+ # @return Array for valid properties with the reasons
40
+ def list_invalid_properties
41
+ invalid_properties = Array.new
42
+ invalid_properties
43
+ end
44
+
45
+ # Check to see if the all the properties in the model are valid
46
+ # @return true if the model is valid
47
+ def valid?
48
+ true
49
+ end
50
+
51
+ # Checks equality by comparing each attribute.
52
+ # @param [Object] Object to be compared
53
+ def ==(o)
54
+ return true if self.equal?(o)
55
+ self.class == o.class
56
+ end
57
+
58
+ # @see the `==` method
59
+ # @param [Object] Object to be compared
60
+ def eql?(o)
61
+ self == o
62
+ end
63
+
64
+ # Calculates hash code according to all attributes.
65
+ # @return [Fixnum] Hash code
66
+ def hash
67
+ [].hash
68
+ end
69
+
70
+ # Builds the object from hash
71
+ # @param [Hash] attributes Model attributes in the form of hash
72
+ # @return [Object] Returns the model itself
73
+ def build_from_hash(attributes)
74
+ return nil unless attributes.is_a?(Hash)
75
+ self.class.swagger_types.each_pair do |key, type|
76
+ if type =~ /\AArray<(.*)>/i
77
+ # check to ensure the input is an array given that the the attribute
78
+ # is documented as an array but the input is not
79
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
80
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
81
+ end
82
+ elsif !attributes[self.class.attribute_map[key]].nil?
83
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
84
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
85
+ end
86
+
87
+ self
88
+ end
89
+
90
+ # Deserializes the data based on type
91
+ # @param string type Data type
92
+ # @param string value Value to be deserialized
93
+ # @return [Object] Deserialized data
94
+ def _deserialize(type, value)
95
+ case type.to_sym
96
+ when :DateTime
97
+ DateTime.parse(value)
98
+ when :Date
99
+ Date.parse(value)
100
+ when :String
101
+ value.to_s
102
+ when :Integer
103
+ value.to_i
104
+ when :Float
105
+ value.to_f
106
+ when :BOOLEAN
107
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
108
+ true
109
+ else
110
+ false
111
+ end
112
+ when :Object
113
+ # generic object (usually a Hash), return directly
114
+ value
115
+ when /\AArray<(?<inner_type>.+)>\z/
116
+ inner_type = Regexp.last_match[:inner_type]
117
+ value.map { |v| _deserialize(inner_type, v) }
118
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
119
+ k_type = Regexp.last_match[:k_type]
120
+ v_type = Regexp.last_match[:v_type]
121
+ {}.tap do |hash|
122
+ value.each do |k, v|
123
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
124
+ end
125
+ end
126
+ else # model
127
+ temp_model = TalonOne.const_get(type).new
128
+ temp_model.build_from_hash(value)
129
+ end
130
+ end
131
+
132
+ # Returns the string representation of the object
133
+ # @return [String] String presentation of the object
134
+ def to_s
135
+ to_hash.to_s
136
+ end
137
+
138
+ # to_body is an alias to to_hash (backward compatibility)
139
+ # @return [Hash] Returns the object in the form of hash
140
+ def to_body
141
+ to_hash
142
+ end
143
+
144
+ # Returns the object in the form of hash
145
+ # @return [Hash] Returns the object in the form of hash
146
+ def to_hash
147
+ hash = {}
148
+ self.class.attribute_map.each_pair do |attr, param|
149
+ value = self.send(attr)
150
+ next if value.nil?
151
+ hash[param] = _to_hash(value)
152
+ end
153
+ hash
154
+ end
155
+
156
+ # Outputs non-array value in the form of hash
157
+ # For object, use to_hash. Otherwise, just return the value
158
+ # @param [Object] value Any valid value
159
+ # @return [Hash] Returns the value in the form of hash
160
+ def _to_hash(value)
161
+ if value.is_a?(Array)
162
+ value.compact.map { |v| _to_hash(v) }
163
+ elsif value.is_a?(Hash)
164
+ {}.tap do |hash|
165
+ value.each { |k, v| hash[k] = _to_hash(v) }
166
+ end
167
+ elsif value.respond_to? :to_hash
168
+ value.to_hash
169
+ else
170
+ value
171
+ end
172
+ end
173
+ end
174
+ end
@@ -0,0 +1,251 @@
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
+ # Holds a reference to the campaign, the referral and the reason for which that referral was rejected. Should only be present when there is a 'rejectReferral' effect.
17
+ class ReferralRejectionReason
18
+ attr_accessor :campaign_id
19
+
20
+ attr_accessor :referral_id
21
+
22
+ attr_accessor :reason
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'campaign_id' => :'campaignId',
50
+ :'referral_id' => :'referralId',
51
+ :'reason' => :'reason'
52
+ }
53
+ end
54
+
55
+ # Attribute type mapping.
56
+ def self.swagger_types
57
+ {
58
+ :'campaign_id' => :'Integer',
59
+ :'referral_id' => :'Integer',
60
+ :'reason' => :'String'
61
+ }
62
+ end
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ def initialize(attributes = {})
67
+ return unless attributes.is_a?(Hash)
68
+
69
+ # convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
71
+
72
+ if attributes.has_key?(:'campaignId')
73
+ self.campaign_id = attributes[:'campaignId']
74
+ end
75
+
76
+ if attributes.has_key?(:'referralId')
77
+ self.referral_id = attributes[:'referralId']
78
+ end
79
+
80
+ if attributes.has_key?(:'reason')
81
+ self.reason = attributes[:'reason']
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ invalid_properties = Array.new
89
+ if @campaign_id.nil?
90
+ invalid_properties.push('invalid value for "campaign_id", campaign_id cannot be nil.')
91
+ end
92
+
93
+ if @referral_id.nil?
94
+ invalid_properties.push('invalid value for "referral_id", referral_id cannot be nil.')
95
+ end
96
+
97
+ if @reason.nil?
98
+ invalid_properties.push('invalid value for "reason", reason cannot be nil.')
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 @campaign_id.nil?
108
+ return false if @referral_id.nil?
109
+ return false if @reason.nil?
110
+ reason_validator = EnumAttributeValidator.new('String', ['ReferralNotFound', 'ReferralRecipientIdSameAsAdvocate', 'ReferralPartOfNotRunningCampaign', 'ReferralValidConditionMissing', 'ReferralLimitReached', 'CampaignLimitReached', 'ProfileLimitReached', 'ReferralRecipientDoesNotMatch', 'ReferralExpired', 'ReferralStartDateInFuture', 'ReferralRejectedByCondition', 'EffectCouldNotBeApplied'])
111
+ return false unless reason_validator.valid?(@reason)
112
+ true
113
+ end
114
+
115
+ # Custom attribute writer method checking allowed values (enum).
116
+ # @param [Object] reason Object to be assigned
117
+ def reason=(reason)
118
+ validator = EnumAttributeValidator.new('String', ['ReferralNotFound', 'ReferralRecipientIdSameAsAdvocate', 'ReferralPartOfNotRunningCampaign', 'ReferralValidConditionMissing', 'ReferralLimitReached', 'CampaignLimitReached', 'ProfileLimitReached', 'ReferralRecipientDoesNotMatch', 'ReferralExpired', 'ReferralStartDateInFuture', 'ReferralRejectedByCondition', 'EffectCouldNotBeApplied'])
119
+ unless validator.valid?(reason)
120
+ fail ArgumentError, 'invalid value for "reason", must be one of #{validator.allowable_values}.'
121
+ end
122
+ @reason = reason
123
+ end
124
+
125
+ # Checks equality by comparing each attribute.
126
+ # @param [Object] Object to be compared
127
+ def ==(o)
128
+ return true if self.equal?(o)
129
+ self.class == o.class &&
130
+ campaign_id == o.campaign_id &&
131
+ referral_id == o.referral_id &&
132
+ reason == o.reason
133
+ end
134
+
135
+ # @see the `==` method
136
+ # @param [Object] Object to be compared
137
+ def eql?(o)
138
+ self == o
139
+ end
140
+
141
+ # Calculates hash code according to all attributes.
142
+ # @return [Fixnum] Hash code
143
+ def hash
144
+ [campaign_id, referral_id, reason].hash
145
+ end
146
+
147
+ # Builds the object from hash
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @return [Object] Returns the model itself
150
+ def build_from_hash(attributes)
151
+ return nil unless attributes.is_a?(Hash)
152
+ self.class.swagger_types.each_pair do |key, type|
153
+ if type =~ /\AArray<(.*)>/i
154
+ # check to ensure the input is an array given that the the attribute
155
+ # is documented as an array but the input is not
156
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
157
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
158
+ end
159
+ elsif !attributes[self.class.attribute_map[key]].nil?
160
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
161
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
162
+ end
163
+
164
+ self
165
+ end
166
+
167
+ # Deserializes the data based on type
168
+ # @param string type Data type
169
+ # @param string value Value to be deserialized
170
+ # @return [Object] Deserialized data
171
+ def _deserialize(type, value)
172
+ case type.to_sym
173
+ when :DateTime
174
+ DateTime.parse(value)
175
+ when :Date
176
+ Date.parse(value)
177
+ when :String
178
+ value.to_s
179
+ when :Integer
180
+ value.to_i
181
+ when :Float
182
+ value.to_f
183
+ when :BOOLEAN
184
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
185
+ true
186
+ else
187
+ false
188
+ end
189
+ when :Object
190
+ # generic object (usually a Hash), return directly
191
+ value
192
+ when /\AArray<(?<inner_type>.+)>\z/
193
+ inner_type = Regexp.last_match[:inner_type]
194
+ value.map { |v| _deserialize(inner_type, v) }
195
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
196
+ k_type = Regexp.last_match[:k_type]
197
+ v_type = Regexp.last_match[:v_type]
198
+ {}.tap do |hash|
199
+ value.each do |k, v|
200
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
201
+ end
202
+ end
203
+ else # model
204
+ temp_model = TalonOne.const_get(type).new
205
+ temp_model.build_from_hash(value)
206
+ end
207
+ end
208
+
209
+ # Returns the string representation of the object
210
+ # @return [String] String presentation of the object
211
+ def to_s
212
+ to_hash.to_s
213
+ end
214
+
215
+ # to_body is an alias to to_hash (backward compatibility)
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_body
218
+ to_hash
219
+ end
220
+
221
+ # Returns the object in the form of hash
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_hash
224
+ hash = {}
225
+ self.class.attribute_map.each_pair do |attr, param|
226
+ value = self.send(attr)
227
+ next if value.nil?
228
+ hash[param] = _to_hash(value)
229
+ end
230
+ hash
231
+ end
232
+
233
+ # Outputs non-array value in the form of hash
234
+ # For object, use to_hash. Otherwise, just return the value
235
+ # @param [Object] value Any valid value
236
+ # @return [Hash] Returns the value in the form of hash
237
+ def _to_hash(value)
238
+ if value.is_a?(Array)
239
+ value.compact.map { |v| _to_hash(v) }
240
+ elsif value.is_a?(Hash)
241
+ {}.tap do |hash|
242
+ value.each { |k, v| hash[k] = _to_hash(v) }
243
+ end
244
+ elsif value.respond_to? :to_hash
245
+ value.to_hash
246
+ else
247
+ value
248
+ end
249
+ end
250
+ end
251
+ end
@@ -42,6 +42,8 @@ module TalonOne
42
42
  # Update
43
43
  attr_accessor :roles
44
44
 
45
+ attr_accessor :application_notification_subscriptions
46
+
45
47
  class EnumAttributeValidator
46
48
  attr_reader :datatype
47
49
  attr_reader :allowable_values
@@ -75,7 +77,8 @@ module TalonOne
75
77
  :'state' => :'state',
76
78
  :'release_update' => :'releaseUpdate',
77
79
  :'latest_feature' => :'latestFeature',
78
- :'roles' => :'roles'
80
+ :'roles' => :'roles',
81
+ :'application_notification_subscriptions' => :'applicationNotificationSubscriptions'
79
82
  }
80
83
  end
81
84
 
@@ -90,7 +93,8 @@ module TalonOne
90
93
  :'state' => :'String',
91
94
  :'release_update' => :'BOOLEAN',
92
95
  :'latest_feature' => :'String',
93
- :'roles' => :'Array<Integer>'
96
+ :'roles' => :'Array<Integer>',
97
+ :'application_notification_subscriptions' => :'Object'
94
98
  }
95
99
  end
96
100
 
@@ -139,6 +143,10 @@ module TalonOne
139
143
  self.roles = value
140
144
  end
141
145
  end
146
+
147
+ if attributes.has_key?(:'applicationNotificationSubscriptions')
148
+ self.application_notification_subscriptions = attributes[:'applicationNotificationSubscriptions']
149
+ end
142
150
  end
143
151
 
144
152
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -184,7 +192,8 @@ module TalonOne
184
192
  state == o.state &&
185
193
  release_update == o.release_update &&
186
194
  latest_feature == o.latest_feature &&
187
- roles == o.roles
195
+ roles == o.roles &&
196
+ application_notification_subscriptions == o.application_notification_subscriptions
188
197
  end
189
198
 
190
199
  # @see the `==` method
@@ -196,7 +205,7 @@ module TalonOne
196
205
  # Calculates hash code according to all attributes.
197
206
  # @return [Fixnum] Hash code
198
207
  def hash
199
- [email, name, password, new_password, policy, state, release_update, latest_feature, roles].hash
208
+ [email, name, password, new_password, policy, state, release_update, latest_feature, roles, application_notification_subscriptions].hash
200
209
  end
201
210
 
202
211
  # Builds the object from hash