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