Project

gyazo

0.02
Low commit activity in last 3 years
No release in over a year
Gyazo.com API Wrapper
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Gyazo

Gyazo API wrapper for Ruby

Install

% gem install gyazo

Usage

Register new application and get ACCESS TOKEN, then

Upload

require 'gyazo'
gyazo = Gyazo::Client.new access_token: 'your-access-token'
res = gyazo.upload imagefile: 'my_image.png'
puts res #=> {:type=>"png", :thumb_url=>"https://thumb.gyazo.com/thumb/...", :created_at=>"2019-05-03T11:57:35+0000", :image_id=>"...", :permalink_url=>"https://gyazo.com/...", :url=>"https://i.gyazo.com/....png"}

passing filename

if you give io for imagefile:, you need filename:.

gyazo.upload imagefile: File.open(image), filename: 'image.png'

Upload with metadata

Following attributes can be set

  • created_at(default: Time.now)
  • referer_url(default: '')
  • title(default: '')
  • desc(default: '')
  • collection_id(default: '')
res = gyazo.upload imagefile: 'my_image.png', created_at: Time.now, referer_url: 'https://example.com/'

List

gyazo.list[:images].each do |image|
  puts image[:url]
end

image detail

gyazo.image image_id: image_id

Delete

gyazo.delete image_id: image_id

Test

setup

% gem install bundler
% bundle install
% export GYAZO_TOKEN=a1b2cdef3456   ## set your API Token

run test

% bundle exec rake test

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request