Module: Mastodon::REST::Instances

Includes:
Utils
Included in:
API
Defined in:
lib/mastodon/rest/instances.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_domain(domain) ⇒ Boolean

Block a domain

Parameters:

  • domain (String)

Returns:

  • (Boolean)


30
31
32
33
# File 'lib/mastodon/rest/instances.rb', line 30

def block_domain(domain)
  !perform_request(:post, '/api/v1/domain_blocks',
                   { domain: domain }).nil?
end

#domain_blocks(options = {}) ⇒ Mastodon::Collection<String>

Get user domain blocks

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :limit (Integer)

Returns:



22
23
24
25
# File 'lib/mastodon/rest/instances.rb', line 22

def domain_blocks(options = {})
  perform_request_with_collection(:get, '/api/v1/domain_blocks',
                                  options, String)
end

#instanceMastodon::Instance

Retrieve the current instance. Does not require authentication

Returns:



13
14
15
16
# File 'lib/mastodon/rest/instances.rb', line 13

def instance
  perform_request_with_object(:get, '/api/v1/instance', {},
                              Mastodon::Instance)
end

#unblock_domain(domain) ⇒ Boolean

Unblock a domain

Parameters:

  • domain (String)

Returns:

  • (Boolean)


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

def unblock_domain(domain)
  !perform_request(:delete, '/api/v1/domain_blocks',
                   { domain: domain }).nil?
end