zelf-sdk 1.2.0 → 1.3.1
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/lib/zelf/errors.rb +7 -2
- data/lib/zelf/models.rb +4 -4
- data/lib/zelf/resources/creator_vetting.rb +1 -1
- data/lib/zelf/transport.rb +1 -1
- data/lib/zelf/version.rb +1 -1
- data/lib/zelf/webhooks.rb +1 -1
- data/lib/zelf.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c92c1167b2cddff274d5e14f91180d6ca5dc1eda305b2cd9ba9456356a535ead
|
|
4
|
+
data.tar.gz: 4232a2d6adc7520cd0d9972c2e2ade9dd71d2eaa453d58e90dd6a653006b92f8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2e309ed0f46971b924ae70426ceaa14d677198938a898f653a499e92c1c813d1b278b86ceb829484cdba1d114d74b719861899916b344f42b16601ee4298ad00
|
|
7
|
+
data.tar.gz: 2f00087a2005a8e8a164867be31027d7fe99fe5bcf2daddd5e4e9c6da796c32019ad8d6073b373227c9067b7a00049a586c1b3931bc54663bd4b870aab5ad3f8
|
data/lib/zelf/errors.rb
CHANGED
|
@@ -14,7 +14,12 @@ module Zelf
|
|
|
14
14
|
attr_reader :status, :code, :details, :log_id
|
|
15
15
|
|
|
16
16
|
def initialize(message, status:, code: nil, details: nil, log_id: nil)
|
|
17
|
-
|
|
17
|
+
# The message alone says a request was refused but never which
|
|
18
|
+
# field or which limit, and that is the part a caller can act on.
|
|
19
|
+
reasons = (details || {}).map do |field, said|
|
|
20
|
+
"#{field}: #{said.is_a?(Array) ? said.join(' ') : said}"
|
|
21
|
+
end.join(' ')
|
|
22
|
+
super(reasons.empty? ? message : "#{message} #{reasons}")
|
|
18
23
|
@status = status
|
|
19
24
|
@code = code
|
|
20
25
|
@details = details || {}
|
|
@@ -93,7 +98,7 @@ module Zelf
|
|
|
93
98
|
detail = body['error'].is_a?(Hash) ? body['error'] : {}
|
|
94
99
|
status = response.code.to_i
|
|
95
100
|
klass = STATUS_MAP.fetch(status, APIError)
|
|
96
|
-
klass.new(detail['message'] || "HTTP #{status} from the
|
|
101
|
+
klass.new(detail['message'] || "HTTP #{status} from the Zelf API",
|
|
97
102
|
status: status, code: detail['code'],
|
|
98
103
|
details: detail['details'], log_id: body['log_id'])
|
|
99
104
|
end
|
data/lib/zelf/models.rb
CHANGED
|
@@ -24,7 +24,7 @@ module Zelf
|
|
|
24
24
|
# Accepted values for ContentFormEnum.
|
|
25
25
|
ContentFormEnum = [
|
|
26
26
|
"VIDEO",
|
|
27
|
-
"
|
|
27
|
+
"PHOTO",
|
|
28
28
|
].freeze
|
|
29
29
|
|
|
30
30
|
# Accepted values for KindEnum.
|
|
@@ -507,7 +507,7 @@ module Zelf
|
|
|
507
507
|
field :transcript, "transcript"
|
|
508
508
|
# Direct URL to the post on its platform
|
|
509
509
|
field :platform_url, "platform_url"
|
|
510
|
-
#
|
|
510
|
+
# What the content was most recently collected under: a hashtag, a creator handle,...
|
|
511
511
|
field :last_keyword, "last_keyword"
|
|
512
512
|
# Short AI-generated summary of the content
|
|
513
513
|
field :ai_summary, "ai_summary"
|
|
@@ -1203,7 +1203,7 @@ module Zelf
|
|
|
1203
1203
|
field :download_url, "download_url"
|
|
1204
1204
|
end
|
|
1205
1205
|
|
|
1206
|
-
# The outer payload
|
|
1206
|
+
# The outer payload Zelf POSTs to receivers, uniform across all pushes. Top-level
|
|
1207
1207
|
# fields are delivery metadata and remain identical across modes. `data` carries the
|
|
1208
1208
|
# content; which key inside it is populated (`files` or `items`) is determined by
|
|
1209
1209
|
# `delivery_mode`. `manifest` deliveries use `data.files`, while `inline` event pushes
|
|
@@ -1215,7 +1215,7 @@ module Zelf
|
|
|
1215
1215
|
field :type, "type"
|
|
1216
1216
|
# Id of the subscription that produced this push
|
|
1217
1217
|
field :subscription_id, "subscription_id"
|
|
1218
|
-
# Unix epoch seconds at which
|
|
1218
|
+
# Unix epoch seconds at which Zelf sent this push
|
|
1219
1219
|
field :delivered_at, "delivered_at"
|
|
1220
1220
|
# true for production data; false for test deliveries
|
|
1221
1221
|
field :livemode, "livemode"
|
|
@@ -102,7 +102,7 @@ module Zelf
|
|
|
102
102
|
# `time_seconds`. It also gives each source a `channels` status: `present`, `absent`
|
|
103
103
|
# or `unknown` (not checked). Disclosures are not counted as violations. Limits: only
|
|
104
104
|
# videos up to 10 minutes are checked; on-screen text is read from sampled frames, so
|
|
105
|
-
# text shown only briefly can be missed; videos
|
|
105
|
+
# text shown only briefly can be missed; videos Zelf analyzed before the request are
|
|
106
106
|
# not re-analyzed for disclosures. An empty `evidence` list does not confirm that a
|
|
107
107
|
# video has no disclosure. Detection reports what was stated; it does not assess legal
|
|
108
108
|
# compliance.
|
data/lib/zelf/transport.rb
CHANGED
data/lib/zelf/version.rb
CHANGED
data/lib/zelf/webhooks.rb
CHANGED
|
@@ -7,7 +7,7 @@ require 'openssl'
|
|
|
7
7
|
require 'uri'
|
|
8
8
|
|
|
9
9
|
module Zelf
|
|
10
|
-
# Verifies and routes the deliveries
|
|
10
|
+
# Verifies and routes the deliveries Zelf posts to a receiver.
|
|
11
11
|
module Webhooks
|
|
12
12
|
SIGNATURE_HEADER = 'Webhook-Signature'.freeze
|
|
13
13
|
TIMESTAMP_HEADER = 'Webhook-Timestamp'.freeze
|
data/lib/zelf.rb
CHANGED
|
@@ -21,9 +21,9 @@ require_relative 'zelf/resources/sub_brands'
|
|
|
21
21
|
require_relative 'zelf/resources/usage'
|
|
22
22
|
require_relative 'zelf/resources/webhooks'
|
|
23
23
|
|
|
24
|
-
# Ruby client for the
|
|
24
|
+
# Ruby client for the Zelf APIs (spec version 1.3.0).
|
|
25
25
|
module Zelf
|
|
26
|
-
# Client for the
|
|
26
|
+
# Client for the Zelf APIs.
|
|
27
27
|
#
|
|
28
28
|
# The key comes from the api_key: argument, falling back to the
|
|
29
29
|
# ZELF_API_KEY environment variable. It is sent as the x-api-key header
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: zelf-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Zelf
|
|
@@ -62,5 +62,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
62
62
|
requirements: []
|
|
63
63
|
rubygems_version: 3.6.9
|
|
64
64
|
specification_version: 4
|
|
65
|
-
summary: Ruby client for the
|
|
65
|
+
summary: Ruby client for the Zelf APIs
|
|
66
66
|
test_files: []
|