zelf-sdk 1.1.1 → 1.3.0
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 +1 -1
- data/lib/zelf/models.rb +25 -25
- data/lib/zelf/resources/analytics.rb +0 -20
- data/lib/zelf/resources/creator_vetting.rb +1 -1
- data/lib/zelf/resources/engage.rb +31 -0
- 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 +5 -3
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8ea6c46cc2c031f6dc4406875f1db335c201654f45c9837cf459b90ed3cb6cc5
|
|
4
|
+
data.tar.gz: e57d1efc5e789ff92489d3f4b039c896ca297057520f0846135f3bd05150e9f3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b821ee8a254d4efdda139485c8edcabfb697748558471a2d1e87d56f62ec0629d1116b3ec23ecfe617b425ec18cc9959db078cf375aacbbff4fcaaa262a1162b
|
|
7
|
+
data.tar.gz: bec3bf4f30a3cbba532e38686405c4e7ca07bcdfec073497e9d0c56d8ac6acfb03de35c43ee872b15ede25e01c7257025f5330f84db12a88e189e03152f902a1
|
data/lib/zelf/errors.rb
CHANGED
|
@@ -93,7 +93,7 @@ module Zelf
|
|
|
93
93
|
detail = body['error'].is_a?(Hash) ? body['error'] : {}
|
|
94
94
|
status = response.code.to_i
|
|
95
95
|
klass = STATUS_MAP.fetch(status, APIError)
|
|
96
|
-
klass.new(detail['message'] || "HTTP #{status} from the
|
|
96
|
+
klass.new(detail['message'] || "HTTP #{status} from the Zelf API",
|
|
97
97
|
status: status, code: detail['code'],
|
|
98
98
|
details: detail['details'], log_id: body['log_id'])
|
|
99
99
|
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.
|
|
@@ -108,6 +108,8 @@ module Zelf
|
|
|
108
108
|
class BrandStatistics < Zelf::Model; end
|
|
109
109
|
class Comment < Zelf::Model; end
|
|
110
110
|
class CommentAuthor < Zelf::Model; end
|
|
111
|
+
class CommentCategory < Zelf::Model; end
|
|
112
|
+
class CommentStatistics < Zelf::Model; end
|
|
111
113
|
class Content < Zelf::Model; end
|
|
112
114
|
class ContentActionRequestRequest < Zelf::Model; end
|
|
113
115
|
class ContentActionResponse < Zelf::Model; end
|
|
@@ -143,8 +145,6 @@ module Zelf
|
|
|
143
145
|
class FollowerTimeseries < Zelf::Model; end
|
|
144
146
|
class PatchedBrandUpdateRequest < Zelf::Model; end
|
|
145
147
|
class PatchedWebhookSubscriptionUpdateRequest < Zelf::Model; end
|
|
146
|
-
class PostedCommentCategory < Zelf::Model; end
|
|
147
|
-
class PostedComments < Zelf::Model; end
|
|
148
148
|
class ResultFile < Zelf::Model; end
|
|
149
149
|
class SafetyCheckRequest < Zelf::Model; end
|
|
150
150
|
class Usage < Zelf::Model; end
|
|
@@ -433,6 +433,26 @@ module Zelf
|
|
|
433
433
|
field :profile_picture_url, "profile_picture_url"
|
|
434
434
|
end
|
|
435
435
|
|
|
436
|
+
# Comments the brand posted on one category of content.
|
|
437
|
+
class CommentCategory
|
|
438
|
+
# brand, owned, competitors, themes or other
|
|
439
|
+
field :category, "category"
|
|
440
|
+
# Comments posted on this category
|
|
441
|
+
field :comments, "comments"
|
|
442
|
+
# Likes those comments received
|
|
443
|
+
field :likes, "likes"
|
|
444
|
+
# Replies those comments received
|
|
445
|
+
field :replies, "replies"
|
|
446
|
+
end
|
|
447
|
+
|
|
448
|
+
# Comments the brand posted, split by the content they were posted on.
|
|
449
|
+
class CommentStatistics
|
|
450
|
+
# Comments the brand posted in the window, across every category
|
|
451
|
+
field :total_comments_posted, "total_comments_posted"
|
|
452
|
+
# One entry per category
|
|
453
|
+
field :categories, "categories", cast: [CommentCategory]
|
|
454
|
+
end
|
|
455
|
+
|
|
436
456
|
# A piece of content (a post, video, or image) and its metrics.
|
|
437
457
|
class Content
|
|
438
458
|
# Unique identifier for this piece of content
|
|
@@ -1011,26 +1031,6 @@ module Zelf
|
|
|
1011
1031
|
field :enabled, "enabled"
|
|
1012
1032
|
end
|
|
1013
1033
|
|
|
1014
|
-
# Comments the brand posted on one category of content.
|
|
1015
|
-
class PostedCommentCategory
|
|
1016
|
-
# brand, owned, competitors, themes or other
|
|
1017
|
-
field :category, "category"
|
|
1018
|
-
# Comments posted on this category
|
|
1019
|
-
field :comments, "comments"
|
|
1020
|
-
# Likes those comments received
|
|
1021
|
-
field :likes, "likes"
|
|
1022
|
-
# Replies those comments received
|
|
1023
|
-
field :replies, "replies"
|
|
1024
|
-
end
|
|
1025
|
-
|
|
1026
|
-
# Comments the brand posted, split by the content they were posted on.
|
|
1027
|
-
class PostedComments
|
|
1028
|
-
# Comments the brand posted in the window, across every category
|
|
1029
|
-
field :total_comments_posted, "total_comments_posted"
|
|
1030
|
-
# One entry per category
|
|
1031
|
-
field :categories, "categories", cast: [PostedCommentCategory]
|
|
1032
|
-
end
|
|
1033
|
-
|
|
1034
1034
|
# Signed, time-limited download of an analysis run's result payload.
|
|
1035
1035
|
class ResultFile
|
|
1036
1036
|
# Unix epoch seconds after which download_url expires
|
|
@@ -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"
|
|
@@ -47,26 +47,6 @@ module Zelf
|
|
|
47
47
|
envelope = @transport.request(:get, "/api/v1/analytics/follower_timeseries/", query: query)
|
|
48
48
|
Zelf.rows(envelope, Models::FollowerTimeseries)
|
|
49
49
|
end
|
|
50
|
-
|
|
51
|
-
# Get Posted Comment Analytics. Returns the comments the brand posted in the window,
|
|
52
|
-
# grouped by the kind of content they were posted on, together with the likes and
|
|
53
|
-
# replies those comments received. These are comments the brand wrote, not comments
|
|
54
|
-
# left on its content; `comments.list` returns the latter. The five categories add up
|
|
55
|
-
# to `total_comments_posted`.
|
|
56
|
-
#
|
|
57
|
-
# Calls GET /api/v1/analytics/posted_comments/ (analytics.posted_comments).
|
|
58
|
-
def posted_comments(brand_id:, platform: nil, posted_after: nil, posted_before: nil, posted_within_days: nil, posted_within_hours: nil)
|
|
59
|
-
query = {
|
|
60
|
-
"brand_id" => brand_id,
|
|
61
|
-
"platform" => platform,
|
|
62
|
-
"posted_after" => posted_after,
|
|
63
|
-
"posted_before" => posted_before,
|
|
64
|
-
"posted_within_days" => posted_within_days,
|
|
65
|
-
"posted_within_hours" => posted_within_hours,
|
|
66
|
-
}.reject { |_, value| value.nil? }
|
|
67
|
-
envelope = @transport.request(:get, "/api/v1/analytics/posted_comments/", query: query)
|
|
68
|
-
Zelf.one(envelope, Models::PostedComments, "PostedComments")
|
|
69
|
-
end
|
|
70
50
|
end
|
|
71
51
|
end
|
|
72
52
|
end
|
|
@@ -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.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Generated by codegen. Do not edit by hand.
|
|
2
|
+
module Zelf
|
|
3
|
+
module Resources
|
|
4
|
+
# The engage endpoints.
|
|
5
|
+
class Engage
|
|
6
|
+
def initialize(transport)
|
|
7
|
+
@transport = transport
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# Get Comment Statistics. Returns the comments the brand posted in the window, grouped
|
|
11
|
+
# by the kind of content they were posted on, together with the likes and replies
|
|
12
|
+
# those comments received. These are comments the brand wrote, not comments left on
|
|
13
|
+
# its content; `comments.list` returns the latter. The five categories add up to
|
|
14
|
+
# `total_comments_posted`.
|
|
15
|
+
#
|
|
16
|
+
# Calls GET /api/v1/engage/comment_statistics/ (engage.comment_statistics).
|
|
17
|
+
def comment_statistics(brand_id:, platform: nil, posted_after: nil, posted_before: nil, posted_within_days: nil, posted_within_hours: nil)
|
|
18
|
+
query = {
|
|
19
|
+
"brand_id" => brand_id,
|
|
20
|
+
"platform" => platform,
|
|
21
|
+
"posted_after" => posted_after,
|
|
22
|
+
"posted_before" => posted_before,
|
|
23
|
+
"posted_within_days" => posted_within_days,
|
|
24
|
+
"posted_within_hours" => posted_within_hours,
|
|
25
|
+
}.reject { |_, value| value.nil? }
|
|
26
|
+
envelope = @transport.request(:get, "/api/v1/engage/comment_statistics/", query: query)
|
|
27
|
+
Zelf.one(envelope, Models::CommentStatistics, "CommentStatistics")
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
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
|
@@ -16,19 +16,20 @@ require_relative 'zelf/resources/creator_sync'
|
|
|
16
16
|
require_relative 'zelf/resources/creator_vetting'
|
|
17
17
|
require_relative 'zelf/resources/creators'
|
|
18
18
|
require_relative 'zelf/resources/detection'
|
|
19
|
+
require_relative 'zelf/resources/engage'
|
|
19
20
|
require_relative 'zelf/resources/sub_brands'
|
|
20
21
|
require_relative 'zelf/resources/usage'
|
|
21
22
|
require_relative 'zelf/resources/webhooks'
|
|
22
23
|
|
|
23
|
-
# Ruby client for the
|
|
24
|
+
# Ruby client for the Zelf APIs (spec version 1.3.0).
|
|
24
25
|
module Zelf
|
|
25
|
-
# Client for the
|
|
26
|
+
# Client for the Zelf APIs.
|
|
26
27
|
#
|
|
27
28
|
# The key comes from the api_key: argument, falling back to the
|
|
28
29
|
# ZELF_API_KEY environment variable. It is sent as the x-api-key header
|
|
29
30
|
# and is kept out of inspect output.
|
|
30
31
|
class Client
|
|
31
|
-
attr_reader :ai_analysis, :analytics, :brand_accounts, :brands, :comments, :content, :creator_sync, :creator_vetting, :creators, :detection, :sub_brands, :usage, :webhooks
|
|
32
|
+
attr_reader :ai_analysis, :analytics, :brand_accounts, :brands, :comments, :content, :creator_sync, :creator_vetting, :creators, :detection, :engage, :sub_brands, :usage, :webhooks
|
|
32
33
|
|
|
33
34
|
def initialize(api_key: nil, base_url: nil, timeout: 60,
|
|
34
35
|
max_retries: 2, retry_writes: false, headers: {})
|
|
@@ -45,6 +46,7 @@ module Zelf
|
|
|
45
46
|
@creator_vetting = Resources::CreatorVetting.new(@transport)
|
|
46
47
|
@creators = Resources::Creators.new(@transport)
|
|
47
48
|
@detection = Resources::Detection.new(@transport)
|
|
49
|
+
@engage = Resources::Engage.new(@transport)
|
|
48
50
|
@sub_brands = Resources::SubBrands.new(@transport)
|
|
49
51
|
@usage = Resources::Usage.new(@transport)
|
|
50
52
|
@webhooks = Resources::Webhooks.new(@transport)
|
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.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Zelf
|
|
@@ -31,6 +31,7 @@ files:
|
|
|
31
31
|
- lib/zelf/resources/creator_vetting.rb
|
|
32
32
|
- lib/zelf/resources/creators.rb
|
|
33
33
|
- lib/zelf/resources/detection.rb
|
|
34
|
+
- lib/zelf/resources/engage.rb
|
|
34
35
|
- lib/zelf/resources/sub_brands.rb
|
|
35
36
|
- lib/zelf/resources/usage.rb
|
|
36
37
|
- lib/zelf/resources/webhooks.rb
|
|
@@ -61,5 +62,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
61
62
|
requirements: []
|
|
62
63
|
rubygems_version: 3.6.9
|
|
63
64
|
specification_version: 4
|
|
64
|
-
summary: Ruby client for the
|
|
65
|
+
summary: Ruby client for the Zelf APIs
|
|
65
66
|
test_files: []
|