paperclip-dropbox 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -26,12 +26,12 @@ end
26
26
 
27
27
  Valid options for `#has_attached_file` are:
28
28
 
29
- - `:dropbox_settings` – A `Hash`, a `File`, or a path to the file where your
29
+ - `:dropbox_settings` – A Hash, a File, or a path to the file where your
30
30
  Dropbox configuration is located
31
31
 
32
- - `:dropbox_options` – This can be used to overrride `:dropbox_settings` (for example,
32
+ - `:dropbox_options` – This can be used to override `:dropbox_settings` (for example,
33
33
  you have configuration in your YAML file, but you want to override some things
34
- that are specific for a certain attribute)
34
+ that are specific for that certain attribute)
35
35
 
36
36
  ## Configuration
37
37
 
@@ -45,17 +45,17 @@ access_token_secret: <%= ENV["DROPBOX_ACCESS_TOKEN_SECRET"] %>
45
45
  ```
46
46
 
47
47
  You can also namespace them inside of `development`, `testing` and `production` environments
48
- (just like you do with your `database.yml`).
48
+ (just like you do in your `database.yml`).
49
49
 
50
50
  There are 3 more **optional** configurations:
51
51
 
52
52
  - `:access_type` – This is either `"app_folder"` or `"dropbox"` (defaults to `"app_folder"`)
53
- - `:path` - Similar to Paperclip's `:path` option (defaults to `"<filename>"`)
54
- - `:environment` - Here you can set your environment if you're in a non-Rails application
53
+ - `:path` Similar to Paperclip's `:path` option (defaults to `"<filename>"`)
54
+ - `:environment` Here you can set your environment if you're in a non-Rails application
55
55
 
56
56
  ### The `:path` option
57
57
 
58
- Let's say we've set `:path` to `"<table_name>/<record_id>_<attachment_name>_<filename>"`. If a user with the ID of 13
58
+ Let's say we've set `:path => "<table_name>/<record_id>_<attachment_name>_<filename>"`. If a user with the ID of `13`
59
59
  uploads `photo.jpg` for his avatar, the file would be saved to
60
60
 
61
61
  ```
@@ -63,13 +63,13 @@ users/13_avatar_photo.jpg
63
63
  ```
64
64
 
65
65
  The keywords are: `<filename>`, `<table_name>`, `<model_name>`,
66
- `<attachment_name>` and `<style>`. Additionally, if you want to use a record's attribute, just
67
- prefix it with `record_` (like the `<record_id>` above).
66
+ `<attachment_name>` and `<style>`. Additionally, if you want to use any of the record's attributes,
67
+ just prefix them with `record_` (like the `<record_id>` above).
68
68
 
69
- Filenames in Dropbox inside a folder have to be unique, otherwise exception
69
+ Files in Dropbox inside a certain folder have to have unique filenames, otherwise exception
70
70
  `Paperclip::Storage::Dropbox::FileExists` is thrown. To help you with that, you
71
- can pass in `:unique_filename => true` to Dropbox configuration, which will
72
- ensure uniqueness of filenames (this is the same as passing `:path => "<model_name>_<record_id>_<attachment_name>"`).
71
+ can pass in `:unique_filename => true` to the Dropbox configuration, which will
72
+ ensure uniqueness of the filenames (this is the same as passing `:path => "<model_name>_<record_id>_<attachment_name>"`).
73
73
 
74
74
  ### Obtaining the access token
75
75
 
@@ -81,10 +81,6 @@ $ rake dropbox:authorize APP_KEY=your_app_key APP_SECRET=your_app_secret
81
81
 
82
82
  And just follow the instructions.
83
83
 
84
- ## Credits
85
-
86
- I found some solutions to my problems in **@dripster82**'s [paperclipdropbox](https://github.com/dripster82/paperclipdropbox) gem.
87
-
88
84
  ## License
89
85
 
90
86
  [MIT](https://github.com/janko-m/paperclip-dropbox/blob/master/LICENSE)
@@ -64,7 +64,7 @@ module Paperclip
64
64
  options = args.last.is_a?(Hash) ? args.last : {}
65
65
  query = options[:download] ? "?dl=1" : ""
66
66
 
67
- dropbox_client.media(path(style))["url"] + query
67
+ dropbox_client.media(path(style).to_s)["url"] + query
68
68
 
69
69
  rescue DropboxError
70
70
  nil
@@ -78,6 +78,9 @@ module Paperclip
78
78
  end
79
79
  style_suffix = style != default_style ? "_#{style}" : ""
80
80
  result = "#{result}#{style_suffix}#{extension}"
81
+
82
+ rescue
83
+ nil
81
84
  end
82
85
 
83
86
  def copy_to_local_file(style, destination_path)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = "paperclip-dropbox"
5
- gem.version = "0.0.1"
5
+ gem.version = "0.0.2"
6
6
 
7
7
  gem.authors = ["Janko Marohnić"]
8
8
  gem.email = ["janko.marohnic@gmail.com"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclip-dropbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: