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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2852d366a306a698457955ea9e631fb4cd05fbc0f55949a772f0b872b19ce0af
4
- data.tar.gz: 74845607657bcea29116fe1a3d509daea04f0afba3e0ded079068f03b17d3506
3
+ metadata.gz: c459486395f3eed2f4199f1946ed7a71c7b6b5de5ae270e46b088e779c772459
4
+ data.tar.gz: 38788f6fd45363f0c229af3cd7fd28a79a21511d1a7b8c4c417bb2d0c5c93f48
5
5
  SHA512:
6
- metadata.gz: 0650f24d42af376d663521ced5c78be0fe97dc99d117534a132479a02f8290a18404426d5791ea5f90f3ed786041ccb2d3a15486533b149e7ab0c94324839238
7
- data.tar.gz: 39699c4a07a238f45fc1e12545dfc97b88d85299f03cd3eb1ba97380a1f7bfa79da004abd170c3da87aa707d486a7a103c298c0b34fb9371d9d0c4ada45e3014
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)
@@ -235,7 +235,29 @@ module PostProxy
235
235
  end
236
236
 
237
237
  class Placement < Model
238
- attr_accessor :id, :name
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
- attr_accessor :format
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
@@ -1,3 +1,3 @@
1
1
  module PostProxy
2
- VERSION = "1.10.0"
2
+ VERSION = "1.11.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postproxy-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - PostProxy