Module: Mastodon::REST::Accounts

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

Instance Method Summary collapse

Methods included from Utils

#array_param, #perform_request, #perform_request_with_collection, #perform_request_with_object

Instance Method Details

#account(id) ⇒ Mastodon::Account

Retrieve account

Parameters:

  • id (Integer)

Returns:



18
19
20
# File 'lib/mastodon/rest/accounts.rb', line 18

def (id)
  perform_request_with_object(:get, "/api/v1/accounts/#{id}", {}, Mastodon::Account)
end

#follow_by_uri(uri) ⇒ Mastodon::Account

Follow a remote user

Parameters:

  • uri (String)

    The URI of the remote user, in the format of username@domain

Returns:



39
40
41
# File 'lib/mastodon/rest/accounts.rb', line 39

def follow_by_uri(uri)
  perform_request_with_object(:post, '/api/v1/follows', { uri: uri }, Mastodon::Account)
end

#followers(id) ⇒ Mastodon::Collection<Mastodon::Account>

Get a list of followers

Parameters:

  • id (Integer)

Returns:



25
26
27
# File 'lib/mastodon/rest/accounts.rb', line 25

def followers(id)
  perform_request_with_collection(:get, "/api/v1/accounts/#{id}/followers", {}, Mastodon::Account)
end

#following(id) ⇒ Mastodon::Collection<Mastodon::Account>

Get a list of followed accounts

Parameters:

  • id (Integer)

Returns:



32
33
34
# File 'lib/mastodon/rest/accounts.rb', line 32

def following(id)
  perform_request_with_collection(:get, "/api/v1/accounts/#{id}/following", {}, Mastodon::Account)
end

#verify_credentialsMastodon::Account

Retrieve account of authenticated user

Returns:



11
12
13
# File 'lib/mastodon/rest/accounts.rb', line 11

def verify_credentials
  perform_request_with_object(:get, '/api/v1/accounts/verify_credentials', {}, Mastodon::Account)
end