postproxy-sdk 1.10.0 → 1.11.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/README.md +21 -0
- data/lib/postproxy/resources/profiles.rb +35 -0
- data/lib/postproxy/types.rb +26 -2
- data/lib/postproxy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c459486395f3eed2f4199f1946ed7a71c7b6b5de5ae270e46b088e779c772459
|
|
4
|
+
data.tar.gz: 38788f6fd45363f0c229af3cd7fd28a79a21511d1a7b8c4c417bb2d0c5c93f48
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8458cc1ca2c4bd873fe980d9b18db5d81b2871c3d027f914a0555ce686cbca1daba5400464f2a950ceb2ba3602657d6e2bf1daa5d5d23c891addbdc0c5b2c54b
|
|
7
|
+
data.tar.gz: 3b9fa99981232895852351741ebdaf2cf5675d585b298100bb29ae1fdca054f67b6e16d9e909ba1db6a15f2fda1b0b06a69f37f6443eceb2680af253e0ca27a3
|
data/README.md
CHANGED
|
@@ -431,6 +431,24 @@ profile = client.profiles.get("prof-id")
|
|
|
431
431
|
# Get placements for a profile
|
|
432
432
|
placements = client.profiles.placements("prof-id").data
|
|
433
433
|
|
|
434
|
+
# Move a placement (e.g. a Facebook Page or Telegram channel) to another group
|
|
435
|
+
placement = client.profiles.assign_placement_to_group("prof-id",
|
|
436
|
+
placement_id: "placement-external-id",
|
|
437
|
+
target_profile_group_id: "pg-other"
|
|
438
|
+
)
|
|
439
|
+
puts placement.profile_group_id # => "pg-other"
|
|
440
|
+
|
|
441
|
+
# Ice breakers (Instagram DMs): FAQ prompts shown when a user opens a chat
|
|
442
|
+
result = client.profiles.ice_breakers("prof-id")
|
|
443
|
+
puts result.ice_breakers.map(&:question)
|
|
444
|
+
|
|
445
|
+
client.profiles.set_ice_breakers("prof-id", [
|
|
446
|
+
{ question: "What services do you offer?", payload: "services" },
|
|
447
|
+
{ question: "What are your hours?", payload: "hours" }
|
|
448
|
+
]) # 1-4 items
|
|
449
|
+
|
|
450
|
+
client.profiles.delete_ice_breakers("prof-id")
|
|
451
|
+
|
|
434
452
|
# Delete a profile
|
|
435
453
|
client.profiles.delete("prof-id")
|
|
436
454
|
|
|
@@ -521,6 +539,9 @@ platforms = PostProxy::PlatformParams.new(
|
|
|
521
539
|
board_id: "board-123"
|
|
522
540
|
),
|
|
523
541
|
threads: PostProxy::ThreadsParams.new(format: "post"),
|
|
542
|
+
# Twitter also supports polls:
|
|
543
|
+
# twitter: PostProxy::TwitterParams.new(format: "poll",
|
|
544
|
+
# poll_options: ["Yes", "No"], poll_duration_minutes: 1440),
|
|
524
545
|
twitter: PostProxy::TwitterParams.new(format: "post"),
|
|
525
546
|
bluesky: PostProxy::BlueskyParams.new(format: "post"),
|
|
526
547
|
telegram: PostProxy::TelegramParams.new(
|
|
@@ -36,6 +36,41 @@ module PostProxy
|
|
|
36
36
|
ProfileStatsResponse.new(data: result[:data])
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
+
# Moves a placement (e.g. a Facebook Page or Telegram channel) to another
|
|
40
|
+
# profile group. `placement_id` is the placement's external ID as
|
|
41
|
+
# returned by #placements.
|
|
42
|
+
def assign_placement_to_group(id, placement_id:, target_profile_group_id:, profile_group_id: nil)
|
|
43
|
+
result = @client.request(:patch, "/profiles/#{id}/assign_placement_to_group",
|
|
44
|
+
json: {
|
|
45
|
+
placement_id: placement_id,
|
|
46
|
+
target_profile_group_id: target_profile_group_id
|
|
47
|
+
},
|
|
48
|
+
profile_group_id: profile_group_id
|
|
49
|
+
)
|
|
50
|
+
Placement.new(**result)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Lists DM ice breakers. Supported for Instagram profiles only.
|
|
54
|
+
def ice_breakers(id, profile_group_id: nil)
|
|
55
|
+
result = @client.request(:get, "/profiles/#{id}/ice_breakers", profile_group_id: profile_group_id)
|
|
56
|
+
IceBreakersResponse.new(**result)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Replaces the DM ice breakers for a profile (1-4 items).
|
|
60
|
+
def set_ice_breakers(id, ice_breakers, profile_group_id: nil)
|
|
61
|
+
items = ice_breakers.map { |ib| ib.is_a?(IceBreaker) ? ib.to_h : ib }
|
|
62
|
+
result = @client.request(:post, "/profiles/#{id}/ice_breakers",
|
|
63
|
+
json: { ice_breakers: items },
|
|
64
|
+
profile_group_id: profile_group_id
|
|
65
|
+
)
|
|
66
|
+
SuccessResponse.new(**result)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def delete_ice_breakers(id, profile_group_id: nil)
|
|
70
|
+
result = @client.request(:delete, "/profiles/#{id}/ice_breakers", profile_group_id: profile_group_id)
|
|
71
|
+
SuccessResponse.new(**result)
|
|
72
|
+
end
|
|
73
|
+
|
|
39
74
|
def delete(id, profile_group_id: nil)
|
|
40
75
|
result = @client.request(:delete, "/profiles/#{id}", profile_group_id: profile_group_id)
|
|
41
76
|
SuccessResponse.new(**result)
|
data/lib/postproxy/types.rb
CHANGED
|
@@ -235,7 +235,29 @@ module PostProxy
|
|
|
235
235
|
end
|
|
236
236
|
|
|
237
237
|
class Placement < Model
|
|
238
|
-
|
|
238
|
+
# `metadata` and `profile_group_id` are present in placements and
|
|
239
|
+
# assign_placement_to_group responses.
|
|
240
|
+
attr_accessor :id, :name, :metadata, :profile_group_id
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
# Instagram DM ice breaker (FAQ prompt). May carry extra platform fields.
|
|
244
|
+
class IceBreaker < Model
|
|
245
|
+
attr_accessor :question, :payload
|
|
246
|
+
|
|
247
|
+
def to_h
|
|
248
|
+
{ question: question, payload: payload }
|
|
249
|
+
end
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
class IceBreakersResponse < Model
|
|
253
|
+
attr_accessor :ice_breakers
|
|
254
|
+
|
|
255
|
+
def initialize(**attrs)
|
|
256
|
+
@ice_breakers = (attrs.delete(:ice_breakers) || []).map do |ib|
|
|
257
|
+
ib.is_a?(IceBreaker) ? ib : IceBreaker.new(**ib)
|
|
258
|
+
end
|
|
259
|
+
super
|
|
260
|
+
end
|
|
239
261
|
end
|
|
240
262
|
|
|
241
263
|
class StatsRecord < Model
|
|
@@ -596,7 +618,9 @@ module PostProxy
|
|
|
596
618
|
end
|
|
597
619
|
|
|
598
620
|
class TwitterParams < Model
|
|
599
|
-
|
|
621
|
+
# poll_options and poll_duration_minutes are required when format is
|
|
622
|
+
# "poll": 2-4 options (max 25 chars each), duration 5 to 10080 minutes.
|
|
623
|
+
attr_accessor :format, :poll_options, :poll_duration_minutes
|
|
600
624
|
end
|
|
601
625
|
|
|
602
626
|
class BlueskyParams < Model
|
data/lib/postproxy/version.rb
CHANGED