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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -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/lib/zernio-sdk/api/analytics_api.rb +77 -0
  17. data/lib/zernio-sdk/api/webhook_events_api.rb +66 -0
  18. data/lib/zernio-sdk/models/analytics_delta_entry.rb +380 -0
  19. data/lib/zernio-sdk/models/analytics_delta_entry_metrics.rb +507 -0
  20. data/lib/zernio-sdk/models/analytics_delta_response.rb +221 -0
  21. data/lib/zernio-sdk/models/boost_post_request.rb +14 -2
  22. data/lib/zernio-sdk/models/create_call_ad_request.rb +14 -2
  23. data/lib/zernio-sdk/models/create_messaging_ad_request.rb +14 -2
  24. data/lib/zernio-sdk/models/create_standalone_ad_request.rb +14 -2
  25. data/lib/zernio-sdk/models/ctwa_ad_request_body.rb +17 -5
  26. data/lib/zernio-sdk/models/webhook_payload_analytics_synced.rb +295 -0
  27. data/lib/zernio-sdk/models/webhook_payload_analytics_synced_account.rb +244 -0
  28. data/lib/zernio-sdk/models/webhook_payload_analytics_synced_sync.rb +193 -0
  29. data/lib/zernio-sdk/version.rb +1 -1
  30. data/lib/zernio-sdk.rb +6 -0
  31. data/openapi.yaml +392 -10
  32. data/spec/api/analytics_api_spec.rb +15 -0
  33. data/spec/models/analytics_delta_entry_metrics_spec.rb +114 -0
  34. data/spec/models/analytics_delta_entry_spec.rb +84 -0
  35. data/spec/models/analytics_delta_response_spec.rb +48 -0
  36. data/spec/models/boost_post_request_spec.rb +6 -0
  37. data/spec/models/create_call_ad_request_spec.rb +6 -0
  38. data/spec/models/create_messaging_ad_request_spec.rb +6 -0
  39. data/spec/models/create_standalone_ad_request_spec.rb +6 -0
  40. data/spec/models/create_webhook_settings_request_spec.rb +1 -1
  41. data/spec/models/ctwa_ad_request_body_spec.rb +6 -0
  42. data/spec/models/update_webhook_settings_request_spec.rb +1 -1
  43. data/spec/models/webhook_payload_analytics_synced_account_spec.rb +54 -0
  44. data/spec/models/webhook_payload_analytics_synced_spec.rb +64 -0
  45. data/spec/models/webhook_payload_analytics_synced_sync_spec.rb +42 -0
  46. data/spec/models/webhook_spec.rb +1 -1
  47. metadata +1773 -1749
@@ -0,0 +1,295 @@
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
+ # Webhook payload for `analytics.synced`. 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: it deliberately carries no metrics and no cursor. When it arrives, call `GET /v1/analytics/delta` with YOUR OWN last `nextCursor` to read what changed, across every account, in one paginated stream. The absent cursor is deliberate. The feed's ordering position is assigned inside the analytics store when the row is materialized, which normally has not happened yet at the moment this event fires, so a cursor minted here could sit ahead of the very rows the event announces and make you skip them. Your own `nextCursor` is always in the feed's own ordering and can never do that. Because of that same lag, a delta read issued the instant this event lands can legitimately come back empty. That is not \"nothing changed\": poll again with the same cursor you just used rather than treating the account as done. Subscribe to this event on a DEDICATED webhook endpoint. It is high volume (roughly one delivery per connected account per hour) and 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 that share the same subscription.
18
+ class WebhookPayloadAnalyticsSynced < ApiModelBase
19
+ # Stable webhook event ID
20
+ attr_accessor :id
21
+
22
+ attr_accessor :event
23
+
24
+ attr_accessor :account
25
+
26
+ attr_accessor :sync
27
+
28
+ # UTC time at which Zernio generated this event (set once when the event payload is built, before delivery is queued).
29
+ attr_accessor :timestamp
30
+
31
+ class EnumAttributeValidator
32
+ attr_reader :datatype
33
+ attr_reader :allowable_values
34
+
35
+ def initialize(datatype, allowable_values)
36
+ @allowable_values = allowable_values.map do |value|
37
+ case datatype.to_s
38
+ when /Integer/i
39
+ value.to_i
40
+ when /Float/i
41
+ value.to_f
42
+ else
43
+ value
44
+ end
45
+ end
46
+ end
47
+
48
+ def valid?(value)
49
+ !value || allowable_values.include?(value)
50
+ end
51
+ end
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'id' => :'id',
57
+ :'event' => :'event',
58
+ :'account' => :'account',
59
+ :'sync' => :'sync',
60
+ :'timestamp' => :'timestamp'
61
+ }
62
+ end
63
+
64
+ # Returns attribute mapping this model knows about
65
+ def self.acceptable_attribute_map
66
+ attribute_map
67
+ end
68
+
69
+ # Returns all the JSON keys this model knows about
70
+ def self.acceptable_attributes
71
+ acceptable_attribute_map.values
72
+ end
73
+
74
+ # Attribute type mapping.
75
+ def self.openapi_types
76
+ {
77
+ :'id' => :'String',
78
+ :'event' => :'String',
79
+ :'account' => :'WebhookPayloadAnalyticsSyncedAccount',
80
+ :'sync' => :'WebhookPayloadAnalyticsSyncedSync',
81
+ :'timestamp' => :'Time'
82
+ }
83
+ end
84
+
85
+ # List of attributes with nullable: true
86
+ def self.openapi_nullable
87
+ Set.new([
88
+ ])
89
+ end
90
+
91
+ # Initializes the object
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ def initialize(attributes = {})
94
+ if (!attributes.is_a?(Hash))
95
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::WebhookPayloadAnalyticsSynced` initialize method"
96
+ end
97
+
98
+ # check to see if the attribute exists and convert string to symbol for hash key
99
+ acceptable_attribute_map = self.class.acceptable_attribute_map
100
+ attributes = attributes.each_with_object({}) { |(k, v), h|
101
+ if (!acceptable_attribute_map.key?(k.to_sym))
102
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::WebhookPayloadAnalyticsSynced`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
103
+ end
104
+ h[k.to_sym] = v
105
+ }
106
+
107
+ if attributes.key?(:'id')
108
+ self.id = attributes[:'id']
109
+ else
110
+ self.id = nil
111
+ end
112
+
113
+ if attributes.key?(:'event')
114
+ self.event = attributes[:'event']
115
+ else
116
+ self.event = nil
117
+ end
118
+
119
+ if attributes.key?(:'account')
120
+ self.account = attributes[:'account']
121
+ else
122
+ self.account = nil
123
+ end
124
+
125
+ if attributes.key?(:'sync')
126
+ self.sync = attributes[:'sync']
127
+ else
128
+ self.sync = nil
129
+ end
130
+
131
+ if attributes.key?(:'timestamp')
132
+ self.timestamp = attributes[:'timestamp']
133
+ else
134
+ self.timestamp = nil
135
+ end
136
+ end
137
+
138
+ # Show invalid properties with the reasons. Usually used together with valid?
139
+ # @return Array for valid properties with the reasons
140
+ def list_invalid_properties
141
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
142
+ invalid_properties = Array.new
143
+ if @id.nil?
144
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
145
+ end
146
+
147
+ if @event.nil?
148
+ invalid_properties.push('invalid value for "event", event cannot be nil.')
149
+ end
150
+
151
+ if @account.nil?
152
+ invalid_properties.push('invalid value for "account", account cannot be nil.')
153
+ end
154
+
155
+ if @sync.nil?
156
+ invalid_properties.push('invalid value for "sync", sync cannot be nil.')
157
+ end
158
+
159
+ if @timestamp.nil?
160
+ invalid_properties.push('invalid value for "timestamp", timestamp cannot be nil.')
161
+ end
162
+
163
+ invalid_properties
164
+ end
165
+
166
+ # Check to see if the all the properties in the model are valid
167
+ # @return true if the model is valid
168
+ def valid?
169
+ warn '[DEPRECATED] the `valid?` method is obsolete'
170
+ return false if @id.nil?
171
+ return false if @event.nil?
172
+ event_validator = EnumAttributeValidator.new('String', ["analytics.synced"])
173
+ return false unless event_validator.valid?(@event)
174
+ return false if @account.nil?
175
+ return false if @sync.nil?
176
+ return false if @timestamp.nil?
177
+ true
178
+ end
179
+
180
+ # Custom attribute writer method with validation
181
+ # @param [Object] id Value to be assigned
182
+ def id=(id)
183
+ if id.nil?
184
+ fail ArgumentError, 'id cannot be nil'
185
+ end
186
+
187
+ @id = id
188
+ end
189
+
190
+ # Custom attribute writer method checking allowed values (enum).
191
+ # @param [Object] event Object to be assigned
192
+ def event=(event)
193
+ validator = EnumAttributeValidator.new('String', ["analytics.synced"])
194
+ unless validator.valid?(event)
195
+ fail ArgumentError, "invalid value for \"event\", must be one of #{validator.allowable_values}."
196
+ end
197
+ @event = event
198
+ end
199
+
200
+ # Custom attribute writer method with validation
201
+ # @param [Object] account Value to be assigned
202
+ def account=(account)
203
+ if account.nil?
204
+ fail ArgumentError, 'account cannot be nil'
205
+ end
206
+
207
+ @account = account
208
+ end
209
+
210
+ # Custom attribute writer method with validation
211
+ # @param [Object] sync Value to be assigned
212
+ def sync=(sync)
213
+ if sync.nil?
214
+ fail ArgumentError, 'sync cannot be nil'
215
+ end
216
+
217
+ @sync = sync
218
+ end
219
+
220
+ # Custom attribute writer method with validation
221
+ # @param [Object] timestamp Value to be assigned
222
+ def timestamp=(timestamp)
223
+ if timestamp.nil?
224
+ fail ArgumentError, 'timestamp cannot be nil'
225
+ end
226
+
227
+ @timestamp = timestamp
228
+ end
229
+
230
+ # Checks equality by comparing each attribute.
231
+ # @param [Object] Object to be compared
232
+ def ==(o)
233
+ return true if self.equal?(o)
234
+ self.class == o.class &&
235
+ id == o.id &&
236
+ event == o.event &&
237
+ account == o.account &&
238
+ sync == o.sync &&
239
+ timestamp == o.timestamp
240
+ end
241
+
242
+ # @see the `==` method
243
+ # @param [Object] Object to be compared
244
+ def eql?(o)
245
+ self == o
246
+ end
247
+
248
+ # Calculates hash code according to all attributes.
249
+ # @return [Integer] Hash code
250
+ def hash
251
+ [id, event, account, sync, timestamp].hash
252
+ end
253
+
254
+ # Builds the object from hash
255
+ # @param [Hash] attributes Model attributes in the form of hash
256
+ # @return [Object] Returns the model itself
257
+ def self.build_from_hash(attributes)
258
+ return nil unless attributes.is_a?(Hash)
259
+ attributes = attributes.transform_keys(&:to_sym)
260
+ transformed_hash = {}
261
+ openapi_types.each_pair do |key, type|
262
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
263
+ transformed_hash["#{key}"] = nil
264
+ elsif type =~ /\AArray<(.*)>/i
265
+ # check to ensure the input is an array given that the attribute
266
+ # is documented as an array but the input is not
267
+ if attributes[attribute_map[key]].is_a?(Array)
268
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
269
+ end
270
+ elsif !attributes[attribute_map[key]].nil?
271
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
272
+ end
273
+ end
274
+ new(transformed_hash)
275
+ end
276
+
277
+ # Returns the object in the form of hash
278
+ # @return [Hash] Returns the object in the form of hash
279
+ def to_hash
280
+ hash = {}
281
+ self.class.attribute_map.each_pair do |attr, param|
282
+ value = self.send(attr)
283
+ if value.nil?
284
+ is_nullable = self.class.openapi_nullable.include?(attr)
285
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
286
+ end
287
+
288
+ hash[param] = _to_hash(value)
289
+ end
290
+ hash
291
+ end
292
+
293
+ end
294
+
295
+ end
@@ -0,0 +1,244 @@
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
+ class WebhookPayloadAnalyticsSyncedAccount < ApiModelBase
18
+ # The account's unique identifier (same as used in /v1/accounts/{accountId})
19
+ attr_accessor :account_id
20
+
21
+ # The profile this account belongs to
22
+ attr_accessor :profile_id
23
+
24
+ attr_accessor :platform
25
+
26
+ attr_accessor :username
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'account_id' => :'accountId',
32
+ :'profile_id' => :'profileId',
33
+ :'platform' => :'platform',
34
+ :'username' => :'username'
35
+ }
36
+ end
37
+
38
+ # Returns attribute mapping this model knows about
39
+ def self.acceptable_attribute_map
40
+ attribute_map
41
+ end
42
+
43
+ # Returns all the JSON keys this model knows about
44
+ def self.acceptable_attributes
45
+ acceptable_attribute_map.values
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.openapi_types
50
+ {
51
+ :'account_id' => :'String',
52
+ :'profile_id' => :'String',
53
+ :'platform' => :'String',
54
+ :'username' => :'String'
55
+ }
56
+ end
57
+
58
+ # List of attributes with nullable: true
59
+ def self.openapi_nullable
60
+ Set.new([
61
+ ])
62
+ end
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ def initialize(attributes = {})
67
+ if (!attributes.is_a?(Hash))
68
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::WebhookPayloadAnalyticsSyncedAccount` initialize method"
69
+ end
70
+
71
+ # check to see if the attribute exists and convert string to symbol for hash key
72
+ acceptable_attribute_map = self.class.acceptable_attribute_map
73
+ attributes = attributes.each_with_object({}) { |(k, v), h|
74
+ if (!acceptable_attribute_map.key?(k.to_sym))
75
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::WebhookPayloadAnalyticsSyncedAccount`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
76
+ end
77
+ h[k.to_sym] = v
78
+ }
79
+
80
+ if attributes.key?(:'account_id')
81
+ self.account_id = attributes[:'account_id']
82
+ else
83
+ self.account_id = nil
84
+ end
85
+
86
+ if attributes.key?(:'profile_id')
87
+ self.profile_id = attributes[:'profile_id']
88
+ else
89
+ self.profile_id = nil
90
+ end
91
+
92
+ if attributes.key?(:'platform')
93
+ self.platform = attributes[:'platform']
94
+ else
95
+ self.platform = nil
96
+ end
97
+
98
+ if attributes.key?(:'username')
99
+ self.username = attributes[:'username']
100
+ else
101
+ self.username = nil
102
+ end
103
+ end
104
+
105
+ # Show invalid properties with the reasons. Usually used together with valid?
106
+ # @return Array for valid properties with the reasons
107
+ def list_invalid_properties
108
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
109
+ invalid_properties = Array.new
110
+ if @account_id.nil?
111
+ invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
112
+ end
113
+
114
+ if @profile_id.nil?
115
+ invalid_properties.push('invalid value for "profile_id", profile_id cannot be nil.')
116
+ end
117
+
118
+ if @platform.nil?
119
+ invalid_properties.push('invalid value for "platform", platform cannot be nil.')
120
+ end
121
+
122
+ if @username.nil?
123
+ invalid_properties.push('invalid value for "username", username cannot be nil.')
124
+ end
125
+
126
+ invalid_properties
127
+ end
128
+
129
+ # Check to see if the all the properties in the model are valid
130
+ # @return true if the model is valid
131
+ def valid?
132
+ warn '[DEPRECATED] the `valid?` method is obsolete'
133
+ return false if @account_id.nil?
134
+ return false if @profile_id.nil?
135
+ return false if @platform.nil?
136
+ return false if @username.nil?
137
+ true
138
+ end
139
+
140
+ # Custom attribute writer method with validation
141
+ # @param [Object] account_id Value to be assigned
142
+ def account_id=(account_id)
143
+ if account_id.nil?
144
+ fail ArgumentError, 'account_id cannot be nil'
145
+ end
146
+
147
+ @account_id = account_id
148
+ end
149
+
150
+ # Custom attribute writer method with validation
151
+ # @param [Object] profile_id Value to be assigned
152
+ def profile_id=(profile_id)
153
+ if profile_id.nil?
154
+ fail ArgumentError, 'profile_id cannot be nil'
155
+ end
156
+
157
+ @profile_id = profile_id
158
+ end
159
+
160
+ # Custom attribute writer method with validation
161
+ # @param [Object] platform Value to be assigned
162
+ def platform=(platform)
163
+ if platform.nil?
164
+ fail ArgumentError, 'platform cannot be nil'
165
+ end
166
+
167
+ @platform = platform
168
+ end
169
+
170
+ # Custom attribute writer method with validation
171
+ # @param [Object] username Value to be assigned
172
+ def username=(username)
173
+ if username.nil?
174
+ fail ArgumentError, 'username cannot be nil'
175
+ end
176
+
177
+ @username = username
178
+ end
179
+
180
+ # Checks equality by comparing each attribute.
181
+ # @param [Object] Object to be compared
182
+ def ==(o)
183
+ return true if self.equal?(o)
184
+ self.class == o.class &&
185
+ account_id == o.account_id &&
186
+ profile_id == o.profile_id &&
187
+ platform == o.platform &&
188
+ username == o.username
189
+ end
190
+
191
+ # @see the `==` method
192
+ # @param [Object] Object to be compared
193
+ def eql?(o)
194
+ self == o
195
+ end
196
+
197
+ # Calculates hash code according to all attributes.
198
+ # @return [Integer] Hash code
199
+ def hash
200
+ [account_id, profile_id, platform, username].hash
201
+ end
202
+
203
+ # Builds the object from hash
204
+ # @param [Hash] attributes Model attributes in the form of hash
205
+ # @return [Object] Returns the model itself
206
+ def self.build_from_hash(attributes)
207
+ return nil unless attributes.is_a?(Hash)
208
+ attributes = attributes.transform_keys(&:to_sym)
209
+ transformed_hash = {}
210
+ openapi_types.each_pair do |key, type|
211
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
212
+ transformed_hash["#{key}"] = nil
213
+ elsif type =~ /\AArray<(.*)>/i
214
+ # check to ensure the input is an array given that the attribute
215
+ # is documented as an array but the input is not
216
+ if attributes[attribute_map[key]].is_a?(Array)
217
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
218
+ end
219
+ elsif !attributes[attribute_map[key]].nil?
220
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
221
+ end
222
+ end
223
+ new(transformed_hash)
224
+ end
225
+
226
+ # Returns the object in the form of hash
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_hash
229
+ hash = {}
230
+ self.class.attribute_map.each_pair do |attr, param|
231
+ value = self.send(attr)
232
+ if value.nil?
233
+ is_nullable = self.class.openapi_nullable.include?(attr)
234
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
235
+ end
236
+
237
+ hash[param] = _to_hash(value)
238
+ end
239
+ hash
240
+ end
241
+
242
+ end
243
+
244
+ end