Module: Mastodon::REST::Filters
Instance Method Summary collapse
-
#create_filter(options = {}) ⇒ Object
Create a new filter.
-
#delete_filter(id) ⇒ Object
Delete a filter.
-
#filter(id) ⇒ Object
Gets a filter.
-
#filters ⇒ Object
Gets all filters.
-
#update_filter(id, options = {}) ⇒ Object
Update an existing filter.
Methods included from Utils
#array_param, #perform_request, #perform_request_with_collection, #perform_request_with_object
Instance Method Details
#create_filter(options = {}) ⇒ Object
Create a new filter
19 20 21 22 23 24 25 26 |
# File 'lib/mastodon/rest/filters.rb', line 19 def create_filter( = {}) context = .delete(:context) context = [ context ] unless context.kind_of? Array ['context[]'] = context perform_request_with_object(:post, '/api/v1/filters', , Mastodon::Filter) end |
#delete_filter(id) ⇒ Object
Delete a filter
64 65 66 |
# File 'lib/mastodon/rest/filters.rb', line 64 def delete_filter(id) !perform_request(:delete, "/api/v1/filters/#{id}").nil? end |
#filter(id) ⇒ Object
Gets a filter
31 32 33 34 |
# File 'lib/mastodon/rest/filters.rb', line 31 def filter(id) perform_request_with_object(:get, "/api/v1/filters/#{id}", {}, Mastodon::Filter) end |
#filters ⇒ Object
Gets all filters
38 39 40 41 |
# 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 = {}) ⇒ Object
Update an existing filter
52 53 54 55 56 57 58 59 |
# File 'lib/mastodon/rest/filters.rb', line 52 def update_filter(id, = {}) context = .delete(:context) context = [ context ] unless context.kind_of? Array ['context[]'] = context perform_request_with_object(:put, "/api/v1/filters/#{id}", , Mastodon::Filter) end |