module Mastodon::REST::Filters
Public Instance Methods
create_filter(options = {})
click to toggle source
Create a new filter @param options [Hash] @option options :phrase [String] @option options :context [Array<String>] @option options :irreversible [Boolean] @option options :whole_word [Boolean] @option options :expires_in [Integer] @returns [Mastodon::Filter]
# File lib/mastodon/rest/filters.rb, line 19 def create_filter(options = {}) context = options.delete(:context) context = [ context ] unless context.kind_of? Array options['context[]'] = context perform_request_with_object(:post, '/api/v1/filters', options, Mastodon::Filter) end
delete_filter(id)
click to toggle source
Delete a filter @param id [Integer] @returns [Mastodon::Filter]
# File lib/mastodon/rest/filters.rb, line 64 def delete_filter(id) !perform_request(:delete, "/api/v1/filters/#{id}").nil? end
filter(id)
click to toggle source
Gets a filter @param id [Integer] @returns [Mastodon::Filter]
# File lib/mastodon/rest/filters.rb, line 31 def filter(id) perform_request_with_object(:get, "/api/v1/filters/#{id}", {}, Mastodon::Filter) end
filters()
click to toggle source
Gets all filters @returns [Mastodon::Collection<Mastodon::Filter>]
# File lib/mastodon/rest/filters.rb, line 38 def filters perform_request_with_collection(:get, '/api/v1/filters', {}, Mastodon::Filter) end
update_filter(id, options = {})
click to toggle source
Update an existing filter @param id [Integer] @param options [Hash] @option options :phrase [String] @option options :context [Array<String>] @option options :irreversible [Boolean] @option options :whole_word [Boolean] @option options :expires_in [Integer] @returns [Mastodon::Filter]
# File lib/mastodon/rest/filters.rb, line 52 def update_filter(id, options = {}) context = options.delete(:context) context = [ context ] unless context.kind_of? Array options['context[]'] = context perform_request_with_object(:put, "/api/v1/filters/#{id}", options, Mastodon::Filter) end