sunshine-conversations-client 9.1.1 → 9.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,312 @@
1
+ =begin
2
+ #Sunshine Conversations API
3
+
4
+ The version of the OpenAPI document: 9.1.0
5
+
6
+ Generated by: https://openapi-generator.tech
7
+ OpenAPI Generator version: 4.3.1
8
+ =end
9
+
10
+ require 'date'
11
+
12
+ module SunshineConversationsClient
13
+ # Instagram Direct setup steps: Take note of your Facebook app ID and secret (apps can be created at [developer.facebook.com](https://developer.facebook.com)); The Facebook app must have been submitted to Facebook for app review with the \"manage_pages\" (to retrieve Page Access Tokens for the Pages and apps that the app user administers and to set a webhook), \"instagram_basic\", and \"instagram_manage_messages\" (to retrieve basic Instagram account information and send messages) permissions. In order to integrate an Instagram Direct app, you must acquire a Page Access Token from your user. Once you have acquired a page access token from your user, call the Create Integration endpoint with your app secret and ID and the user’s page access token.
14
+ class InstagramAllOf
15
+ # The type of integration.
16
+ attr_accessor :type
17
+
18
+ # The Facebook Page Access Token of the Facebook page that is linked to your Instagram account.
19
+ attr_accessor :page_access_token
20
+
21
+ # Your Facebook App ID.
22
+ attr_accessor :app_id
23
+
24
+ # Your Facebook App secret.
25
+ attr_accessor :app_secret
26
+
27
+ # Your Instagram Business account name
28
+ attr_accessor :business_name
29
+
30
+ # Your Instagram Business unique username
31
+ attr_accessor :business_username
32
+
33
+ # The ID of the Facebook Page linked to your Instagram Business account
34
+ attr_accessor :page_id
35
+
36
+ # The ID of the Instagram Business account
37
+ attr_accessor :business_id
38
+
39
+ # The Facebook user's username. This is returned when integrating through the Dashboard
40
+ attr_accessor :username
41
+
42
+ # The Facebook user's user ID. This is returned when integrating through the Dashboard
43
+ attr_accessor :user_id
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'type' => :'type',
49
+ :'page_access_token' => :'pageAccessToken',
50
+ :'app_id' => :'appId',
51
+ :'app_secret' => :'appSecret',
52
+ :'business_name' => :'businessName',
53
+ :'business_username' => :'businessUsername',
54
+ :'page_id' => :'pageId',
55
+ :'business_id' => :'businessId',
56
+ :'username' => :'username',
57
+ :'user_id' => :'userId'
58
+ }
59
+ end
60
+
61
+ # Attribute type mapping.
62
+ def self.openapi_types
63
+ {
64
+ :'type' => :'String',
65
+ :'page_access_token' => :'String',
66
+ :'app_id' => :'String',
67
+ :'app_secret' => :'String',
68
+ :'business_name' => :'String',
69
+ :'business_username' => :'String',
70
+ :'page_id' => :'String',
71
+ :'business_id' => :'String',
72
+ :'username' => :'String',
73
+ :'user_id' => :'String'
74
+ }
75
+ end
76
+
77
+ # List of attributes with nullable: true
78
+ def self.openapi_nullable
79
+ Set.new([
80
+ ])
81
+ end
82
+
83
+ # Initializes the object
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ def initialize(attributes = {})
86
+ if (!attributes.is_a?(Hash))
87
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SunshineConversationsClient::InstagramAllOf` initialize method"
88
+ end
89
+
90
+ # check to see if the attribute exists and convert string to symbol for hash key
91
+ attributes = attributes.each_with_object({}) { |(k, v), h|
92
+ if (!self.class.attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SunshineConversationsClient::InstagramAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
94
+ end
95
+ h[k.to_sym] = v
96
+ }
97
+
98
+ if attributes.key?(:'type')
99
+ self.type = attributes[:'type']
100
+ else
101
+ self.type = 'instagram'
102
+ end
103
+
104
+ if attributes.key?(:'page_access_token')
105
+ self.page_access_token = attributes[:'page_access_token']
106
+ end
107
+
108
+ if attributes.key?(:'app_id')
109
+ self.app_id = attributes[:'app_id']
110
+ end
111
+
112
+ if attributes.key?(:'app_secret')
113
+ self.app_secret = attributes[:'app_secret']
114
+ end
115
+
116
+ if attributes.key?(:'business_name')
117
+ self.business_name = attributes[:'business_name']
118
+ end
119
+
120
+ if attributes.key?(:'business_username')
121
+ self.business_username = attributes[:'business_username']
122
+ end
123
+
124
+ if attributes.key?(:'page_id')
125
+ self.page_id = attributes[:'page_id']
126
+ end
127
+
128
+ if attributes.key?(:'business_id')
129
+ self.business_id = attributes[:'business_id']
130
+ end
131
+
132
+ if attributes.key?(:'username')
133
+ self.username = attributes[:'username']
134
+ end
135
+
136
+ if attributes.key?(:'user_id')
137
+ self.user_id = attributes[:'user_id']
138
+ end
139
+ end
140
+
141
+ # Show invalid properties with the reasons. Usually used together with valid?
142
+ # @return Array for valid properties with the reasons
143
+ def list_invalid_properties
144
+ invalid_properties = Array.new
145
+ if @page_access_token.nil?
146
+ invalid_properties.push('invalid value for "page_access_token", page_access_token cannot be nil.')
147
+ end
148
+
149
+ if @app_id.nil?
150
+ invalid_properties.push('invalid value for "app_id", app_id cannot be nil.')
151
+ end
152
+
153
+ if @app_secret.nil?
154
+ invalid_properties.push('invalid value for "app_secret", app_secret cannot be nil.')
155
+ end
156
+
157
+ invalid_properties
158
+ end
159
+
160
+ # Check to see if the all the properties in the model are valid
161
+ # @return true if the model is valid
162
+ def valid?
163
+ return false if @page_access_token.nil?
164
+ return false if @app_id.nil?
165
+ return false if @app_secret.nil?
166
+ true
167
+ end
168
+
169
+ # Checks equality by comparing each attribute.
170
+ # @param [Object] Object to be compared
171
+ def ==(o)
172
+ return true if self.equal?(o)
173
+ self.class == o.class &&
174
+ type == o.type &&
175
+ page_access_token == o.page_access_token &&
176
+ app_id == o.app_id &&
177
+ app_secret == o.app_secret &&
178
+ business_name == o.business_name &&
179
+ business_username == o.business_username &&
180
+ page_id == o.page_id &&
181
+ business_id == o.business_id &&
182
+ username == o.username &&
183
+ user_id == o.user_id
184
+ end
185
+
186
+ # @see the `==` method
187
+ # @param [Object] Object to be compared
188
+ def eql?(o)
189
+ self == o
190
+ end
191
+
192
+ # Calculates hash code according to all attributes.
193
+ # @return [Integer] Hash code
194
+ def hash
195
+ [type, page_access_token, app_id, app_secret, business_name, business_username, page_id, business_id, username, user_id].hash
196
+ end
197
+
198
+ # Builds the object from hash
199
+ # @param [Hash] attributes Model attributes in the form of hash
200
+ # @return [Object] Returns the model itself
201
+ def self.build_from_hash(attributes)
202
+ new.build_from_hash(attributes)
203
+ end
204
+
205
+ # Builds the object from hash
206
+ # @param [Hash] attributes Model attributes in the form of hash
207
+ # @return [Object] Returns the model itself
208
+ def build_from_hash(attributes)
209
+ return nil unless attributes.is_a?(Hash)
210
+ self.class.openapi_types.each_pair do |key, type|
211
+ if type =~ /\AArray<(.*)>/i
212
+ # check to ensure the input is an array given that the attribute
213
+ # is documented as an array but the input is not
214
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
215
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
216
+ end
217
+ elsif !attributes[self.class.attribute_map[key]].nil?
218
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
219
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
220
+ end
221
+
222
+ self
223
+ end
224
+
225
+ # Deserializes the data based on type
226
+ # @param string type Data type
227
+ # @param string value Value to be deserialized
228
+ # @return [Object] Deserialized data
229
+ def _deserialize(type, value)
230
+ case type.to_sym
231
+ when :DateTime
232
+ DateTime.parse(value)
233
+ when :Date
234
+ Date.parse(value)
235
+ when :String
236
+ value.to_s
237
+ when :Integer
238
+ value.to_i
239
+ when :Float
240
+ value.to_f
241
+ when :Boolean
242
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
243
+ true
244
+ else
245
+ false
246
+ end
247
+ when :Object
248
+ # generic object (usually a Hash), return directly
249
+ value
250
+ when /\AArray<(?<inner_type>.+)>\z/
251
+ inner_type = Regexp.last_match[:inner_type]
252
+ value.map { |v| _deserialize(inner_type, v) }
253
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
254
+ k_type = Regexp.last_match[:k_type]
255
+ v_type = Regexp.last_match[:v_type]
256
+ {}.tap do |hash|
257
+ value.each do |k, v|
258
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
259
+ end
260
+ end
261
+ else # model
262
+ SunshineConversationsClient.const_get(type).build_from_hash(value)
263
+ end
264
+ end
265
+
266
+ # Returns the string representation of the object
267
+ # @return [String] String presentation of the object
268
+ def to_s
269
+ to_hash.to_s
270
+ end
271
+
272
+ # to_body is an alias to to_hash (backward compatibility)
273
+ # @return [Hash] Returns the object in the form of hash
274
+ def to_body
275
+ to_hash
276
+ end
277
+
278
+ # Returns the object in the form of hash
279
+ # @return [Hash] Returns the object in the form of hash
280
+ def to_hash
281
+ hash = {}
282
+ self.class.attribute_map.each_pair do |attr, param|
283
+ value = self.send(attr)
284
+ if value.nil?
285
+ is_nullable = self.class.openapi_nullable.include?(attr)
286
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
287
+ end
288
+
289
+ hash[param] = _to_hash(value)
290
+ end
291
+ hash
292
+ end
293
+
294
+ # Outputs non-array value in the form of hash
295
+ # For object, use to_hash. Otherwise, just return the value
296
+ # @param [Object] value Any valid value
297
+ # @return [Hash] Returns the value in the form of hash
298
+ def _to_hash(value)
299
+ if value.is_a?(Array)
300
+ value.compact.map { |v| _to_hash(v) }
301
+ elsif value.is_a?(Hash)
302
+ {}.tap do |hash|
303
+ value.each { |k, v| hash[k] = _to_hash(v) }
304
+ end
305
+ elsif value.respond_to? :to_hash
306
+ value.to_hash
307
+ else
308
+ value
309
+ end
310
+ end
311
+ end
312
+ end
@@ -0,0 +1,247 @@
1
+ =begin
2
+ #Sunshine Conversations API
3
+
4
+ The version of the OpenAPI document: 9.1.0
5
+
6
+ Generated by: https://openapi-generator.tech
7
+ OpenAPI Generator version: 4.3.1
8
+ =end
9
+
10
+ require 'date'
11
+
12
+ module SunshineConversationsClient
13
+ class InstagramUpdate
14
+ # A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`.
15
+ attr_accessor :display_name
16
+
17
+ # A Facebook Page Access Token.
18
+ attr_accessor :page_access_token
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'display_name' => :'displayName',
24
+ :'page_access_token' => :'pageAccessToken'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.openapi_types
30
+ {
31
+ :'display_name' => :'String',
32
+ :'page_access_token' => :'String'
33
+ }
34
+ end
35
+
36
+ # List of attributes with nullable: true
37
+ def self.openapi_nullable
38
+ Set.new([
39
+ :'display_name',
40
+ ])
41
+ end
42
+
43
+ # List of class defined in allOf (OpenAPI v3)
44
+ def self.openapi_all_of
45
+ [
46
+ :'InstagramUpdateAllOf',
47
+ :'IntegrationUpdateBase'
48
+ ]
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SunshineConversationsClient::InstagramUpdate` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SunshineConversationsClient::InstagramUpdate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'display_name')
67
+ self.display_name = attributes[:'display_name']
68
+ end
69
+
70
+ if attributes.key?(:'page_access_token')
71
+ self.page_access_token = attributes[:'page_access_token']
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ if !@display_name.nil? && @display_name.to_s.length > 100
80
+ invalid_properties.push('invalid value for "display_name", the character length must be smaller than or equal to 100.')
81
+ end
82
+
83
+ if !@display_name.nil? && @display_name.to_s.length < 1
84
+ invalid_properties.push('invalid value for "display_name", the character length must be great than or equal to 1.')
85
+ end
86
+
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ return false if !@display_name.nil? && @display_name.to_s.length > 100
94
+ return false if !@display_name.nil? && @display_name.to_s.length < 1
95
+ true
96
+ end
97
+
98
+ # Custom attribute writer method with validation
99
+ # @param [Object] display_name Value to be assigned
100
+ def display_name=(display_name)
101
+ if !display_name.nil? && display_name.to_s.length > 100
102
+ fail ArgumentError, 'invalid value for "display_name", the character length must be smaller than or equal to 100.'
103
+ end
104
+
105
+ if !display_name.nil? && display_name.to_s.length < 1
106
+ fail ArgumentError, 'invalid value for "display_name", the character length must be great than or equal to 1.'
107
+ end
108
+
109
+ @display_name = display_name
110
+ end
111
+
112
+ # Checks equality by comparing each attribute.
113
+ # @param [Object] Object to be compared
114
+ def ==(o)
115
+ return true if self.equal?(o)
116
+ self.class == o.class &&
117
+ display_name == o.display_name &&
118
+ page_access_token == o.page_access_token
119
+ end
120
+
121
+ # @see the `==` method
122
+ # @param [Object] Object to be compared
123
+ def eql?(o)
124
+ self == o
125
+ end
126
+
127
+ # Calculates hash code according to all attributes.
128
+ # @return [Integer] Hash code
129
+ def hash
130
+ [display_name, page_access_token].hash
131
+ end
132
+
133
+ # Builds the object from hash
134
+ # @param [Hash] attributes Model attributes in the form of hash
135
+ # @return [Object] Returns the model itself
136
+ def self.build_from_hash(attributes)
137
+ new.build_from_hash(attributes)
138
+ end
139
+
140
+ # Builds the object from hash
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ # @return [Object] Returns the model itself
143
+ def build_from_hash(attributes)
144
+ return nil unless attributes.is_a?(Hash)
145
+ self.class.openapi_types.each_pair do |key, type|
146
+ if type =~ /\AArray<(.*)>/i
147
+ # check to ensure the input is an array given that the attribute
148
+ # is documented as an array but the input is not
149
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
150
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
151
+ end
152
+ elsif !attributes[self.class.attribute_map[key]].nil?
153
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
154
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
155
+ end
156
+
157
+ self
158
+ end
159
+
160
+ # Deserializes the data based on type
161
+ # @param string type Data type
162
+ # @param string value Value to be deserialized
163
+ # @return [Object] Deserialized data
164
+ def _deserialize(type, value)
165
+ case type.to_sym
166
+ when :DateTime
167
+ DateTime.parse(value)
168
+ when :Date
169
+ Date.parse(value)
170
+ when :String
171
+ value.to_s
172
+ when :Integer
173
+ value.to_i
174
+ when :Float
175
+ value.to_f
176
+ when :Boolean
177
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
178
+ true
179
+ else
180
+ false
181
+ end
182
+ when :Object
183
+ # generic object (usually a Hash), return directly
184
+ value
185
+ when /\AArray<(?<inner_type>.+)>\z/
186
+ inner_type = Regexp.last_match[:inner_type]
187
+ value.map { |v| _deserialize(inner_type, v) }
188
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
189
+ k_type = Regexp.last_match[:k_type]
190
+ v_type = Regexp.last_match[:v_type]
191
+ {}.tap do |hash|
192
+ value.each do |k, v|
193
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
194
+ end
195
+ end
196
+ else # model
197
+ SunshineConversationsClient.const_get(type).build_from_hash(value)
198
+ end
199
+ end
200
+
201
+ # Returns the string representation of the object
202
+ # @return [String] String presentation of the object
203
+ def to_s
204
+ to_hash.to_s
205
+ end
206
+
207
+ # to_body is an alias to to_hash (backward compatibility)
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_body
210
+ to_hash
211
+ end
212
+
213
+ # Returns the object in the form of hash
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_hash
216
+ hash = {}
217
+ self.class.attribute_map.each_pair do |attr, param|
218
+ value = self.send(attr)
219
+ if value.nil?
220
+ is_nullable = self.class.openapi_nullable.include?(attr)
221
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
222
+ end
223
+
224
+ hash[param] = _to_hash(value)
225
+ end
226
+ hash
227
+ end
228
+
229
+ # Outputs non-array value in the form of hash
230
+ # For object, use to_hash. Otherwise, just return the value
231
+ # @param [Object] value Any valid value
232
+ # @return [Hash] Returns the value in the form of hash
233
+ def _to_hash(value)
234
+ if value.is_a?(Array)
235
+ value.compact.map { |v| _to_hash(v) }
236
+ elsif value.is_a?(Hash)
237
+ {}.tap do |hash|
238
+ value.each { |k, v| hash[k] = _to_hash(v) }
239
+ end
240
+ elsif value.respond_to? :to_hash
241
+ value.to_hash
242
+ else
243
+ value
244
+ end
245
+ end
246
+ end
247
+ end