zernio-sdk 0.0.821 → 0.0.823
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.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/docs/AnalyticsApi.md +78 -0
- data/docs/AnalyticsDeltaEntry.md +34 -0
- data/docs/AnalyticsDeltaEntryMetrics.md +44 -0
- data/docs/AnalyticsDeltaResponse.md +22 -0
- data/docs/BoostPostRequest.md +3 -1
- data/docs/CreateCallAdRequest.md +3 -1
- data/docs/CreateMessagingAdRequest.md +3 -1
- data/docs/CreateStandaloneAdRequest.md +3 -1
- data/docs/CtwaAdRequestBody.md +4 -2
- data/docs/WebhookEventsApi.md +69 -0
- data/docs/WebhookPayloadAnalyticsSynced.md +26 -0
- data/docs/WebhookPayloadAnalyticsSyncedAccount.md +24 -0
- data/docs/WebhookPayloadAnalyticsSyncedSync.md +20 -0
- data/lib/zernio-sdk/api/analytics_api.rb +77 -0
- data/lib/zernio-sdk/api/webhook_events_api.rb +66 -0
- data/lib/zernio-sdk/models/analytics_delta_entry.rb +380 -0
- data/lib/zernio-sdk/models/analytics_delta_entry_metrics.rb +507 -0
- data/lib/zernio-sdk/models/analytics_delta_response.rb +221 -0
- data/lib/zernio-sdk/models/boost_post_request.rb +14 -2
- data/lib/zernio-sdk/models/create_call_ad_request.rb +14 -2
- data/lib/zernio-sdk/models/create_messaging_ad_request.rb +14 -2
- data/lib/zernio-sdk/models/create_standalone_ad_request.rb +14 -2
- data/lib/zernio-sdk/models/ctwa_ad_request_body.rb +17 -5
- data/lib/zernio-sdk/models/webhook_payload_analytics_synced.rb +295 -0
- data/lib/zernio-sdk/models/webhook_payload_analytics_synced_account.rb +244 -0
- data/lib/zernio-sdk/models/webhook_payload_analytics_synced_sync.rb +193 -0
- data/lib/zernio-sdk/version.rb +1 -1
- data/lib/zernio-sdk.rb +6 -0
- data/openapi.yaml +392 -10
- data/spec/api/analytics_api_spec.rb +15 -0
- data/spec/models/analytics_delta_entry_metrics_spec.rb +114 -0
- data/spec/models/analytics_delta_entry_spec.rb +84 -0
- data/spec/models/analytics_delta_response_spec.rb +48 -0
- data/spec/models/boost_post_request_spec.rb +6 -0
- data/spec/models/create_call_ad_request_spec.rb +6 -0
- data/spec/models/create_messaging_ad_request_spec.rb +6 -0
- data/spec/models/create_standalone_ad_request_spec.rb +6 -0
- data/spec/models/create_webhook_settings_request_spec.rb +1 -1
- data/spec/models/ctwa_ad_request_body_spec.rb +6 -0
- data/spec/models/update_webhook_settings_request_spec.rb +1 -1
- data/spec/models/webhook_payload_analytics_synced_account_spec.rb +54 -0
- data/spec/models/webhook_payload_analytics_synced_spec.rb +64 -0
- data/spec/models/webhook_payload_analytics_synced_sync_spec.rb +42 -0
- data/spec/models/webhook_spec.rb +1 -1
- metadata +1773 -1749
|
@@ -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 `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.
|
|
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
|