paperclip-google-drive 0.2 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4b3dff7c90edf224a4aa0eb34a9171e8c4500d2
4
- data.tar.gz: f0f885e0894000ecaf130bd67b4deafcac437682
3
+ metadata.gz: ea643014b17dba645cc7be27b4e40344a477850d
4
+ data.tar.gz: b02d033f6903ca1c63b143549be498c902eef798
5
5
  SHA512:
6
- metadata.gz: fb808cd7e7467354fc158e8171a26a47a041a75b30fbba81bce4244c44ca8b6ceb453c5ac3f646c26e2ca8eb2323711f6a865603ac3e3ad20e4c4317a2648236
7
- data.tar.gz: c6d63cc09d0071fe9b57c9eff052b7ed28d57107cf1bc5920daab0d7ca53fe01527df3fc70b8c61fa69fc49278a625b46ec25d9de0a6b8fdb793212449cef8d1
6
+ metadata.gz: 6502999e062f9a3bec85a781f6831bff4e1ad6d2b94c72234c4ea7c149f65097e81af5817b4575ea884ce1e7472248e17c7343dc048f870782752ab40107a47c
7
+ data.tar.gz: c24b8109949282ab6f5016cb92a1d309efc5c0d9f25a96290a1d575153ea2576c5ada1a7ae4268233e193adbd68a6bd071b59e52767713583ae0a783fd658488
data/README.md CHANGED
@@ -1,14 +1,15 @@
1
- # PaperclipGoogledrive
2
- [![Gem Version](https://badge.fury.io/rb/paperclip-googledrive.png)](http://badge.fury.io/rb/paperclip-googledrive)
3
- [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/evinsou/paperclip-googledrive)
1
+ # PaperclipGoogleDrive
2
+ [![GitHub version](https://badge.fury.io/gh/degzcs%2Fpaperclip-googledrive.svg)](https://badge.fury.io/gh/degzcs%2Fpaperclip-googledrive)
3
+ [![Code Climate](https://codeclimate.com/github/degzcs/paperclip-googledrive/badges/gpa.svg)](https://codeclimate.com/github/degzcs/paperclip-googledrive)
4
4
 
5
- PaperclipGoogledrive is a gem that extends paperclip storage for Google Drive (V3). Works with Rails 3.x. and later.
5
+ PaperclipGoogledrive is a gem that extends paperclip storage for Google Drive (V3). Works with Rails 3.x. and later.
6
+ IMPORTANT NOTE: This repo was forked and upgraded to use Google Drive V3.
6
7
 
7
8
  ## Installation
8
9
 
9
10
  Add this line to your application's Gemfile:
10
11
 
11
- gem 'paperclip-googledrive', github: 'degzcs/paperclip-googledrive'
12
+ gem 'paperclip-google-drive'
12
13
 
13
14
  And then execute:
14
15
 
@@ -16,7 +17,7 @@ And then execute:
16
17
 
17
18
  Or install it yourself as:
18
19
 
19
- $ gem install paperclip-googledrive
20
+ $ gem install paperclip-google-drive
20
21
 
21
22
  ## Google Drive Setup
22
23
 
@@ -28,15 +29,15 @@ Google Drive is a free service for file storage files. In order to use this stor
28
29
 
29
30
  3. Go to "API Manager > Credentials" and click on "OAuth Client ID" before to select "Other" type you must specify `http://localhost` for application home page.
30
31
 
31
- 4. Now you will have a Client ID, Client Secret, and Redirect URL. So, download the client_secret_XXXXX.json file and rename it to client_secrete.json.
32
+ 4. Now you will have a Client ID, Client Secret, and Redirect URL. So, download the client_secret_XXXXX.json file and rename it to client_secret.json.
32
33
 
33
34
  5. Run the authorization task:
34
35
  ```sh
35
- $ rake google_drive:authorize"[path/to/client_secret.json application_name]"
36
+ $ rake google_drive:authorize"[path/to/client_secret.json, 'application_name']"
36
37
  ```
37
38
  NOTE:
38
39
  - the `path/to/client_secret.json` path is the file downloaded from Google console (it will be overrided with the fresh token).
39
- - the application_name param is the name that you set for the application credentials on Google console.
40
+ - the `application_name` param is the name that you set for the application credentials on Google console.
40
41
 
41
42
  6. The Rake task will give you an auth url. Simply go to that url (while signed in as the designated uploads owner), authorize the app, then enter code from url in the console. The rake task will override valid `client_secret.json` which you can use to connect with GoogleDrive from now on.
42
43
 
@@ -54,9 +55,9 @@ end
54
55
  ```
55
56
  The `:google_drive_client_secret_path` option
56
57
 
57
- Thise is obtained from your Google Drive app settings and the authorization Rake task.
58
+ This is the path of the file which was obtained from your Google Drive app settings and the authorization Rake task.
58
59
 
59
- Example `path/to/client_secret.json`:
60
+ Example of the overridden `path/to/client_secret.json` file:
60
61
  ```json
61
62
  {
62
63
  "client_id": "4444-1111.apps.googleusercontent.com",
@@ -85,7 +86,8 @@ class Product < ActiveRecord::Base
85
86
  :google_drive_client_secret_path => "#{Rails.root}/config/client_secret.json"
86
87
  :styles => { :medium => "300x300" },
87
88
  :google_drive_options => {
88
- :path => proc { |style| "#{style}_#{id}_#{photo.original_filename}" }
89
+ :path => proc { |style| "#{style}_#{id}_#{photo.original_filename}" },
90
+ :public_folder_id => 'AAAARRRRGGGBBBFFFFadsasdX'
89
91
  }
90
92
  end
91
93
  ```
@@ -105,7 +107,7 @@ Useful links
105
107
 
106
108
  [Enable the Drive API and SDK](https://developers.google.com/drive/enable-sdk)
107
109
 
108
- [Quickstart](https://developers.google.com/drive/quickstart-ruby#step_1_enable_the_drive_api)
110
+ [Quickstart](https://developers.google.com/drive/v3/web/quickstart/ruby)
109
111
 
110
112
  ## License
111
113
 
@@ -124,7 +124,7 @@ module Paperclip
124
124
  default_image
125
125
  else
126
126
  metadata = metadata_by_id(searched_id)
127
- metadata.web_content_link #or metadata.web_view_link?
127
+ metadata.thumbnail_link #web_content_link #or metadata.web_view_link?
128
128
  end
129
129
  end
130
130
 
@@ -180,7 +180,7 @@ module Paperclip
180
180
  title = @google_drive_options[:default_url]
181
181
  searched_id = search_for_title(title) # id
182
182
  metadata = metadata_by_id(searched_id) unless searched_id.nil?
183
- metadata.web_content_link
183
+ metadata.thumbnail_link#web_view_link #web_content_link
184
184
  else
185
185
  'No picture' # ---- ?
186
186
  end
@@ -1,3 +1,3 @@
1
1
  module PaperclipGoogleDrive
2
- VERSION = "0.2"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclip-google-drive
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diego Gomez