smooch-api 5.25.1 → 5.29.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +176 -0
  3. data/README.md +20 -1
  4. data/docs/AppApi.md +60 -0
  5. data/docs/AppUserLink.md +1 -0
  6. data/docs/Author.md +11 -0
  7. data/docs/GetSdkIdsResponse.md +10 -0
  8. data/docs/Integration.md +4 -0
  9. data/docs/IntegrationCreate.md +7 -0
  10. data/docs/NotificationApi.md +71 -0
  11. data/docs/NotificationPost.md +11 -0
  12. data/docs/NotificationPostDestination.md +9 -0
  13. data/docs/NotificationResponse.md +8 -0
  14. data/docs/NotificationResponseNotification.md +8 -0
  15. data/lib/smooch-api.rb +8 -1
  16. data/lib/smooch-api/api/app_api.rb +56 -1
  17. data/lib/smooch-api/api/app_user_api.rb +1 -1
  18. data/lib/smooch-api/api/attachments_api.rb +1 -1
  19. data/lib/smooch-api/api/conversation_api.rb +1 -1
  20. data/lib/smooch-api/api/deployment_api.rb +1 -1
  21. data/lib/smooch-api/api/integration_api.rb +1 -1
  22. data/lib/smooch-api/api/menu_api.rb +1 -1
  23. data/lib/smooch-api/api/notification_api.rb +84 -0
  24. data/lib/smooch-api/api/service_account_api.rb +1 -1
  25. data/lib/smooch-api/api/template_api.rb +1 -1
  26. data/lib/smooch-api/api/webhook_api.rb +1 -1
  27. data/lib/smooch-api/api_client.rb +1 -1
  28. data/lib/smooch-api/api_error.rb +1 -1
  29. data/lib/smooch-api/configuration.rb +1 -1
  30. data/lib/smooch-api/models/action.rb +1 -1
  31. data/lib/smooch-api/models/activity_response.rb +1 -1
  32. data/lib/smooch-api/models/app.rb +1 -1
  33. data/lib/smooch-api/models/app_create.rb +1 -1
  34. data/lib/smooch-api/models/app_response.rb +1 -1
  35. data/lib/smooch-api/models/app_settings.rb +1 -1
  36. data/lib/smooch-api/models/app_update.rb +1 -1
  37. data/lib/smooch-api/models/app_user.rb +1 -1
  38. data/lib/smooch-api/models/app_user_business_systems_response.rb +1 -1
  39. data/lib/smooch-api/models/app_user_channels_response.rb +1 -1
  40. data/lib/smooch-api/models/app_user_link.rb +12 -2
  41. data/lib/smooch-api/models/app_user_merge.rb +1 -1
  42. data/lib/smooch-api/models/app_user_pre_create.rb +1 -1
  43. data/lib/smooch-api/models/app_user_response.rb +1 -1
  44. data/lib/smooch-api/models/app_user_update.rb +1 -1
  45. data/lib/smooch-api/models/attachment_remove.rb +1 -1
  46. data/lib/smooch-api/models/attachment_response.rb +1 -1
  47. data/lib/smooch-api/models/auth_code_response.rb +1 -1
  48. data/lib/smooch-api/models/author.rb +224 -0
  49. data/lib/smooch-api/models/business_system_item.rb +1 -1
  50. data/lib/smooch-api/models/channel_entity_item.rb +1 -1
  51. data/lib/smooch-api/models/client.rb +1 -1
  52. data/lib/smooch-api/models/client_info.rb +1 -1
  53. data/lib/smooch-api/models/confirmation.rb +1 -1
  54. data/lib/smooch-api/models/conversation.rb +1 -1
  55. data/lib/smooch-api/models/conversation_activity.rb +1 -1
  56. data/lib/smooch-api/models/coordinates.rb +1 -1
  57. data/lib/smooch-api/models/deployment.rb +1 -1
  58. data/lib/smooch-api/models/deployment_activate_phone_number.rb +1 -1
  59. data/lib/smooch-api/models/deployment_confirm_code.rb +1 -1
  60. data/lib/smooch-api/models/deployment_create.rb +1 -1
  61. data/lib/smooch-api/models/deployment_response.rb +1 -1
  62. data/lib/smooch-api/models/destination.rb +1 -1
  63. data/lib/smooch-api/models/display_settings.rb +1 -1
  64. data/lib/smooch-api/models/enums.rb +3 -3
  65. data/lib/smooch-api/models/field.rb +1 -1
  66. data/lib/smooch-api/models/field_post.rb +1 -1
  67. data/lib/smooch-api/models/get_integration_profile_response.rb +1 -1
  68. data/lib/smooch-api/models/get_messages_response.rb +1 -1
  69. data/lib/smooch-api/models/get_sdk_ids_response.rb +224 -0
  70. data/lib/smooch-api/models/integration.rb +45 -5
  71. data/lib/smooch-api/models/integration_create.rb +75 -5
  72. data/lib/smooch-api/models/integration_profile_update.rb +1 -1
  73. data/lib/smooch-api/models/integration_response.rb +1 -1
  74. data/lib/smooch-api/models/integration_update.rb +1 -1
  75. data/lib/smooch-api/models/jwt_response.rb +1 -1
  76. data/lib/smooch-api/models/link_request_response.rb +1 -1
  77. data/lib/smooch-api/models/link_request_response_link_requests.rb +1 -1
  78. data/lib/smooch-api/models/list_apps_response.rb +1 -1
  79. data/lib/smooch-api/models/list_deployments_response.rb +1 -1
  80. data/lib/smooch-api/models/list_integrations_response.rb +1 -1
  81. data/lib/smooch-api/models/list_secret_keys_response.rb +1 -1
  82. data/lib/smooch-api/models/list_service_accounts_response.rb +1 -1
  83. data/lib/smooch-api/models/list_templates_response.rb +1 -1
  84. data/lib/smooch-api/models/list_webhooks_response.rb +1 -1
  85. data/lib/smooch-api/models/location.rb +1 -1
  86. data/lib/smooch-api/models/menu.rb +1 -1
  87. data/lib/smooch-api/models/menu_item.rb +1 -1
  88. data/lib/smooch-api/models/menu_response.rb +1 -1
  89. data/lib/smooch-api/models/merged_user.rb +1 -1
  90. data/lib/smooch-api/models/message.rb +1 -1
  91. data/lib/smooch-api/models/message_item.rb +1 -1
  92. data/lib/smooch-api/models/message_override.rb +1 -1
  93. data/lib/smooch-api/models/message_override_line.rb +1 -1
  94. data/lib/smooch-api/models/message_override_messenger.rb +1 -1
  95. data/lib/smooch-api/models/message_override_whatsapp.rb +1 -1
  96. data/lib/smooch-api/models/message_post.rb +1 -1
  97. data/lib/smooch-api/models/message_response.rb +1 -1
  98. data/lib/smooch-api/models/notification_post.rb +234 -0
  99. data/lib/smooch-api/models/notification_post_destination.rb +209 -0
  100. data/lib/smooch-api/models/notification_response.rb +188 -0
  101. data/lib/smooch-api/models/notification_response_notification.rb +194 -0
  102. data/lib/smooch-api/models/option.rb +1 -1
  103. data/lib/smooch-api/models/quoted_message.rb +1 -1
  104. data/lib/smooch-api/models/secret_key.rb +1 -1
  105. data/lib/smooch-api/models/secret_key_create.rb +1 -1
  106. data/lib/smooch-api/models/secret_key_response.rb +1 -1
  107. data/lib/smooch-api/models/select.rb +1 -1
  108. data/lib/smooch-api/models/service_account.rb +1 -1
  109. data/lib/smooch-api/models/service_account_create.rb +1 -1
  110. data/lib/smooch-api/models/service_account_response.rb +1 -1
  111. data/lib/smooch-api/models/service_account_update.rb +1 -1
  112. data/lib/smooch-api/models/source.rb +1 -1
  113. data/lib/smooch-api/models/sub_menu_item.rb +1 -1
  114. data/lib/smooch-api/models/template.rb +1 -1
  115. data/lib/smooch-api/models/template_create.rb +1 -1
  116. data/lib/smooch-api/models/template_response.rb +1 -1
  117. data/lib/smooch-api/models/template_update.rb +1 -1
  118. data/lib/smooch-api/models/upload_integration_profile_photo_response.rb +1 -1
  119. data/lib/smooch-api/models/webhook.rb +1 -1
  120. data/lib/smooch-api/models/webhook_create.rb +1 -1
  121. data/lib/smooch-api/models/webhook_response.rb +1 -1
  122. data/lib/smooch-api/models/webhook_update.rb +1 -1
  123. data/lib/smooch-api/version.rb +2 -2
  124. data/smooch-api.gemspec +4 -4
  125. data/spec/api_client_spec.rb +1 -1
  126. data/spec/configuration_spec.rb +1 -1
  127. data/spec/spec_helper.rb +1 -1
  128. metadata +23 -8
@@ -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.29
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
@@ -0,0 +1,188 @@
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.29
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 NotificationResponse
18
+ attr_accessor :notification
19
+
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'notification' => :'notification'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ :'notification' => :'NotificationResponseNotification'
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?(:'notification')
44
+ self.notification = attributes[:'notification']
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
+ return invalid_properties
54
+ end
55
+
56
+ # Check to see if the all the properties in the model are valid
57
+ # @return true if the model is valid
58
+ def valid?
59
+ return true
60
+ end
61
+
62
+ # Checks equality by comparing each attribute.
63
+ # @param [Object] Object to be compared
64
+ def ==(o)
65
+ return true if self.equal?(o)
66
+ self.class == o.class &&
67
+ notification == o.notification
68
+ end
69
+
70
+ # @see the `==` method
71
+ # @param [Object] Object to be compared
72
+ def eql?(o)
73
+ self == o
74
+ end
75
+
76
+ # Calculates hash code according to all attributes.
77
+ # @return [Fixnum] Hash code
78
+ def hash
79
+ [notification].hash
80
+ end
81
+
82
+ # Builds the object from hash
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ # @return [Object] Returns the model itself
85
+ def build_from_hash(attributes)
86
+ return nil unless attributes.is_a?(Hash)
87
+ self.class.swagger_types.each_pair do |key, type|
88
+ if type =~ /\AArray<(.*)>/i
89
+ # check to ensure the input is an array given that the the attribute
90
+ # is documented as an array but the input is not
91
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
92
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
93
+ end
94
+ elsif !attributes[self.class.attribute_map[key]].nil?
95
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
96
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
97
+ end
98
+
99
+ self
100
+ end
101
+
102
+ # Deserializes the data based on type
103
+ # @param string type Data type
104
+ # @param string value Value to be deserialized
105
+ # @return [Object] Deserialized data
106
+ def _deserialize(type, value)
107
+ case type.to_sym
108
+ when :DateTime
109
+ DateTime.parse(value)
110
+ when :Date
111
+ Date.parse(value)
112
+ when :String
113
+ value.to_s
114
+ when :Integer
115
+ value.to_i
116
+ when :Float
117
+ value.to_f
118
+ when :BOOLEAN
119
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
120
+ true
121
+ else
122
+ false
123
+ end
124
+ when :Object
125
+ # generic object (usually a Hash), return directly
126
+ value
127
+ when /\AArray<(?<inner_type>.+)>\z/
128
+ inner_type = Regexp.last_match[:inner_type]
129
+ value.map { |v| _deserialize(inner_type, v) }
130
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
131
+ k_type = Regexp.last_match[:k_type]
132
+ v_type = Regexp.last_match[:v_type]
133
+ {}.tap do |hash|
134
+ value.each do |k, v|
135
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
136
+ end
137
+ end
138
+ else # model
139
+ temp_model = SmoochApi.const_get(type).new
140
+ temp_model.build_from_hash(value)
141
+ end
142
+ end
143
+
144
+ # Returns the string representation of the object
145
+ # @return [String] String presentation of the object
146
+ def to_s
147
+ to_hash.to_s
148
+ end
149
+
150
+ # to_body is an alias to to_hash (backward compatibility)
151
+ # @return [Hash] Returns the object in the form of hash
152
+ def to_body
153
+ to_hash
154
+ end
155
+
156
+ # Returns the object in the form of hash
157
+ # @return [Hash] Returns the object in the form of hash
158
+ def to_hash
159
+ hash = {}
160
+ self.class.attribute_map.each_pair do |attr, param|
161
+ value = self.send(attr)
162
+ next if value.nil?
163
+ hash[param] = _to_hash(value)
164
+ end
165
+ hash
166
+ end
167
+
168
+ # Outputs non-array value in the form of hash
169
+ # For object, use to_hash. Otherwise, just return the value
170
+ # @param [Object] value Any valid value
171
+ # @return [Hash] Returns the value in the form of hash
172
+ def _to_hash(value)
173
+ if value.is_a?(Array)
174
+ value.compact.map{ |v| _to_hash(v) }
175
+ elsif value.is_a?(Hash)
176
+ {}.tap do |hash|
177
+ value.each { |k, v| hash[k] = _to_hash(v) }
178
+ end
179
+ elsif value.respond_to? :to_hash
180
+ value.to_hash
181
+ else
182
+ value
183
+ end
184
+ end
185
+
186
+ end
187
+
188
+ end
@@ -0,0 +1,194 @@
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.29
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 NotificationResponseNotification
18
+ # Automatically generated UUID used to identify the notification in Webhooks.
19
+ attr_accessor :id
20
+
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'id' => :'_id'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.swagger_types
31
+ {
32
+ :'id' => :'String'
33
+ }
34
+ end
35
+
36
+ # Initializes the object
37
+ # @param [Hash] attributes Model attributes in the form of hash
38
+ def initialize(attributes = {})
39
+ return unless attributes.is_a?(Hash)
40
+
41
+ # convert string to symbol for hash key
42
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
43
+
44
+ if attributes.has_key?(:'_id')
45
+ self.id = attributes[:'_id']
46
+ end
47
+
48
+ end
49
+
50
+ # Show invalid properties with the reasons. Usually used together with valid?
51
+ # @return Array for valid properies with the reasons
52
+ def list_invalid_properties
53
+ invalid_properties = Array.new
54
+ if @id.nil?
55
+ invalid_properties.push("invalid value for 'id', id cannot be nil.")
56
+ end
57
+
58
+ return invalid_properties
59
+ end
60
+
61
+ # Check to see if the all the properties in the model are valid
62
+ # @return true if the model is valid
63
+ def valid?
64
+ return false if @id.nil?
65
+ return true
66
+ end
67
+
68
+ # Checks equality by comparing each attribute.
69
+ # @param [Object] Object to be compared
70
+ def ==(o)
71
+ return true if self.equal?(o)
72
+ self.class == o.class &&
73
+ id == o.id
74
+ end
75
+
76
+ # @see the `==` method
77
+ # @param [Object] Object to be compared
78
+ def eql?(o)
79
+ self == o
80
+ end
81
+
82
+ # Calculates hash code according to all attributes.
83
+ # @return [Fixnum] Hash code
84
+ def hash
85
+ [id].hash
86
+ end
87
+
88
+ # Builds the object from hash
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ # @return [Object] Returns the model itself
91
+ def build_from_hash(attributes)
92
+ return nil unless attributes.is_a?(Hash)
93
+ self.class.swagger_types.each_pair do |key, type|
94
+ if type =~ /\AArray<(.*)>/i
95
+ # check to ensure the input is an array given that the the attribute
96
+ # is documented as an array but the input is not
97
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
98
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
99
+ end
100
+ elsif !attributes[self.class.attribute_map[key]].nil?
101
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
102
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
103
+ end
104
+
105
+ self
106
+ end
107
+
108
+ # Deserializes the data based on type
109
+ # @param string type Data type
110
+ # @param string value Value to be deserialized
111
+ # @return [Object] Deserialized data
112
+ def _deserialize(type, value)
113
+ case type.to_sym
114
+ when :DateTime
115
+ DateTime.parse(value)
116
+ when :Date
117
+ Date.parse(value)
118
+ when :String
119
+ value.to_s
120
+ when :Integer
121
+ value.to_i
122
+ when :Float
123
+ value.to_f
124
+ when :BOOLEAN
125
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
126
+ true
127
+ else
128
+ false
129
+ end
130
+ when :Object
131
+ # generic object (usually a Hash), return directly
132
+ value
133
+ when /\AArray<(?<inner_type>.+)>\z/
134
+ inner_type = Regexp.last_match[:inner_type]
135
+ value.map { |v| _deserialize(inner_type, v) }
136
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
137
+ k_type = Regexp.last_match[:k_type]
138
+ v_type = Regexp.last_match[:v_type]
139
+ {}.tap do |hash|
140
+ value.each do |k, v|
141
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
142
+ end
143
+ end
144
+ else # model
145
+ temp_model = SmoochApi.const_get(type).new
146
+ temp_model.build_from_hash(value)
147
+ end
148
+ end
149
+
150
+ # Returns the string representation of the object
151
+ # @return [String] String presentation of the object
152
+ def to_s
153
+ to_hash.to_s
154
+ end
155
+
156
+ # to_body is an alias to to_hash (backward compatibility)
157
+ # @return [Hash] Returns the object in the form of hash
158
+ def to_body
159
+ to_hash
160
+ end
161
+
162
+ # Returns the object in the form of hash
163
+ # @return [Hash] Returns the object in the form of hash
164
+ def to_hash
165
+ hash = {}
166
+ self.class.attribute_map.each_pair do |attr, param|
167
+ value = self.send(attr)
168
+ next if value.nil?
169
+ hash[param] = _to_hash(value)
170
+ end
171
+ hash
172
+ end
173
+
174
+ # Outputs non-array value in the form of hash
175
+ # For object, use to_hash. Otherwise, just return the value
176
+ # @param [Object] value Any valid value
177
+ # @return [Hash] Returns the value in the form of hash
178
+ def _to_hash(value)
179
+ if value.is_a?(Array)
180
+ value.compact.map{ |v| _to_hash(v) }
181
+ elsif value.is_a?(Hash)
182
+ {}.tap do |hash|
183
+ value.each { |k, v| hash[k] = _to_hash(v) }
184
+ end
185
+ elsif value.respond_to? :to_hash
186
+ value.to_hash
187
+ else
188
+ value
189
+ end
190
+ end
191
+
192
+ end
193
+
194
+ end