postproxy-sdk 1.6.0 → 1.7.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: e62e2ba2b3d951aed31a2d60d74a7ee4a46672b03131676f28d81f6dc5cade69
4
- data.tar.gz: 83bf66f3dae825b04195d1ec9e809849352f4c290dbf2d1458879a1838688e93
3
+ metadata.gz: 0aea2892ef3d3256dfd1cc9ce790da283df1d6edb83a2cfcaa76c0aa8a8194ae
4
+ data.tar.gz: a9f008666d47832963cc7119d0db1b53d53c7ddd3dc690fa13acebc05c72f5f6
5
5
  SHA512:
6
- metadata.gz: 2b38044c1990d12a5d937b261df5b01e80d3cec44caaebd0eeb4eb9038859bb2428c35c6f557421ba8a5cc494347e4e08de7963d98d8ff1ad552960cbcd02dae
7
- data.tar.gz: 5f3393e61377f4de158148d7c4de2982df376410cc377bdd356d478729bf129a86b5659ea0abc412a4809a55a343dde7b59e4e8ee11ff6957630f7475957286d
6
+ metadata.gz: c9f6cf9ec0d398081c84c21c41824bd590fa9d57b7e8eea423512bcc899b82d3df93c4532edf307e2f949a0d72217e6677743b36434a4384e9b9d801030b4aa4
7
+ data.tar.gz: 325923dc017d840f212edac1941f2f2aa8d8821594f2418e40dee1e1b56a8f103627ab1f8cb9adb07f576afcc8fe5a6b431fcc408a50c4ac6887948bf80426d6
data/README.md CHANGED
@@ -105,6 +105,18 @@ post.thread.each { |child| puts "#{child.id}: #{child.body}" }
105
105
 
106
106
  # Delete a post
107
107
  client.posts.delete("post-id")
108
+
109
+ # Delete a post and also remove it from social platforms
110
+ client.posts.delete("post-id", delete_on_platform: true)
111
+
112
+ # Delete from platforms only (keeps DB record). Defaults to all platforms.
113
+ client.posts.delete_on_platform("post-id")
114
+ # Target a single network
115
+ client.posts.delete_on_platform("post-id", network: "twitter")
116
+ # Target a specific profile
117
+ client.posts.delete_on_platform("post-id", profile_id: "prof-abc")
118
+ # Target a specific post profile (covers entire thread for that profile)
119
+ client.posts.delete_on_platform("post-id", post_profile_id: "pp-abc")
108
120
  ```
109
121
 
110
122
  ## Post Stats
@@ -38,6 +38,8 @@ module PostProxy
38
38
  form_data = { "post[body]" => body }
39
39
  form_data["post[scheduled_at]"] = format_time(scheduled_at) if scheduled_at
40
40
  form_data["post[draft]"] = draft.to_s if !draft.nil?
41
+ form_data["queue_id"] = queue_id if queue_id
42
+ form_data["queue_priority"] = queue_priority if queue_priority
41
43
 
42
44
  files = []
43
45
 
@@ -116,6 +118,8 @@ module PostProxy
116
118
  form_data["post[body]"] = body if body
117
119
  form_data["post[scheduled_at]"] = format_time(scheduled_at) if scheduled_at
118
120
  form_data["post[draft]"] = draft.to_s if !draft.nil?
121
+ form_data["queue_id"] = queue_id if queue_id
122
+ form_data["queue_priority"] = queue_priority if queue_priority
119
123
 
120
124
  files = []
121
125
 
@@ -205,11 +209,28 @@ module PostProxy
205
209
  StatsResponse.new(data: posts)
206
210
  end
207
211
 
208
- def delete(id, profile_group_id: nil)
209
- result = @client.request(:delete, "/posts/#{id}", profile_group_id: profile_group_id)
212
+ def delete(id, delete_on_platform: nil, profile_group_id: nil)
213
+ params = {}
214
+ params[:delete_on_platform] = delete_on_platform unless delete_on_platform.nil?
215
+ result = @client.request(:delete, "/posts/#{id}",
216
+ params: params.empty? ? nil : params,
217
+ profile_group_id: profile_group_id
218
+ )
210
219
  DeleteResponse.new(**result)
211
220
  end
212
221
 
222
+ def delete_on_platform(id, post_profile_id: nil, profile_id: nil, network: nil, profile_group_id: nil)
223
+ json_body = {}
224
+ json_body[:post_profile_id] = post_profile_id if post_profile_id
225
+ json_body[:profile_id] = profile_id if profile_id
226
+ json_body[:network] = network if network
227
+ result = @client.request(:post, "/posts/#{id}/delete_on_platform",
228
+ json: json_body.empty? ? nil : json_body,
229
+ profile_group_id: profile_group_id
230
+ )
231
+ DeleteOnPlatformResponse.new(**result)
232
+ end
233
+
213
234
  private
214
235
 
215
236
  def format_time(value)
@@ -63,17 +63,31 @@ module PostProxy
63
63
  end
64
64
  end
65
65
 
66
+ class ErrorDetails < Model
67
+ attr_accessor :platform_error_code, :platform_error_subcode, :platform_error_message, :postproxy_note
68
+
69
+ def initialize(**attrs)
70
+ @platform_error_code = nil
71
+ @platform_error_subcode = nil
72
+ @platform_error_message = nil
73
+ @postproxy_note = nil
74
+ super
75
+ end
76
+ end
77
+
66
78
  class PlatformResult < Model
67
- attr_accessor :platform, :status, :params, :error, :attempted_at, :insights
79
+ attr_accessor :platform, :status, :params, :error, :error_details, :attempted_at, :insights
68
80
 
69
81
  def initialize(**attrs)
70
82
  @params = nil
71
83
  @error = nil
84
+ @error_details = nil
72
85
  @attempted_at = nil
73
86
  @insights = nil
74
87
  super
75
88
  @attempted_at = parse_time(@attempted_at)
76
89
  @insights = Insights.new(**@insights) if @insights.is_a?(Hash)
90
+ @error_details = ErrorDetails.new(**@error_details.transform_keys(&:to_sym)) if @error_details.is_a?(Hash)
77
91
  end
78
92
 
79
93
  private
@@ -316,6 +330,22 @@ module PostProxy
316
330
  attr_accessor :deleted
317
331
  end
318
332
 
333
+ class DeletingPlatform < Model
334
+ attr_accessor :post_profile_id, :platform
335
+ end
336
+
337
+ class DeleteOnPlatformResponse < Model
338
+ attr_accessor :success, :deleting
339
+
340
+ def initialize(**attrs)
341
+ @deleting = []
342
+ super
343
+ @deleting = (@deleting || []).map do |entry|
344
+ entry.is_a?(DeletingPlatform) ? entry : DeletingPlatform.new(**entry)
345
+ end
346
+ end
347
+ end
348
+
319
349
  class SuccessResponse < Model
320
350
  attr_accessor :success
321
351
  end
@@ -346,7 +376,8 @@ module PostProxy
346
376
  end
347
377
 
348
378
  class YouTubeParams < Model
349
- attr_accessor :format, :title, :privacy_status, :cover_url, :made_for_kids
379
+ attr_accessor :format, :title, :privacy_status, :cover_url, :made_for_kids,
380
+ :tags, :category_id, :contains_synthetic_media
350
381
  end
351
382
 
352
383
  class PinterestParams < Model
@@ -1,3 +1,3 @@
1
1
  module PostProxy
2
- VERSION = "1.6.0"
2
+ VERSION = "1.7.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.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - PostProxy