Giter Club home page Giter Club logo

ruby-imgur's Introduction

imgur

Library to interface with the imgur API.

Usage

  1. Register your application with imgur at https://api.imgur.com/oauth2/addclient
  2. Place a file called .imgurrc in your user's $HOME directory with the following contents
  :client_id: "client_id_from_registering_app"
  :client_secret: "client_secret_from_registering_app"
  :account_username: "username_of_imgur_account"
  
  1. On first run, you will be presented with a browser window asking you to allow access to your account, do this.
  2. After approval, you will be prompted to enter both the access_token and refresh_token values, which can be retrieved from the URL of the page you are redirected to

Examples:

Get first page of gallery:

client = Imgur::Client.new
client.images.all(resource: "gallery", page: 0)
-> [
     [  0] #<Imgur::Client::Image:0x7fa559f29f08 attributes={id:"pzJKU",title:"I had quite the view last night",datetime:1355670464,animated:false,width:5184,height:3456,size:519719,views:0,bandwidth:0,account_url:nil,link:"http://i.imgur.com/pzJKU.jpg",ups:94,downs:0,score:406,is_album:false}>,
     ...
     [173] #<Imgur::Client::Image:0x7fa55ad4a5b0 attributes={id:"CmIrs",title:"Day officially made",datetime:1355595301,animated:false,width:245,height:176,size:899725,views:21774,bandwidth:19590612150,account_url:"idontwantoliveonthisplanetanymore",link:"http://i.imgur.com/CmIrs.gif",ups:269,downs:6,score:273,is_album:false}>
   ]

Open image in browser

client = Imgur::Client.new
image = client.images.all.first
image.open_in_browser

Contributing to imgur

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
  • Fork the project
  • Start a feature/bugfix branch
  • Commit and push until you are happy with your contribution
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.

Copyright

Copyright (c) 2012 Eugene Howe. See LICENSE.txt for further details.

ruby-imgur's People

Contributors

jaspr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ruby-imgur's Issues

Missing specific models for Gallery Image and Gallery Album

Unfortunately, Imgur has different data models for images -vs- gallery images and albums -vs- gallery albums. Some of the functionality we've written applies to gallery images/albums, and the same functionality should not be available for images/albums (e.g. adding comments).

http://api.imgur.com/models/image
http://api.imgur.com/models/gallery_image

http://api.imgur.com/models/album
http://api.imgur.com/models/gallery_album

Additionally some requests return gallery images rather than images, albums, etc. This should be separated out in due time.

searching for missing file imgur/requests/get_comments

C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in require': cannot load such file -- imgur/requests/get_comments (LoadError) from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:inrequire'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cistern-0.1.4/lib/cistern/service.rb:115:in block in setup_requirements' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cistern-0.1.4/lib/cistern/service.rb:114:ineach'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cistern-0.1.4/lib/cistern/service.rb:114:in setup_requirements' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/cistern-0.1.4/lib/cistern/service.rb:141:innew'
from app.rb:6:in `

'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.