smooch-api 5.12.0 → 5.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -12
  3. data/docs/AppApi.md +40 -10
  4. data/docs/AppUserApi.md +52 -13
  5. data/docs/AttachmentsApi.md +8 -2
  6. data/docs/ConversationApi.md +26 -8
  7. data/docs/DeploymentApi.md +24 -6
  8. data/docs/Enums.md +2 -0
  9. data/docs/Field.md +19 -0
  10. data/docs/FieldPost.md +14 -0
  11. data/docs/IntegrationApi.md +48 -12
  12. data/docs/MenuApi.md +12 -3
  13. data/docs/Message.md +5 -0
  14. data/docs/MessagePost.md +2 -0
  15. data/docs/Option.md +9 -0
  16. data/docs/QuotedMessage.md +10 -0
  17. data/docs/Select.md +10 -0
  18. data/docs/ServiceAccountApi.md +40 -10
  19. data/docs/TemplateApi.md +20 -5
  20. data/docs/WebhookApi.md +20 -5
  21. data/lib/smooch-api.rb +6 -1
  22. data/lib/smooch-api/api/app_api.rb +1 -1
  23. data/lib/smooch-api/api/app_user_api.rb +1 -1
  24. data/lib/smooch-api/api/attachments_api.rb +1 -1
  25. data/lib/smooch-api/api/conversation_api.rb +3 -3
  26. data/lib/smooch-api/api/deployment_api.rb +1 -1
  27. data/lib/smooch-api/api/integration_api.rb +1 -1
  28. data/lib/smooch-api/api/menu_api.rb +1 -1
  29. data/lib/smooch-api/api/service_account_api.rb +1 -1
  30. data/lib/smooch-api/api/template_api.rb +1 -1
  31. data/lib/smooch-api/api/webhook_api.rb +1 -1
  32. data/lib/smooch-api/api_client.rb +1 -1
  33. data/lib/smooch-api/api_error.rb +1 -1
  34. data/lib/smooch-api/configuration.rb +1 -1
  35. data/lib/smooch-api/models/action.rb +1 -1
  36. data/lib/smooch-api/models/activity_response.rb +1 -1
  37. data/lib/smooch-api/models/app.rb +1 -1
  38. data/lib/smooch-api/models/app_create.rb +1 -1
  39. data/lib/smooch-api/models/app_response.rb +1 -1
  40. data/lib/smooch-api/models/app_settings.rb +1 -1
  41. data/lib/smooch-api/models/app_update.rb +1 -1
  42. data/lib/smooch-api/models/app_user.rb +1 -1
  43. data/lib/smooch-api/models/app_user_business_systems_response.rb +1 -1
  44. data/lib/smooch-api/models/app_user_channels_response.rb +1 -1
  45. data/lib/smooch-api/models/app_user_link.rb +1 -1
  46. data/lib/smooch-api/models/app_user_merge.rb +1 -1
  47. data/lib/smooch-api/models/app_user_pre_create.rb +1 -1
  48. data/lib/smooch-api/models/app_user_response.rb +1 -1
  49. data/lib/smooch-api/models/app_user_update.rb +1 -1
  50. data/lib/smooch-api/models/attachment_remove.rb +1 -1
  51. data/lib/smooch-api/models/attachment_response.rb +1 -1
  52. data/lib/smooch-api/models/auth_code_response.rb +1 -1
  53. data/lib/smooch-api/models/business_system_item.rb +1 -1
  54. data/lib/smooch-api/models/channel_entity_item.rb +1 -1
  55. data/lib/smooch-api/models/client.rb +1 -1
  56. data/lib/smooch-api/models/client_info.rb +1 -1
  57. data/lib/smooch-api/models/confirmation.rb +1 -1
  58. data/lib/smooch-api/models/conversation.rb +1 -1
  59. data/lib/smooch-api/models/conversation_activity.rb +1 -1
  60. data/lib/smooch-api/models/deployment.rb +1 -1
  61. data/lib/smooch-api/models/deployment_activate_phone_number.rb +1 -1
  62. data/lib/smooch-api/models/deployment_confirm_code.rb +1 -1
  63. data/lib/smooch-api/models/deployment_create.rb +1 -1
  64. data/lib/smooch-api/models/deployment_response.rb +1 -1
  65. data/lib/smooch-api/models/destination.rb +1 -1
  66. data/lib/smooch-api/models/display_settings.rb +1 -1
  67. data/lib/smooch-api/models/enums.rb +46 -4
  68. data/lib/smooch-api/models/field.rb +318 -0
  69. data/lib/smooch-api/models/field_post.rb +266 -0
  70. data/lib/smooch-api/models/get_integration_profile_response.rb +1 -1
  71. data/lib/smooch-api/models/get_messages_response.rb +1 -1
  72. data/lib/smooch-api/models/integration.rb +1 -1
  73. data/lib/smooch-api/models/integration_create.rb +1 -1
  74. data/lib/smooch-api/models/integration_profile_update.rb +1 -1
  75. data/lib/smooch-api/models/integration_response.rb +1 -1
  76. data/lib/smooch-api/models/integration_update.rb +1 -1
  77. data/lib/smooch-api/models/jwt_response.rb +1 -1
  78. data/lib/smooch-api/models/link_request_response.rb +1 -1
  79. data/lib/smooch-api/models/link_request_response_link_requests.rb +1 -1
  80. data/lib/smooch-api/models/list_apps_response.rb +1 -1
  81. data/lib/smooch-api/models/list_deployments_response.rb +1 -1
  82. data/lib/smooch-api/models/list_integrations_response.rb +1 -1
  83. data/lib/smooch-api/models/list_secret_keys_response.rb +1 -1
  84. data/lib/smooch-api/models/list_service_accounts_response.rb +1 -1
  85. data/lib/smooch-api/models/list_templates_response.rb +1 -1
  86. data/lib/smooch-api/models/list_webhooks_response.rb +1 -1
  87. data/lib/smooch-api/models/menu.rb +1 -1
  88. data/lib/smooch-api/models/menu_item.rb +1 -1
  89. data/lib/smooch-api/models/menu_response.rb +1 -1
  90. data/lib/smooch-api/models/merged_user.rb +1 -1
  91. data/lib/smooch-api/models/message.rb +57 -5
  92. data/lib/smooch-api/models/message_item.rb +1 -1
  93. data/lib/smooch-api/models/message_override.rb +1 -1
  94. data/lib/smooch-api/models/message_override_whatsapp.rb +1 -1
  95. data/lib/smooch-api/models/message_post.rb +24 -2
  96. data/lib/smooch-api/models/message_response.rb +1 -1
  97. data/lib/smooch-api/models/option.rb +209 -0
  98. data/lib/smooch-api/models/quoted_message.rb +213 -0
  99. data/lib/smooch-api/models/secret_key.rb +1 -1
  100. data/lib/smooch-api/models/secret_key_create.rb +1 -1
  101. data/lib/smooch-api/models/secret_key_response.rb +1 -1
  102. data/lib/smooch-api/models/select.rb +219 -0
  103. data/lib/smooch-api/models/service_account.rb +1 -1
  104. data/lib/smooch-api/models/service_account_create.rb +1 -1
  105. data/lib/smooch-api/models/service_account_response.rb +1 -1
  106. data/lib/smooch-api/models/service_account_update.rb +1 -1
  107. data/lib/smooch-api/models/source.rb +1 -1
  108. data/lib/smooch-api/models/sub_menu_item.rb +1 -1
  109. data/lib/smooch-api/models/template.rb +1 -1
  110. data/lib/smooch-api/models/template_create.rb +1 -1
  111. data/lib/smooch-api/models/template_response.rb +1 -1
  112. data/lib/smooch-api/models/template_update.rb +1 -1
  113. data/lib/smooch-api/models/upload_integration_profile_photo_response.rb +1 -1
  114. data/lib/smooch-api/models/webhook.rb +1 -1
  115. data/lib/smooch-api/models/webhook_create.rb +1 -1
  116. data/lib/smooch-api/models/webhook_response.rb +1 -1
  117. data/lib/smooch-api/models/webhook_update.rb +1 -1
  118. data/lib/smooch-api/version.rb +2 -2
  119. data/smooch-api.gemspec +1 -1
  120. data/spec/api_client_spec.rb +1 -1
  121. data/spec/configuration_spec.rb +1 -1
  122. data/spec/spec_helper.rb +1 -1
  123. metadata +12 -2
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- OpenAPI spec version: 5.12
6
+ OpenAPI spec version: 5.13
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
  Swagger Codegen version: 2.2.3-SNAPSHOT
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- OpenAPI spec version: 5.12
6
+ OpenAPI spec version: 5.13
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
  Swagger Codegen version: 2.2.3-SNAPSHOT
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- OpenAPI spec version: 5.12
6
+ OpenAPI spec version: 5.13
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
  Swagger Codegen version: 2.2.3-SNAPSHOT
@@ -66,6 +66,21 @@ module SmoochApi
66
66
  # Settings to adjust the carousel layout. See [Display Settings](https://docs.smooch.io/rest/#display-settings).
67
67
  attr_accessor :displaySettings
68
68
 
69
+ # Indicates if the Web SDK chat input should be blocked. Defaults to false. Only for form messages.
70
+ attr_accessor :blockChatInput
71
+
72
+ # The fields in the form. Required for form and formResponse messages.
73
+ attr_accessor :fields
74
+
75
+ # Indicates if the form was submitted. Generated automatically.
76
+ attr_accessor :submitted
77
+
78
+ # The form message a formResponse message responds to. Required for formResponse messages.
79
+ attr_accessor :quotedMessage
80
+
81
+ # The text fallback displayed in channels that do not support form messages. Only for formResponse messages. Generated automatically.
82
+ attr_accessor :textFallback
83
+
69
84
 
70
85
  # Attribute mapping from ruby-style variable name to JSON key.
71
86
  def self.attribute_map
@@ -86,7 +101,12 @@ module SmoochApi
86
101
  :'items' => :'items',
87
102
  :'actions' => :'actions',
88
103
  :'payload' => :'payload',
89
- :'displaySettings' => :'displaySettings'
104
+ :'displaySettings' => :'displaySettings',
105
+ :'blockChatInput' => :'blockChatInput',
106
+ :'fields' => :'fields',
107
+ :'submitted' => :'submitted',
108
+ :'quotedMessage' => :'quotedMessage',
109
+ :'textFallback' => :'textFallback'
90
110
  }
91
111
  end
92
112
 
@@ -109,7 +129,12 @@ module SmoochApi
109
129
  :'items' => :'Array<MessageItem>',
110
130
  :'actions' => :'Array<Action>',
111
131
  :'payload' => :'String',
112
- :'displaySettings' => :'DisplaySettings'
132
+ :'displaySettings' => :'DisplaySettings',
133
+ :'blockChatInput' => :'BOOLEAN',
134
+ :'fields' => :'Array<Field>',
135
+ :'submitted' => :'BOOLEAN',
136
+ :'quotedMessage' => :'QuotedMessage',
137
+ :'textFallback' => :'String'
113
138
  }
114
139
  end
115
140
 
@@ -193,6 +218,28 @@ module SmoochApi
193
218
  self.displaySettings = attributes[:'displaySettings']
194
219
  end
195
220
 
221
+ if attributes.has_key?(:'blockChatInput')
222
+ self.blockChatInput = attributes[:'blockChatInput']
223
+ end
224
+
225
+ if attributes.has_key?(:'fields')
226
+ if (value = attributes[:'fields']).is_a?(Array)
227
+ self.fields = value
228
+ end
229
+ end
230
+
231
+ if attributes.has_key?(:'submitted')
232
+ self.submitted = attributes[:'submitted']
233
+ end
234
+
235
+ if attributes.has_key?(:'quotedMessage')
236
+ self.quotedMessage = attributes[:'quotedMessage']
237
+ end
238
+
239
+ if attributes.has_key?(:'textFallback')
240
+ self.textFallback = attributes[:'textFallback']
241
+ end
242
+
196
243
  end
197
244
 
198
245
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -269,7 +316,12 @@ module SmoochApi
269
316
  items == o.items &&
270
317
  actions == o.actions &&
271
318
  payload == o.payload &&
272
- displaySettings == o.displaySettings
319
+ displaySettings == o.displaySettings &&
320
+ blockChatInput == o.blockChatInput &&
321
+ fields == o.fields &&
322
+ submitted == o.submitted &&
323
+ quotedMessage == o.quotedMessage &&
324
+ textFallback == o.textFallback
273
325
  end
274
326
 
275
327
  # @see the `==` method
@@ -281,7 +333,7 @@ module SmoochApi
281
333
  # Calculates hash code according to all attributes.
282
334
  # @return [Fixnum] Hash code
283
335
  def hash
284
- [id, authorId, role, type, source, name, text, email, avatarUrl, received, mediaUrl, mediaType, metadata, items, actions, payload, displaySettings].hash
336
+ [id, authorId, role, type, source, name, text, email, avatarUrl, received, mediaUrl, mediaType, metadata, items, actions, payload, displaySettings, blockChatInput, fields, submitted, quotedMessage, textFallback].hash
285
337
  end
286
338
 
287
339
  # Builds the object from hash
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- OpenAPI spec version: 5.12
6
+ OpenAPI spec version: 5.13
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
  Swagger Codegen version: 2.2.3-SNAPSHOT
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- OpenAPI spec version: 5.12
6
+ OpenAPI spec version: 5.13
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
  Swagger Codegen version: 2.2.3-SNAPSHOT
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- OpenAPI spec version: 5.12
6
+ OpenAPI spec version: 5.13
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
  Swagger Codegen version: 2.2.3-SNAPSHOT
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- OpenAPI spec version: 5.12
6
+ OpenAPI spec version: 5.13
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
  Swagger Codegen version: 2.2.3-SNAPSHOT
@@ -51,6 +51,12 @@ module SmoochApi
51
51
  # The actions in the message.
52
52
  attr_accessor :actions
53
53
 
54
+ # Indicates if the Web SDK chat input should be blocked. Defaults to false. Only for form messages.
55
+ attr_accessor :blockChatInput
56
+
57
+ # The fields in the form. Required for form messages.
58
+ attr_accessor :fields
59
+
54
60
  # Specifies which channel to deliver a message to. See [list integrations](https://docs.smooch.io/rest/#list-integrations) to get integration ID and type.
55
61
  attr_accessor :destination
56
62
 
@@ -73,6 +79,8 @@ module SmoochApi
73
79
  :'mediaType' => :'mediaType',
74
80
  :'items' => :'items',
75
81
  :'actions' => :'actions',
82
+ :'blockChatInput' => :'blockChatInput',
83
+ :'fields' => :'fields',
76
84
  :'destination' => :'destination',
77
85
  :'override' => :'override'
78
86
  }
@@ -93,6 +101,8 @@ module SmoochApi
93
101
  :'mediaType' => :'String',
94
102
  :'items' => :'Array<MessageItem>',
95
103
  :'actions' => :'Array<Action>',
104
+ :'blockChatInput' => :'BOOLEAN',
105
+ :'fields' => :'Array<FieldPost>',
96
106
  :'destination' => :'Destination',
97
107
  :'override' => :'MessageOverride'
98
108
  }
@@ -158,6 +168,16 @@ module SmoochApi
158
168
  end
159
169
  end
160
170
 
171
+ if attributes.has_key?(:'blockChatInput')
172
+ self.blockChatInput = attributes[:'blockChatInput']
173
+ end
174
+
175
+ if attributes.has_key?(:'fields')
176
+ if (value = attributes[:'fields']).is_a?(Array)
177
+ self.fields = value
178
+ end
179
+ end
180
+
161
181
  if attributes.has_key?(:'destination')
162
182
  self.destination = attributes[:'destination']
163
183
  end
@@ -208,6 +228,8 @@ module SmoochApi
208
228
  mediaType == o.mediaType &&
209
229
  items == o.items &&
210
230
  actions == o.actions &&
231
+ blockChatInput == o.blockChatInput &&
232
+ fields == o.fields &&
211
233
  destination == o.destination &&
212
234
  override == o.override
213
235
  end
@@ -221,7 +243,7 @@ module SmoochApi
221
243
  # Calculates hash code according to all attributes.
222
244
  # @return [Fixnum] Hash code
223
245
  def hash
224
- [role, type, name, email, avatarUrl, metadata, payload, text, mediaUrl, mediaType, items, actions, destination, override].hash
246
+ [role, type, name, email, avatarUrl, metadata, payload, text, mediaUrl, mediaType, items, actions, blockChatInput, fields, destination, override].hash
225
247
  end
226
248
 
227
249
  # Builds the object from hash
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- OpenAPI spec version: 5.12
6
+ OpenAPI spec version: 5.13
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
  Swagger Codegen version: 2.2.3-SNAPSHOT
@@ -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.13
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 Option
18
+ # The name of the option. It must be unique per field.
19
+ attr_accessor :name
20
+
21
+ # The label the option will be displayed with on Web Messenger.
22
+ attr_accessor :label
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'name' => :'name',
29
+ :'label' => :'label'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'name' => :'String',
37
+ :'label' => :'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?(:'name')
50
+ self.name = attributes[:'name']
51
+ end
52
+
53
+ if attributes.has_key?(:'label')
54
+ self.label = attributes[:'label']
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 @name.nil?
64
+ invalid_properties.push("invalid value for 'name', name cannot be nil.")
65
+ end
66
+
67
+ if @label.nil?
68
+ invalid_properties.push("invalid value for 'label', label 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 @name.nil?
78
+ return false if @label.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
+ name == o.name &&
88
+ label == o.label
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
+ [name, label].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,213 @@
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.13
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 QuotedMessage
18
+ # The quoted message type. See [**QuotedMessageTypeEnum**](Enums.md#QuotedMessageTypeEnum) for available values.
19
+ attr_accessor :type
20
+
21
+ # The external message Id of the quoted message. Only for quoted messages with type set to externalMessageId.
22
+ attr_accessor :externalMessageId
23
+
24
+ attr_accessor :content
25
+
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'type' => :'type',
31
+ :'externalMessageId' => :'externalMessageId',
32
+ :'content' => :'content'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.swagger_types
38
+ {
39
+ :'type' => :'String',
40
+ :'externalMessageId' => :'String',
41
+ :'content' => :'Message'
42
+ }
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ return unless attributes.is_a?(Hash)
49
+
50
+ # convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
52
+
53
+ if attributes.has_key?(:'type')
54
+ self.type = attributes[:'type']
55
+ end
56
+
57
+ if attributes.has_key?(:'externalMessageId')
58
+ self.externalMessageId = attributes[:'externalMessageId']
59
+ end
60
+
61
+ if attributes.has_key?(:'content')
62
+ self.content = attributes[:'content']
63
+ end
64
+
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properies with the reasons
69
+ def list_invalid_properties
70
+ invalid_properties = Array.new
71
+ if @type.nil?
72
+ invalid_properties.push("invalid value for 'type', type cannot be nil.")
73
+ end
74
+
75
+ return invalid_properties
76
+ end
77
+
78
+ # Check to see if the all the properties in the model are valid
79
+ # @return true if the model is valid
80
+ def valid?
81
+ return false if @type.nil?
82
+ return true
83
+ end
84
+
85
+ # Checks equality by comparing each attribute.
86
+ # @param [Object] Object to be compared
87
+ def ==(o)
88
+ return true if self.equal?(o)
89
+ self.class == o.class &&
90
+ type == o.type &&
91
+ externalMessageId == o.externalMessageId &&
92
+ content == o.content
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Fixnum] Hash code
103
+ def hash
104
+ [type, externalMessageId, content].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ self.class.swagger_types.each_pair do |key, type|
113
+ if type =~ /\AArray<(.*)>/i
114
+ # check to ensure the input is an array given that the the attribute
115
+ # is documented as an array but the input is not
116
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
117
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
118
+ end
119
+ elsif !attributes[self.class.attribute_map[key]].nil?
120
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
121
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
122
+ end
123
+
124
+ self
125
+ end
126
+
127
+ # Deserializes the data based on type
128
+ # @param string type Data type
129
+ # @param string value Value to be deserialized
130
+ # @return [Object] Deserialized data
131
+ def _deserialize(type, value)
132
+ case type.to_sym
133
+ when :DateTime
134
+ DateTime.parse(value)
135
+ when :Date
136
+ Date.parse(value)
137
+ when :String
138
+ value.to_s
139
+ when :Integer
140
+ value.to_i
141
+ when :Float
142
+ value.to_f
143
+ when :BOOLEAN
144
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
145
+ true
146
+ else
147
+ false
148
+ end
149
+ when :Object
150
+ # generic object (usually a Hash), return directly
151
+ value
152
+ when /\AArray<(?<inner_type>.+)>\z/
153
+ inner_type = Regexp.last_match[:inner_type]
154
+ value.map { |v| _deserialize(inner_type, v) }
155
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
156
+ k_type = Regexp.last_match[:k_type]
157
+ v_type = Regexp.last_match[:v_type]
158
+ {}.tap do |hash|
159
+ value.each do |k, v|
160
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
161
+ end
162
+ end
163
+ else # model
164
+ temp_model = SmoochApi.const_get(type).new
165
+ temp_model.build_from_hash(value)
166
+ end
167
+ end
168
+
169
+ # Returns the string representation of the object
170
+ # @return [String] String presentation of the object
171
+ def to_s
172
+ to_hash.to_s
173
+ end
174
+
175
+ # to_body is an alias to to_hash (backward compatibility)
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_body
178
+ to_hash
179
+ end
180
+
181
+ # Returns the object in the form of hash
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = self.send(attr)
187
+ next if value.nil?
188
+ hash[param] = _to_hash(value)
189
+ end
190
+ hash
191
+ end
192
+
193
+ # Outputs non-array value in the form of hash
194
+ # For object, use to_hash. Otherwise, just return the value
195
+ # @param [Object] value Any valid value
196
+ # @return [Hash] Returns the value in the form of hash
197
+ def _to_hash(value)
198
+ if value.is_a?(Array)
199
+ value.compact.map{ |v| _to_hash(v) }
200
+ elsif value.is_a?(Hash)
201
+ {}.tap do |hash|
202
+ value.each { |k, v| hash[k] = _to_hash(v) }
203
+ end
204
+ elsif value.respond_to? :to_hash
205
+ value.to_hash
206
+ else
207
+ value
208
+ end
209
+ end
210
+
211
+ end
212
+
213
+ end