late-sdk 0.0.612 → 0.0.614

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 (31) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -0
  3. data/docs/AnalyticsApi.md +78 -2
  4. data/docs/FacebookPostEarningsResponse.md +32 -0
  5. data/docs/FacebookPostEarningsResponseMetricsValue.md +22 -0
  6. data/docs/FacebookPostEarningsResponseUnavailableMetricsInner.md +22 -0
  7. data/docs/InstagramAccountInsightsResponse.md +3 -1
  8. data/docs/InstagramAccountInsightsResponseMetricsValue.md +6 -2
  9. data/docs/InstagramAccountInsightsResponseUnavailableMetricsInner.md +22 -0
  10. data/docs/LinkedInAdsPlatformDataThoughtLeader.md +1 -1
  11. data/lib/zernio-sdk/api/analytics_api.rb +76 -2
  12. data/lib/zernio-sdk/models/facebook_post_earnings_response.rb +253 -0
  13. data/lib/zernio-sdk/models/facebook_post_earnings_response_metrics_value.rb +203 -0
  14. data/lib/zernio-sdk/models/facebook_post_earnings_response_unavailable_metrics_inner.rb +202 -0
  15. data/lib/zernio-sdk/models/instagram_account_insights_response.rb +14 -2
  16. data/lib/zernio-sdk/models/instagram_account_insights_response_metrics_value.rb +60 -5
  17. data/lib/zernio-sdk/models/instagram_account_insights_response_unavailable_metrics_inner.rb +202 -0
  18. data/lib/zernio-sdk/models/linked_in_ads_platform_data_thought_leader.rb +2 -2
  19. data/lib/zernio-sdk/version.rb +1 -1
  20. data/lib/zernio-sdk.rb +4 -0
  21. data/openapi.yaml +341 -18
  22. data/spec/api/analytics_api_spec.rb +15 -1
  23. data/spec/models/facebook_post_earnings_response_metrics_value_spec.rb +52 -0
  24. data/spec/models/facebook_post_earnings_response_spec.rb +82 -0
  25. data/spec/models/facebook_post_earnings_response_unavailable_metrics_inner_spec.rb +52 -0
  26. data/spec/models/instagram_account_insights_response_metrics_value_spec.rb +16 -0
  27. data/spec/models/instagram_account_insights_response_spec.rb +6 -0
  28. data/spec/models/instagram_account_insights_response_unavailable_metrics_inner_spec.rb +52 -0
  29. data/zernio-sdk-0.0.614.gem +0 -0
  30. metadata +19 -3
  31. data/zernio-sdk-0.0.612.gem +0 -0
@@ -31,9 +31,12 @@ module Zernio
31
31
  # Breakdown dimension used (only present when breakdown was requested)
32
32
  attr_accessor :breakdown
33
33
 
34
- # Object keyed by metric name. For time_series: each metric has \"total\" (number) and \"values\" (array of {date, value}). For total_value: each metric has \"total\" (number) and optionally \"breakdowns\" (array of {dimension, value}).
34
+ # Object keyed by metric name. For time_series: each metric has \"total\" (number) and \"values\" (array of {date, value}). For total_value: each metric has \"total\" (number) and optionally \"breakdowns\" (array of {dimension, value}). Monetary metrics additionally carry \"unit\" and \"currency\". Zernio never rescales money: \"total\" and every \"values[].value\" are the platform's raw numbers in the stated unit. Monetary metrics also keep \"values\" on metricType=total_value, because their \"total\" is the sum of the daily buckets the platform returned over the range: keep the series so you can reconcile that sum against the platform's own reporting before invoicing on it. A metric that could not be served is absent from this object and listed in \"unavailableMetrics\" instead, so an unavailable metric is never reported as a zero.
35
35
  attr_accessor :metrics
36
36
 
37
+ # Requested metrics that could not be served. Present only when at least one metric is unavailable, and absent otherwise. Each listed metric is OMITTED from \"metrics\" rather than reported as 0, which is how an unavailable metric is distinguished from a genuine zero. The request itself still succeeds with HTTP 200.
38
+ attr_accessor :unavailable_metrics
39
+
37
40
  attr_accessor :data_delay
38
41
 
39
42
  class EnumAttributeValidator
@@ -68,6 +71,7 @@ module Zernio
68
71
  :'metric_type' => :'metricType',
69
72
  :'breakdown' => :'breakdown',
70
73
  :'metrics' => :'metrics',
74
+ :'unavailable_metrics' => :'unavailableMetrics',
71
75
  :'data_delay' => :'dataDelay'
72
76
  }
73
77
  end
@@ -92,6 +96,7 @@ module Zernio
92
96
  :'metric_type' => :'String',
93
97
  :'breakdown' => :'String',
94
98
  :'metrics' => :'Hash<String, InstagramAccountInsightsResponseMetricsValue>',
99
+ :'unavailable_metrics' => :'Array<InstagramAccountInsightsResponseUnavailableMetricsInner>',
95
100
  :'data_delay' => :'String'
96
101
  }
97
102
  end
@@ -148,6 +153,12 @@ module Zernio
148
153
  end
149
154
  end
150
155
 
156
+ if attributes.key?(:'unavailable_metrics')
157
+ if (value = attributes[:'unavailable_metrics']).is_a?(Array)
158
+ self.unavailable_metrics = value
159
+ end
160
+ end
161
+
151
162
  if attributes.key?(:'data_delay')
152
163
  self.data_delay = attributes[:'data_delay']
153
164
  end
@@ -204,6 +215,7 @@ module Zernio
204
215
  metric_type == o.metric_type &&
205
216
  breakdown == o.breakdown &&
206
217
  metrics == o.metrics &&
218
+ unavailable_metrics == o.unavailable_metrics &&
207
219
  data_delay == o.data_delay
208
220
  end
209
221
 
@@ -216,7 +228,7 @@ module Zernio
216
228
  # Calculates hash code according to all attributes.
217
229
  # @return [Integer] Hash code
218
230
  def hash
219
- [success, account_id, platform, date_range, metric_type, breakdown, metrics, data_delay].hash
231
+ [success, account_id, platform, date_range, metric_type, breakdown, metrics, unavailable_metrics, data_delay].hash
220
232
  end
221
233
 
222
234
  # Builds the object from hash
@@ -18,18 +18,48 @@ module Zernio
18
18
  # Sum or aggregate value for the metric
19
19
  attr_accessor :total
20
20
 
21
- # Daily values (only for time_series)
21
+ # Daily values (for time_series, and always on monetary metrics)
22
22
  attr_accessor :values
23
23
 
24
24
  # Breakdown values (only for total_value with breakdown)
25
25
  attr_accessor :breakdowns
26
26
 
27
+ # Present on monetary metrics only. The scale of \"total\" and of every \"values[].value\", exactly as the platform returned them. \"micro_amount\": the platform returned an object shape carrying a micro amount, and the values are that integer, summed, 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. On Facebook Page insights this is always content_monetization_earnings. \"unspecified\": the platform returned a bare number with no unit metadata. It is passed through as-is; the platform does not state whether it is major or minor currency units. On Facebook Page insights this is always monetization_approximate_earnings.
28
+ attr_accessor :unit
29
+
30
+ # ISO 4217 currency of a monetary metric, or null when the platform omitted it. Always null on monetization_approximate_earnings, which Meta returns as a bare number with no currency; always present on content_monetization_earnings.
31
+ attr_accessor :currency
32
+
33
+ class EnumAttributeValidator
34
+ attr_reader :datatype
35
+ attr_reader :allowable_values
36
+
37
+ def initialize(datatype, allowable_values)
38
+ @allowable_values = allowable_values.map do |value|
39
+ case datatype.to_s
40
+ when /Integer/i
41
+ value.to_i
42
+ when /Float/i
43
+ value.to_f
44
+ else
45
+ value
46
+ end
47
+ end
48
+ end
49
+
50
+ def valid?(value)
51
+ !value || allowable_values.include?(value)
52
+ end
53
+ end
54
+
27
55
  # Attribute mapping from ruby-style variable name to JSON key.
28
56
  def self.attribute_map
29
57
  {
30
58
  :'total' => :'total',
31
59
  :'values' => :'values',
32
- :'breakdowns' => :'breakdowns'
60
+ :'breakdowns' => :'breakdowns',
61
+ :'unit' => :'unit',
62
+ :'currency' => :'currency'
33
63
  }
34
64
  end
35
65
 
@@ -48,13 +78,16 @@ module Zernio
48
78
  {
49
79
  :'total' => :'Float',
50
80
  :'values' => :'Array<InstagramAccountInsightsResponseMetricsValueValuesInner>',
51
- :'breakdowns' => :'Array<InstagramAccountInsightsResponseMetricsValueBreakdownsInner>'
81
+ :'breakdowns' => :'Array<InstagramAccountInsightsResponseMetricsValueBreakdownsInner>',
82
+ :'unit' => :'String',
83
+ :'currency' => :'String'
52
84
  }
53
85
  end
54
86
 
55
87
  # List of attributes with nullable: true
56
88
  def self.openapi_nullable
57
89
  Set.new([
90
+ :'currency'
58
91
  ])
59
92
  end
60
93
 
@@ -89,6 +122,14 @@ module Zernio
89
122
  self.breakdowns = value
90
123
  end
91
124
  end
125
+
126
+ if attributes.key?(:'unit')
127
+ self.unit = attributes[:'unit']
128
+ end
129
+
130
+ if attributes.key?(:'currency')
131
+ self.currency = attributes[:'currency']
132
+ end
92
133
  end
93
134
 
94
135
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -103,9 +144,21 @@ module Zernio
103
144
  # @return true if the model is valid
104
145
  def valid?
105
146
  warn '[DEPRECATED] the `valid?` method is obsolete'
147
+ unit_validator = EnumAttributeValidator.new('String', ["micro_amount", "unspecified"])
148
+ return false unless unit_validator.valid?(@unit)
106
149
  true
107
150
  end
108
151
 
152
+ # Custom attribute writer method checking allowed values (enum).
153
+ # @param [Object] unit Object to be assigned
154
+ def unit=(unit)
155
+ validator = EnumAttributeValidator.new('String', ["micro_amount", "unspecified"])
156
+ unless validator.valid?(unit)
157
+ fail ArgumentError, "invalid value for \"unit\", must be one of #{validator.allowable_values}."
158
+ end
159
+ @unit = unit
160
+ end
161
+
109
162
  # Checks equality by comparing each attribute.
110
163
  # @param [Object] Object to be compared
111
164
  def ==(o)
@@ -113,7 +166,9 @@ module Zernio
113
166
  self.class == o.class &&
114
167
  total == o.total &&
115
168
  values == o.values &&
116
- breakdowns == o.breakdowns
169
+ breakdowns == o.breakdowns &&
170
+ unit == o.unit &&
171
+ currency == o.currency
117
172
  end
118
173
 
119
174
  # @see the `==` method
@@ -125,7 +180,7 @@ module Zernio
125
180
  # Calculates hash code according to all attributes.
126
181
  # @return [Integer] Hash code
127
182
  def hash
128
- [total, values, breakdowns].hash
183
+ [total, values, breakdowns, unit, currency].hash
129
184
  end
130
185
 
131
186
  # Builds the object from hash
@@ -0,0 +1,202 @@
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 InstagramAccountInsightsResponseUnavailableMetricsInner < ApiModelBase
18
+ # The requested metric name.
19
+ attr_accessor :metric
20
+
21
+ # \"not_enrolled\": the account is not enrolled in the program behind this metric. \"permission_missing\": the connected user lacks access to this metric. \"unsupported_metric\": the platform does not accept this metric name on the API version Zernio uses. \"no_data\": the platform returned no bucket for this metric over the requested range. \"unreadable_value\": the platform returned a value shape Zernio cannot read, so no total is reported. \"mixed_currency\": readable values disagree on currency or unit within the range. \"upstream_error\": any other platform failure. \"no_data\" is the common case in practice. The others are defensive: \"not_enrolled\" and \"unsupported_metric\" in particular have not been observed on live Facebook traffic, since a non-enrolled Page returns zeros rather than an error and metric names are validated before any platform call.
22
+ attr_accessor :reason
23
+
24
+ # Platform-provided explanation when available (access tokens redacted), otherwise Zernio copy.
25
+ attr_accessor :message
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
+ :'metric' => :'metric',
53
+ :'reason' => :'reason',
54
+ :'message' => :'message'
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
+ :'metric' => :'String',
72
+ :'reason' => :'String',
73
+ :'message' => :'String'
74
+ }
75
+ end
76
+
77
+ # List of attributes with nullable: true
78
+ def self.openapi_nullable
79
+ Set.new([
80
+ ])
81
+ end
82
+
83
+ # Initializes the object
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ def initialize(attributes = {})
86
+ if (!attributes.is_a?(Hash))
87
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::InstagramAccountInsightsResponseUnavailableMetricsInner` initialize method"
88
+ end
89
+
90
+ # check to see if the attribute exists and convert string to symbol for hash key
91
+ acceptable_attribute_map = self.class.acceptable_attribute_map
92
+ attributes = attributes.each_with_object({}) { |(k, v), h|
93
+ if (!acceptable_attribute_map.key?(k.to_sym))
94
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::InstagramAccountInsightsResponseUnavailableMetricsInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
95
+ end
96
+ h[k.to_sym] = v
97
+ }
98
+
99
+ if attributes.key?(:'metric')
100
+ self.metric = attributes[:'metric']
101
+ end
102
+
103
+ if attributes.key?(:'reason')
104
+ self.reason = attributes[:'reason']
105
+ end
106
+
107
+ if attributes.key?(:'message')
108
+ self.message = attributes[:'message']
109
+ end
110
+ end
111
+
112
+ # Show invalid properties with the reasons. Usually used together with valid?
113
+ # @return Array for valid properties with the reasons
114
+ def list_invalid_properties
115
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
116
+ invalid_properties = Array.new
117
+ invalid_properties
118
+ end
119
+
120
+ # Check to see if the all the properties in the model are valid
121
+ # @return true if the model is valid
122
+ def valid?
123
+ warn '[DEPRECATED] the `valid?` method is obsolete'
124
+ reason_validator = EnumAttributeValidator.new('String', ["not_enrolled", "permission_missing", "unsupported_metric", "no_data", "unreadable_value", "mixed_currency", "upstream_error"])
125
+ return false unless reason_validator.valid?(@reason)
126
+ true
127
+ end
128
+
129
+ # Custom attribute writer method checking allowed values (enum).
130
+ # @param [Object] reason Object to be assigned
131
+ def reason=(reason)
132
+ validator = EnumAttributeValidator.new('String', ["not_enrolled", "permission_missing", "unsupported_metric", "no_data", "unreadable_value", "mixed_currency", "upstream_error"])
133
+ unless validator.valid?(reason)
134
+ fail ArgumentError, "invalid value for \"reason\", must be one of #{validator.allowable_values}."
135
+ end
136
+ @reason = reason
137
+ end
138
+
139
+ # Checks equality by comparing each attribute.
140
+ # @param [Object] Object to be compared
141
+ def ==(o)
142
+ return true if self.equal?(o)
143
+ self.class == o.class &&
144
+ metric == o.metric &&
145
+ reason == o.reason &&
146
+ message == o.message
147
+ end
148
+
149
+ # @see the `==` method
150
+ # @param [Object] Object to be compared
151
+ def eql?(o)
152
+ self == o
153
+ end
154
+
155
+ # Calculates hash code according to all attributes.
156
+ # @return [Integer] Hash code
157
+ def hash
158
+ [metric, reason, message].hash
159
+ end
160
+
161
+ # Builds the object from hash
162
+ # @param [Hash] attributes Model attributes in the form of hash
163
+ # @return [Object] Returns the model itself
164
+ def self.build_from_hash(attributes)
165
+ return nil unless attributes.is_a?(Hash)
166
+ attributes = attributes.transform_keys(&:to_sym)
167
+ transformed_hash = {}
168
+ openapi_types.each_pair do |key, type|
169
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
170
+ transformed_hash["#{key}"] = nil
171
+ elsif type =~ /\AArray<(.*)>/i
172
+ # check to ensure the input is an array given that the attribute
173
+ # is documented as an array but the input is not
174
+ if attributes[attribute_map[key]].is_a?(Array)
175
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
176
+ end
177
+ elsif !attributes[attribute_map[key]].nil?
178
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
179
+ end
180
+ end
181
+ new(transformed_hash)
182
+ end
183
+
184
+ # Returns the object in the form of hash
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_hash
187
+ hash = {}
188
+ self.class.attribute_map.each_pair do |attr, param|
189
+ value = self.send(attr)
190
+ if value.nil?
191
+ is_nullable = self.class.openapi_nullable.include?(attr)
192
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
193
+ end
194
+
195
+ hash[param] = _to_hash(value)
196
+ end
197
+ hash
198
+ end
199
+
200
+ end
201
+
202
+ end
@@ -14,9 +14,9 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Zernio
17
- # POST /v1/ads/create only. Thought-leader ad: references someone else's existing LinkedIn share or ugcPost as the creative. Unlike boostPost, which provisions its own CampaignGroup + Campaign around the post, this variant attaches the reference under the campaign /v1/ads/create builds — same shape as every other format, so the caller can pick bidding / targeting / schedule freely. No headline, body, imageUrl or organization are needed; the referenced post carries its own commentary and author. Mutually exclusive with the other creative sources.
17
+ # POST /v1/ads/create only. Sponsors an existing LinkedIn post (a share or ugcPost authored by your organization's Company Page) as the creative, keeping its commentary, author and engagement. Unlike boostPost, which provisions its own CampaignGroup + Campaign around the post, this variant attaches the reference under the campaign /v1/ads/create builds — same shape as every other format, so the caller can pick bidding / targeting / schedule freely. No headline, body, imageUrl or organization are needed; the referenced post carries its own commentary and author. Mutually exclusive with the other creative sources. Posts from personal profiles (Thought Leader Ads) are NOT supported (see postUrn).
18
18
  class LinkedInAdsPlatformDataThoughtLeader < ApiModelBase
19
- # LinkedIn share or ugcPost URN, urn:li:share:N or urn:li:ugcPost:N. Get it via \"Copy link to post\" on the target LinkedIn post (the URL contains -share- for a share or -ugcPost- for a ugcPost, then the numeric id). For member (personal profile) posts, LinkedIn's API only accepts video and document posts (ugcPost URNs); text and image member posts (share URNs) are rejected by LinkedIn regardless of sponsorship approval (a LinkedIn API limitation; those can only be sponsored from Campaign Manager). The member must have authorised sponsorship for the ad account's organization.
19
+ # LinkedIn share or ugcPost URN, urn:li:share:N or urn:li:ugcPost:N. Get it via \"Copy link to post\" on the target LinkedIn post (the URL contains -share- for a share or -ugcPost- for a ugcPost, then the numeric id). The post must be authored by an organization (Company Page). Member (personal profile) posts, i.e. Thought Leader Ads proper, are rejected by LinkedIn's public Marketing API regardless of sponsorship approval and of post type (a LinkedIn limitation; their Campaign Manager creates those through a private API). Referencing a member post returns a 422 with a clear error.
20
20
  attr_accessor :post_urn
21
21
 
22
22
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -11,5 +11,5 @@ Generator version: 7.19.0
11
11
  =end
12
12
 
13
13
  module Zernio
14
- VERSION = '0.0.612'
14
+ VERSION = '0.0.614'
15
15
  end
data/lib/zernio-sdk.rb CHANGED
@@ -392,6 +392,9 @@ require 'zernio-sdk/models/external_post_summary_analytics'
392
392
  require 'zernio-sdk/models/external_post_webhook_post'
393
393
  require 'zernio-sdk/models/facebook_platform_data'
394
394
  require 'zernio-sdk/models/facebook_platform_data_carousel_cards_inner'
395
+ require 'zernio-sdk/models/facebook_post_earnings_response'
396
+ require 'zernio-sdk/models/facebook_post_earnings_response_metrics_value'
397
+ require 'zernio-sdk/models/facebook_post_earnings_response_unavailable_metrics_inner'
395
398
  require 'zernio-sdk/models/fetch_google_business_verification_options200_response'
396
399
  require 'zernio-sdk/models/fetch_google_business_verification_options200_response_options_inner'
397
400
  require 'zernio-sdk/models/fetch_google_business_verification_options_request'
@@ -761,6 +764,7 @@ require 'zernio-sdk/models/instagram_account_insights_response_date_range'
761
764
  require 'zernio-sdk/models/instagram_account_insights_response_metrics_value'
762
765
  require 'zernio-sdk/models/instagram_account_insights_response_metrics_value_breakdowns_inner'
763
766
  require 'zernio-sdk/models/instagram_account_insights_response_metrics_value_values_inner'
767
+ require 'zernio-sdk/models/instagram_account_insights_response_unavailable_metrics_inner'
764
768
  require 'zernio-sdk/models/instagram_demographics_response'
765
769
  require 'zernio-sdk/models/instagram_demographics_response_demographics_value_inner'
766
770
  require 'zernio-sdk/models/instagram_platform_data'