Skip to content

Commit

Permalink
Bump gem version and update docs
Browse files Browse the repository at this point in the history
Clarify how to get keys, and the
fact that access_token is mandatory.
  • Loading branch information
dncrht committed Aug 12, 2017
1 parent af0c03c commit 50c00f0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Tell your typical model™ to use Imgur as storage:
```ruby
class User < ActiveRecord::Base
has_attached_file :avatar, storage: :imgur
validates_attachment_content_type :avatar, content_type: /\Aimage\/.*\z/
end
```

Expand All @@ -31,18 +32,19 @@ The credentials to upload and delete images from Imgur will be read from `#{Rail
```yml
client_id: 'CLIENT_ID'
client_secret: 'CLIENT_SECRET'
access_token: 'ACCESS_TOKEN'
refresh_token: 'REFRESH_TOKEN'
```
Get these keys with:
```bash
rake imgur:authorize CLIENT_ID='CLIENT_ID' CLIENT_SECRET='CLIENT_SECRET'
```
Please refer to the [API client gem documentation](https://github.com/dncrht/imgur) for more information on this.
Please refer to the [API client gem documentation](https://github.com/dncrht/imgur) for more information on this. Create an [application](https://imgur.com/account/settings/apps) if you don't have those client keys yet.

You can also specify the credentials per model attribute, using a hash:
```ruby
has_attached_file :avatar, storage: :imgur, imgur_credentials: {client_id: 'CLIENT_ID', client_secret: 'CLIENT_SECRET', refresh_token: 'REFRESH_TOKEN'}
has_attached_file :avatar, storage: :imgur, imgur_credentials: {client_id: 'CLIENT_ID', client_secret: 'CLIENT_SECRET', access_token: 'ACCESS_TOKEN', refresh_token: 'REFRESH_TOKEN'}
```
…or path to a YAML file
```ruby
Expand Down
7 changes: 4 additions & 3 deletions paperclip-imgur.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

Gem::Specification.new do |gem|
gem.name = 'paperclip-imgur'
gem.version = '0.1.2'
gem.version = '0.1.3'
gem.authors = ['Daniel Cruz Horts']
gem.description = %q{Extends Paperclip with Imgur storage}
gem.summary = gem.description
Expand All @@ -16,7 +16,8 @@ Gem::Specification.new do |gem|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ['lib']

gem.add_dependency 'imgurapi', '~> 3.0.0'
gem.add_development_dependency 'byebug'
gem.add_dependency 'imgurapi', '>= 3.0.2'
gem.add_development_dependency 'rspec'
gem.add_dependency 'pry'
gem.add_dependency 'pry-byebug'
end

0 comments on commit 50c00f0

Please sign in to comment.