smooch-api 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +181 -0
  4. data/Rakefile +8 -0
  5. data/docs/Action.md +16 -0
  6. data/docs/App.md +10 -0
  7. data/docs/AppApi.md +609 -0
  8. data/docs/AppCreate.md +8 -0
  9. data/docs/AppResponse.md +8 -0
  10. data/docs/AppUser.md +18 -0
  11. data/docs/AppUserApi.md +561 -0
  12. data/docs/AppUserLink.md +9 -0
  13. data/docs/AppUserPreCreate.md +14 -0
  14. data/docs/AppUserResponse.md +8 -0
  15. data/docs/AppUserUpdate.md +12 -0
  16. data/docs/Client.md +14 -0
  17. data/docs/ClientInfo.md +15 -0
  18. data/docs/Conversation.md +9 -0
  19. data/docs/ConversationApi.md +282 -0
  20. data/docs/Destination.md +9 -0
  21. data/docs/DeviceInit.md +12 -0
  22. data/docs/DeviceResponse.md +8 -0
  23. data/docs/DeviceUpdate.md +10 -0
  24. data/docs/DisplaySettings.md +8 -0
  25. data/docs/Event.md +8 -0
  26. data/docs/GetMessagesResponse.md +10 -0
  27. data/docs/Init.md +9 -0
  28. data/docs/InitApi.md +61 -0
  29. data/docs/InitResponse.md +9 -0
  30. data/docs/Integration.md +24 -0
  31. data/docs/IntegrationApi.md +121 -0
  32. data/docs/IntegrationCreate.md +23 -0
  33. data/docs/IntegrationResponse.md +8 -0
  34. data/docs/JwtResponse.md +8 -0
  35. data/docs/ListAppsResponse.md +10 -0
  36. data/docs/ListIntegrationsResponse.md +8 -0
  37. data/docs/ListSecretKeysResponse.md +8 -0
  38. data/docs/ListWebhooksResponse.md +8 -0
  39. data/docs/Menu.md +9 -0
  40. data/docs/MenuApi.md +155 -0
  41. data/docs/MenuItem.md +11 -0
  42. data/docs/MenuResponse.md +8 -0
  43. data/docs/Message.md +23 -0
  44. data/docs/MessageItem.md +13 -0
  45. data/docs/MessagePost.md +20 -0
  46. data/docs/MessageResponse.md +9 -0
  47. data/docs/PostMessagesResponse.md +9 -0
  48. data/docs/SecretKey.md +10 -0
  49. data/docs/SecretKeyCreate.md +8 -0
  50. data/docs/SecretKeyResponse.md +8 -0
  51. data/docs/TrackEventResponse.md +8 -0
  52. data/docs/TypingActivityTrigger.md +11 -0
  53. data/docs/Webhook.md +11 -0
  54. data/docs/WebhookApi.md +287 -0
  55. data/docs/WebhookCreate.md +9 -0
  56. data/docs/WebhookResponse.md +8 -0
  57. data/docs/WebhookUpdate.md +9 -0
  58. data/git_push.sh +55 -0
  59. data/lib/smooch-api.rb +91 -0
  60. data/lib/smooch-api/api/app_api.rb +628 -0
  61. data/lib/smooch-api/api/app_user_api.rb +585 -0
  62. data/lib/smooch-api/api/conversation_api.rb +298 -0
  63. data/lib/smooch-api/api/init_api.rb +75 -0
  64. data/lib/smooch-api/api/integration_api.rb +135 -0
  65. data/lib/smooch-api/api/menu_api.rb +173 -0
  66. data/lib/smooch-api/api/webhook_api.rb +306 -0
  67. data/lib/smooch-api/api_client.rb +376 -0
  68. data/lib/smooch-api/api_error.rb +37 -0
  69. data/lib/smooch-api/configuration.rb +202 -0
  70. data/lib/smooch-api/models/action.rb +311 -0
  71. data/lib/smooch-api/models/app.rb +223 -0
  72. data/lib/smooch-api/models/app_create.rb +193 -0
  73. data/lib/smooch-api/models/app_response.rb +188 -0
  74. data/lib/smooch-api/models/app_user.rb +307 -0
  75. data/lib/smooch-api/models/app_user_link.rb +236 -0
  76. data/lib/smooch-api/models/app_user_pre_create.rb +253 -0
  77. data/lib/smooch-api/models/app_user_response.rb +193 -0
  78. data/lib/smooch-api/models/app_user_update.rb +228 -0
  79. data/lib/smooch-api/models/client.rb +290 -0
  80. data/lib/smooch-api/models/client_info.rb +258 -0
  81. data/lib/smooch-api/models/conversation.rb +208 -0
  82. data/lib/smooch-api/models/destination.rb +208 -0
  83. data/lib/smooch-api/models/device_init.rb +270 -0
  84. data/lib/smooch-api/models/device_response.rb +188 -0
  85. data/lib/smooch-api/models/device_update.rb +207 -0
  86. data/lib/smooch-api/models/display_settings.rb +188 -0
  87. data/lib/smooch-api/models/event.rb +193 -0
  88. data/lib/smooch-api/models/get_messages_response.rb +210 -0
  89. data/lib/smooch-api/models/init.rb +202 -0
  90. data/lib/smooch-api/models/init_response.rb +208 -0
  91. data/lib/smooch-api/models/integration.rb +358 -0
  92. data/lib/smooch-api/models/integration_create.rb +343 -0
  93. data/lib/smooch-api/models/integration_response.rb +188 -0
  94. data/lib/smooch-api/models/jwt_response.rb +188 -0
  95. data/lib/smooch-api/models/list_apps_response.rb +210 -0
  96. data/lib/smooch-api/models/list_integrations_response.rb +190 -0
  97. data/lib/smooch-api/models/list_secret_keys_response.rb +190 -0
  98. data/lib/smooch-api/models/list_webhooks_response.rb +195 -0
  99. data/lib/smooch-api/models/menu.rb +205 -0
  100. data/lib/smooch-api/models/menu_item.rb +228 -0
  101. data/lib/smooch-api/models/menu_response.rb +193 -0
  102. data/lib/smooch-api/models/message.rb +415 -0
  103. data/lib/smooch-api/models/message_item.rb +250 -0
  104. data/lib/smooch-api/models/message_post.rb +355 -0
  105. data/lib/smooch-api/models/message_response.rb +208 -0
  106. data/lib/smooch-api/models/post_messages_response.rb +200 -0
  107. data/lib/smooch-api/models/secret_key.rb +223 -0
  108. data/lib/smooch-api/models/secret_key_create.rb +193 -0
  109. data/lib/smooch-api/models/secret_key_response.rb +188 -0
  110. data/lib/smooch-api/models/track_event_response.rb +188 -0
  111. data/lib/smooch-api/models/typing_activity_trigger.rb +228 -0
  112. data/lib/smooch-api/models/webhook.rb +261 -0
  113. data/lib/smooch-api/models/webhook_create.rb +226 -0
  114. data/lib/smooch-api/models/webhook_response.rb +193 -0
  115. data/lib/smooch-api/models/webhook_update.rb +221 -0
  116. data/lib/smooch-api/version.rb +14 -0
  117. data/smooch-api.gemspec +44 -0
  118. data/spec/api_client_spec.rb +225 -0
  119. data/spec/configuration_spec.rb +41 -0
  120. data/spec/spec_helper.rb +110 -0
  121. metadata +349 -0
@@ -0,0 +1,208 @@
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: 1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module SmoochApi
15
+
16
+ class Destination
17
+ # The ID of the target integration.
18
+ attr_accessor :integration_id
19
+
20
+ # The type of the target integration.
21
+ attr_accessor :integration_type
22
+
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'integration_id' => :'integrationId',
28
+ :'integration_type' => :'integrationType'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'integration_id' => :'String',
36
+ :'integration_type' => :'String'
37
+ }
38
+ end
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ def initialize(attributes = {})
43
+ return unless attributes.is_a?(Hash)
44
+
45
+ # convert string to symbol for hash key
46
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
47
+
48
+ if attributes.has_key?(:'integrationId')
49
+ self.integration_id = attributes[:'integrationId']
50
+ end
51
+
52
+ if attributes.has_key?(:'integrationType')
53
+ self.integration_type = attributes[:'integrationType']
54
+ end
55
+
56
+ end
57
+
58
+ # Show invalid properties with the reasons. Usually used together with valid?
59
+ # @return Array for valid properies with the reasons
60
+ def list_invalid_properties
61
+ invalid_properties = Array.new
62
+ if @integration_id.nil?
63
+ invalid_properties.push("invalid value for 'integration_id', integration_id cannot be nil.")
64
+ end
65
+
66
+ if @integration_type.nil?
67
+ invalid_properties.push("invalid value for 'integration_type', integration_type cannot be nil.")
68
+ end
69
+
70
+ return invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ return false if @integration_id.nil?
77
+ return false if @integration_type.nil?
78
+ return true
79
+ end
80
+
81
+ # Checks equality by comparing each attribute.
82
+ # @param [Object] Object to be compared
83
+ def ==(o)
84
+ return true if self.equal?(o)
85
+ self.class == o.class &&
86
+ integration_id == o.integration_id &&
87
+ integration_type == o.integration_type
88
+ end
89
+
90
+ # @see the `==` method
91
+ # @param [Object] Object to be compared
92
+ def eql?(o)
93
+ self == o
94
+ end
95
+
96
+ # Calculates hash code according to all attributes.
97
+ # @return [Fixnum] Hash code
98
+ def hash
99
+ [integration_id, integration_type].hash
100
+ end
101
+
102
+ # Builds the object from hash
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ # @return [Object] Returns the model itself
105
+ def build_from_hash(attributes)
106
+ return nil unless attributes.is_a?(Hash)
107
+ self.class.swagger_types.each_pair do |key, type|
108
+ if type =~ /\AArray<(.*)>/i
109
+ # check to ensure the input is an array given that the the attribute
110
+ # is documented as an array but the input is not
111
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
112
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
113
+ end
114
+ elsif !attributes[self.class.attribute_map[key]].nil?
115
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
116
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
117
+ end
118
+
119
+ self
120
+ end
121
+
122
+ # Deserializes the data based on type
123
+ # @param string type Data type
124
+ # @param string value Value to be deserialized
125
+ # @return [Object] Deserialized data
126
+ def _deserialize(type, value)
127
+ case type.to_sym
128
+ when :DateTime
129
+ DateTime.parse(value)
130
+ when :Date
131
+ Date.parse(value)
132
+ when :String
133
+ value.to_s
134
+ when :Integer
135
+ value.to_i
136
+ when :Float
137
+ value.to_f
138
+ when :BOOLEAN
139
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
140
+ true
141
+ else
142
+ false
143
+ end
144
+ when :Object
145
+ # generic object (usually a Hash), return directly
146
+ value
147
+ when /\AArray<(?<inner_type>.+)>\z/
148
+ inner_type = Regexp.last_match[:inner_type]
149
+ value.map { |v| _deserialize(inner_type, v) }
150
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
151
+ k_type = Regexp.last_match[:k_type]
152
+ v_type = Regexp.last_match[:v_type]
153
+ {}.tap do |hash|
154
+ value.each do |k, v|
155
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
156
+ end
157
+ end
158
+ else # model
159
+ temp_model = SmoochApi.const_get(type).new
160
+ temp_model.build_from_hash(value)
161
+ end
162
+ end
163
+
164
+ # Returns the string representation of the object
165
+ # @return [String] String presentation of the object
166
+ def to_s
167
+ to_hash.to_s
168
+ end
169
+
170
+ # to_body is an alias to to_hash (backward compatibility)
171
+ # @return [Hash] Returns the object in the form of hash
172
+ def to_body
173
+ to_hash
174
+ end
175
+
176
+ # Returns the object in the form of hash
177
+ # @return [Hash] Returns the object in the form of hash
178
+ def to_hash
179
+ hash = {}
180
+ self.class.attribute_map.each_pair do |attr, param|
181
+ value = self.send(attr)
182
+ next if value.nil?
183
+ hash[param] = _to_hash(value)
184
+ end
185
+ hash
186
+ end
187
+
188
+ # Outputs non-array value in the form of hash
189
+ # For object, use to_hash. Otherwise, just return the value
190
+ # @param [Object] value Any valid value
191
+ # @return [Hash] Returns the value in the form of hash
192
+ def _to_hash(value)
193
+ if value.is_a?(Array)
194
+ value.compact.map{ |v| _to_hash(v) }
195
+ elsif value.is_a?(Hash)
196
+ {}.tap do |hash|
197
+ value.each { |k, v| hash[k] = _to_hash(v) }
198
+ end
199
+ elsif value.respond_to? :to_hash
200
+ value.to_hash
201
+ else
202
+ value
203
+ end
204
+ end
205
+
206
+ end
207
+
208
+ end
@@ -0,0 +1,270 @@
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: 1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module SmoochApi
15
+
16
+ class DeviceInit
17
+ # An identifier for the client. Must be globally unique.
18
+ attr_accessor :id
19
+
20
+ # The client's platform.
21
+ attr_accessor :platform
22
+
23
+ # The GCM or APN token to be used for sending push notifications to the device. Applies to only *android* and *ios* clients.
24
+ attr_accessor :push_notification_token
25
+
26
+ # A reserved string field for reporting the app version running on the device.
27
+ attr_accessor :app_version
28
+
29
+ attr_accessor :info
30
+
31
+ class EnumAttributeValidator
32
+ attr_reader :datatype
33
+ attr_reader :allowable_values
34
+
35
+ def initialize(datatype, allowable_values)
36
+ @allowable_values = allowable_values.map do |value|
37
+ case datatype.to_s
38
+ when /Integer/i
39
+ value.to_i
40
+ when /Float/i
41
+ value.to_f
42
+ else
43
+ value
44
+ end
45
+ end
46
+ end
47
+
48
+ def valid?(value)
49
+ !value || allowable_values.include?(value)
50
+ end
51
+ end
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'id' => :'id',
57
+ :'platform' => :'platform',
58
+ :'push_notification_token' => :'pushNotificationToken',
59
+ :'app_version' => :'appVersion',
60
+ :'info' => :'info'
61
+ }
62
+ end
63
+
64
+ # Attribute type mapping.
65
+ def self.swagger_types
66
+ {
67
+ :'id' => :'String',
68
+ :'platform' => :'String',
69
+ :'push_notification_token' => :'String',
70
+ :'app_version' => :'String',
71
+ :'info' => :'ClientInfo'
72
+ }
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ return unless attributes.is_a?(Hash)
79
+
80
+ # convert string to symbol for hash key
81
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
82
+
83
+ if attributes.has_key?(:'id')
84
+ self.id = attributes[:'id']
85
+ end
86
+
87
+ if attributes.has_key?(:'platform')
88
+ self.platform = attributes[:'platform']
89
+ end
90
+
91
+ if attributes.has_key?(:'pushNotificationToken')
92
+ self.push_notification_token = attributes[:'pushNotificationToken']
93
+ end
94
+
95
+ if attributes.has_key?(:'appVersion')
96
+ self.app_version = attributes[:'appVersion']
97
+ end
98
+
99
+ if attributes.has_key?(:'info')
100
+ self.info = attributes[:'info']
101
+ end
102
+
103
+ end
104
+
105
+ # Show invalid properties with the reasons. Usually used together with valid?
106
+ # @return Array for valid properies with the reasons
107
+ def list_invalid_properties
108
+ invalid_properties = Array.new
109
+ if @id.nil?
110
+ invalid_properties.push("invalid value for 'id', id cannot be nil.")
111
+ end
112
+
113
+ if @platform.nil?
114
+ invalid_properties.push("invalid value for 'platform', platform cannot be nil.")
115
+ end
116
+
117
+ return invalid_properties
118
+ end
119
+
120
+ # Check to see if the all the properties in the model are valid
121
+ # @return true if the model is valid
122
+ def valid?
123
+ return false if @id.nil?
124
+ return false if @platform.nil?
125
+ platform_validator = EnumAttributeValidator.new('String', ["ios", "android", "web", "other"])
126
+ return false unless platform_validator.valid?(@platform)
127
+ return true
128
+ end
129
+
130
+ # Custom attribute writer method checking allowed values (enum).
131
+ # @param [Object] platform Object to be assigned
132
+ def platform=(platform)
133
+ validator = EnumAttributeValidator.new('String', ["ios", "android", "web", "other"])
134
+ unless validator.valid?(platform)
135
+ fail ArgumentError, "invalid value for 'platform', must be one of #{validator.allowable_values}."
136
+ end
137
+ @platform = platform
138
+ end
139
+
140
+ # Checks equality by comparing each attribute.
141
+ # @param [Object] Object to be compared
142
+ def ==(o)
143
+ return true if self.equal?(o)
144
+ self.class == o.class &&
145
+ id == o.id &&
146
+ platform == o.platform &&
147
+ push_notification_token == o.push_notification_token &&
148
+ app_version == o.app_version &&
149
+ info == o.info
150
+ end
151
+
152
+ # @see the `==` method
153
+ # @param [Object] Object to be compared
154
+ def eql?(o)
155
+ self == o
156
+ end
157
+
158
+ # Calculates hash code according to all attributes.
159
+ # @return [Fixnum] Hash code
160
+ def hash
161
+ [id, platform, push_notification_token, app_version, info].hash
162
+ end
163
+
164
+ # Builds the object from hash
165
+ # @param [Hash] attributes Model attributes in the form of hash
166
+ # @return [Object] Returns the model itself
167
+ def build_from_hash(attributes)
168
+ return nil unless attributes.is_a?(Hash)
169
+ self.class.swagger_types.each_pair do |key, type|
170
+ if type =~ /\AArray<(.*)>/i
171
+ # check to ensure the input is an array given that the the attribute
172
+ # is documented as an array but the input is not
173
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
174
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
175
+ end
176
+ elsif !attributes[self.class.attribute_map[key]].nil?
177
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
178
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
179
+ end
180
+
181
+ self
182
+ end
183
+
184
+ # Deserializes the data based on type
185
+ # @param string type Data type
186
+ # @param string value Value to be deserialized
187
+ # @return [Object] Deserialized data
188
+ def _deserialize(type, value)
189
+ case type.to_sym
190
+ when :DateTime
191
+ DateTime.parse(value)
192
+ when :Date
193
+ Date.parse(value)
194
+ when :String
195
+ value.to_s
196
+ when :Integer
197
+ value.to_i
198
+ when :Float
199
+ value.to_f
200
+ when :BOOLEAN
201
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
202
+ true
203
+ else
204
+ false
205
+ end
206
+ when :Object
207
+ # generic object (usually a Hash), return directly
208
+ value
209
+ when /\AArray<(?<inner_type>.+)>\z/
210
+ inner_type = Regexp.last_match[:inner_type]
211
+ value.map { |v| _deserialize(inner_type, v) }
212
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
213
+ k_type = Regexp.last_match[:k_type]
214
+ v_type = Regexp.last_match[:v_type]
215
+ {}.tap do |hash|
216
+ value.each do |k, v|
217
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
218
+ end
219
+ end
220
+ else # model
221
+ temp_model = SmoochApi.const_get(type).new
222
+ temp_model.build_from_hash(value)
223
+ end
224
+ end
225
+
226
+ # Returns the string representation of the object
227
+ # @return [String] String presentation of the object
228
+ def to_s
229
+ to_hash.to_s
230
+ end
231
+
232
+ # to_body is an alias to to_hash (backward compatibility)
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_body
235
+ to_hash
236
+ end
237
+
238
+ # Returns the object in the form of hash
239
+ # @return [Hash] Returns the object in the form of hash
240
+ def to_hash
241
+ hash = {}
242
+ self.class.attribute_map.each_pair do |attr, param|
243
+ value = self.send(attr)
244
+ next if value.nil?
245
+ hash[param] = _to_hash(value)
246
+ end
247
+ hash
248
+ end
249
+
250
+ # Outputs non-array value in the form of hash
251
+ # For object, use to_hash. Otherwise, just return the value
252
+ # @param [Object] value Any valid value
253
+ # @return [Hash] Returns the value in the form of hash
254
+ def _to_hash(value)
255
+ if value.is_a?(Array)
256
+ value.compact.map{ |v| _to_hash(v) }
257
+ elsif value.is_a?(Hash)
258
+ {}.tap do |hash|
259
+ value.each { |k, v| hash[k] = _to_hash(v) }
260
+ end
261
+ elsif value.respond_to? :to_hash
262
+ value.to_hash
263
+ else
264
+ value
265
+ end
266
+ end
267
+
268
+ end
269
+
270
+ end