module Mastodon::REST::Accounts
Public Instance Methods
Accept a follow request @param id [Integer] @return [Boolean]
# File lib/mastodon/rest/accounts.rb, line 137 def accept_follow_request(id) !perform_request(:post, "/api/v1/follow_requests/#{id}/authorize").nil? end
Retrieve account @param id [Integer] @return [Mastodon::Account]
# File lib/mastodon/rest/accounts.rb, line 45 def account(id) perform_request_with_object(:get, "/api/v1/accounts/#{id}", {}, Mastodon::Account) end
Add an endorsement @param id [Integer] @return [Mastodon::Relationship]
# File lib/mastodon/rest/accounts.rb, line 89 def add_endorsement(id) perform_request_with_object(:post, "/api/v1/accounts/#{id}/pin", {}, Mastodon::Relationship) end
Get user blocks @param options [Hash] @option options :limit [Integer] @return [Mastodon::Collection<Mastodon::Account>]
# File lib/mastodon/rest/accounts.rb, line 112 def blocks(options = {}) perform_request_with_collection(:get, '/api/v1/blocks', options, Mastodon::Account) end
Get account endorsements @return [Mastodon::Collection<Mastodon::Account>]
# File lib/mastodon/rest/accounts.rb, line 81 def endorsements perform_request_with_collection(:get, '/api/v1/endorsements', {}, Mastodon::Account) end
Follow a remote user @param uri [String] The URI of the remote user, in the format of
username@domain
@return [Mastodon::Account]
# File lib/mastodon/rest/accounts.rb, line 72 def follow_by_uri(uri) perform_request_with_object(:post, '/api/v1/follows', { uri: uri }, Mastodon::Account) end
Gets follow requests @param options [Hash] @option options :limit [Integer] @return [Mastodon::Collection<Mastodon::Account>]
# File lib/mastodon/rest/accounts.rb, line 129 def follow_requests(options = {}) perform_request_with_collection(:get, '/api/v1/follow_requests', options, Mastodon::Account) end
Get a list of followers @param id [Integer] @return [Mastodon::Collection<Mastodon::Account>]
# File lib/mastodon/rest/accounts.rb, line 53 def followers(id) perform_request_with_collection(:get, "/api/v1/accounts/#{id}/followers", {}, Mastodon::Account) end
Get a list of followed accounts @param id [Integer] @return [Mastodon::Collection<Mastodon::Account>]
# File lib/mastodon/rest/accounts.rb, line 62 def following(id) perform_request_with_collection(:get, "/api/v1/accounts/#{id}/following", {}, Mastodon::Account) end
Get user mutes @return [Mastodon::Collection<Mastodon::Account>]
# File lib/mastodon/rest/accounts.rb, line 103 def mutes perform_request_with_collection(:get, '/api/v1/mutes', {}, Mastodon::Account) end
Reject follow request @param id [Integer] @return [Boolean]
# File lib/mastodon/rest/accounts.rb, line 144 def reject_follow_request(id) !perform_request(:post, "/api/v1/follow_requests/#{id}/reject").nil? end
Remove an endorsement @param id [Integer] @return [Mastodon::Relationship]
# File lib/mastodon/rest/accounts.rb, line 97 def remove_endorsement(id) perform_request_with_object(:post, "/api/v1/accounts/#{id}/unpin", {}, Mastodon::Relationship) end
Report an account @param id [Integer] @param options [Hash] @option options :status_ids [Array<Integer>] @option options :comment [String]
# File lib/mastodon/rest/accounts.rb, line 121 def report(id, options = {}) options[:account_id] = id !perform_request(:post, '/api/v1/reports', options).nil? end
@return [Mastodon::Account]
# File lib/mastodon/rest/accounts.rb, line 32 def update_credentials(opts = {}) opts[:fields] and opts.delete(:fields).each_with_index { |f, i| opts["fields_attributes[#{i}][name]"] = f[:name] opts["fields_attributes[#{i}][value]"] = f[:value] } perform_request_with_object(:patch, '/api/v1/accounts/update_credentials', opts, Mastodon::Account) end
Retrieve account of authenticated user @return [Mastodon::Account]
# File lib/mastodon/rest/accounts.rb, line 14 def verify_credentials perform_request_with_object(:get, '/api/v1/accounts/verify_credentials', {}, Mastodon::Account) end