late-sdk 0.0.613 → 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.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/docs/AnalyticsApi.md +78 -2
- data/docs/FacebookPostEarningsResponse.md +32 -0
- data/docs/FacebookPostEarningsResponseMetricsValue.md +22 -0
- data/docs/FacebookPostEarningsResponseUnavailableMetricsInner.md +22 -0
- data/docs/InstagramAccountInsightsResponse.md +3 -1
- data/docs/InstagramAccountInsightsResponseMetricsValue.md +6 -2
- data/docs/InstagramAccountInsightsResponseUnavailableMetricsInner.md +22 -0
- data/lib/zernio-sdk/api/analytics_api.rb +76 -2
- data/lib/zernio-sdk/models/facebook_post_earnings_response.rb +253 -0
- data/lib/zernio-sdk/models/facebook_post_earnings_response_metrics_value.rb +203 -0
- data/lib/zernio-sdk/models/facebook_post_earnings_response_unavailable_metrics_inner.rb +202 -0
- data/lib/zernio-sdk/models/instagram_account_insights_response.rb +14 -2
- data/lib/zernio-sdk/models/instagram_account_insights_response_metrics_value.rb +60 -5
- data/lib/zernio-sdk/models/instagram_account_insights_response_unavailable_metrics_inner.rb +202 -0
- data/lib/zernio-sdk/version.rb +1 -1
- data/lib/zernio-sdk.rb +4 -0
- data/openapi.yaml +322 -2
- data/spec/api/analytics_api_spec.rb +15 -1
- data/spec/models/facebook_post_earnings_response_metrics_value_spec.rb +52 -0
- data/spec/models/facebook_post_earnings_response_spec.rb +82 -0
- data/spec/models/facebook_post_earnings_response_unavailable_metrics_inner_spec.rb +52 -0
- data/spec/models/instagram_account_insights_response_metrics_value_spec.rb +16 -0
- data/spec/models/instagram_account_insights_response_spec.rb +6 -0
- data/spec/models/instagram_account_insights_response_unavailable_metrics_inner_spec.rb +52 -0
- data/zernio-sdk-0.0.614.gem +0 -0
- metadata +18 -2
- data/zernio-sdk-0.0.613.gem +0 -0
|
@@ -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
|
|
@@ -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 FacebookPostEarningsResponseUnavailableMetricsInner < 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\": Meta does not accept this metric name on the API version Zernio uses. \"no_data\": Meta returned no bucket for this metric. \"unreadable_value\": Meta returned a value shape Zernio cannot read, so no total is reported. \"mixed_currency\": readable values disagree on currency or unit. \"upstream_error\": any other platform failure. \"no_data\" is the common case in practice; the others are defensive.
|
|
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::FacebookPostEarningsResponseUnavailableMetricsInner` 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::FacebookPostEarningsResponseUnavailableMetricsInner`. 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
|