No commit activity in last 3 years
No release in over 3 years
Data store for storing Dragonfly images on Imgur
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.15
>= 0
~> 10.0
~> 3.6

Runtime

 Project Readme

Dragonfly::ImgurDataStore

Imgur data store for use with the Dragonfly gem.

Installation

Add this line to your application's Gemfile:

gem 'dragonfly-imgur_data_store'

And then execute:

$ bundle

Usage

Configure dragonfly with Imgur credentials at config/initializers/dragonfly.rb as:

datastore :imgur,
  client_id: 'CLIENT_ID',
  client_secret: 'CLIENT_SECRET',
  access_token: 'ACCESS_TOKEN',
  refresh_token: 'REFRESH_TOKEN'

The recommended way to serve an image is via remote_url.

my_model.attachment.remote_url

Bear in mind that Imgur only stores images.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Usually dragonfly datastores are easily tested thanks to a shared example:

it_should_behave_like 'data_store'

as stated in the documentation. However ImgurDataStore cannot because that shared example uses a text file not allowed by Imgur.

You'll also need to create your own config/imgur.yml with the relevant credentials. Use the template file as a guide:

cp config/imgur.yml.SAMPLE config/imgur.yml

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/dncrht/dragonfly-imgur_data_store.

License

The gem is available as open source under the terms of the MIT License.