Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/augustt198/imgur
Ruby wrapper for the Imgur API
https://github.com/augustt198/imgur
Last synced: about 2 months ago
JSON representation
Ruby wrapper for the Imgur API
- Host: GitHub
- URL: https://github.com/augustt198/imgur
- Owner: augustt198
- License: mit
- Created: 2014-05-15T21:57:11.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-07-24T14:48:08.000Z (over 2 years ago)
- Last Synced: 2024-10-19T21:36:07.768Z (3 months ago)
- Language: Ruby
- Homepage:
- Size: 195 KB
- Stars: 10
- Watchers: 2
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Imgur
Ruby wrapper for the Imgur API.
## Installation
Install with RubyGems:
```sh
$ gem install imgur-api
```Or add to your Gemfile:
```ruby
gem 'imgur-api'
```## Usage
For anonymous usage, create a new client with your Client-ID
```ruby
client = Imgur.new(client_id) # or Imgur::Client.new(client_id)
```To upload an image, first create a `Imgur::LocalImage`
```ruby
image = Imgur::LocalImage.new('path/to/image', title: 'Awesome photo')
```Then use the client to upload it and recieve a `Imgur::Image`
```ruby
uploaded = client.upload(image)
# uploaded.link => http://i.imgur.com/...
```Creating an album is super easy!
```ruby
# The first argument can also be an array of images, or nil for a blank album.
album = client.new_album(uploaded, title: 'My Photography')# album.link => http://imgur.com/a/...
```