module WeebSh::API::Toph
Constants
- BASE
Public Instance Methods
image(interface, id)
click to toggle source
# File lib/weeb/api/toph.rb, line 79 def image(interface, id) WeebSh::API.request( :get, "#{interface.api_url}#{BASE}/info/#{id}", { Authorization: interface.auth, 'User-Agent': interface.user_agent } ) end
list(interface, query)
click to toggle source
# File lib/weeb/api/toph.rb, line 125 def list(interface, query) WeebSh::API.request( :get, "#{interface.api_url}#{BASE}/list?#{URI.encode_www_form(query)}", { Authorization: interface.auth, 'User-Agent': interface.user_agent } ) end
list_user(interface, id, query)
click to toggle source
# File lib/weeb/api/toph.rb, line 136 def list_user(interface, id, query) WeebSh::API.request( :get, "#{interface.api_url}#{BASE}/list/#{id}?#{URI.encode_www_form(query)}", { Authorization: interface.auth, 'User-Agent': interface.user_agent } ) end
random(interface, query)
click to toggle source
# File lib/weeb/api/toph.rb, line 68 def random(interface, query) WeebSh::API.request( :get, "#{interface.api_url}#{BASE}/random?#{URI.encode_www_form(query)}", { Authorization: interface.auth, 'User-Agent': interface.user_agent } ) end
remove_image(interface, id)
click to toggle source
# File lib/weeb/api/toph.rb, line 114 def remove_image(interface, id) WeebSh::API.request( :delete, "#{interface.api_url}#{BASE}/info/#{id}", { Authorization: interface.auth, 'User-Agent': interface.user_agent } ) end
types(interface, query)
click to toggle source
# File lib/weeb/api/toph.rb, line 46 def types(interface, query) WeebSh::API.request( :get, "#{interface.api_url}#{BASE}/types?#{URI.encode_www_form(query)}", { Authorization: interface.auth, 'User-Agent': interface.user_agent } ) end
upload(interface, resource, type, hidden, tags, nsfw, source)
click to toggle source
# File lib/weeb/api/toph.rb, line 12 def upload(interface, resource, type, hidden, tags, nsfw, source) resource.is_a?(File) ? WeebSh::API.request( :post, "#{interface.api_url}#{BASE}/upload", { 'file'.to_sym => resource, 'baseType'.to_sym => type, 'hidden'.to_sym => hidden, 'tags'.to_sym => tags, 'nsfw'.to_sym => nsfw, 'source'.to_sym => source }, { Authorization: interface.auth, 'User-Agent': interface.user_agent } ) : WeebSh::API.request( :post, "#{interface.api_url}#{BASE}/upload", { url: resource, baseType: type, hidden: hidden, tags: tags, nsfw: nsfw, source: source }.to_json, { Authorization: interface.auth, 'User-Agent': interface.user_agent } ) end