class Object
Public Instance Methods
register_image(image_fullpath)
click to toggle source
# File lib/images_to_scrapbox.rb, line 8 def register_image(image_fullpath) gyazo_url="https://upload.gyazo.com/api/upload" begin r = RestClient.post gyazo_url, { "access_token" => ENV["GYAZO_TOKEN"], :imagedata => File.new(image_fullpath, 'rb') } return JSON.parse(r) rescue => e p e puts e.backtrace puts <<EOS Failed to register image data. - Be online. - Set your ACCESS_TOKEN to the environment variable "GYAZO_TOKEN" EOS ensure end exit(1) end