sendx-ruby-sdk 1.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +220 -81
  3. data/lib/sendx-ruby-sdk/api/campaign_api.rb +95 -143
  4. data/lib/sendx-ruby-sdk/api/contact_api.rb +129 -96
  5. data/lib/sendx-ruby-sdk/api/custom_field_api.rb +391 -0
  6. data/lib/sendx-ruby-sdk/api/email_sending_api.rb +158 -0
  7. data/lib/sendx-ruby-sdk/api/event_api.rb +91 -57
  8. data/lib/sendx-ruby-sdk/api/events_api.rb +158 -0
  9. data/lib/sendx-ruby-sdk/api/getting_started_api.rb +2 -2
  10. data/lib/sendx-ruby-sdk/api/list_api.rb +126 -91
  11. data/lib/sendx-ruby-sdk/api/post_api.rb +380 -0
  12. data/lib/sendx-ruby-sdk/api/post_category_api.rb +362 -0
  13. data/lib/sendx-ruby-sdk/api/post_tag_api.rb +362 -0
  14. data/lib/sendx-ruby-sdk/api/report_api.rb +90 -0
  15. data/lib/sendx-ruby-sdk/api/reports_api.rb +4 -4
  16. data/lib/sendx-ruby-sdk/api/sender_api.rb +28 -37
  17. data/lib/sendx-ruby-sdk/api/tag_api.rb +380 -0
  18. data/lib/sendx-ruby-sdk/api/tags_api.rb +8 -8
  19. data/lib/sendx-ruby-sdk/api/team_member_api.rb +147 -0
  20. data/lib/sendx-ruby-sdk/api/template_api.rb +391 -0
  21. data/lib/sendx-ruby-sdk/api/tracking_api.rb +158 -0
  22. data/lib/sendx-ruby-sdk/api/webhook_api.rb +362 -0
  23. data/lib/sendx-ruby-sdk/api_client.rb +10 -11
  24. data/lib/sendx-ruby-sdk/api_error.rb +3 -3
  25. data/lib/sendx-ruby-sdk/configuration.rb +6 -10
  26. data/lib/sendx-ruby-sdk/models/campaign.rb +23 -7
  27. data/lib/sendx-ruby-sdk/models/campaign_dashboard_data.rb +11 -5
  28. data/lib/sendx-ruby-sdk/models/campaign_request.rb +13 -41
  29. data/lib/sendx-ruby-sdk/models/contact.rb +11 -5
  30. data/lib/sendx-ruby-sdk/models/contact_request.rb +11 -5
  31. data/lib/sendx-ruby-sdk/models/create_response.rb +11 -5
  32. data/lib/sendx-ruby-sdk/models/custom_event_request.rb +37 -42
  33. data/lib/sendx-ruby-sdk/models/custom_field.rb +285 -0
  34. data/lib/sendx-ruby-sdk/models/customfield_customfield_id_delete200_response.rb +220 -0
  35. data/lib/sendx-ruby-sdk/models/dashboard_stats.rb +11 -5
  36. data/lib/sendx-ruby-sdk/models/delete_campaign200_response.rb +11 -5
  37. data/lib/sendx-ruby-sdk/models/delete_request.rb +11 -5
  38. data/lib/sendx-ruby-sdk/models/delete_response.rb +77 -13
  39. data/lib/sendx-ruby-sdk/models/e_custom_field.rb +295 -0
  40. data/lib/sendx-ruby-sdk/models/error_response.rb +288 -0
  41. data/lib/sendx-ruby-sdk/models/event_response.rb +13 -19
  42. data/lib/sendx-ruby-sdk/models/events_revenue_postback_get200_response.rb +229 -0
  43. data/lib/sendx-ruby-sdk/models/events_revenue_postback_get400_response.rb +220 -0
  44. data/lib/sendx-ruby-sdk/models/events_revenue_postback_get500_response.rb +220 -0
  45. data/lib/sendx-ruby-sdk/models/identify_error_response.rb +220 -0
  46. data/lib/sendx-ruby-sdk/models/identify_request.rb +52 -40
  47. data/lib/sendx-ruby-sdk/models/identify_response.rb +16 -19
  48. data/lib/sendx-ruby-sdk/models/last_sent_campaign_stat.rb +11 -5
  49. data/lib/sendx-ruby-sdk/models/link_stat.rb +232 -0
  50. data/lib/sendx-ruby-sdk/models/list_model.rb +11 -6
  51. data/lib/sendx-ruby-sdk/models/list_request.rb +11 -5
  52. data/lib/sendx-ruby-sdk/models/message_response.rb +229 -0
  53. data/lib/sendx-ruby-sdk/models/operation_response.rb +241 -0
  54. data/lib/sendx-ruby-sdk/models/postback_response.rb +229 -0
  55. data/lib/sendx-ruby-sdk/models/report_data.rb +11 -5
  56. data/lib/sendx-ruby-sdk/models/response.rb +11 -5
  57. data/lib/sendx-ruby-sdk/models/rest_e_campaign.rb +539 -0
  58. data/lib/sendx-ruby-sdk/models/rest_e_contact.rb +380 -0
  59. data/lib/sendx-ruby-sdk/models/rest_e_custom_field.rb +299 -0
  60. data/lib/sendx-ruby-sdk/models/rest_e_list.rb +238 -0
  61. data/lib/sendx-ruby-sdk/models/rest_e_post.rb +443 -0
  62. data/lib/sendx-ruby-sdk/models/rest_e_post_category.rb +238 -0
  63. data/lib/sendx-ruby-sdk/models/rest_e_post_tag.rb +238 -0
  64. data/lib/sendx-ruby-sdk/models/rest_e_sender.rb +265 -0
  65. data/lib/sendx-ruby-sdk/models/rest_e_tag.rb +238 -0
  66. data/lib/sendx-ruby-sdk/models/rest_e_template.rb +307 -0
  67. data/lib/sendx-ruby-sdk/models/rest_e_webhook.rb +349 -0
  68. data/lib/sendx-ruby-sdk/models/rest_r_campaign.rb +580 -0
  69. data/lib/sendx-ruby-sdk/models/rest_r_contact.rb +438 -0
  70. data/lib/sendx-ruby-sdk/models/rest_r_custom_field.rb +306 -0
  71. data/lib/sendx-ruby-sdk/models/rest_r_list.rb +291 -0
  72. data/lib/sendx-ruby-sdk/models/rest_r_member.rb +274 -0
  73. data/lib/sendx-ruby-sdk/models/rest_r_post.rb +384 -0
  74. data/lib/sendx-ruby-sdk/models/rest_r_post_category.rb +251 -0
  75. data/lib/sendx-ruby-sdk/models/rest_r_post_tag.rb +250 -0
  76. data/lib/sendx-ruby-sdk/models/rest_r_sender.rb +272 -0
  77. data/lib/sendx-ruby-sdk/models/rest_r_tag.rb +272 -0
  78. data/lib/sendx-ruby-sdk/models/rest_r_template.rb +366 -0
  79. data/lib/sendx-ruby-sdk/models/rest_r_webhook.rb +326 -0
  80. data/lib/sendx-ruby-sdk/models/rest_report_data.rb +312 -0
  81. data/lib/sendx-ruby-sdk/models/revenue_event_request.rb +37 -42
  82. data/lib/sendx-ruby-sdk/models/sender.rb +41 -5
  83. data/lib/sendx-ruby-sdk/models/sender_request.rb +31 -5
  84. data/lib/sendx-ruby-sdk/models/sender_response.rb +51 -5
  85. data/lib/sendx-ruby-sdk/models/tag.rb +11 -5
  86. data/lib/sendx-ruby-sdk/models/tag_request.rb +11 -5
  87. data/lib/sendx-ruby-sdk/models/template_email_message.rb +337 -0
  88. data/lib/sendx-ruby-sdk/models/track_request.rb +28 -20
  89. data/lib/sendx-ruby-sdk/models/track_response.rb +12 -6
  90. data/lib/sendx-ruby-sdk/models/webhook.rb +311 -0
  91. data/lib/sendx-ruby-sdk/models/webhook_object.rb +451 -0
  92. data/lib/sendx-ruby-sdk/models/webhook_request.rb +291 -0
  93. data/lib/sendx-ruby-sdk/models/x_attachment.rb +263 -0
  94. data/lib/sendx-ruby-sdk/models/x_email_message.rb +356 -0
  95. data/lib/sendx-ruby-sdk/models/x_email_response.rb +261 -0
  96. data/lib/sendx-ruby-sdk/models/x_from.rb +246 -0
  97. data/lib/sendx-ruby-sdk/models/x_reply_to.rb +246 -0
  98. data/lib/sendx-ruby-sdk/models/xto.rb +279 -0
  99. data/lib/sendx-ruby-sdk/version.rb +4 -4
  100. data/lib/sendx-ruby-sdk.rb +53 -25
  101. data/spec/api/custom_field_api_spec.rb +98 -0
  102. data/spec/api/email_sending_api_spec.rb +59 -0
  103. data/spec/api/events_api_spec.rb +59 -0
  104. data/spec/api/post_api_spec.rb +97 -0
  105. data/spec/api/post_category_api_spec.rb +95 -0
  106. data/spec/api/post_tag_api_spec.rb +95 -0
  107. data/spec/api/report_api_spec.rb +47 -0
  108. data/spec/api/tag_api_spec.rb +97 -0
  109. data/spec/api/team_member_api_spec.rb +58 -0
  110. data/spec/api/template_api_spec.rb +98 -0
  111. data/spec/api/tracking_api_spec.rb +59 -0
  112. data/spec/api/webhook_api_spec.rb +95 -0
  113. data/spec/models/custom_field_spec.rb +58 -0
  114. data/spec/models/customfield_customfield_id_delete200_response_spec.rb +36 -0
  115. data/spec/models/e_custom_field_spec.rb +64 -0
  116. data/spec/models/error_response_spec.rb +46 -0
  117. data/spec/models/events_revenue_postback_get200_response_spec.rb +42 -0
  118. data/spec/models/events_revenue_postback_get400_response_spec.rb +36 -0
  119. data/spec/models/events_revenue_postback_get500_response_spec.rb +36 -0
  120. data/spec/models/identify_error_response_spec.rb +36 -0
  121. data/spec/models/link_stat_spec.rb +42 -0
  122. data/spec/models/message_response_spec.rb +42 -0
  123. data/spec/models/operation_response_spec.rb +48 -0
  124. data/spec/models/postback_response_spec.rb +42 -0
  125. data/spec/models/rest_e_campaign_spec.rb +154 -0
  126. data/spec/models/rest_e_contact_spec.rb +78 -0
  127. data/spec/models/rest_e_custom_field_spec.rb +52 -0
  128. data/spec/models/rest_e_list_spec.rb +36 -0
  129. data/spec/models/rest_e_post_category_spec.rb +36 -0
  130. data/spec/models/rest_e_post_spec.rb +144 -0
  131. data/spec/models/rest_e_post_tag_spec.rb +36 -0
  132. data/spec/models/rest_e_sender_spec.rb +42 -0
  133. data/spec/models/rest_e_tag_spec.rb +36 -0
  134. data/spec/models/rest_e_template_spec.rb +66 -0
  135. data/spec/models/rest_e_webhook_spec.rb +84 -0
  136. data/spec/models/rest_r_campaign_spec.rb +178 -0
  137. data/spec/models/rest_r_contact_spec.rb +150 -0
  138. data/spec/models/rest_r_custom_field_spec.rb +58 -0
  139. data/spec/models/rest_r_list_spec.rb +64 -0
  140. data/spec/models/rest_r_member_spec.rb +72 -0
  141. data/spec/models/rest_r_post_category_spec.rb +54 -0
  142. data/spec/models/rest_r_post_spec.rb +144 -0
  143. data/spec/models/rest_r_post_tag_spec.rb +54 -0
  144. data/spec/models/rest_r_sender_spec.rb +54 -0
  145. data/spec/models/rest_r_tag_spec.rb +54 -0
  146. data/spec/models/rest_r_template_spec.rb +94 -0
  147. data/spec/models/rest_r_webhook_spec.rb +90 -0
  148. data/spec/models/rest_report_data_spec.rb +90 -0
  149. data/spec/models/template_email_message_spec.rb +72 -0
  150. data/spec/models/webhook_object_spec.rb +180 -0
  151. data/spec/models/webhook_request_spec.rb +78 -0
  152. data/spec/models/webhook_spec.rb +90 -0
  153. data/spec/models/x_attachment_spec.rb +42 -0
  154. data/spec/models/x_email_message_spec.rb +90 -0
  155. data/spec/models/x_email_response_spec.rb +60 -0
  156. data/spec/models/x_from_spec.rb +42 -0
  157. data/spec/models/x_reply_to_spec.rb +42 -0
  158. data/spec/models/xto_spec.rb +60 -0
  159. data/spec/spec_helper.rb +3 -3
  160. metadata +202 -28
@@ -0,0 +1,451 @@
1
+ =begin
2
+ #SendX REST API
3
+
4
+ ## SendX REST API Documentation ## 🚀 Introduction The SendX API is organized around REST principles. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. **Key Features:** - 🔒 **Security**: Team-based authentication with optional member-level access - 🎯 **Resource-Oriented**: RESTful design with clear resource boundaries - 📊 **Rich Data Models**: Three-layer model system (Input/Output/Internal) - 🔗 **Relationships**: Automatic prefix handling for resource relationships - 📈 **Scalable**: Built for high-volume email marketing operations ## 🏗️ Architecture Overview SendX uses a three-layer model architecture: 1. **Input Models** (`RestE*`): For API requests 2. **Output Models** (`RestR*`): For API responses with prefixed IDs 3. **Internal Models**: Core business logic (not exposed in API) ## 🔐 Security & Authentication SendX uses API key authentication: ### Team API Key ```http X-Team-ApiKey: YOUR_TEAM_API_KEY ``` - **Required for all requests** - Team-level access to resources - Available in SendX Settings → Team API Key ## 🆔 Encrypted ID System SendX uses encrypted IDs for security and better developer experience: - **Internal IDs**: Sequential integers (not exposed) - **Encrypted IDs**: 22-character alphanumeric strings - **Prefixed IDs**: Resource-type prefixes in API responses (`contact_<22-char-id>`) ### ID Format **All resource IDs follow this pattern:** ``` <resource_prefix>_<22_character_alphanumeric_string> ``` **Example:** ```json { \"id\": \"contact_BnKjkbBBS500CoBCP0oChQ\", \"lists\": [\"list_OcuxJHdiAvujmwQVJfd3ss\", \"list_0tOFLp5RgV7s3LNiHrjGYs\"], \"tags\": [\"tag_UhsDkjL772Qbj5lWtT62VK\", \"tag_fL7t9lsnZ9swvx2HrtQ9wM\"] } ``` ## 📚 Resource Prefixes | Resource | Prefix | Example | |----------|--------|---------| | Contact | `contact_` | `contact_BnKjkbBBS500CoBCP0oChQ` | | Campaign | `campaign_` | `campaign_LUE9BTxmksSmqHWbh96zsn` | | List | `list_` | `list_OcuxJHdiAvujmwQVJfd3ss` | | Tag | `tag_` | `tag_UhsDkjL772Qbj5lWtT62VK` | | Sender | `sender_` | `sender_4vK3WFhMgvOwUNyaL4QxCD` | | Template | `template_` | `template_f3lJvTEhSjKGVb5Lwc5SWS` | | Custom Field | `field_` | `field_MnuqBAG2NPLm7PZMWbjQxt` | | Webhook | `webhook_` | `webhook_9l154iiXlZoPo7vngmamee` | | Post | `post_` | `post_XyZ123aBc456DeF789GhI` | | Post Category | `post_category_` | `post_category_YzS1wOU20yw87UUHKxMzwn` | | Post Tag | `post_tag_` | `post_tag_123XyZ456AbC` | | Member | `member_` | `member_JkL012MnO345PqR678` | ## 🎯 Best Practices ### Error Handling - **Always check status codes**: 2xx = success, 4xx = client error, 5xx = server error - **Read error messages**: Descriptive messages help debug issues - **Handle rate limits**: Respect API rate limits for optimal performance ### Data Validation - **Email format**: Must be valid email addresses - **Required fields**: Check documentation for mandatory fields - **Field lengths**: Respect maximum length constraints ### Performance - **Pagination**: Use offset/limit for large datasets - **Batch operations**: Process multiple items when supported - **Caching**: Cache responses when appropriate ## 🛠️ SDKs & Integration Official SDKs available for: - [Golang](https://github.com/sendx/sendx-go-sdk) - [Python](https://github.com/sendx/sendx-python-sdk) - [Ruby](https://github.com/sendx/sendx-ruby-sdk) - [Java](https://github.com/sendx/sendx-java-sdk) - [PHP](https://github.com/sendx/sendx-php-sdk) - [JavaScript](https://github.com/sendx/sendx-javascript-sdk) ## 📞 Support Need help? Contact us: - 💬 **Website Chat**: Available on sendx.io - 📧 **Email**: hello@sendx.io - 📚 **Documentation**: Full guides at help.sendx.io --- **API Endpoint:** `https://api.sendx.io/api/v1/rest` [<img src=\"https://run.pstmn.io/button.svg\" alt=\"Run In Postman\" style=\"width: 128px; height: 32px;\">](https://god.gw.postman.com/run-collection/33476323-44b198b0-5219-4619-a01f-cfc24d573885?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D33476323-44b198b0-5219-4619-a01f-cfc24d573885%26entityType%3Dcollection%26workspaceId%3D6b1e4f65-96a9-4136-9512-6266c852517e)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: hello@sendx.io
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.13.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SendX
17
+ class WebhookObject
18
+ # The type of the event.
19
+ attr_accessor :type
20
+
21
+ # The timestamp of the event in milliseconds since the epoch.
22
+ attr_accessor :time
23
+
24
+ # Arbitrary data associated with the event.
25
+ attr_accessor :data
26
+
27
+ # Optional provider message ID.
28
+ attr_accessor :provider_message_id
29
+
30
+ # Optional campaign ID.
31
+ attr_accessor :campaign_id
32
+
33
+ # Optional drip step ID.
34
+ attr_accessor :drip_step_id
35
+
36
+ # Optional RSS execution ID.
37
+ attr_accessor :rss_exec_id
38
+
39
+ # Optional tag ID.
40
+ attr_accessor :tag_id
41
+
42
+ # Optional link associated with the event.
43
+ attr_accessor :link
44
+
45
+ # Optional list ID.
46
+ attr_accessor :list_id
47
+
48
+ # Optional contact ID.
49
+ attr_accessor :contact_id
50
+
51
+ # Optional custom field ID.
52
+ attr_accessor :custom_field_id
53
+
54
+ # Optional template ID.
55
+ attr_accessor :template_id
56
+
57
+ # Optional popup ID.
58
+ attr_accessor :popup_id
59
+
60
+ # Optional landing page ID.
61
+ attr_accessor :landing_page_id
62
+
63
+ # Optional form ID.
64
+ attr_accessor :form_id
65
+
66
+ # Optional segment ID.
67
+ attr_accessor :segment_id
68
+
69
+ # Optional automation ID.
70
+ attr_accessor :automation_id
71
+
72
+ # Optional drip ID.
73
+ attr_accessor :drip_id
74
+
75
+ # Optional RSS ID.
76
+ attr_accessor :rss_id
77
+
78
+ # Optional A/B test ID.
79
+ attr_accessor :ab_test_id
80
+
81
+ # Optional workflow ID.
82
+ attr_accessor :workflow_id
83
+
84
+ # Optional workflow node ID.
85
+ attr_accessor :workflow_node_id
86
+
87
+ # Optional workflow email ID.
88
+ attr_accessor :workflow_email_id
89
+
90
+ # Attribute mapping from ruby-style variable name to JSON key.
91
+ def self.attribute_map
92
+ {
93
+ :'type' => :'type',
94
+ :'time' => :'time',
95
+ :'data' => :'data',
96
+ :'provider_message_id' => :'provider_message_id',
97
+ :'campaign_id' => :'campaign_id',
98
+ :'drip_step_id' => :'drip_step_id',
99
+ :'rss_exec_id' => :'rss_exec_id',
100
+ :'tag_id' => :'tag_id',
101
+ :'link' => :'link',
102
+ :'list_id' => :'list_id',
103
+ :'contact_id' => :'contact_id',
104
+ :'custom_field_id' => :'custom_field_id',
105
+ :'template_id' => :'template_id',
106
+ :'popup_id' => :'popup_id',
107
+ :'landing_page_id' => :'landing_page_id',
108
+ :'form_id' => :'form_id',
109
+ :'segment_id' => :'segment_id',
110
+ :'automation_id' => :'automation_id',
111
+ :'drip_id' => :'drip_id',
112
+ :'rss_id' => :'rss_id',
113
+ :'ab_test_id' => :'ab_test_id',
114
+ :'workflow_id' => :'workflow_id',
115
+ :'workflow_node_id' => :'workflow_node_id',
116
+ :'workflow_email_id' => :'workflow_email_id'
117
+ }
118
+ end
119
+
120
+ # Returns attribute mapping this model knows about
121
+ def self.acceptable_attribute_map
122
+ attribute_map
123
+ end
124
+
125
+ # Returns all the JSON keys this model knows about
126
+ def self.acceptable_attributes
127
+ acceptable_attribute_map.values
128
+ end
129
+
130
+ # Attribute type mapping.
131
+ def self.openapi_types
132
+ {
133
+ :'type' => :'Integer',
134
+ :'time' => :'Integer',
135
+ :'data' => :'String',
136
+ :'provider_message_id' => :'String',
137
+ :'campaign_id' => :'String',
138
+ :'drip_step_id' => :'String',
139
+ :'rss_exec_id' => :'String',
140
+ :'tag_id' => :'String',
141
+ :'link' => :'String',
142
+ :'list_id' => :'String',
143
+ :'contact_id' => :'String',
144
+ :'custom_field_id' => :'String',
145
+ :'template_id' => :'String',
146
+ :'popup_id' => :'String',
147
+ :'landing_page_id' => :'String',
148
+ :'form_id' => :'String',
149
+ :'segment_id' => :'String',
150
+ :'automation_id' => :'String',
151
+ :'drip_id' => :'String',
152
+ :'rss_id' => :'String',
153
+ :'ab_test_id' => :'String',
154
+ :'workflow_id' => :'String',
155
+ :'workflow_node_id' => :'String',
156
+ :'workflow_email_id' => :'String'
157
+ }
158
+ end
159
+
160
+ # List of attributes with nullable: true
161
+ def self.openapi_nullable
162
+ Set.new([
163
+ ])
164
+ end
165
+
166
+ # Initializes the object
167
+ # @param [Hash] attributes Model attributes in the form of hash
168
+ def initialize(attributes = {})
169
+ if (!attributes.is_a?(Hash))
170
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SendX::WebhookObject` initialize method"
171
+ end
172
+
173
+ # check to see if the attribute exists and convert string to symbol for hash key
174
+ acceptable_attribute_map = self.class.acceptable_attribute_map
175
+ attributes = attributes.each_with_object({}) { |(k, v), h|
176
+ if (!acceptable_attribute_map.key?(k.to_sym))
177
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SendX::WebhookObject`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
178
+ end
179
+ h[k.to_sym] = v
180
+ }
181
+
182
+ if attributes.key?(:'type')
183
+ self.type = attributes[:'type']
184
+ end
185
+
186
+ if attributes.key?(:'time')
187
+ self.time = attributes[:'time']
188
+ end
189
+
190
+ if attributes.key?(:'data')
191
+ self.data = attributes[:'data']
192
+ end
193
+
194
+ if attributes.key?(:'provider_message_id')
195
+ self.provider_message_id = attributes[:'provider_message_id']
196
+ end
197
+
198
+ if attributes.key?(:'campaign_id')
199
+ self.campaign_id = attributes[:'campaign_id']
200
+ end
201
+
202
+ if attributes.key?(:'drip_step_id')
203
+ self.drip_step_id = attributes[:'drip_step_id']
204
+ end
205
+
206
+ if attributes.key?(:'rss_exec_id')
207
+ self.rss_exec_id = attributes[:'rss_exec_id']
208
+ end
209
+
210
+ if attributes.key?(:'tag_id')
211
+ self.tag_id = attributes[:'tag_id']
212
+ end
213
+
214
+ if attributes.key?(:'link')
215
+ self.link = attributes[:'link']
216
+ end
217
+
218
+ if attributes.key?(:'list_id')
219
+ self.list_id = attributes[:'list_id']
220
+ end
221
+
222
+ if attributes.key?(:'contact_id')
223
+ self.contact_id = attributes[:'contact_id']
224
+ end
225
+
226
+ if attributes.key?(:'custom_field_id')
227
+ self.custom_field_id = attributes[:'custom_field_id']
228
+ end
229
+
230
+ if attributes.key?(:'template_id')
231
+ self.template_id = attributes[:'template_id']
232
+ end
233
+
234
+ if attributes.key?(:'popup_id')
235
+ self.popup_id = attributes[:'popup_id']
236
+ end
237
+
238
+ if attributes.key?(:'landing_page_id')
239
+ self.landing_page_id = attributes[:'landing_page_id']
240
+ end
241
+
242
+ if attributes.key?(:'form_id')
243
+ self.form_id = attributes[:'form_id']
244
+ end
245
+
246
+ if attributes.key?(:'segment_id')
247
+ self.segment_id = attributes[:'segment_id']
248
+ end
249
+
250
+ if attributes.key?(:'automation_id')
251
+ self.automation_id = attributes[:'automation_id']
252
+ end
253
+
254
+ if attributes.key?(:'drip_id')
255
+ self.drip_id = attributes[:'drip_id']
256
+ end
257
+
258
+ if attributes.key?(:'rss_id')
259
+ self.rss_id = attributes[:'rss_id']
260
+ end
261
+
262
+ if attributes.key?(:'ab_test_id')
263
+ self.ab_test_id = attributes[:'ab_test_id']
264
+ end
265
+
266
+ if attributes.key?(:'workflow_id')
267
+ self.workflow_id = attributes[:'workflow_id']
268
+ end
269
+
270
+ if attributes.key?(:'workflow_node_id')
271
+ self.workflow_node_id = attributes[:'workflow_node_id']
272
+ end
273
+
274
+ if attributes.key?(:'workflow_email_id')
275
+ self.workflow_email_id = attributes[:'workflow_email_id']
276
+ end
277
+ end
278
+
279
+ # Show invalid properties with the reasons. Usually used together with valid?
280
+ # @return Array for valid properties with the reasons
281
+ def list_invalid_properties
282
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
283
+ invalid_properties = Array.new
284
+ invalid_properties
285
+ end
286
+
287
+ # Check to see if the all the properties in the model are valid
288
+ # @return true if the model is valid
289
+ def valid?
290
+ warn '[DEPRECATED] the `valid?` method is obsolete'
291
+ true
292
+ end
293
+
294
+ # Checks equality by comparing each attribute.
295
+ # @param [Object] Object to be compared
296
+ def ==(o)
297
+ return true if self.equal?(o)
298
+ self.class == o.class &&
299
+ type == o.type &&
300
+ time == o.time &&
301
+ data == o.data &&
302
+ provider_message_id == o.provider_message_id &&
303
+ campaign_id == o.campaign_id &&
304
+ drip_step_id == o.drip_step_id &&
305
+ rss_exec_id == o.rss_exec_id &&
306
+ tag_id == o.tag_id &&
307
+ link == o.link &&
308
+ list_id == o.list_id &&
309
+ contact_id == o.contact_id &&
310
+ custom_field_id == o.custom_field_id &&
311
+ template_id == o.template_id &&
312
+ popup_id == o.popup_id &&
313
+ landing_page_id == o.landing_page_id &&
314
+ form_id == o.form_id &&
315
+ segment_id == o.segment_id &&
316
+ automation_id == o.automation_id &&
317
+ drip_id == o.drip_id &&
318
+ rss_id == o.rss_id &&
319
+ ab_test_id == o.ab_test_id &&
320
+ workflow_id == o.workflow_id &&
321
+ workflow_node_id == o.workflow_node_id &&
322
+ workflow_email_id == o.workflow_email_id
323
+ end
324
+
325
+ # @see the `==` method
326
+ # @param [Object] Object to be compared
327
+ def eql?(o)
328
+ self == o
329
+ end
330
+
331
+ # Calculates hash code according to all attributes.
332
+ # @return [Integer] Hash code
333
+ def hash
334
+ [type, time, data, provider_message_id, campaign_id, drip_step_id, rss_exec_id, tag_id, link, list_id, contact_id, custom_field_id, template_id, popup_id, landing_page_id, form_id, segment_id, automation_id, drip_id, rss_id, ab_test_id, workflow_id, workflow_node_id, workflow_email_id].hash
335
+ end
336
+
337
+ # Builds the object from hash
338
+ # @param [Hash] attributes Model attributes in the form of hash
339
+ # @return [Object] Returns the model itself
340
+ def self.build_from_hash(attributes)
341
+ return nil unless attributes.is_a?(Hash)
342
+ attributes = attributes.transform_keys(&:to_sym)
343
+ transformed_hash = {}
344
+ openapi_types.each_pair do |key, type|
345
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
346
+ transformed_hash["#{key}"] = nil
347
+ elsif type =~ /\AArray<(.*)>/i
348
+ # check to ensure the input is an array given that the attribute
349
+ # is documented as an array but the input is not
350
+ if attributes[attribute_map[key]].is_a?(Array)
351
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
352
+ end
353
+ elsif !attributes[attribute_map[key]].nil?
354
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
355
+ end
356
+ end
357
+ new(transformed_hash)
358
+ end
359
+
360
+ # Deserializes the data based on type
361
+ # @param string type Data type
362
+ # @param string value Value to be deserialized
363
+ # @return [Object] Deserialized data
364
+ def self._deserialize(type, value)
365
+ case type.to_sym
366
+ when :Time
367
+ Time.parse(value)
368
+ when :Date
369
+ Date.parse(value)
370
+ when :String
371
+ value.to_s
372
+ when :Integer
373
+ value.to_i
374
+ when :Float
375
+ value.to_f
376
+ when :Boolean
377
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
378
+ true
379
+ else
380
+ false
381
+ end
382
+ when :Object
383
+ # generic object (usually a Hash), return directly
384
+ value
385
+ when /\AArray<(?<inner_type>.+)>\z/
386
+ inner_type = Regexp.last_match[:inner_type]
387
+ value.map { |v| _deserialize(inner_type, v) }
388
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
389
+ k_type = Regexp.last_match[:k_type]
390
+ v_type = Regexp.last_match[:v_type]
391
+ {}.tap do |hash|
392
+ value.each do |k, v|
393
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
394
+ end
395
+ end
396
+ else # model
397
+ # models (e.g. Pet) or oneOf
398
+ klass = SendX.const_get(type)
399
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
400
+ end
401
+ end
402
+
403
+ # Returns the string representation of the object
404
+ # @return [String] String presentation of the object
405
+ def to_s
406
+ to_hash.to_s
407
+ end
408
+
409
+ # to_body is an alias to to_hash (backward compatibility)
410
+ # @return [Hash] Returns the object in the form of hash
411
+ def to_body
412
+ to_hash
413
+ end
414
+
415
+ # Returns the object in the form of hash
416
+ # @return [Hash] Returns the object in the form of hash
417
+ def to_hash
418
+ hash = {}
419
+ self.class.attribute_map.each_pair do |attr, param|
420
+ value = self.send(attr)
421
+ if value.nil?
422
+ is_nullable = self.class.openapi_nullable.include?(attr)
423
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
424
+ end
425
+
426
+ hash[param] = _to_hash(value)
427
+ end
428
+ hash
429
+ end
430
+
431
+ # Outputs non-array value in the form of hash
432
+ # For object, use to_hash. Otherwise, just return the value
433
+ # @param [Object] value Any valid value
434
+ # @return [Hash] Returns the value in the form of hash
435
+ def _to_hash(value)
436
+ if value.is_a?(Array)
437
+ value.compact.map { |v| _to_hash(v) }
438
+ elsif value.is_a?(Hash)
439
+ {}.tap do |hash|
440
+ value.each { |k, v| hash[k] = _to_hash(v) }
441
+ end
442
+ elsif value.respond_to? :to_hash
443
+ value.to_hash
444
+ else
445
+ value
446
+ end
447
+ end
448
+
449
+ end
450
+
451
+ end