omnisocials 0.8.0 → 0.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 43d0cc71e753d98ddbaa8b1732f140ecfc3d578d02a8e8df81e248c6c9c75131
4
- data.tar.gz: a66ae890324f9adc7b37b57add4e76ce1be1b110d4b15f751c611bcbfa6adf61
3
+ metadata.gz: 26f8bcb600108496ff4cf072d383bf2dbb1082c573b14d2f0e7b8986284c1b1d
4
+ data.tar.gz: e42dc4799da58ada826fc37d34cab90c96d91b92afed5117f89dce73f01cdf2c
5
5
  SHA512:
6
- metadata.gz: 0b30af0ebca987fe7bebb4710d7648d2c0361e8709cdf716897d4f1f82808dc916159742dcae7c9c0512863e01f68435d642a9341e8254d9cc11511459b496ce
7
- data.tar.gz: e50bd7f05fe6a2e516ff9ea31bb28307af242c4118ca1a30583008b88591e3b2d9c080fb50447137133f036e21d6fed8721b90bd380cfb670dc3870868ac7710
6
+ metadata.gz: 92398e94cbc636eb8dfede06d8cb2dfc0d5a7239c39ef72e417b6f8de5e982ed8538c4f5d7f61c6bdb70cfc2e52a76a556d58d27bd6c5cf161c784d6a30b824f
7
+ data.tar.gz: 1a5e379ad7bafe61ba70912d724531670ac7245e44c5d45e4e4968bfb458f0b030ab9a03ec64001fa3ddd6b50021c4854df280af220b1c6413ce17b30ae30d3d
data/README.md CHANGED
@@ -387,6 +387,32 @@ client.posts.create(
387
387
 
388
388
  The Threads response is `{ "locations" => [...] }` (each with nullable `name`, `address`, `city`, `country`, `latitude`, `longitude`) or `{ "error" => { "code", "message" } }` with `code` one of `not_available`, `threads_not_connected`, `threads_reauth_required` (reconnect Threads), or `platform_error`. Threads location tagging is currently rolling out; until Meta approves the permissions it is disabled on production and calls return a clear error.
389
389
 
390
+ ## Pinterest product tags
391
+
392
+ Tag products on a Pin so people can shop the items in the image. `client.pinterest.list_products` returns the product Pins of the connected Pinterest account; pass their `pin_id` values (max 24) as `"product_tags"` in the `pinterest` options of the post. Only product Pins of your own account can be tagged; products of other merchants cannot. The tags are added right after the Pin is published. A product that Pinterest refuses never fails the post: the outcome is on the post as `pinterest["product_tags_result"]` (`requested`, `tagged`, `skipped`, `error`).
393
+
394
+ ```ruby
395
+ result = client.pinterest.list_products
396
+
397
+ if result["error"]
398
+ # HTTP 200 without "products": pinterest_not_connected,
399
+ # pinterest_catalog_access_required or platform_error
400
+ warn "#{result["error"]["code"]}: #{result["error"]["message"]}"
401
+ else
402
+ product_tags = result["products"].first(3).map { |product| product["pin_id"] }
403
+
404
+ client.posts.create(
405
+ content: "Our summer picks",
406
+ channels: ["pinterest"],
407
+ media_urls: ["https://example.com/summer-look.jpg"],
408
+ scheduled_at: "2026-08-01T09:00:00Z",
409
+ pinterest: { "board_id" => "1234567890", "title" => "Summer picks", "product_tags" => product_tags }
410
+ )
411
+ end
412
+ ```
413
+
414
+ Without `source:` the list reads the Pinterest catalog (with `price`, `currency`, `availability` and `item_id`) when the connection has catalog access, else the account's own Pins. Catalog access is given one time in the OmniSocials composer: Pinterest options, Add products, Connect catalog. `source: "pins"` scans up to 250 Pins per call, so `"products"` can be empty while `"bookmark"` is set; call again with `bookmark: result["bookmark"]`. To check one Pin id or Pin link before you post, call `client.pinterest.validate_product("813744226420795884")`. On `posts.update` the `pinterest` hash replaces the stored one, so leave `"product_tags"` out to remove the tags.
415
+
390
416
  ## Inbox
391
417
 
392
418
  Read and reply to social inbox conversations (DMs, comments, mentions) across connected platforms. Requires an API key with the opt-in `inbox:read` / `inbox:write` scopes. The list endpoints are cursor-paginated (unlike the offset pagination used elsewhere): page while `pagination["has_more"]` is true by passing the previous response's `pagination["next_cursor"]` as `cursor`.
@@ -60,7 +60,8 @@ module OmniSocials
60
60
 
61
61
  attr_reader :api_key, :base_url, :timeout, :max_retries,
62
62
  :posts, :media, :folders, :hashtag_sets, :approval_workflows,
63
- :accounts, :analytics, :audio, :locations, :inbox, :webhooks
63
+ :accounts, :analytics, :audio, :locations, :pinterest, :inbox,
64
+ :webhooks
64
65
 
65
66
  # api_key - API key (omsk_live_* / omsk_test_*). Falls back to the
66
67
  # OMNISOCIALS_API_KEY environment variable. Raises
@@ -94,6 +95,7 @@ module OmniSocials
94
95
  @analytics = Resources::Analytics.new(self)
95
96
  @audio = Resources::Audio.new(self)
96
97
  @locations = Resources::Locations.new(self)
98
+ @pinterest = Resources::Pinterest.new(self)
97
99
  @inbox = Resources::Inbox.new(self)
98
100
  @webhooks = Resources::Webhooks.new(self)
99
101
  end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniSocials
4
+ module Resources
5
+ # Pinterest resource: product Pins for product tagging (list + validate).
6
+ class Pinterest
7
+ def initialize(client)
8
+ @client = client
9
+ end
10
+
11
+ # GET /pinterest/products - list the product Pins of the connected
12
+ # Pinterest account. Pass a result's pin_id in
13
+ # pinterest: { "product_tags" => [...] } on post create/update to tag
14
+ # the product on the Pin (max 24 per Pin). Pinterest only accepts a
15
+ # product Pin that is public, belongs to the same account and links to
16
+ # a website that account claimed; products of other merchants cannot
17
+ # be tagged.
18
+ #
19
+ # source is "catalog" or "pins". "catalog" reads the Pinterest catalog
20
+ # (with price, currency, availability, item_id) and needs catalog
21
+ # access, which is given one time in the OmniSocials composer
22
+ # (Pinterest options, Add products, Connect catalog); product_group_id
23
+ # and page_size (1..100, default 25) apply to this source only. "pins"
24
+ # reads the account's own Pins and works on every connection; one call
25
+ # scans up to 250 Pins, so "products" can be empty while "bookmark" is
26
+ # set (call again with bookmark:). When source is left out the API
27
+ # uses "catalog" when the connection has catalog access, else "pins".
28
+ #
29
+ # Response (not the usual "data" envelope):
30
+ # { "products" => [{ pin_id, title, description, link, image_url,
31
+ # price, currency, availability, item_id }], "bookmark", "source",
32
+ # "catalog_access" } plus "product_groups" and "product_group_id" for
33
+ # the catalog source, or { "error" => { "code", "message" } } without
34
+ # "products" when the list could not be read, both with HTTP 200. code
35
+ # is one of "pinterest_not_connected",
36
+ # "pinterest_catalog_access_required" or "platform_error". A bad source
37
+ # or product_group_id raises a 400 with the standard error envelope.
38
+ def list_products(source: nil, product_group_id: nil, bookmark: nil,
39
+ page_size: nil)
40
+ @client.request(
41
+ "GET", "/pinterest/products",
42
+ query: {
43
+ "source" => source,
44
+ "product_group_id" => product_group_id,
45
+ "bookmark" => bookmark,
46
+ "page_size" => page_size
47
+ }
48
+ )
49
+ end
50
+
51
+ # GET /pinterest/products/validate?id= - check whether a Pin can be
52
+ # used in pinterest product_tags before creating the post. id is a Pin
53
+ # id or a Pin link (https://www.pinterest.com/pin/<id>/). Response:
54
+ # { "valid", "pin_id", ... }; "unverified" => true means the check
55
+ # could not run and the publish step is the final check.
56
+ def validate_product(id)
57
+ @client.request("GET", "/pinterest/products/validate", query: { "id" => id })
58
+ end
59
+ end
60
+ end
61
+ end
@@ -86,6 +86,16 @@ module OmniSocials
86
86
  # disabled on production and create/update/publish return a 400 (also a
87
87
  # 400 validation_error asking you to reconnect Threads when the
88
88
  # connection lacks the threads_location_tagging permission).
89
+ #
90
+ # Pinterest posts can tag products: pass
91
+ # pinterest: { "board_id" => "...", "product_tags" => [...] } with up
92
+ # to 24 product Pins of the connected Pinterest account, each as a Pin
93
+ # id String (see pinterest.list_products) or a Pin link. Products of
94
+ # other merchants cannot be tagged. The tags are added right after the
95
+ # Pin is published; a product Pinterest refuses never fails the post,
96
+ # and the Post's "pinterest" block then carries "product_tags_result"
97
+ # (requested, tagged, skipped, error). More than 24 entries or an
98
+ # invalid entry raises a 400 validation_error.
89
99
  def create(content:, channels: nil, scheduled_at: nil, media_ids: nil,
90
100
  media_urls: nil, type: nil, source: nil, link_url: nil,
91
101
  link_title: nil, link_description: nil, link_thumbnail_url: nil,
@@ -154,6 +164,9 @@ module OmniSocials
154
164
  # and threads thread parts, and to a Threads location tag:
155
165
  # threads: { "location_id" => nil } (or "location" => nil) clears it.
156
166
  #
167
+ # pinterest replaces the stored Pinterest options wholesale, so leave
168
+ # "product_tags" out (or send []) to remove the product tags.
169
+ #
157
170
  # See #create for the 402 "x_credits_insufficient" credit gate that
158
171
  # can also refuse an update to a scheduled X link post.
159
172
  def update(post_id, content: nil, scheduled_at: nil, channels: nil,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OmniSocials
4
- VERSION = "0.8.0"
4
+ VERSION = "0.9.0"
5
5
  end
data/lib/omnisocials.rb CHANGED
@@ -25,6 +25,7 @@ require_relative "omnisocials/resources/accounts"
25
25
  require_relative "omnisocials/resources/analytics"
26
26
  require_relative "omnisocials/resources/audio"
27
27
  require_relative "omnisocials/resources/locations"
28
+ require_relative "omnisocials/resources/pinterest"
28
29
  require_relative "omnisocials/resources/inbox"
29
30
  require_relative "omnisocials/resources/webhooks"
30
31
  require_relative "omnisocials/client"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omnisocials
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OmniSocials
@@ -34,6 +34,7 @@ files:
34
34
  - lib/omnisocials/resources/inbox.rb
35
35
  - lib/omnisocials/resources/locations.rb
36
36
  - lib/omnisocials/resources/media.rb
37
+ - lib/omnisocials/resources/pinterest.rb
37
38
  - lib/omnisocials/resources/posts.rb
38
39
  - lib/omnisocials/resources/webhooks.rb
39
40
  - lib/omnisocials/version.rb