smooch-api 5.25.1 → 5.26.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -257,7 +257,7 @@ module SmoochApi
257
257
  return false unless quotedMessageType_validator.valid?(@quotedMessageType)
258
258
  role_validator = EnumAttributeValidator.new('String', ["appMaker", "appUser"])
259
259
  return false unless role_validator.valid?(@role)
260
- webhookTriggers_validator = EnumAttributeValidator.new('String', ["appUser:delete", "client:add", "client:remove", "conversation:read", "conversation:referral", "conversation:start", "link:failure", "link:match", "link:success", "merge:appUser", "message:appMaker", "message:appUser", "message:delivery:channel", "message:delivery:failure", "message:delivery:user", "payment:success", "postback", "typing:appUser"])
260
+ webhookTriggers_validator = EnumAttributeValidator.new('String', ["appUser:delete", "client:add", "client:remove", "conversation:read", "conversation:referral", "conversation:start", "link:failure", "link:match", "link:success", "merge:appUser", "message:appMaker", "message:appUser", "message:delivery:channel", "message:delivery:failure", "message:delivery:user", "notification:delivery:channel", "notification:delivery:failure", "notification:delivery:user", "payment:success", "postback", "typing:appUser"])
261
261
  return false unless webhookTriggers_validator.valid?(@webhookTriggers)
262
262
  return true
263
263
  end
@@ -445,7 +445,7 @@ module SmoochApi
445
445
  # Custom attribute writer method checking allowed values (enum).
446
446
  # @param [Object] webhookTriggers Object to be assigned
447
447
  def webhookTriggers=(webhookTriggers)
448
- validator = EnumAttributeValidator.new('String', ["appUser:delete", "client:add", "client:remove", "conversation:read", "conversation:referral", "conversation:start", "link:failure", "link:match", "link:success", "merge:appUser", "message:appMaker", "message:appUser", "message:delivery:channel", "message:delivery:failure", "message:delivery:user", "payment:success", "postback", "typing:appUser"])
448
+ validator = EnumAttributeValidator.new('String', ["appUser:delete", "client:add", "client:remove", "conversation:read", "conversation:referral", "conversation:start", "link:failure", "link:match", "link:success", "merge:appUser", "message:appMaker", "message:appUser", "message:delivery:channel", "message:delivery:failure", "message:delivery:user", "notification:delivery:channel", "notification:delivery:failure", "notification:delivery:user", "payment:success", "postback", "typing:appUser"])
449
449
  unless validator.valid?(webhookTriggers)
450
450
  fail ArgumentError, "invalid value for 'webhookTriggers', must be one of #{validator.allowable_values}."
451
451
  end
@@ -0,0 +1,234 @@
1
+ =begin
2
+ #Smooch
3
+
4
+ #The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io).
5
+
6
+ OpenAPI spec version: 5.25
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.2.3-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module SmoochApi
16
+
17
+ class NotificationPost
18
+ # The destination of the notification.
19
+ attr_accessor :destination
20
+
21
+ # If specified, the only accepted value is `whatsapp`. To be included when sending WhatsApp message templates.
22
+ attr_accessor :messageSchema
23
+
24
+ # An object containing role, email, name and avatarUrl.
25
+ attr_accessor :author
26
+
27
+ # The notification message to send.
28
+ attr_accessor :message
29
+
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'destination' => :'destination',
35
+ :'messageSchema' => :'messageSchema',
36
+ :'author' => :'author',
37
+ :'message' => :'message'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.swagger_types
43
+ {
44
+ :'destination' => :'NotificationPostDestination',
45
+ :'messageSchema' => :'String',
46
+ :'author' => :'Author',
47
+ :'message' => :'Object'
48
+ }
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ return unless attributes.is_a?(Hash)
55
+
56
+ # convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
58
+
59
+ if attributes.has_key?(:'destination')
60
+ self.destination = attributes[:'destination']
61
+ end
62
+
63
+ if attributes.has_key?(:'messageSchema')
64
+ self.messageSchema = attributes[:'messageSchema']
65
+ end
66
+
67
+ if attributes.has_key?(:'author')
68
+ self.author = attributes[:'author']
69
+ end
70
+
71
+ if attributes.has_key?(:'message')
72
+ self.message = attributes[:'message']
73
+ end
74
+
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properies with the reasons
79
+ def list_invalid_properties
80
+ invalid_properties = Array.new
81
+ if @destination.nil?
82
+ invalid_properties.push("invalid value for 'destination', destination cannot be nil.")
83
+ end
84
+
85
+ if @author.nil?
86
+ invalid_properties.push("invalid value for 'author', author cannot be nil.")
87
+ end
88
+
89
+ if @message.nil?
90
+ invalid_properties.push("invalid value for 'message', message cannot be nil.")
91
+ end
92
+
93
+ return invalid_properties
94
+ end
95
+
96
+ # Check to see if the all the properties in the model are valid
97
+ # @return true if the model is valid
98
+ def valid?
99
+ return false if @destination.nil?
100
+ return false if @author.nil?
101
+ return false if @message.nil?
102
+ return true
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ destination == o.destination &&
111
+ messageSchema == o.messageSchema &&
112
+ author == o.author &&
113
+ message == o.message
114
+ end
115
+
116
+ # @see the `==` method
117
+ # @param [Object] Object to be compared
118
+ def eql?(o)
119
+ self == o
120
+ end
121
+
122
+ # Calculates hash code according to all attributes.
123
+ # @return [Fixnum] Hash code
124
+ def hash
125
+ [destination, messageSchema, author, message].hash
126
+ end
127
+
128
+ # Builds the object from hash
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ # @return [Object] Returns the model itself
131
+ def build_from_hash(attributes)
132
+ return nil unless attributes.is_a?(Hash)
133
+ self.class.swagger_types.each_pair do |key, type|
134
+ if type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
138
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
139
+ end
140
+ elsif !attributes[self.class.attribute_map[key]].nil?
141
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
142
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
143
+ end
144
+
145
+ self
146
+ end
147
+
148
+ # Deserializes the data based on type
149
+ # @param string type Data type
150
+ # @param string value Value to be deserialized
151
+ # @return [Object] Deserialized data
152
+ def _deserialize(type, value)
153
+ case type.to_sym
154
+ when :DateTime
155
+ DateTime.parse(value)
156
+ when :Date
157
+ Date.parse(value)
158
+ when :String
159
+ value.to_s
160
+ when :Integer
161
+ value.to_i
162
+ when :Float
163
+ value.to_f
164
+ when :BOOLEAN
165
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
+ true
167
+ else
168
+ false
169
+ end
170
+ when :Object
171
+ # generic object (usually a Hash), return directly
172
+ value
173
+ when /\AArray<(?<inner_type>.+)>\z/
174
+ inner_type = Regexp.last_match[:inner_type]
175
+ value.map { |v| _deserialize(inner_type, v) }
176
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
177
+ k_type = Regexp.last_match[:k_type]
178
+ v_type = Regexp.last_match[:v_type]
179
+ {}.tap do |hash|
180
+ value.each do |k, v|
181
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
182
+ end
183
+ end
184
+ else # model
185
+ temp_model = SmoochApi.const_get(type).new
186
+ temp_model.build_from_hash(value)
187
+ end
188
+ end
189
+
190
+ # Returns the string representation of the object
191
+ # @return [String] String presentation of the object
192
+ def to_s
193
+ to_hash.to_s
194
+ end
195
+
196
+ # to_body is an alias to to_hash (backward compatibility)
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_body
199
+ to_hash
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = self.send(attr)
208
+ next if value.nil?
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ # Outputs non-array value in the form of hash
215
+ # For object, use to_hash. Otherwise, just return the value
216
+ # @param [Object] value Any valid value
217
+ # @return [Hash] Returns the value in the form of hash
218
+ def _to_hash(value)
219
+ if value.is_a?(Array)
220
+ value.compact.map{ |v| _to_hash(v) }
221
+ elsif value.is_a?(Hash)
222
+ {}.tap do |hash|
223
+ value.each { |k, v| hash[k] = _to_hash(v) }
224
+ end
225
+ elsif value.respond_to? :to_hash
226
+ value.to_hash
227
+ else
228
+ value
229
+ end
230
+ end
231
+
232
+ end
233
+
234
+ end
@@ -0,0 +1,209 @@
1
+ =begin
2
+ #Smooch
3
+
4
+ #The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io).
5
+
6
+ OpenAPI spec version: 5.25
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.2.3-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module SmoochApi
16
+
17
+ class NotificationPostDestination
18
+ # The ID of the target integration.
19
+ attr_accessor :integrationId
20
+
21
+ # The external ID (channel specific) of the target user.
22
+ attr_accessor :destinationId
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'integrationId' => :'integrationId',
29
+ :'destinationId' => :'destinationId'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'integrationId' => :'String',
37
+ :'destinationId' => :'String'
38
+ }
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ return unless attributes.is_a?(Hash)
45
+
46
+ # convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
48
+
49
+ if attributes.has_key?(:'integrationId')
50
+ self.integrationId = attributes[:'integrationId']
51
+ end
52
+
53
+ if attributes.has_key?(:'destinationId')
54
+ self.destinationId = attributes[:'destinationId']
55
+ end
56
+
57
+ end
58
+
59
+ # Show invalid properties with the reasons. Usually used together with valid?
60
+ # @return Array for valid properies with the reasons
61
+ def list_invalid_properties
62
+ invalid_properties = Array.new
63
+ if @integrationId.nil?
64
+ invalid_properties.push("invalid value for 'integrationId', integrationId cannot be nil.")
65
+ end
66
+
67
+ if @destinationId.nil?
68
+ invalid_properties.push("invalid value for 'destinationId', destinationId cannot be nil.")
69
+ end
70
+
71
+ return invalid_properties
72
+ end
73
+
74
+ # Check to see if the all the properties in the model are valid
75
+ # @return true if the model is valid
76
+ def valid?
77
+ return false if @integrationId.nil?
78
+ return false if @destinationId.nil?
79
+ return true
80
+ end
81
+
82
+ # Checks equality by comparing each attribute.
83
+ # @param [Object] Object to be compared
84
+ def ==(o)
85
+ return true if self.equal?(o)
86
+ self.class == o.class &&
87
+ integrationId == o.integrationId &&
88
+ destinationId == o.destinationId
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Fixnum] Hash code
99
+ def hash
100
+ [integrationId, destinationId].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def build_from_hash(attributes)
107
+ return nil unless attributes.is_a?(Hash)
108
+ self.class.swagger_types.each_pair do |key, type|
109
+ if type =~ /\AArray<(.*)>/i
110
+ # check to ensure the input is an array given that the the attribute
111
+ # is documented as an array but the input is not
112
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
113
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
114
+ end
115
+ elsif !attributes[self.class.attribute_map[key]].nil?
116
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
117
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
118
+ end
119
+
120
+ self
121
+ end
122
+
123
+ # Deserializes the data based on type
124
+ # @param string type Data type
125
+ # @param string value Value to be deserialized
126
+ # @return [Object] Deserialized data
127
+ def _deserialize(type, value)
128
+ case type.to_sym
129
+ when :DateTime
130
+ DateTime.parse(value)
131
+ when :Date
132
+ Date.parse(value)
133
+ when :String
134
+ value.to_s
135
+ when :Integer
136
+ value.to_i
137
+ when :Float
138
+ value.to_f
139
+ when :BOOLEAN
140
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
141
+ true
142
+ else
143
+ false
144
+ end
145
+ when :Object
146
+ # generic object (usually a Hash), return directly
147
+ value
148
+ when /\AArray<(?<inner_type>.+)>\z/
149
+ inner_type = Regexp.last_match[:inner_type]
150
+ value.map { |v| _deserialize(inner_type, v) }
151
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
152
+ k_type = Regexp.last_match[:k_type]
153
+ v_type = Regexp.last_match[:v_type]
154
+ {}.tap do |hash|
155
+ value.each do |k, v|
156
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
157
+ end
158
+ end
159
+ else # model
160
+ temp_model = SmoochApi.const_get(type).new
161
+ temp_model.build_from_hash(value)
162
+ end
163
+ end
164
+
165
+ # Returns the string representation of the object
166
+ # @return [String] String presentation of the object
167
+ def to_s
168
+ to_hash.to_s
169
+ end
170
+
171
+ # to_body is an alias to to_hash (backward compatibility)
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_body
174
+ to_hash
175
+ end
176
+
177
+ # Returns the object in the form of hash
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_hash
180
+ hash = {}
181
+ self.class.attribute_map.each_pair do |attr, param|
182
+ value = self.send(attr)
183
+ next if value.nil?
184
+ hash[param] = _to_hash(value)
185
+ end
186
+ hash
187
+ end
188
+
189
+ # Outputs non-array value in the form of hash
190
+ # For object, use to_hash. Otherwise, just return the value
191
+ # @param [Object] value Any valid value
192
+ # @return [Hash] Returns the value in the form of hash
193
+ def _to_hash(value)
194
+ if value.is_a?(Array)
195
+ value.compact.map{ |v| _to_hash(v) }
196
+ elsif value.is_a?(Hash)
197
+ {}.tap do |hash|
198
+ value.each { |k, v| hash[k] = _to_hash(v) }
199
+ end
200
+ elsif value.respond_to? :to_hash
201
+ value.to_hash
202
+ else
203
+ value
204
+ end
205
+ end
206
+
207
+ end
208
+
209
+ end