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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -45,6 +45,10 @@ module SmoochApi
45
45
 
46
46
  attr_accessor :messageType
47
47
 
48
+ attr_accessor :fieldType
49
+
50
+ attr_accessor :quotedMessageType
51
+
48
52
  attr_accessor :role
49
53
 
50
54
  attr_accessor :webhookTriggers
@@ -89,6 +93,8 @@ module SmoochApi
89
93
  :'menuItemType' => :'MenuItemType',
90
94
  :'messageItemSize' => :'MessageItemSize',
91
95
  :'messageType' => :'MessageType',
96
+ :'fieldType' => :'FieldType',
97
+ :'quotedMessageType' => :'QuotedMessageType',
92
98
  :'role' => :'Role',
93
99
  :'webhookTriggers' => :'WebhookTriggers'
94
100
  }
@@ -112,6 +118,8 @@ module SmoochApi
112
118
  :'menuItemType' => :'String',
113
119
  :'messageItemSize' => :'String',
114
120
  :'messageType' => :'String',
121
+ :'fieldType' => :'String',
122
+ :'quotedMessageType' => :'String',
115
123
  :'role' => :'String',
116
124
  :'webhookTriggers' => :'String'
117
125
  }
@@ -185,6 +193,14 @@ module SmoochApi
185
193
  self.messageType = attributes[:'MessageType']
186
194
  end
187
195
 
196
+ if attributes.has_key?(:'FieldType')
197
+ self.fieldType = attributes[:'FieldType']
198
+ end
199
+
200
+ if attributes.has_key?(:'QuotedMessageType')
201
+ self.quotedMessageType = attributes[:'QuotedMessageType']
202
+ end
203
+
188
204
  if attributes.has_key?(:'Role')
189
205
  self.role = attributes[:'Role']
190
206
  end
@@ -233,8 +249,12 @@ module SmoochApi
233
249
  return false unless menuItemType_validator.valid?(@menuItemType)
234
250
  messageItemSize_validator = EnumAttributeValidator.new('String', ["compact", "large"])
235
251
  return false unless messageItemSize_validator.valid?(@messageItemSize)
236
- messageType_validator = EnumAttributeValidator.new('String', ["carousel", "file", "image", "list", "location", "text"])
252
+ messageType_validator = EnumAttributeValidator.new('String', ["carousel", "file", "image", "list", "location", "text", "form", "formResponse"])
237
253
  return false unless messageType_validator.valid?(@messageType)
254
+ fieldType_validator = EnumAttributeValidator.new('String', ["text", "email", "select"])
255
+ return false unless fieldType_validator.valid?(@fieldType)
256
+ quotedMessageType_validator = EnumAttributeValidator.new('String', ["message", "externalMessageId"])
257
+ return false unless quotedMessageType_validator.valid?(@quotedMessageType)
238
258
  role_validator = EnumAttributeValidator.new('String', ["appMaker", "appUser"])
239
259
  return false unless role_validator.valid?(@role)
240
260
  webhookTriggers_validator = EnumAttributeValidator.new('String', ["appUser:delete", "client:add", "client:remove", "conversation:read", "conversation:referral", "link:failure", "link:match", "link:success", "merge:appUser", "message:appMaker", "message:appUser", "message:delivery:channel", "message:delivery:failure", "message:delivery:user", "payment:success", "postback", "typing:appUser"])
@@ -385,13 +405,33 @@ module SmoochApi
385
405
  # Custom attribute writer method checking allowed values (enum).
386
406
  # @param [Object] messageType Object to be assigned
387
407
  def messageType=(messageType)
388
- validator = EnumAttributeValidator.new('String', ["carousel", "file", "image", "list", "location", "text"])
408
+ validator = EnumAttributeValidator.new('String', ["carousel", "file", "image", "list", "location", "text", "form", "formResponse"])
389
409
  unless validator.valid?(messageType)
390
410
  fail ArgumentError, "invalid value for 'messageType', must be one of #{validator.allowable_values}."
391
411
  end
392
412
  @messageType = messageType
393
413
  end
394
414
 
415
+ # Custom attribute writer method checking allowed values (enum).
416
+ # @param [Object] fieldType Object to be assigned
417
+ def fieldType=(fieldType)
418
+ validator = EnumAttributeValidator.new('String', ["text", "email", "select"])
419
+ unless validator.valid?(fieldType)
420
+ fail ArgumentError, "invalid value for 'fieldType', must be one of #{validator.allowable_values}."
421
+ end
422
+ @fieldType = fieldType
423
+ end
424
+
425
+ # Custom attribute writer method checking allowed values (enum).
426
+ # @param [Object] quotedMessageType Object to be assigned
427
+ def quotedMessageType=(quotedMessageType)
428
+ validator = EnumAttributeValidator.new('String', ["message", "externalMessageId"])
429
+ unless validator.valid?(quotedMessageType)
430
+ fail ArgumentError, "invalid value for 'quotedMessageType', must be one of #{validator.allowable_values}."
431
+ end
432
+ @quotedMessageType = quotedMessageType
433
+ end
434
+
395
435
  # Custom attribute writer method checking allowed values (enum).
396
436
  # @param [Object] role Object to be assigned
397
437
  def role=(role)
@@ -432,6 +472,8 @@ module SmoochApi
432
472
  menuItemType == o.menuItemType &&
433
473
  messageItemSize == o.messageItemSize &&
434
474
  messageType == o.messageType &&
475
+ fieldType == o.fieldType &&
476
+ quotedMessageType == o.quotedMessageType &&
435
477
  role == o.role &&
436
478
  webhookTriggers == o.webhookTriggers
437
479
  end
@@ -445,7 +487,7 @@ module SmoochApi
445
487
  # Calculates hash code according to all attributes.
446
488
  # @return [Fixnum] Hash code
447
489
  def hash
448
- [actionSize, actionType, businessSystemType, clientStatus, confirmationType, conversationActivityType, deploymentActivationMethod, deploymentHosting, deploymentStatus, imageAspectRatio, integrationStatus, integrationType, menuItemType, messageItemSize, messageType, role, webhookTriggers].hash
490
+ [actionSize, actionType, businessSystemType, clientStatus, confirmationType, conversationActivityType, deploymentActivationMethod, deploymentHosting, deploymentStatus, imageAspectRatio, integrationStatus, integrationType, menuItemType, messageItemSize, messageType, fieldType, quotedMessageType, role, webhookTriggers].hash
449
491
  end
450
492
 
451
493
  # Builds the object from hash
@@ -0,0 +1,318 @@
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 Field
18
+ # The field ID, generated automatically.
19
+ attr_accessor :id
20
+
21
+ # The field type. See [**FieldTypeEnum**](Enums.md#FieldTypeEnum) for available values.
22
+ attr_accessor :type
23
+
24
+ # The name of the field. Each field name must be unique per form.
25
+ attr_accessor :name
26
+
27
+ # The label to be displayed with the field.
28
+ attr_accessor :label
29
+
30
+ # The placeholder text of the field that will be rendered. Only for form messages
31
+ attr_accessor :placeholder
32
+
33
+ # The minimum possible length of the response. Defaults to 1 if not specified. Only for text fields in form messages.
34
+ attr_accessor :minSize
35
+
36
+ # The maximum possible length of the response. Defaults to 128 if not specified. Only for text fields in form messages.
37
+ attr_accessor :maxSize
38
+
39
+ # The field options that can be selected. The array is limited to 20 options. Only for select fields in form messages.
40
+ attr_accessor :options
41
+
42
+ # The select size, generated automatically. Only for select fields in form messages.
43
+ attr_accessor :selectSize
44
+
45
+ # The text response to a text field. Required for text fields in form response messages.
46
+ attr_accessor :text
47
+
48
+ # The email response to an email field. Required for email fields in form response messages.
49
+ attr_accessor :email
50
+
51
+ # The options selected as a response to a select field. Required for select fields in form response messages.
52
+ attr_accessor :select
53
+
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'id' => :'_id',
59
+ :'type' => :'type',
60
+ :'name' => :'name',
61
+ :'label' => :'label',
62
+ :'placeholder' => :'placeholder',
63
+ :'minSize' => :'minSize',
64
+ :'maxSize' => :'maxSize',
65
+ :'options' => :'options',
66
+ :'selectSize' => :'selectSize',
67
+ :'text' => :'text',
68
+ :'email' => :'email',
69
+ :'select' => :'select'
70
+ }
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.swagger_types
75
+ {
76
+ :'id' => :'String',
77
+ :'type' => :'String',
78
+ :'name' => :'String',
79
+ :'label' => :'String',
80
+ :'placeholder' => :'String',
81
+ :'minSize' => :'Integer',
82
+ :'maxSize' => :'Integer',
83
+ :'options' => :'Array<Option>',
84
+ :'selectSize' => :'Integer',
85
+ :'text' => :'String',
86
+ :'email' => :'String',
87
+ :'select' => :'Array<Select>'
88
+ }
89
+ end
90
+
91
+ # Initializes the object
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ def initialize(attributes = {})
94
+ return unless attributes.is_a?(Hash)
95
+
96
+ # convert string to symbol for hash key
97
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
98
+
99
+ if attributes.has_key?(:'_id')
100
+ self.id = attributes[:'_id']
101
+ end
102
+
103
+ if attributes.has_key?(:'type')
104
+ self.type = attributes[:'type']
105
+ end
106
+
107
+ if attributes.has_key?(:'name')
108
+ self.name = attributes[:'name']
109
+ end
110
+
111
+ if attributes.has_key?(:'label')
112
+ self.label = attributes[:'label']
113
+ end
114
+
115
+ if attributes.has_key?(:'placeholder')
116
+ self.placeholder = attributes[:'placeholder']
117
+ end
118
+
119
+ if attributes.has_key?(:'minSize')
120
+ self.minSize = attributes[:'minSize']
121
+ end
122
+
123
+ if attributes.has_key?(:'maxSize')
124
+ self.maxSize = attributes[:'maxSize']
125
+ end
126
+
127
+ if attributes.has_key?(:'options')
128
+ if (value = attributes[:'options']).is_a?(Array)
129
+ self.options = value
130
+ end
131
+ end
132
+
133
+ if attributes.has_key?(:'selectSize')
134
+ self.selectSize = attributes[:'selectSize']
135
+ end
136
+
137
+ if attributes.has_key?(:'text')
138
+ self.text = attributes[:'text']
139
+ end
140
+
141
+ if attributes.has_key?(:'email')
142
+ self.email = attributes[:'email']
143
+ end
144
+
145
+ if attributes.has_key?(:'select')
146
+ if (value = attributes[:'select']).is_a?(Array)
147
+ self.select = value
148
+ end
149
+ end
150
+
151
+ end
152
+
153
+ # Show invalid properties with the reasons. Usually used together with valid?
154
+ # @return Array for valid properies with the reasons
155
+ def list_invalid_properties
156
+ invalid_properties = Array.new
157
+ if @type.nil?
158
+ invalid_properties.push("invalid value for 'type', type cannot be nil.")
159
+ end
160
+
161
+ if @name.nil?
162
+ invalid_properties.push("invalid value for 'name', name cannot be nil.")
163
+ end
164
+
165
+ if @label.nil?
166
+ invalid_properties.push("invalid value for 'label', label cannot be nil.")
167
+ end
168
+
169
+ return invalid_properties
170
+ end
171
+
172
+ # Check to see if the all the properties in the model are valid
173
+ # @return true if the model is valid
174
+ def valid?
175
+ return false if @type.nil?
176
+ return false if @name.nil?
177
+ return false if @label.nil?
178
+ return true
179
+ end
180
+
181
+ # Checks equality by comparing each attribute.
182
+ # @param [Object] Object to be compared
183
+ def ==(o)
184
+ return true if self.equal?(o)
185
+ self.class == o.class &&
186
+ id == o.id &&
187
+ type == o.type &&
188
+ name == o.name &&
189
+ label == o.label &&
190
+ placeholder == o.placeholder &&
191
+ minSize == o.minSize &&
192
+ maxSize == o.maxSize &&
193
+ options == o.options &&
194
+ selectSize == o.selectSize &&
195
+ text == o.text &&
196
+ email == o.email &&
197
+ select == o.select
198
+ end
199
+
200
+ # @see the `==` method
201
+ # @param [Object] Object to be compared
202
+ def eql?(o)
203
+ self == o
204
+ end
205
+
206
+ # Calculates hash code according to all attributes.
207
+ # @return [Fixnum] Hash code
208
+ def hash
209
+ [id, type, name, label, placeholder, minSize, maxSize, options, selectSize, text, email, select].hash
210
+ end
211
+
212
+ # Builds the object from hash
213
+ # @param [Hash] attributes Model attributes in the form of hash
214
+ # @return [Object] Returns the model itself
215
+ def build_from_hash(attributes)
216
+ return nil unless attributes.is_a?(Hash)
217
+ self.class.swagger_types.each_pair do |key, type|
218
+ if type =~ /\AArray<(.*)>/i
219
+ # check to ensure the input is an array given that the the attribute
220
+ # is documented as an array but the input is not
221
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
222
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
223
+ end
224
+ elsif !attributes[self.class.attribute_map[key]].nil?
225
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
226
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
227
+ end
228
+
229
+ self
230
+ end
231
+
232
+ # Deserializes the data based on type
233
+ # @param string type Data type
234
+ # @param string value Value to be deserialized
235
+ # @return [Object] Deserialized data
236
+ def _deserialize(type, value)
237
+ case type.to_sym
238
+ when :DateTime
239
+ DateTime.parse(value)
240
+ when :Date
241
+ Date.parse(value)
242
+ when :String
243
+ value.to_s
244
+ when :Integer
245
+ value.to_i
246
+ when :Float
247
+ value.to_f
248
+ when :BOOLEAN
249
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
250
+ true
251
+ else
252
+ false
253
+ end
254
+ when :Object
255
+ # generic object (usually a Hash), return directly
256
+ value
257
+ when /\AArray<(?<inner_type>.+)>\z/
258
+ inner_type = Regexp.last_match[:inner_type]
259
+ value.map { |v| _deserialize(inner_type, v) }
260
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
261
+ k_type = Regexp.last_match[:k_type]
262
+ v_type = Regexp.last_match[:v_type]
263
+ {}.tap do |hash|
264
+ value.each do |k, v|
265
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
266
+ end
267
+ end
268
+ else # model
269
+ temp_model = SmoochApi.const_get(type).new
270
+ temp_model.build_from_hash(value)
271
+ end
272
+ end
273
+
274
+ # Returns the string representation of the object
275
+ # @return [String] String presentation of the object
276
+ def to_s
277
+ to_hash.to_s
278
+ end
279
+
280
+ # to_body is an alias to to_hash (backward compatibility)
281
+ # @return [Hash] Returns the object in the form of hash
282
+ def to_body
283
+ to_hash
284
+ end
285
+
286
+ # Returns the object in the form of hash
287
+ # @return [Hash] Returns the object in the form of hash
288
+ def to_hash
289
+ hash = {}
290
+ self.class.attribute_map.each_pair do |attr, param|
291
+ value = self.send(attr)
292
+ next if value.nil?
293
+ hash[param] = _to_hash(value)
294
+ end
295
+ hash
296
+ end
297
+
298
+ # Outputs non-array value in the form of hash
299
+ # For object, use to_hash. Otherwise, just return the value
300
+ # @param [Object] value Any valid value
301
+ # @return [Hash] Returns the value in the form of hash
302
+ def _to_hash(value)
303
+ if value.is_a?(Array)
304
+ value.compact.map{ |v| _to_hash(v) }
305
+ elsif value.is_a?(Hash)
306
+ {}.tap do |hash|
307
+ value.each { |k, v| hash[k] = _to_hash(v) }
308
+ end
309
+ elsif value.respond_to? :to_hash
310
+ value.to_hash
311
+ else
312
+ value
313
+ end
314
+ end
315
+
316
+ end
317
+
318
+ end