Module: Mastodon::REST::Relationships

Includes:
Utils
Included in:
API
Defined in:
lib/mastodon/rest/relationships.rb

Instance Method Summary collapse

Methods included from Utils

#array_param, #perform_request, #perform_request_with_collection, #perform_request_with_object

Instance Method Details

#block(id) ⇒ Mastodon::Relationship

Block a user

Parameters:

  • id (Integer)

Returns:



33
34
35
# File 'lib/mastodon/rest/relationships.rb', line 33

def block(id)
  perform_request_with_object(:post, "/api/v1/accounts/#{id}/block", {}, Mastodon::Relationship)
end

#follow(id) ⇒ Mastodon::Relationship

Follow a user

Parameters:

  • id (Integer)

Returns:



19
20
21
# File 'lib/mastodon/rest/relationships.rb', line 19

def follow(id)
  perform_request_with_object(:post, "/api/v1/accounts/#{id}/follow", {}, Mastodon::Relationship)
end

#relationships(*ids) ⇒ Mastodon::Collection<Mastodon::Relationship>

Get the relationships of authenticated user towards given other users

Parameters:

  • ids (Integer)

Returns:



12
13
14
# File 'lib/mastodon/rest/relationships.rb', line 12

def relationships(*ids)
  perform_request_with_collection(:get, '/api/v1/accounts/relationships', array_param(:id, ids), Mastodon::Relationship)
end

#unblock(id) ⇒ Mastodon::Relationship

Unblock a user

Parameters:

  • id (Integer)

Returns:



40
41
42
# File 'lib/mastodon/rest/relationships.rb', line 40

def unblock(id)
  perform_request_with_object(:post, "/api/v1/accounts/#{id}/unblock", {}, Mastodon::Relationship)
end

#unfollow(id) ⇒ Mastodon::Relationship

Unfollow a user

Parameters:

  • id (Integer)

Returns:



26
27
28
# File 'lib/mastodon/rest/relationships.rb', line 26

def unfollow(id)
  perform_request_with_object(:post, "/api/v1/accounts/#{id}/unfollow", {}, Mastodon::Relationship)
end