late-sdk 0.0.822 → 0.0.824

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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -0
  3. data/docs/AnalyticsApi.md +78 -0
  4. data/docs/AnalyticsDeltaEntry.md +34 -0
  5. data/docs/AnalyticsDeltaEntryMetrics.md +44 -0
  6. data/docs/AnalyticsDeltaResponse.md +22 -0
  7. data/docs/BoostPostRequest.md +3 -1
  8. data/docs/CreateCallAdRequest.md +3 -1
  9. data/docs/CreateMessagingAdRequest.md +3 -1
  10. data/docs/CreateStandaloneAdRequest.md +3 -1
  11. data/docs/CtwaAdRequestBody.md +4 -2
  12. data/docs/WebhookEventsApi.md +69 -0
  13. data/docs/WebhookPayloadAnalyticsSynced.md +26 -0
  14. data/docs/WebhookPayloadAnalyticsSyncedAccount.md +24 -0
  15. data/docs/WebhookPayloadAnalyticsSyncedSync.md +20 -0
  16. data/docs/WebhookPayloadMessageMetadata.md +3 -1
  17. data/docs/WebhookPayloadMessageMetadataQuotedMessage.md +20 -0
  18. data/lib/zernio-sdk/api/analytics_api.rb +77 -0
  19. data/lib/zernio-sdk/api/webhook_events_api.rb +66 -0
  20. data/lib/zernio-sdk/models/analytics_delta_entry.rb +380 -0
  21. data/lib/zernio-sdk/models/analytics_delta_entry_metrics.rb +507 -0
  22. data/lib/zernio-sdk/models/analytics_delta_response.rb +221 -0
  23. data/lib/zernio-sdk/models/boost_post_request.rb +14 -2
  24. data/lib/zernio-sdk/models/create_call_ad_request.rb +14 -2
  25. data/lib/zernio-sdk/models/create_messaging_ad_request.rb +14 -2
  26. data/lib/zernio-sdk/models/create_standalone_ad_request.rb +14 -2
  27. data/lib/zernio-sdk/models/ctwa_ad_request_body.rb +17 -5
  28. data/lib/zernio-sdk/models/webhook_payload_analytics_synced.rb +295 -0
  29. data/lib/zernio-sdk/models/webhook_payload_analytics_synced_account.rb +244 -0
  30. data/lib/zernio-sdk/models/webhook_payload_analytics_synced_sync.rb +193 -0
  31. data/lib/zernio-sdk/models/webhook_payload_message_metadata.rb +11 -2
  32. data/lib/zernio-sdk/models/webhook_payload_message_metadata_quoted_message.rb +159 -0
  33. data/lib/zernio-sdk/version.rb +1 -1
  34. data/lib/zernio-sdk.rb +7 -0
  35. data/openapi.yaml +414 -14
  36. data/spec/api/analytics_api_spec.rb +15 -0
  37. data/spec/models/analytics_delta_entry_metrics_spec.rb +114 -0
  38. data/spec/models/analytics_delta_entry_spec.rb +84 -0
  39. data/spec/models/analytics_delta_response_spec.rb +48 -0
  40. data/spec/models/boost_post_request_spec.rb +6 -0
  41. data/spec/models/create_call_ad_request_spec.rb +6 -0
  42. data/spec/models/create_messaging_ad_request_spec.rb +6 -0
  43. data/spec/models/create_standalone_ad_request_spec.rb +6 -0
  44. data/spec/models/create_webhook_settings_request_spec.rb +1 -1
  45. data/spec/models/ctwa_ad_request_body_spec.rb +6 -0
  46. data/spec/models/update_webhook_settings_request_spec.rb +1 -1
  47. data/spec/models/webhook_payload_analytics_synced_account_spec.rb +54 -0
  48. data/spec/models/webhook_payload_analytics_synced_spec.rb +64 -0
  49. data/spec/models/webhook_payload_analytics_synced_sync_spec.rb +42 -0
  50. data/spec/models/webhook_payload_message_metadata_quoted_message_spec.rb +42 -0
  51. data/spec/models/webhook_payload_message_metadata_spec.rb +6 -0
  52. data/spec/models/webhook_spec.rb +1 -1
  53. data/zernio-sdk-0.0.824.gem +0 -0
  54. metadata +31 -3
  55. data/zernio-sdk-0.0.822.gem +0 -0
@@ -133,6 +133,83 @@ module Zernio
133
133
  return data, status_code, headers
134
134
  end
135
135
 
136
+ # Analytics changed since a cursor
137
+ # Cursor feed of the analytics snapshots that CHANGED, across every account you can read, in one paginated stream. Built for integrations that would otherwise call `GET /v1/analytics` once per connected account. Each page carries changes from many accounts at once, so your call count scales with how much actually changed rather than with how many accounts you have. Measured against a fleet of roughly 1,600 connected accounts: about 1,599 per-account analytics calls an hour became about 205 delta calls an hour, a 7.8x reduction. **Bootstrap once, then stay in sync.** Load your baseline from `GET /v1/analytics`, which is the historical endpoint. This one is a rolling 7-day change log and cannot replay history. Then call this endpoint with NO `cursor`: it answers with an empty `data` array plus the feed's current position in `nextCursor`. Send that `nextCursor` back on the next call and you receive everything written since. `nextCursor` is present on every response, empty pages included, so you always have something to advance with. **Ordering.** Entries come back oldest first, in the order the feed received them. That order is NOT `syncedAt`: `syncedAt` is stamped when an account's sync cycle started, and a slow cycle writes its rows after a faster cycle that started later, so `syncedAt` can go backwards between consecutive entries. Do not sort, filter or resume on it. The cursor is the only stable position, and it is opaque: pass it back verbatim, and do not parse, construct or compare cursors. **`hasMore: false` does not mean the feed ended.** This stream has no end and `nextCursor` is never null. `hasMore: true` means more changes are already waiting, so call again straight away. `hasMore: false` means you are caught up: keep the cursor and poll again on your normal interval. **The newest changes settle before they are served.** The feed deliberately holds back its last few seconds of writes, so that a row can never become visible behind a cursor you have already advanced past. A read issued the instant an `analytics.synced` webhook lands will therefore often return an empty page for that account. Do not read an empty page as \"nothing changed\": poll again with the SAME cursor you just used rather than advancing. **Repeats inside one instant.** A sync cycle occasionally records the same post twice at the same feed position. When that happens the feed delivers one of those rows, not both. Measured over a day of production traffic, about 1.3% of rows fall in such a group and 99.4% of those groups are identical rows, so this is far more often deduplication than loss. Metrics are absolute values rather than increments, so a later entry for the same post supersedes an earlier one. **Retention is 7 days.** Changes older than that leave the feed. A cursor older than 6 days is rejected with a `400` (a day of margin, because expiry is lazy). Recover by re-bootstrapping from `GET /v1/analytics` and taking a fresh cursor from a call to this endpoint with no `cursor`. A consumer that polls at least daily never reaches this. Pairs with the `analytics.synced` webhook, so changes can be read on notification instead of on a timer. That event carries no cursor of its own: keep using the `nextCursor` this endpoint gave you. Requires the same analytics access as `GET /v1/analytics`, and shares the stricter per-second rate-limit window applied to analytics endpoints.
138
+ # @param [Hash] opts the optional parameters
139
+ # @option opts [String] :cursor Opaque cursor from a previous response's `nextCursor`. Omit it to start from now: the response is then an empty page carrying the feed's current position. Rejected with a `400` when malformed, or when older than the retention window.
140
+ # @option opts [Integer] :limit Page size. Out-of-range values are a 400, never a silent clamp. (default to 50)
141
+ # @option opts [String] :platform Filter to a single platform (for example \"youtube\"). Omit for every platform.
142
+ # @option opts [String] :profile_id Filter by profile ID (default \"all\"). Must be a valid profile ID or \"all\". (default to 'all')
143
+ # @return [AnalyticsDeltaResponse]
144
+ def get_analytics_delta(opts = {})
145
+ data, _status_code, _headers = get_analytics_delta_with_http_info(opts)
146
+ data
147
+ end
148
+
149
+ # Analytics changed since a cursor
150
+ # Cursor feed of the analytics snapshots that CHANGED, across every account you can read, in one paginated stream. Built for integrations that would otherwise call `GET /v1/analytics` once per connected account. Each page carries changes from many accounts at once, so your call count scales with how much actually changed rather than with how many accounts you have. Measured against a fleet of roughly 1,600 connected accounts: about 1,599 per-account analytics calls an hour became about 205 delta calls an hour, a 7.8x reduction. **Bootstrap once, then stay in sync.** Load your baseline from `GET /v1/analytics`, which is the historical endpoint. This one is a rolling 7-day change log and cannot replay history. Then call this endpoint with NO `cursor`: it answers with an empty `data` array plus the feed's current position in `nextCursor`. Send that `nextCursor` back on the next call and you receive everything written since. `nextCursor` is present on every response, empty pages included, so you always have something to advance with. **Ordering.** Entries come back oldest first, in the order the feed received them. That order is NOT `syncedAt`: `syncedAt` is stamped when an account's sync cycle started, and a slow cycle writes its rows after a faster cycle that started later, so `syncedAt` can go backwards between consecutive entries. Do not sort, filter or resume on it. The cursor is the only stable position, and it is opaque: pass it back verbatim, and do not parse, construct or compare cursors. **`hasMore: false` does not mean the feed ended.** This stream has no end and `nextCursor` is never null. `hasMore: true` means more changes are already waiting, so call again straight away. `hasMore: false` means you are caught up: keep the cursor and poll again on your normal interval. **The newest changes settle before they are served.** The feed deliberately holds back its last few seconds of writes, so that a row can never become visible behind a cursor you have already advanced past. A read issued the instant an `analytics.synced` webhook lands will therefore often return an empty page for that account. Do not read an empty page as \"nothing changed\": poll again with the SAME cursor you just used rather than advancing. **Repeats inside one instant.** A sync cycle occasionally records the same post twice at the same feed position. When that happens the feed delivers one of those rows, not both. Measured over a day of production traffic, about 1.3% of rows fall in such a group and 99.4% of those groups are identical rows, so this is far more often deduplication than loss. Metrics are absolute values rather than increments, so a later entry for the same post supersedes an earlier one. **Retention is 7 days.** Changes older than that leave the feed. A cursor older than 6 days is rejected with a `400` (a day of margin, because expiry is lazy). Recover by re-bootstrapping from `GET /v1/analytics` and taking a fresh cursor from a call to this endpoint with no `cursor`. A consumer that polls at least daily never reaches this. Pairs with the `analytics.synced` webhook, so changes can be read on notification instead of on a timer. That event carries no cursor of its own: keep using the `nextCursor` this endpoint gave you. Requires the same analytics access as `GET /v1/analytics`, and shares the stricter per-second rate-limit window applied to analytics endpoints.
151
+ # @param [Hash] opts the optional parameters
152
+ # @option opts [String] :cursor Opaque cursor from a previous response's `nextCursor`. Omit it to start from now: the response is then an empty page carrying the feed's current position. Rejected with a `400` when malformed, or when older than the retention window.
153
+ # @option opts [Integer] :limit Page size. Out-of-range values are a 400, never a silent clamp. (default to 50)
154
+ # @option opts [String] :platform Filter to a single platform (for example \"youtube\"). Omit for every platform.
155
+ # @option opts [String] :profile_id Filter by profile ID (default \"all\"). Must be a valid profile ID or \"all\". (default to 'all')
156
+ # @return [Array<(AnalyticsDeltaResponse, Integer, Hash)>] AnalyticsDeltaResponse data, response status code and response headers
157
+ def get_analytics_delta_with_http_info(opts = {})
158
+ if @api_client.config.debugging
159
+ @api_client.config.logger.debug 'Calling API: AnalyticsApi.get_analytics_delta ...'
160
+ end
161
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
162
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AnalyticsApi.get_analytics_delta, must be smaller than or equal to 100.'
163
+ end
164
+
165
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
166
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AnalyticsApi.get_analytics_delta, must be greater than or equal to 1.'
167
+ end
168
+
169
+ # resource path
170
+ local_var_path = '/v1/analytics/delta'
171
+
172
+ # query parameters
173
+ query_params = opts[:query_params] || {}
174
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
175
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
176
+ query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
177
+ query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
178
+
179
+ # header parameters
180
+ header_params = opts[:header_params] || {}
181
+ # HTTP header 'Accept' (if needed)
182
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
183
+
184
+ # form parameters
185
+ form_params = opts[:form_params] || {}
186
+
187
+ # http body (model)
188
+ post_body = opts[:debug_body]
189
+
190
+ # return_type
191
+ return_type = opts[:debug_return_type] || 'AnalyticsDeltaResponse'
192
+
193
+ # auth_names
194
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
195
+
196
+ new_options = opts.merge(
197
+ :operation => :"AnalyticsApi.get_analytics_delta",
198
+ :header_params => header_params,
199
+ :query_params => query_params,
200
+ :form_params => form_params,
201
+ :body => post_body,
202
+ :auth_names => auth_names,
203
+ :return_type => return_type
204
+ )
205
+
206
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
207
+ if @api_client.config.debugging
208
+ @api_client.config.logger.debug "API called: AnalyticsApi#get_analytics_delta\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
209
+ end
210
+ return data, status_code, headers
211
+ end
212
+
136
213
  # Get best times to post
137
214
  # Returns the best times to post based on historical engagement data. Groups all published posts by day of week and hour (UTC), calculating average engagement per slot. Use this to auto-schedule posts at optimal times. Requires the Analytics add-on.
138
215
  # @param [Hash] opts the optional parameters
@@ -283,6 +283,72 @@ module Zernio
283
283
  return data, status_code, headers
284
284
  end
285
285
 
286
+ # Analytics synced event
287
+ # Fired once per connected account each time its analytics sync cycle completes successfully. Poll-driven (roughly hourly per account), not real-time, and never fired for a skipped or failed cycle. A trigger, not a transport: the payload carries no metrics and no cursor. On receipt, call `GET /v1/analytics/delta` with your own last `nextCursor` to read every post whose analytics changed, across every account, in one paginated stream instead of polling analytics once per account. The feed holds back its most recent few seconds of writes, so a read issued the instant this event lands often returns an empty page for that account. Poll again with the same cursor rather than reading an empty page as \"nothing changed\". High volume (roughly one delivery per connected account per hour). Subscribe to it on a dedicated webhook endpoint: a subscription's consecutive-failure count is shared across all of its events, so an outage while this event is flowing can suppress the low-volume publishing events on the same subscription.
288
+ # @param webhook_payload_analytics_synced [WebhookPayloadAnalyticsSynced]
289
+ # @param [Hash] opts the optional parameters
290
+ # @return [nil]
291
+ def on_analytics_synced(webhook_payload_analytics_synced, opts = {})
292
+ on_analytics_synced_with_http_info(webhook_payload_analytics_synced, opts)
293
+ nil
294
+ end
295
+
296
+ # Analytics synced event
297
+ # Fired once per connected account each time its analytics sync cycle completes successfully. Poll-driven (roughly hourly per account), not real-time, and never fired for a skipped or failed cycle. A trigger, not a transport: the payload carries no metrics and no cursor. On receipt, call &#x60;GET /v1/analytics/delta&#x60; with your own last &#x60;nextCursor&#x60; to read every post whose analytics changed, across every account, in one paginated stream instead of polling analytics once per account. The feed holds back its most recent few seconds of writes, so a read issued the instant this event lands often returns an empty page for that account. Poll again with the same cursor rather than reading an empty page as \&quot;nothing changed\&quot;. High volume (roughly one delivery per connected account per hour). Subscribe to it on a dedicated webhook endpoint: a subscription&#39;s consecutive-failure count is shared across all of its events, so an outage while this event is flowing can suppress the low-volume publishing events on the same subscription.
298
+ # @param webhook_payload_analytics_synced [WebhookPayloadAnalyticsSynced]
299
+ # @param [Hash] opts the optional parameters
300
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
301
+ def on_analytics_synced_with_http_info(webhook_payload_analytics_synced, opts = {})
302
+ if @api_client.config.debugging
303
+ @api_client.config.logger.debug 'Calling API: WebhookEventsApi.on_analytics_synced ...'
304
+ end
305
+ # verify the required parameter 'webhook_payload_analytics_synced' is set
306
+ if @api_client.config.client_side_validation && webhook_payload_analytics_synced.nil?
307
+ fail ArgumentError, "Missing the required parameter 'webhook_payload_analytics_synced' when calling WebhookEventsApi.on_analytics_synced"
308
+ end
309
+ # resource path
310
+ local_var_path = '/analytics.synced'
311
+
312
+ # query parameters
313
+ query_params = opts[:query_params] || {}
314
+
315
+ # header parameters
316
+ header_params = opts[:header_params] || {}
317
+ # HTTP header 'Content-Type'
318
+ content_type = @api_client.select_header_content_type(['application/json'])
319
+ if !content_type.nil?
320
+ header_params['Content-Type'] = content_type
321
+ end
322
+
323
+ # form parameters
324
+ form_params = opts[:form_params] || {}
325
+
326
+ # http body (model)
327
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(webhook_payload_analytics_synced)
328
+
329
+ # return_type
330
+ return_type = opts[:debug_return_type]
331
+
332
+ # auth_names
333
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
334
+
335
+ new_options = opts.merge(
336
+ :operation => :"WebhookEventsApi.on_analytics_synced",
337
+ :header_params => header_params,
338
+ :query_params => query_params,
339
+ :form_params => form_params,
340
+ :body => post_body,
341
+ :auth_names => auth_names,
342
+ :return_type => return_type
343
+ )
344
+
345
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
346
+ if @api_client.config.debugging
347
+ @api_client.config.logger.debug "API called: WebhookEventsApi#on_analytics_synced\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
348
+ end
349
+ return data, status_code, headers
350
+ end
351
+
286
352
  # Call ended event
287
353
  # Fired on call hangup with the duration and a zero-markup billing breakdown (Meta cost, Telnyx cost, recording surcharge, total). Costs are pass-through; no margin is applied.
288
354
  # @param webhook_payload_call_ended [WebhookPayloadCallEnded]
@@ -0,0 +1,380 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema).
5
+
6
+ The version of the OpenAPI document: 1.0.4
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zernio
17
+ # One changed analytics snapshot. Metrics are the absolute values recorded at `syncedAt`, not the amount they moved by since the previous snapshot, so a later entry for the same `postId` always supersedes an earlier one.
18
+ class AnalyticsDeltaEntry < ApiModelBase
19
+ # External post ID. The same identifier as `posts[]._id` in GET /v1/analytics.
20
+ attr_accessor :post_id
21
+
22
+ # Social account this post was published through
23
+ attr_accessor :account_id
24
+
25
+ # Profile the account belongs to
26
+ attr_accessor :profile_id
27
+
28
+ attr_accessor :platform
29
+
30
+ # Platform-side post ID (for example the YouTube video ID)
31
+ attr_accessor :platform_post_id
32
+
33
+ # When the post was published, ISO-8601 UTC
34
+ attr_accessor :published_at
35
+
36
+ # When the sync cycle that produced this snapshot STARTED, ISO-8601 UTC. This is NOT the order entries arrive in and it is not a resume point: a slow cycle writes its rows after a faster cycle that started later, so `syncedAt` can go backwards between consecutive entries. Use `nextCursor` to resume.
37
+ attr_accessor :synced_at
38
+
39
+ # True when the post was detected as deleted on the platform at this sync
40
+ attr_accessor :is_deleted
41
+
42
+ attr_accessor :metrics
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'post_id' => :'postId',
48
+ :'account_id' => :'accountId',
49
+ :'profile_id' => :'profileId',
50
+ :'platform' => :'platform',
51
+ :'platform_post_id' => :'platformPostId',
52
+ :'published_at' => :'publishedAt',
53
+ :'synced_at' => :'syncedAt',
54
+ :'is_deleted' => :'isDeleted',
55
+ :'metrics' => :'metrics'
56
+ }
57
+ end
58
+
59
+ # Returns attribute mapping this model knows about
60
+ def self.acceptable_attribute_map
61
+ attribute_map
62
+ end
63
+
64
+ # Returns all the JSON keys this model knows about
65
+ def self.acceptable_attributes
66
+ acceptable_attribute_map.values
67
+ end
68
+
69
+ # Attribute type mapping.
70
+ def self.openapi_types
71
+ {
72
+ :'post_id' => :'String',
73
+ :'account_id' => :'String',
74
+ :'profile_id' => :'String',
75
+ :'platform' => :'String',
76
+ :'platform_post_id' => :'String',
77
+ :'published_at' => :'Time',
78
+ :'synced_at' => :'Time',
79
+ :'is_deleted' => :'Boolean',
80
+ :'metrics' => :'AnalyticsDeltaEntryMetrics'
81
+ }
82
+ end
83
+
84
+ # List of attributes with nullable: true
85
+ def self.openapi_nullable
86
+ Set.new([
87
+ ])
88
+ end
89
+
90
+ # Initializes the object
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ def initialize(attributes = {})
93
+ if (!attributes.is_a?(Hash))
94
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::AnalyticsDeltaEntry` initialize method"
95
+ end
96
+
97
+ # check to see if the attribute exists and convert string to symbol for hash key
98
+ acceptable_attribute_map = self.class.acceptable_attribute_map
99
+ attributes = attributes.each_with_object({}) { |(k, v), h|
100
+ if (!acceptable_attribute_map.key?(k.to_sym))
101
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::AnalyticsDeltaEntry`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
102
+ end
103
+ h[k.to_sym] = v
104
+ }
105
+
106
+ if attributes.key?(:'post_id')
107
+ self.post_id = attributes[:'post_id']
108
+ else
109
+ self.post_id = nil
110
+ end
111
+
112
+ if attributes.key?(:'account_id')
113
+ self.account_id = attributes[:'account_id']
114
+ else
115
+ self.account_id = nil
116
+ end
117
+
118
+ if attributes.key?(:'profile_id')
119
+ self.profile_id = attributes[:'profile_id']
120
+ else
121
+ self.profile_id = nil
122
+ end
123
+
124
+ if attributes.key?(:'platform')
125
+ self.platform = attributes[:'platform']
126
+ else
127
+ self.platform = nil
128
+ end
129
+
130
+ if attributes.key?(:'platform_post_id')
131
+ self.platform_post_id = attributes[:'platform_post_id']
132
+ else
133
+ self.platform_post_id = nil
134
+ end
135
+
136
+ if attributes.key?(:'published_at')
137
+ self.published_at = attributes[:'published_at']
138
+ else
139
+ self.published_at = nil
140
+ end
141
+
142
+ if attributes.key?(:'synced_at')
143
+ self.synced_at = attributes[:'synced_at']
144
+ else
145
+ self.synced_at = nil
146
+ end
147
+
148
+ if attributes.key?(:'is_deleted')
149
+ self.is_deleted = attributes[:'is_deleted']
150
+ else
151
+ self.is_deleted = nil
152
+ end
153
+
154
+ if attributes.key?(:'metrics')
155
+ self.metrics = attributes[:'metrics']
156
+ else
157
+ self.metrics = nil
158
+ end
159
+ end
160
+
161
+ # Show invalid properties with the reasons. Usually used together with valid?
162
+ # @return Array for valid properties with the reasons
163
+ def list_invalid_properties
164
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
165
+ invalid_properties = Array.new
166
+ if @post_id.nil?
167
+ invalid_properties.push('invalid value for "post_id", post_id cannot be nil.')
168
+ end
169
+
170
+ if @account_id.nil?
171
+ invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
172
+ end
173
+
174
+ if @profile_id.nil?
175
+ invalid_properties.push('invalid value for "profile_id", profile_id cannot be nil.')
176
+ end
177
+
178
+ if @platform.nil?
179
+ invalid_properties.push('invalid value for "platform", platform cannot be nil.')
180
+ end
181
+
182
+ if @platform_post_id.nil?
183
+ invalid_properties.push('invalid value for "platform_post_id", platform_post_id cannot be nil.')
184
+ end
185
+
186
+ if @published_at.nil?
187
+ invalid_properties.push('invalid value for "published_at", published_at cannot be nil.')
188
+ end
189
+
190
+ if @synced_at.nil?
191
+ invalid_properties.push('invalid value for "synced_at", synced_at cannot be nil.')
192
+ end
193
+
194
+ if @is_deleted.nil?
195
+ invalid_properties.push('invalid value for "is_deleted", is_deleted cannot be nil.')
196
+ end
197
+
198
+ if @metrics.nil?
199
+ invalid_properties.push('invalid value for "metrics", metrics cannot be nil.')
200
+ end
201
+
202
+ invalid_properties
203
+ end
204
+
205
+ # Check to see if the all the properties in the model are valid
206
+ # @return true if the model is valid
207
+ def valid?
208
+ warn '[DEPRECATED] the `valid?` method is obsolete'
209
+ return false if @post_id.nil?
210
+ return false if @account_id.nil?
211
+ return false if @profile_id.nil?
212
+ return false if @platform.nil?
213
+ return false if @platform_post_id.nil?
214
+ return false if @published_at.nil?
215
+ return false if @synced_at.nil?
216
+ return false if @is_deleted.nil?
217
+ return false if @metrics.nil?
218
+ true
219
+ end
220
+
221
+ # Custom attribute writer method with validation
222
+ # @param [Object] post_id Value to be assigned
223
+ def post_id=(post_id)
224
+ if post_id.nil?
225
+ fail ArgumentError, 'post_id cannot be nil'
226
+ end
227
+
228
+ @post_id = post_id
229
+ end
230
+
231
+ # Custom attribute writer method with validation
232
+ # @param [Object] account_id Value to be assigned
233
+ def account_id=(account_id)
234
+ if account_id.nil?
235
+ fail ArgumentError, 'account_id cannot be nil'
236
+ end
237
+
238
+ @account_id = account_id
239
+ end
240
+
241
+ # Custom attribute writer method with validation
242
+ # @param [Object] profile_id Value to be assigned
243
+ def profile_id=(profile_id)
244
+ if profile_id.nil?
245
+ fail ArgumentError, 'profile_id cannot be nil'
246
+ end
247
+
248
+ @profile_id = profile_id
249
+ end
250
+
251
+ # Custom attribute writer method with validation
252
+ # @param [Object] platform Value to be assigned
253
+ def platform=(platform)
254
+ if platform.nil?
255
+ fail ArgumentError, 'platform cannot be nil'
256
+ end
257
+
258
+ @platform = platform
259
+ end
260
+
261
+ # Custom attribute writer method with validation
262
+ # @param [Object] platform_post_id Value to be assigned
263
+ def platform_post_id=(platform_post_id)
264
+ if platform_post_id.nil?
265
+ fail ArgumentError, 'platform_post_id cannot be nil'
266
+ end
267
+
268
+ @platform_post_id = platform_post_id
269
+ end
270
+
271
+ # Custom attribute writer method with validation
272
+ # @param [Object] published_at Value to be assigned
273
+ def published_at=(published_at)
274
+ if published_at.nil?
275
+ fail ArgumentError, 'published_at cannot be nil'
276
+ end
277
+
278
+ @published_at = published_at
279
+ end
280
+
281
+ # Custom attribute writer method with validation
282
+ # @param [Object] synced_at Value to be assigned
283
+ def synced_at=(synced_at)
284
+ if synced_at.nil?
285
+ fail ArgumentError, 'synced_at cannot be nil'
286
+ end
287
+
288
+ @synced_at = synced_at
289
+ end
290
+
291
+ # Custom attribute writer method with validation
292
+ # @param [Object] is_deleted Value to be assigned
293
+ def is_deleted=(is_deleted)
294
+ if is_deleted.nil?
295
+ fail ArgumentError, 'is_deleted cannot be nil'
296
+ end
297
+
298
+ @is_deleted = is_deleted
299
+ end
300
+
301
+ # Custom attribute writer method with validation
302
+ # @param [Object] metrics Value to be assigned
303
+ def metrics=(metrics)
304
+ if metrics.nil?
305
+ fail ArgumentError, 'metrics cannot be nil'
306
+ end
307
+
308
+ @metrics = metrics
309
+ end
310
+
311
+ # Checks equality by comparing each attribute.
312
+ # @param [Object] Object to be compared
313
+ def ==(o)
314
+ return true if self.equal?(o)
315
+ self.class == o.class &&
316
+ post_id == o.post_id &&
317
+ account_id == o.account_id &&
318
+ profile_id == o.profile_id &&
319
+ platform == o.platform &&
320
+ platform_post_id == o.platform_post_id &&
321
+ published_at == o.published_at &&
322
+ synced_at == o.synced_at &&
323
+ is_deleted == o.is_deleted &&
324
+ metrics == o.metrics
325
+ end
326
+
327
+ # @see the `==` method
328
+ # @param [Object] Object to be compared
329
+ def eql?(o)
330
+ self == o
331
+ end
332
+
333
+ # Calculates hash code according to all attributes.
334
+ # @return [Integer] Hash code
335
+ def hash
336
+ [post_id, account_id, profile_id, platform, platform_post_id, published_at, synced_at, is_deleted, metrics].hash
337
+ end
338
+
339
+ # Builds the object from hash
340
+ # @param [Hash] attributes Model attributes in the form of hash
341
+ # @return [Object] Returns the model itself
342
+ def self.build_from_hash(attributes)
343
+ return nil unless attributes.is_a?(Hash)
344
+ attributes = attributes.transform_keys(&:to_sym)
345
+ transformed_hash = {}
346
+ openapi_types.each_pair do |key, type|
347
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
348
+ transformed_hash["#{key}"] = nil
349
+ elsif type =~ /\AArray<(.*)>/i
350
+ # check to ensure the input is an array given that the attribute
351
+ # is documented as an array but the input is not
352
+ if attributes[attribute_map[key]].is_a?(Array)
353
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
354
+ end
355
+ elsif !attributes[attribute_map[key]].nil?
356
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
357
+ end
358
+ end
359
+ new(transformed_hash)
360
+ end
361
+
362
+ # Returns the object in the form of hash
363
+ # @return [Hash] Returns the object in the form of hash
364
+ def to_hash
365
+ hash = {}
366
+ self.class.attribute_map.each_pair do |attr, param|
367
+ value = self.send(attr)
368
+ if value.nil?
369
+ is_nullable = self.class.openapi_nullable.include?(attr)
370
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
371
+ end
372
+
373
+ hash[param] = _to_hash(value)
374
+ end
375
+ hash
376
+ end
377
+
378
+ end
379
+
380
+ end