shrine-google_drive_storage 0.3.6 → 0.3.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a2925cb411265e26775f1921435976e85d9404d6
4
- data.tar.gz: '03008f788cb962a2e310b7f6509999c9b26cb249'
3
+ metadata.gz: cf11ee5e155a79f5f4b4df8f676c7a2358a98fde
4
+ data.tar.gz: ced7a62f10dc54614dd2ea09fa224de6097cdfcd
5
5
  SHA512:
6
- metadata.gz: 76bec922e690693b1955ce0f56fc0695fe21dc4499dd8460f97b5cbe9b8f1f5967afcbe6cd69d481cc2e8125d26832b527be9d12600d4feff940c5676d558e20
7
- data.tar.gz: 4bb2bb19aa1a4ecdfbbe38c4514c0918fd5d4db904b4c55910329ce8bf29bfda23f6881301a71e081bf8fe19c458ddabb818abaa260318374a5859998d8ffed4
6
+ metadata.gz: d0c3260b294e3b7fd74af5dd43759be12e766471cbac849c95a06bb8b0026d63263c181f9cb32deeae0267bf6ea99d0f87b9b82c008498407d8668f05c753217
7
+ data.tar.gz: 38edc79087c650872fcc652cd01cb27856420b847d7ea71c6e5335afa3d05689773ac99dd28931cfc8398f3e935b427d4229d279d3cf63a48ceea323f92f8fe7
data/README.md CHANGED
@@ -49,9 +49,9 @@ Shrine.storages = {
49
49
  Shrine::Storage::GoogleDriveStorage.new(
50
50
  prefix: "store",
51
51
  google_drive_client_secret_path: "#{Rails.root}/config/client_secret.json",
52
+ drive_public_folder_id: 'AAAARRRRGGGBBBFFFFadsasdX',
52
53
  google_drive_options: {
53
54
  path: proc { |style| "#{id}_#{photo.original_filename}_#{style}" },
54
- public_folder_id: 'AAAARRRRGGGBBBFFFFadsasdX'
55
55
  },
56
56
  )
57
57
  ```
@@ -60,6 +60,10 @@ The `:google_drive_client_secret_path` option
60
60
 
61
61
  This is the path of the file downloaded from your Google Drive app settings by the authorization Rake task.
62
62
 
63
+ The `:drive_public_folder_id` option
64
+
65
+ This is the id of Google Drive folder that must be created in google drive and set public permissions on it
66
+
63
67
  Example of the overridden `path/to/client_secret.json` file:
64
68
  ```json
65
69
  {
@@ -77,9 +81,7 @@ The `:google_drive_options` option
77
81
 
78
82
  This is a hash containing any of the following options:
79
83
  - `:path` – block
80
- - `:public_folder_id`- id of folder that must be created in google drive and set public permissions on it
81
84
  - `:default_image` - an image in Public folder that used for attachments if attachment is not present
82
- - `:application_name` - is the name that you set for the application credentials on Google console.
83
85
 
84
86
  The :path option should be a block which returns a path that the uploaded file should be saved to. The block yields the attachment style and is executed in the scope of the model instance.
85
87
 
@@ -12,8 +12,9 @@ class Shrine
12
12
 
13
13
  def initialize(prefix: nil, google_drive_options: {})
14
14
  @prefix = prefix
15
- @google_drive_client_secret_path = @options[:google_drive_client_secret_path]
16
- @google_drive_options = @options[:google_drive_options]
15
+ @google_drive_client_secret_path = google_drive_client_secret_path
16
+ @drive_public_folder_id = drive_public_folder_id
17
+ @google_drive_options = google_drive_options
17
18
  end
18
19
 
19
20
  def upload(io, id, shrine_metadata: {}, **_options)
@@ -22,7 +23,7 @@ class Shrine
22
23
  name: id,
23
24
  description: 'shrine file on google drive',
24
25
  mimeType: mime_type,
25
- parents: folder_id
26
+ parents: @drive_public_folder_id
26
27
  }
27
28
 
28
29
  google_api_client.create_file(
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shrine-google_drive_storage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Near