Class: DistributedPress::V1::Social::Outbox
- Inherits:
-
Object
- Object
- DistributedPress::V1::Social::Outbox
- Defined in:
- lib/distributed_press/v1/social/outbox.rb
Overview
Manages the actor’s outbox on the Social Inbox
Instance Attribute Summary collapse
- #actor ⇒ String readonly
- #client ⇒ DistributedPress::V1::Social::Client readonly
Instance Method Summary collapse
-
#endpoint ⇒ String
Outbox.
-
#get(id:) ⇒ HTTParty::Response
Get an activity queued on the outbox.
-
#initialize(client:, actor:) ⇒ Outbox
constructor
A new instance of Outbox.
-
#post(activity:) ⇒ HTTParty::Response
Send an activity to the actor’s outbox.
Constructor Details
#initialize(client:, actor:) ⇒ Outbox
Returns a new instance of Outbox.
19 20 21 22 |
# File 'lib/distributed_press/v1/social/outbox.rb', line 19 def initialize(client:, actor:) @client = client @actor = actor end |
Instance Attribute Details
#actor ⇒ String (readonly)
15 16 17 |
# File 'lib/distributed_press/v1/social/outbox.rb', line 15 def actor @actor end |
#client ⇒ DistributedPress::V1::Social::Client (readonly)
12 13 14 |
# File 'lib/distributed_press/v1/social/outbox.rb', line 12 def client @client end |
Instance Method Details
#endpoint ⇒ String
Outbox
44 45 46 |
# File 'lib/distributed_press/v1/social/outbox.rb', line 44 def endpoint @endpoint ||= "/v1/#{actor}/outbox" end |
#get(id:) ⇒ HTTParty::Response
Get an activity queued on the outbox
37 38 39 |
# File 'lib/distributed_press/v1/social/outbox.rb', line 37 def get(id:) client.get(endpoint: "#{endpoint}/#{URI.encode_uri_component(id)}") end |
#post(activity:) ⇒ HTTParty::Response
Send an activity to the actor’s outbox. The Social Inbox will take care of sending it to the audiences.
29 30 31 |
# File 'lib/distributed_press/v1/social/outbox.rb', line 29 def post(activity:) client.post(endpoint: endpoint, body: activity) end |