distributed-press-api-client 0.5.0rc9 → 0.5.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: 35ce06825d1ddabae961e86d8bdd698c5554f0e75a0dd74cc91741f508b23a2e
4
- data.tar.gz: 74864dd3aaf4ac30d7a3a4cbba91ffe0c7d33dda6881a706e3bdef73682732ad
3
+ metadata.gz: 99b6cf4b078aa2942ff5cfe6a4dc016d2ad25ea8494058cf65ce54296b854f06
4
+ data.tar.gz: 6756613bc840361701d02b0995e1fd332408019f28f47a0cb64f9666620638eb
5
5
  SHA512:
6
- metadata.gz: a66393b7fd19dba0355757c0590e2334671db099892d7ffa36471053fc07402247c74ab72f26681d2cc006beba68f5ed8d1eceab3c3d793308427d57e00cd863
7
- data.tar.gz: 2e6c050daa4c9fc9f5192be716f1bf733c221b4020ded3e1ce637ef59e02a8f8020888f539d348f9e69a412dfc1819d330d0beb1ce21535725e7d67146371cd5
6
+ metadata.gz: ad7dc270c799ac8fdc4dd895d84b99cf46e0e99d66d6a4e6ee447935f69af3ce6aa5cb88a4923e41e2b26e0246d9f2b3ba94c28399c8b44976b326b314874c82
7
+ data.tar.gz: d58c00c34eb85ffa85e36be7abf4ae5d889225fa4450ff4ee7b7fc768d417bdbf5d7768a25eeb19d7b3a121716a5103678b80c39dd69e922181fd47d8209a685
@@ -43,6 +43,9 @@ class DistributedPress
43
43
  next unless object.key?(attribute)
44
44
  throw :total_items_reached if object['id'] && object['id'] == referenced[attribute]['id']
45
45
 
46
+ require 'pry'
47
+ binding.pry
48
+
46
49
  referenced[attribute].each(&block).each do |item|
47
50
  counter += 1
48
51
  enum << item
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'base64'
4
+ require_relative 'client'
5
+
6
+ class DistributedPress
7
+ module V1
8
+ module Social
9
+ # Manages the activity's likes
10
+ class Likes
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/likes/#{Base64.encode64(activity).delete("\n")}"
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -28,6 +28,15 @@ class DistributedPress
28
28
  @dereferencer = dereferencer
29
29
  end
30
30
 
31
+ def ==(other)
32
+ case other
33
+ when String then uri == other
34
+ when Reference then uri == other.uri
35
+ else false
36
+ end
37
+ end
38
+
39
+
31
40
  # Fetches the remote object once
32
41
  #
33
42
  # @return [HTTParty::Response]
@@ -20,6 +20,8 @@ class DistributedPress
20
20
  inReplyTo
21
21
  object
22
22
  replies
23
+ likes
24
+ shares
23
25
  to
24
26
  publicKey
25
27
  audience
@@ -95,9 +97,9 @@ class DistributedPress
95
97
  new_object =
96
98
  case new_object['type']
97
99
  when 'Collection', 'OrderedCollection', 'CollectionPage', 'OrderedCollectionPage'
98
- Collection.new(object: object, referenced: new_object, dereferencer: self)
100
+ Collection.new(object: object, referenced: new_object, dereferencer: dereferencer)
99
101
  else
100
- ReferencedObject.new(object: object, referenced: new_object, dereferencer: self)
102
+ ReferencedObject.new(object: object, referenced: new_object, dereferencer: dereferencer)
101
103
  end
102
104
 
103
105
  Reference.new(dereferencer: dereferencer, object: new_object, uri: new_object['id'])
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'base64'
4
+ require_relative 'client'
5
+
6
+ class DistributedPress
7
+ module V1
8
+ module Social
9
+ # Manages the activity's shares (boosts, announces)
10
+ class Shares
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/shares/#{Base64.encode64(activity).delete("\n")}"
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.5.0rc9'
6
+ VERSION = '0.5.0'
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.5.0rc9
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - f
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-26 00:00:00.000000000 Z
11
+ date: 2024-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -329,11 +329,13 @@ files:
329
329
  - lib/distributed_press/v1/social/followers.rb
330
330
  - lib/distributed_press/v1/social/hook.rb
331
331
  - lib/distributed_press/v1/social/inbox.rb
332
+ - lib/distributed_press/v1/social/likes.rb
332
333
  - lib/distributed_press/v1/social/outbox.rb
333
334
  - lib/distributed_press/v1/social/reference.rb
334
335
  - lib/distributed_press/v1/social/referenced_object.rb
335
336
  - lib/distributed_press/v1/social/replies.rb
336
337
  - lib/distributed_press/v1/social/schemas/webhook.rb
338
+ - lib/distributed_press/v1/social/shares.rb
337
339
  - lib/distributed_press/v1/social/signed_headers.rb
338
340
  - lib/distributed_press/v1/token.rb
339
341
  - lib/distributed_press/version.rb
@@ -368,9 +370,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
368
370
  version: '2.7'
369
371
  required_rubygems_version: !ruby/object:Gem::Requirement
370
372
  requirements:
371
- - - ">"
373
+ - - ">="
372
374
  - !ruby/object:Gem::Version
373
- version: 1.3.1
375
+ version: '0'
374
376
  requirements: []
375
377
  rubygems_version: 3.3.26
376
378
  signing_key: