postproxy-sdk 1.13.0 → 1.14.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 +415 -11
- data/lib/postproxy/client.rb +72 -7
- data/lib/postproxy/constants.rb +37 -2
- data/lib/postproxy/errors.rb +15 -0
- data/lib/postproxy/resources/api_keys.rb +30 -0
- data/lib/postproxy/resources/chats.rb +30 -1
- data/lib/postproxy/resources/comments.rb +52 -4
- data/lib/postproxy/resources/google_business.rb +194 -0
- data/lib/postproxy/resources/messages.rb +25 -1
- data/lib/postproxy/resources/placements.rb +35 -0
- data/lib/postproxy/resources/posts.rb +86 -25
- data/lib/postproxy/resources/profile_groups.rb +8 -1
- data/lib/postproxy/resources/profiles.rb +131 -0
- data/lib/postproxy/resources/whatsapp.rb +278 -0
- data/lib/postproxy/resources/whatsapp_templates.rb +108 -0
- data/lib/postproxy/types.rb +408 -29
- data/lib/postproxy/version.rb +1 -1
- data/lib/postproxy/webhook_events.rb +90 -4
- metadata +9 -4
|
@@ -52,7 +52,32 @@ module PostProxy
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
class ProfileEventData < Model
|
|
55
|
-
|
|
55
|
+
# `origin` is set on `profile.disconnected`: "user" or "automated".
|
|
56
|
+
attr_accessor :id, :name, :platform, :profile_group_id, :status, :uid,
|
|
57
|
+
:platform_id, :username, :origin
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# `id` is the placement's id on the platform (page id, phone number id,
|
|
61
|
+
# ...). `placement.name_status_updated` adds `decision`, `requested_name`
|
|
62
|
+
# and `rejection_reason`; `placement.quality_updated` adds `event`,
|
|
63
|
+
# `current_limit` and `old_limit`.
|
|
64
|
+
class PlacementEventData < Model
|
|
65
|
+
attr_accessor :id, :name, :platform, :profile_group_id, :profile_id,
|
|
66
|
+
:profile_name, :metadata, :decision, :requested_name,
|
|
67
|
+
:rejection_reason, :event, :current_limit, :old_limit
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
class PlacementsSyncedData < ProfileEventData
|
|
71
|
+
attr_accessor :placements_sync_status, :placements
|
|
72
|
+
|
|
73
|
+
def initialize(**attrs)
|
|
74
|
+
@placements_sync_status = nil
|
|
75
|
+
@placements = []
|
|
76
|
+
super
|
|
77
|
+
@placements = (@placements || []).map do |p|
|
|
78
|
+
p.is_a?(PlacementEventData) ? p : PlacementEventData.new(**p.transform_keys(&:to_sym))
|
|
79
|
+
end
|
|
80
|
+
end
|
|
56
81
|
end
|
|
57
82
|
|
|
58
83
|
class ProfileStatsData < Model
|
|
@@ -68,7 +93,14 @@ module PostProxy
|
|
|
68
93
|
:parent_external_id, :body, :status, :author_external_id,
|
|
69
94
|
:author_name, :author_username, :author_avatar_url,
|
|
70
95
|
:like_count, :reply_count, :is_hidden, :permalink,
|
|
71
|
-
:platform_data, :
|
|
96
|
+
:platform_data, :profile_id, :error, :error_details,
|
|
97
|
+
:external_edited_at, :posted_at, :created_at
|
|
98
|
+
|
|
99
|
+
def initialize(**attrs)
|
|
100
|
+
@error_details = nil
|
|
101
|
+
super
|
|
102
|
+
@error_details = ErrorDetails.new(**@error_details.transform_keys(&:to_sym)) if @error_details.is_a?(Hash)
|
|
103
|
+
end
|
|
72
104
|
end
|
|
73
105
|
|
|
74
106
|
class MessageEventData < Model
|
|
@@ -97,7 +129,42 @@ module PostProxy
|
|
|
97
129
|
class ProfileCommentCreatedData < Model
|
|
98
130
|
attr_accessor :id, :profile_id, :platform, :placement_id, :external_id,
|
|
99
131
|
:parent_external_id, :body, :status, :author_username,
|
|
100
|
-
:author_avatar_url, :platform_data, :
|
|
132
|
+
:author_avatar_url, :platform_data, :error, :error_details,
|
|
133
|
+
:permalink, :posted_at, :created_at
|
|
134
|
+
|
|
135
|
+
def initialize(**attrs)
|
|
136
|
+
@error_details = nil
|
|
137
|
+
super
|
|
138
|
+
@error_details = ErrorDetails.new(**@error_details.transform_keys(&:to_sym)) if @error_details.is_a?(Hash)
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
class WebhookChatData < Model
|
|
143
|
+
attr_accessor :id, :profile_id, :platform, :external_placement_id, :group,
|
|
144
|
+
:participant_external_id, :participant_username,
|
|
145
|
+
:participant_name, :last_inbound_at, :last_outbound_at,
|
|
146
|
+
:last_message_at
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# `ctwa_clid` is the click-to-WhatsApp ad click id.
|
|
150
|
+
class ReferralEventData < Model
|
|
151
|
+
attr_accessor :chat, :ref, :source, :type, :ctwa_clid, :occurred_at
|
|
152
|
+
|
|
153
|
+
def initialize(**attrs)
|
|
154
|
+
@chat = nil
|
|
155
|
+
super
|
|
156
|
+
@chat = WebhookChatData.new(**@chat.transform_keys(&:to_sym)) if @chat.is_a?(Hash)
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
class MessageTemplateEventData < Model
|
|
161
|
+
attr_accessor :id, :external_id, :profile_id, :platform, :name, :language,
|
|
162
|
+
:category, :status, :rejected_reason, :quality_score
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
class WhatsAppAutomaticEventData < Model
|
|
166
|
+
attr_accessor :profile_id, :chat_id, :participant_external_id,
|
|
167
|
+
:external_message_id, :event_name, :ctwa_clid, :custom_data
|
|
101
168
|
end
|
|
102
169
|
|
|
103
170
|
DATA_CLASSES = {
|
|
@@ -106,13 +173,26 @@ module PostProxy
|
|
|
106
173
|
"platform_post.published" => PlatformPostData,
|
|
107
174
|
"platform_post.failed" => PlatformPostData,
|
|
108
175
|
"platform_post.failed_waiting_for_retry" => PlatformPostData,
|
|
176
|
+
"platform_post.edited" => PlatformPostData,
|
|
177
|
+
"platform_post.edit_failed" => PlatformPostData,
|
|
109
178
|
"platform_post.insights" => PlatformPostData,
|
|
110
179
|
"profile.connected" => ProfileEventData,
|
|
111
180
|
"profile.disconnected" => ProfileEventData,
|
|
112
181
|
"profile.stats" => ProfileStatsData,
|
|
182
|
+
"profile.placements_synced" => PlacementsSyncedData,
|
|
183
|
+
"placement.orphaned" => PlacementEventData,
|
|
184
|
+
"placement.restored" => PlacementEventData,
|
|
113
185
|
"media.failed" => MediaFailedData,
|
|
114
186
|
"comment.created" => CommentCreatedData,
|
|
187
|
+
"comment.failed" => CommentCreatedData,
|
|
188
|
+
"comment.failed_waiting_for_retry" => CommentCreatedData,
|
|
189
|
+
"comment.delivery_unconfirmed" => CommentCreatedData,
|
|
190
|
+
"comment.edited" => CommentCreatedData,
|
|
191
|
+
"comment.edit_failed" => CommentCreatedData,
|
|
115
192
|
"profile_comment.created" => ProfileCommentCreatedData,
|
|
193
|
+
"profile_comment.failed" => ProfileCommentCreatedData,
|
|
194
|
+
"profile_comment.failed_waiting_for_retry" => ProfileCommentCreatedData,
|
|
195
|
+
"profile_comment.deleted" => ProfileCommentCreatedData,
|
|
116
196
|
"message.received" => MessageEventData,
|
|
117
197
|
"message.sent" => MessageEventData,
|
|
118
198
|
"message.delivered" => MessageEventData,
|
|
@@ -121,7 +201,13 @@ module PostProxy
|
|
|
121
201
|
"message.deleted" => MessageEventData,
|
|
122
202
|
"message.failed_waiting_for_retry" => MessageEventData,
|
|
123
203
|
"message.failed" => MessageEventData,
|
|
124
|
-
"reaction.received" => ReactionEventData
|
|
204
|
+
"reaction.received" => ReactionEventData,
|
|
205
|
+
"referral.received" => ReferralEventData,
|
|
206
|
+
"message_template.status_updated" => MessageTemplateEventData,
|
|
207
|
+
"message_template.category_updated" => MessageTemplateEventData,
|
|
208
|
+
"placement.name_status_updated" => PlacementEventData,
|
|
209
|
+
"placement.quality_updated" => PlacementEventData,
|
|
210
|
+
"whatsapp.automatic_event" => WhatsAppAutomaticEventData
|
|
125
211
|
}.freeze
|
|
126
212
|
|
|
127
213
|
# Parse a webhook body and return a typed Event. `data` is parsed into the
|
metadata
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: postproxy-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.14.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- Postproxy
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
@@ -65,7 +65,7 @@ dependencies:
|
|
|
65
65
|
- - "~>"
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
67
|
version: '3.0'
|
|
68
|
-
description: Ruby client for the
|
|
68
|
+
description: Ruby client for the Postproxy API — manage social media posts, profiles,
|
|
69
69
|
and profile groups.
|
|
70
70
|
email:
|
|
71
71
|
- support@postproxy.dev
|
|
@@ -78,15 +78,20 @@ files:
|
|
|
78
78
|
- lib/postproxy/client.rb
|
|
79
79
|
- lib/postproxy/constants.rb
|
|
80
80
|
- lib/postproxy/errors.rb
|
|
81
|
+
- lib/postproxy/resources/api_keys.rb
|
|
81
82
|
- lib/postproxy/resources/chats.rb
|
|
82
83
|
- lib/postproxy/resources/comments.rb
|
|
84
|
+
- lib/postproxy/resources/google_business.rb
|
|
83
85
|
- lib/postproxy/resources/messages.rb
|
|
86
|
+
- lib/postproxy/resources/placements.rb
|
|
84
87
|
- lib/postproxy/resources/posts.rb
|
|
85
88
|
- lib/postproxy/resources/profile_comments.rb
|
|
86
89
|
- lib/postproxy/resources/profile_groups.rb
|
|
87
90
|
- lib/postproxy/resources/profiles.rb
|
|
88
91
|
- lib/postproxy/resources/queues.rb
|
|
89
92
|
- lib/postproxy/resources/webhooks.rb
|
|
93
|
+
- lib/postproxy/resources/whatsapp.rb
|
|
94
|
+
- lib/postproxy/resources/whatsapp_templates.rb
|
|
90
95
|
- lib/postproxy/types.rb
|
|
91
96
|
- lib/postproxy/version.rb
|
|
92
97
|
- lib/postproxy/webhook_events.rb
|
|
@@ -114,5 +119,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
114
119
|
requirements: []
|
|
115
120
|
rubygems_version: 4.0.3
|
|
116
121
|
specification_version: 4
|
|
117
|
-
summary: Ruby client for the
|
|
122
|
+
summary: Ruby client for the Postproxy API
|
|
118
123
|
test_files: []
|