distributed-press-api-client 0.4.2 → 0.5.0rc1

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: 26a1b1d09a0b95c8852f253a6d4bf5c5a8f506c0e8176f65bbbffe1ef8f06aff
4
- data.tar.gz: a06560b95f7e1969c52e653fb563569bb17b811e91995766a36f3f8de85b640d
3
+ metadata.gz: dd36188ea41206127dc73adb68060bb2d597b108668e5d7735e01487b3fcca22
4
+ data.tar.gz: 79eb79b794953204f07574444d5d02d4678011005b7401873938094f24ab9f80
5
5
  SHA512:
6
- metadata.gz: bce9df9c4cd0eb80868af163c63a9234006d5c779b91e768bd4726aebd0978fb44a240b9c7806912ea480f338a47ead8d433b3c7b956662eb0cb2b9527c93f57
7
- data.tar.gz: 28be64d94b3add7ac1333f85ff2f00a4e55b9568783de437172264c619227d75e28801082a0600186480935e2dda9605411e68dc8d53cc10280ceed1893fe411
6
+ metadata.gz: e4e9175c76c9ecba06bfb2d00d7c5a55398cd71cb7819cade5f1a0158bffabe879aacdabf2cc09a06192f7a7096903c86d7cec91460d979f6472e83e91726a51
7
+ data.tar.gz: 74ccef6f5af3bc9b7c6d11c54ebc5df2501d940a1af8fc19690d95e9ffb918fa97b4c81c6de717863fb9d8a2dde07548be4bba10ea625ef6f140127e885d8642
@@ -174,7 +174,26 @@ class DistributedPress
174
174
  #
175
175
  # @return [String]
176
176
  def host
177
- @host ||= URI.parse(url).host
177
+ @host ||= uri.host
178
+ end
179
+
180
+ # If the endpoint is on a subdirectory, we need the absolute
181
+ # path for signing
182
+ #
183
+ # @param :endpoint [String]
184
+ # @return [String]
185
+ def absolute_endpoint(endpoint)
186
+ "#{uri.path}/#{endpoint}".squeeze('/')
187
+ end
188
+
189
+ # Absolute URL for an endpoint
190
+ #
191
+ # @param :endpoint [String]
192
+ # @return [String]
193
+ def absolute_url(endpoint)
194
+ uri.dup.tap do |u|
195
+ u.path = absolute_endpoint(endpoint)
196
+ end.to_s
178
197
  end
179
198
 
180
199
  private
@@ -254,15 +273,6 @@ class DistributedPress
254
273
  nil
255
274
  end
256
275
 
257
- # If the endpoint is on a subdirectory, we need the absolute
258
- # path for signing
259
- #
260
- # @param :endpoint [String]
261
- # @return [String]
262
- def absolute_endpoint(endpoint)
263
- "#{uri.path}/#{endpoint}".squeeze('/')
264
- end
265
-
266
276
  # Brotli available
267
277
  def brotli?
268
278
  begin
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'uri'
4
+ require_relative 'client'
5
+
6
+ class DistributedPress
7
+ module V1
8
+ module Social
9
+ # Manages the activity's replies
10
+ class Replies
11
+ # @return [DistributedPress::V1::Social::Client]
12
+ attr_reader :client
13
+
14
+ # @return [String]
15
+ attr_reader :actor
16
+
17
+ # @return [String] Activity ID (URL)
18
+ attr_reader :activity
19
+
20
+ # @param :client [DistributedPress::V1::Social::Client]
21
+ # @param :actor [String]
22
+ # @param :activity [String]
23
+ def initialize(client:, actor:, activity:)
24
+ @client = client
25
+ @actor = actor
26
+ @activity = activity
27
+ end
28
+
29
+ # Get the activities replies collection. Authenticated requests
30
+ # contain the list of replies.
31
+ #
32
+ # @return [HTTParty::Response]
33
+ def get
34
+ client.get(endpoint: endpoint)
35
+ end
36
+
37
+ # Replies
38
+ #
39
+ # @return [String]
40
+ def endpoint
41
+ @endpoint ||= "/v1/#{actor}/inbox/replies/#{URI.encode_uri_component(activity)}"
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -3,5 +3,5 @@
3
3
  # API client
4
4
  class DistributedPress
5
5
  # Version
6
- VERSION = '0.4.2'
6
+ VERSION = '0.5.0rc1'
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: distributed-press-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - f
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-05 00:00:00.000000000 Z
11
+ date: 2024-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -317,6 +317,7 @@ files:
317
317
  - lib/distributed_press/v1/social/outbox.rb
318
318
  - lib/distributed_press/v1/social/reference.rb
319
319
  - lib/distributed_press/v1/social/referenced_object.rb
320
+ - lib/distributed_press/v1/social/replies.rb
320
321
  - lib/distributed_press/v1/social/schemas/webhook.rb
321
322
  - lib/distributed_press/v1/social/signed_headers.rb
322
323
  - lib/distributed_press/v1/token.rb
@@ -351,9 +352,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
351
352
  version: '2.7'
352
353
  required_rubygems_version: !ruby/object:Gem::Requirement
353
354
  requirements:
354
- - - ">="
355
+ - - ">"
355
356
  - !ruby/object:Gem::Version
356
- version: '0'
357
+ version: 1.3.1
357
358
  requirements: []
358
359
  rubygems_version: 3.3.26
359
360
  signing_key: