late-sdk 0.0.613 → 0.0.615

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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -0
  3. data/docs/AdCampaignsApi.md +6 -0
  4. data/docs/AdCreative.md +2 -0
  5. data/docs/AnalyticsApi.md +78 -2
  6. data/docs/FacebookPostEarningsResponse.md +32 -0
  7. data/docs/FacebookPostEarningsResponseMetricsValue.md +22 -0
  8. data/docs/FacebookPostEarningsResponseUnavailableMetricsInner.md +22 -0
  9. data/docs/InstagramAccountInsightsResponse.md +3 -1
  10. data/docs/InstagramAccountInsightsResponseMetricsValue.md +6 -2
  11. data/docs/InstagramAccountInsightsResponseUnavailableMetricsInner.md +22 -0
  12. data/lib/zernio-sdk/api/ad_campaigns_api.rb +9 -0
  13. data/lib/zernio-sdk/api/analytics_api.rb +76 -2
  14. data/lib/zernio-sdk/models/ad_creative.rb +12 -1
  15. data/lib/zernio-sdk/models/facebook_post_earnings_response.rb +253 -0
  16. data/lib/zernio-sdk/models/facebook_post_earnings_response_metrics_value.rb +203 -0
  17. data/lib/zernio-sdk/models/facebook_post_earnings_response_unavailable_metrics_inner.rb +202 -0
  18. data/lib/zernio-sdk/models/instagram_account_insights_response.rb +14 -2
  19. data/lib/zernio-sdk/models/instagram_account_insights_response_metrics_value.rb +60 -5
  20. data/lib/zernio-sdk/models/instagram_account_insights_response_unavailable_metrics_inner.rb +202 -0
  21. data/lib/zernio-sdk/version.rb +1 -1
  22. data/lib/zernio-sdk.rb +4 -0
  23. data/openapi.yaml +326 -2
  24. data/spec/api/ad_campaigns_api_spec.rb +3 -0
  25. data/spec/api/analytics_api_spec.rb +15 -1
  26. data/spec/models/ad_creative_spec.rb +6 -0
  27. data/spec/models/facebook_post_earnings_response_metrics_value_spec.rb +52 -0
  28. data/spec/models/facebook_post_earnings_response_spec.rb +82 -0
  29. data/spec/models/facebook_post_earnings_response_unavailable_metrics_inner_spec.rb +52 -0
  30. data/spec/models/instagram_account_insights_response_metrics_value_spec.rb +16 -0
  31. data/spec/models/instagram_account_insights_response_spec.rb +6 -0
  32. data/spec/models/instagram_account_insights_response_unavailable_metrics_inner_spec.rb +52 -0
  33. data/zernio-sdk-0.0.615.gem +0 -0
  34. metadata +18 -2
  35. data/zernio-sdk-0.0.613.gem +0 -0
@@ -37,6 +37,9 @@ module Zernio
37
37
  # Meta `effective_object_story_id` — `{pageId}_{postId}` of the Facebook post the ad's engagement (comments) lives on. Pass to GET /v1/ads?effectiveObjectStoryId= to map a Business-Manager-visible post back to this ad; GET /v1/ads/{adId}/comments resolves comments against it.
38
38
  attr_accessor :effective_object_story_id
39
39
 
40
+ # Facebook Page backing the creative (Meta only). What the `pageId` filter on /v1/ads, /v1/ads/campaigns and /v1/ads/tree matches against. Absent for non-Meta ads and rare Meta creatives with no page signal.
41
+ attr_accessor :page_id
42
+
40
43
  # Meta `effective_instagram_media_id` — the Instagram media ID of the boosted post the ad's engagement lives on. Pass to GET /v1/ads?effectiveInstagramMediaId= to map a Business-Manager-visible IG post back to this ad.
41
44
  attr_accessor :effective_instagram_media_id
42
45
 
@@ -77,6 +80,7 @@ module Zernio
77
80
  :'object_type' => :'objectType',
78
81
  :'object_story_id' => :'objectStoryId',
79
82
  :'effective_object_story_id' => :'effectiveObjectStoryId',
83
+ :'page_id' => :'pageId',
80
84
  :'effective_instagram_media_id' => :'effectiveInstagramMediaId',
81
85
  :'instagram_user_id' => :'instagramUserId',
82
86
  :'instagram_permalink_url' => :'instagramPermalinkUrl',
@@ -111,6 +115,7 @@ module Zernio
111
115
  :'object_type' => :'String',
112
116
  :'object_story_id' => :'String',
113
117
  :'effective_object_story_id' => :'String',
118
+ :'page_id' => :'String',
114
119
  :'effective_instagram_media_id' => :'String',
115
120
  :'instagram_user_id' => :'String',
116
121
  :'instagram_permalink_url' => :'String',
@@ -132,6 +137,7 @@ module Zernio
132
137
  :'video_url',
133
138
  :'object_story_id',
134
139
  :'effective_object_story_id',
140
+ :'page_id',
135
141
  :'effective_instagram_media_id',
136
142
  :'instagram_user_id',
137
143
  :'instagram_permalink_url',
@@ -182,6 +188,10 @@ module Zernio
182
188
  self.effective_object_story_id = attributes[:'effective_object_story_id']
183
189
  end
184
190
 
191
+ if attributes.key?(:'page_id')
192
+ self.page_id = attributes[:'page_id']
193
+ end
194
+
185
195
  if attributes.key?(:'effective_instagram_media_id')
186
196
  self.effective_instagram_media_id = attributes[:'effective_instagram_media_id']
187
197
  end
@@ -256,6 +266,7 @@ module Zernio
256
266
  object_type == o.object_type &&
257
267
  object_story_id == o.object_story_id &&
258
268
  effective_object_story_id == o.effective_object_story_id &&
269
+ page_id == o.page_id &&
259
270
  effective_instagram_media_id == o.effective_instagram_media_id &&
260
271
  instagram_user_id == o.instagram_user_id &&
261
272
  instagram_permalink_url == o.instagram_permalink_url &&
@@ -278,7 +289,7 @@ module Zernio
278
289
  # Calculates hash code according to all attributes.
279
290
  # @return [Integer] Hash code
280
291
  def hash
281
- [thumbnail_url, image_url, video_id, video_url, object_type, object_story_id, effective_object_story_id, effective_instagram_media_id, instagram_user_id, instagram_permalink_url, media_urls, body, google_headline, google_description, link_url, pinterest_image_url, pinterest_title, pinterest_description].hash
292
+ [thumbnail_url, image_url, video_id, video_url, object_type, object_story_id, effective_object_story_id, page_id, effective_instagram_media_id, instagram_user_id, instagram_permalink_url, media_urls, body, google_headline, google_description, link_url, pinterest_image_url, pinterest_title, pinterest_description].hash
282
293
  end
283
294
 
284
295
  # Builds the object from hash
@@ -0,0 +1,253 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
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
+ # Lifetime monetization earnings for one Facebook post. Same \"unit\" / \"currency\" contract and same unavailable-vs-zero contract as the Page-level response; there is no date range, no metricType, and no daily \"values\", because the single lifetime bucket IS the total.
18
+ class FacebookPostEarningsResponse < ApiModelBase
19
+ attr_accessor :success
20
+
21
+ attr_accessor :account_id
22
+
23
+ # The platform post ID that was queried, echoed back.
24
+ attr_accessor :post_id
25
+
26
+ attr_accessor :platform
27
+
28
+ # Always \"lifetime\": the total is cumulative since publication and must not be summed across dates or across posts.
29
+ attr_accessor :period
30
+
31
+ # One entry per served metric. A metric reported here with \"total\": 0 genuinely earned nothing (or its Page is not enrolled, which Meta reports identically).
32
+ attr_accessor :metrics
33
+
34
+ # Requested metrics Meta could not serve. Present only when at least one metric is unavailable, and absent otherwise. Each listed metric is OMITTED from \"metrics\" rather than reported as 0. The request itself still succeeds with HTTP 200.
35
+ attr_accessor :unavailable_metrics
36
+
37
+ attr_accessor :data_delay
38
+
39
+ class EnumAttributeValidator
40
+ attr_reader :datatype
41
+ attr_reader :allowable_values
42
+
43
+ def initialize(datatype, allowable_values)
44
+ @allowable_values = allowable_values.map do |value|
45
+ case datatype.to_s
46
+ when /Integer/i
47
+ value.to_i
48
+ when /Float/i
49
+ value.to_f
50
+ else
51
+ value
52
+ end
53
+ end
54
+ end
55
+
56
+ def valid?(value)
57
+ !value || allowable_values.include?(value)
58
+ end
59
+ end
60
+
61
+ # Attribute mapping from ruby-style variable name to JSON key.
62
+ def self.attribute_map
63
+ {
64
+ :'success' => :'success',
65
+ :'account_id' => :'accountId',
66
+ :'post_id' => :'postId',
67
+ :'platform' => :'platform',
68
+ :'period' => :'period',
69
+ :'metrics' => :'metrics',
70
+ :'unavailable_metrics' => :'unavailableMetrics',
71
+ :'data_delay' => :'dataDelay'
72
+ }
73
+ end
74
+
75
+ # Returns attribute mapping this model knows about
76
+ def self.acceptable_attribute_map
77
+ attribute_map
78
+ end
79
+
80
+ # Returns all the JSON keys this model knows about
81
+ def self.acceptable_attributes
82
+ acceptable_attribute_map.values
83
+ end
84
+
85
+ # Attribute type mapping.
86
+ def self.openapi_types
87
+ {
88
+ :'success' => :'Boolean',
89
+ :'account_id' => :'String',
90
+ :'post_id' => :'String',
91
+ :'platform' => :'String',
92
+ :'period' => :'String',
93
+ :'metrics' => :'Hash<String, FacebookPostEarningsResponseMetricsValue>',
94
+ :'unavailable_metrics' => :'Array<FacebookPostEarningsResponseUnavailableMetricsInner>',
95
+ :'data_delay' => :'String'
96
+ }
97
+ end
98
+
99
+ # List of attributes with nullable: true
100
+ def self.openapi_nullable
101
+ Set.new([
102
+ ])
103
+ end
104
+
105
+ # Initializes the object
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ def initialize(attributes = {})
108
+ if (!attributes.is_a?(Hash))
109
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::FacebookPostEarningsResponse` initialize method"
110
+ end
111
+
112
+ # check to see if the attribute exists and convert string to symbol for hash key
113
+ acceptable_attribute_map = self.class.acceptable_attribute_map
114
+ attributes = attributes.each_with_object({}) { |(k, v), h|
115
+ if (!acceptable_attribute_map.key?(k.to_sym))
116
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::FacebookPostEarningsResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
117
+ end
118
+ h[k.to_sym] = v
119
+ }
120
+
121
+ if attributes.key?(:'success')
122
+ self.success = attributes[:'success']
123
+ end
124
+
125
+ if attributes.key?(:'account_id')
126
+ self.account_id = attributes[:'account_id']
127
+ end
128
+
129
+ if attributes.key?(:'post_id')
130
+ self.post_id = attributes[:'post_id']
131
+ end
132
+
133
+ if attributes.key?(:'platform')
134
+ self.platform = attributes[:'platform']
135
+ end
136
+
137
+ if attributes.key?(:'period')
138
+ self.period = attributes[:'period']
139
+ end
140
+
141
+ if attributes.key?(:'metrics')
142
+ if (value = attributes[:'metrics']).is_a?(Hash)
143
+ self.metrics = value
144
+ end
145
+ end
146
+
147
+ if attributes.key?(:'unavailable_metrics')
148
+ if (value = attributes[:'unavailable_metrics']).is_a?(Array)
149
+ self.unavailable_metrics = value
150
+ end
151
+ end
152
+
153
+ if attributes.key?(:'data_delay')
154
+ self.data_delay = attributes[:'data_delay']
155
+ end
156
+ end
157
+
158
+ # Show invalid properties with the reasons. Usually used together with valid?
159
+ # @return Array for valid properties with the reasons
160
+ def list_invalid_properties
161
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
162
+ invalid_properties = Array.new
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
+ period_validator = EnumAttributeValidator.new('String', ["lifetime"])
171
+ return false unless period_validator.valid?(@period)
172
+ true
173
+ end
174
+
175
+ # Custom attribute writer method checking allowed values (enum).
176
+ # @param [Object] period Object to be assigned
177
+ def period=(period)
178
+ validator = EnumAttributeValidator.new('String', ["lifetime"])
179
+ unless validator.valid?(period)
180
+ fail ArgumentError, "invalid value for \"period\", must be one of #{validator.allowable_values}."
181
+ end
182
+ @period = period
183
+ end
184
+
185
+ # Checks equality by comparing each attribute.
186
+ # @param [Object] Object to be compared
187
+ def ==(o)
188
+ return true if self.equal?(o)
189
+ self.class == o.class &&
190
+ success == o.success &&
191
+ account_id == o.account_id &&
192
+ post_id == o.post_id &&
193
+ platform == o.platform &&
194
+ period == o.period &&
195
+ metrics == o.metrics &&
196
+ unavailable_metrics == o.unavailable_metrics &&
197
+ data_delay == o.data_delay
198
+ end
199
+
200
+ # @see the `==` method
201
+ # @param [Object] Object to be compared
202
+ def eql?(o)
203
+ self == o
204
+ end
205
+
206
+ # Calculates hash code according to all attributes.
207
+ # @return [Integer] Hash code
208
+ def hash
209
+ [success, account_id, post_id, platform, period, metrics, unavailable_metrics, data_delay].hash
210
+ end
211
+
212
+ # Builds the object from hash
213
+ # @param [Hash] attributes Model attributes in the form of hash
214
+ # @return [Object] Returns the model itself
215
+ def self.build_from_hash(attributes)
216
+ return nil unless attributes.is_a?(Hash)
217
+ attributes = attributes.transform_keys(&:to_sym)
218
+ transformed_hash = {}
219
+ openapi_types.each_pair do |key, type|
220
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
221
+ transformed_hash["#{key}"] = nil
222
+ elsif type =~ /\AArray<(.*)>/i
223
+ # check to ensure the input is an array given that the attribute
224
+ # is documented as an array but the input is not
225
+ if attributes[attribute_map[key]].is_a?(Array)
226
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
227
+ end
228
+ elsif !attributes[attribute_map[key]].nil?
229
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
230
+ end
231
+ end
232
+ new(transformed_hash)
233
+ end
234
+
235
+ # Returns the object in the form of hash
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_hash
238
+ hash = {}
239
+ self.class.attribute_map.each_pair do |attr, param|
240
+ value = self.send(attr)
241
+ if value.nil?
242
+ is_nullable = self.class.openapi_nullable.include?(attr)
243
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
244
+ end
245
+
246
+ hash[param] = _to_hash(value)
247
+ end
248
+ hash
249
+ end
250
+
251
+ end
252
+
253
+ end
@@ -0,0 +1,203 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
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 FacebookPostEarningsResponseMetricsValue < ApiModelBase
18
+ # Lifetime earnings in \"unit\", exactly as Meta returned them. Never rescaled.
19
+ attr_accessor :total
20
+
21
+ # \"micro_amount\": Meta returned an object shape carrying a micro amount, and \"total\" is that integer, unconverted. Zernio does not publish a divisor because Meta does not document one; divide by the scale you have verified against the Page's own Meta Business Suite export. This is always content_monetization_earnings. \"unspecified\": Meta returned a bare number with no unit metadata, passed through as-is; Meta does not state whether it is major or minor currency units. This is always monetization_approximate_earnings.
22
+ attr_accessor :unit
23
+
24
+ # ISO 4217 currency, or null when Meta omitted it. Always null on monetization_approximate_earnings; always present on content_monetization_earnings.
25
+ attr_accessor :currency
26
+
27
+ class EnumAttributeValidator
28
+ attr_reader :datatype
29
+ attr_reader :allowable_values
30
+
31
+ def initialize(datatype, allowable_values)
32
+ @allowable_values = allowable_values.map do |value|
33
+ case datatype.to_s
34
+ when /Integer/i
35
+ value.to_i
36
+ when /Float/i
37
+ value.to_f
38
+ else
39
+ value
40
+ end
41
+ end
42
+ end
43
+
44
+ def valid?(value)
45
+ !value || allowable_values.include?(value)
46
+ end
47
+ end
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'total' => :'total',
53
+ :'unit' => :'unit',
54
+ :'currency' => :'currency'
55
+ }
56
+ end
57
+
58
+ # Returns attribute mapping this model knows about
59
+ def self.acceptable_attribute_map
60
+ attribute_map
61
+ end
62
+
63
+ # Returns all the JSON keys this model knows about
64
+ def self.acceptable_attributes
65
+ acceptable_attribute_map.values
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.openapi_types
70
+ {
71
+ :'total' => :'Float',
72
+ :'unit' => :'String',
73
+ :'currency' => :'String'
74
+ }
75
+ end
76
+
77
+ # List of attributes with nullable: true
78
+ def self.openapi_nullable
79
+ Set.new([
80
+ :'currency'
81
+ ])
82
+ end
83
+
84
+ # Initializes the object
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ def initialize(attributes = {})
87
+ if (!attributes.is_a?(Hash))
88
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::FacebookPostEarningsResponseMetricsValue` initialize method"
89
+ end
90
+
91
+ # check to see if the attribute exists and convert string to symbol for hash key
92
+ acceptable_attribute_map = self.class.acceptable_attribute_map
93
+ attributes = attributes.each_with_object({}) { |(k, v), h|
94
+ if (!acceptable_attribute_map.key?(k.to_sym))
95
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::FacebookPostEarningsResponseMetricsValue`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
96
+ end
97
+ h[k.to_sym] = v
98
+ }
99
+
100
+ if attributes.key?(:'total')
101
+ self.total = attributes[:'total']
102
+ end
103
+
104
+ if attributes.key?(:'unit')
105
+ self.unit = attributes[:'unit']
106
+ end
107
+
108
+ if attributes.key?(:'currency')
109
+ self.currency = attributes[:'currency']
110
+ end
111
+ end
112
+
113
+ # Show invalid properties with the reasons. Usually used together with valid?
114
+ # @return Array for valid properties with the reasons
115
+ def list_invalid_properties
116
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
117
+ invalid_properties = Array.new
118
+ invalid_properties
119
+ end
120
+
121
+ # Check to see if the all the properties in the model are valid
122
+ # @return true if the model is valid
123
+ def valid?
124
+ warn '[DEPRECATED] the `valid?` method is obsolete'
125
+ unit_validator = EnumAttributeValidator.new('String', ["micro_amount", "unspecified"])
126
+ return false unless unit_validator.valid?(@unit)
127
+ true
128
+ end
129
+
130
+ # Custom attribute writer method checking allowed values (enum).
131
+ # @param [Object] unit Object to be assigned
132
+ def unit=(unit)
133
+ validator = EnumAttributeValidator.new('String', ["micro_amount", "unspecified"])
134
+ unless validator.valid?(unit)
135
+ fail ArgumentError, "invalid value for \"unit\", must be one of #{validator.allowable_values}."
136
+ end
137
+ @unit = unit
138
+ end
139
+
140
+ # Checks equality by comparing each attribute.
141
+ # @param [Object] Object to be compared
142
+ def ==(o)
143
+ return true if self.equal?(o)
144
+ self.class == o.class &&
145
+ total == o.total &&
146
+ unit == o.unit &&
147
+ currency == o.currency
148
+ end
149
+
150
+ # @see the `==` method
151
+ # @param [Object] Object to be compared
152
+ def eql?(o)
153
+ self == o
154
+ end
155
+
156
+ # Calculates hash code according to all attributes.
157
+ # @return [Integer] Hash code
158
+ def hash
159
+ [total, unit, currency].hash
160
+ end
161
+
162
+ # Builds the object from hash
163
+ # @param [Hash] attributes Model attributes in the form of hash
164
+ # @return [Object] Returns the model itself
165
+ def self.build_from_hash(attributes)
166
+ return nil unless attributes.is_a?(Hash)
167
+ attributes = attributes.transform_keys(&:to_sym)
168
+ transformed_hash = {}
169
+ openapi_types.each_pair do |key, type|
170
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
171
+ transformed_hash["#{key}"] = nil
172
+ elsif type =~ /\AArray<(.*)>/i
173
+ # check to ensure the input is an array given that the attribute
174
+ # is documented as an array but the input is not
175
+ if attributes[attribute_map[key]].is_a?(Array)
176
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
177
+ end
178
+ elsif !attributes[attribute_map[key]].nil?
179
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
180
+ end
181
+ end
182
+ new(transformed_hash)
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = self.send(attr)
191
+ if value.nil?
192
+ is_nullable = self.class.openapi_nullable.include?(attr)
193
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
194
+ end
195
+
196
+ hash[param] = _to_hash(value)
197
+ end
198
+ hash
199
+ end
200
+
201
+ end
202
+
203
+ end