Class: DistributedPress::V1::Social::Likes

Inherits:
Object
  • Object
show all
Defined in:
lib/distributed_press/v1/social/likes.rb

Overview

Manages the activity’s likes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:, actor:, activity:) ⇒ Likes

Returns a new instance of Likes.

Parameters:



23
24
25
26
27
# File 'lib/distributed_press/v1/social/likes.rb', line 23

def initialize(client:, actor:, activity:)
  @client = client
  @actor = actor
  @activity = activity
end

Instance Attribute Details

#activityString (readonly)

Returns Activity ID (URL).

Returns:

  • (String)

    Activity ID (URL)



18
19
20
# File 'lib/distributed_press/v1/social/likes.rb', line 18

def activity
  @activity
end

#actorString (readonly)

Returns:

  • (String)


15
16
17
# File 'lib/distributed_press/v1/social/likes.rb', line 15

def actor
  @actor
end

#clientDistributedPress::V1::Social::Client (readonly)



12
13
14
# File 'lib/distributed_press/v1/social/likes.rb', line 12

def client
  @client
end

Instance Method Details

#endpointString

Replies

Returns:

  • (String)


40
41
42
# File 'lib/distributed_press/v1/social/likes.rb', line 40

def endpoint
  @endpoint ||= "/v1/#{actor}/inbox/likes/#{Base64.encode64(activity).delete("\n")}"
end

#getHTTParty::Response

Get the activities replies collection. Authenticated requests contain the list of replies.

Returns:

  • (HTTParty::Response)


33
34
35
# File 'lib/distributed_press/v1/social/likes.rb', line 33

def get
  client.get(endpoint: endpoint)
end