class Twitch::Clipr::Client
Public Class Methods
new()
click to toggle source
# File lib/twitch/clipr/client.rb, line 7 def initialize @base_url = "https://clipr.xyz" end
Public Instance Methods
download(download_url, destination_filepath)
click to toggle source
# File lib/twitch/clipr/client.rb, line 18 def download(download_url, destination_filepath) client = Faraday.new() response = client.get(download_url) File.open(destination_filepath, 'wb') { |fp| fp.write(response.body) } end
get(clip_url)
click to toggle source
# File lib/twitch/clipr/client.rb, line 11 def get(clip_url) clipr = Faraday.new(@base_url) response = clipr.post("/api/grabclip", {clip_url: clip_url}) json = JSON.parse(response.body) json["download_url"] end