distributed-press-api-client 0.5.0rc9 → 0.5.0rc10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35ce06825d1ddabae961e86d8bdd698c5554f0e75a0dd74cc91741f508b23a2e
4
- data.tar.gz: 74864dd3aaf4ac30d7a3a4cbba91ffe0c7d33dda6881a706e3bdef73682732ad
3
+ metadata.gz: 1c7bfb83a8c6326af6500d6619774fa60cc9e2a927ea4d9ab9b783a76f3955cd
4
+ data.tar.gz: 52768679c15dad21d8f6ceb9572bf145e52990a3cd7cf60632e05c2faa164073
5
5
  SHA512:
6
- metadata.gz: a66393b7fd19dba0355757c0590e2334671db099892d7ffa36471053fc07402247c74ab72f26681d2cc006beba68f5ed8d1eceab3c3d793308427d57e00cd863
7
- data.tar.gz: 2e6c050daa4c9fc9f5192be716f1bf733c221b4020ded3e1ce637ef59e02a8f8020888f539d348f9e69a412dfc1819d330d0beb1ce21535725e7d67146371cd5
6
+ metadata.gz: b4172a1b83d52eb02cfe212c918ac2b0e8a247915ebe41c1fa9628c066cb9ebbb1bd6c31471d1d4ba02a13868dd7fa6357220d053dca2e71e72713e0c38a68fb
7
+ data.tar.gz: d7ec761d26636bc7ccb37ee3d7cc7617d4990481d3f8d5e198823c9c36b45f72b5bb1ca632a44f26b5a64fc068f39f65455fbd0ec3441d871ee0d99851ad38c1
@@ -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
@@ -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.0rc10'
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.0rc10
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-07-27 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