gyaazle 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +35 -2
- data/bin/gyaazle +0 -1
- data/lib/gyaazle/client.rb +10 -7
- data/lib/gyaazle/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd7758c9dbc613c89561a922691f28b624aef943
|
4
|
+
data.tar.gz: 453f8c594fa93bcfb9055cbe774734f1c219dbcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 341020bcb4d18d26ee6605bb4d08642314a01ecf97fd96f4a0d1dfa6fe133a61f52bc8168e4fab640e5050765c478dcdf7fa50796921a001fe4bd04b95f276be
|
7
|
+
data.tar.gz: 0abe5cbe6dd9ddbe15340a7d17b2ad755c8e97091c3846a86b45bb2021d7ca9ff1967cd108e32b5e31067a801d7e60b5602056dce17e0ccffa0ad6028ab16be2
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Gyaazle
|
2
2
|
|
3
|
-
|
3
|
+
Gyazo like image uploader that upload image(s) to Google Drive.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,7 +18,40 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
$ gyaazle [options] <file1> <file2> ..
|
22
|
+
|
23
|
+
At first time execute, you should authorize Gyaazle app by browser.
|
24
|
+
|
25
|
+
## Setting
|
26
|
+
|
27
|
+
`gyaazle -e` for open config file by $EDITOR.
|
28
|
+
|
29
|
+
### Permissions
|
30
|
+
|
31
|
+
Add "permissions" object like below:
|
32
|
+
|
33
|
+
```json
|
34
|
+
{
|
35
|
+
"access_token": "********",
|
36
|
+
"token_type": "Bearer",
|
37
|
+
"expires_in": 3600,
|
38
|
+
...
|
39
|
+
"permissions": {
|
40
|
+
"role": "reader",
|
41
|
+
"type": "domain",
|
42
|
+
"value": "uu59.org",
|
43
|
+
"withLink": true,
|
44
|
+
"additionalRoles": [
|
45
|
+
"commenter"
|
46
|
+
]
|
47
|
+
}
|
48
|
+
}
|
49
|
+
```
|
50
|
+
|
51
|
+
Learn more:
|
52
|
+
|
53
|
+
* <https://developers.google.com/drive/manage-sharing>
|
54
|
+
* <https://developers.google.com/drive/v2/reference/permissions#resource>
|
22
55
|
|
23
56
|
## Contributing
|
24
57
|
|
data/bin/gyaazle
CHANGED
data/lib/gyaazle/client.rb
CHANGED
@@ -67,17 +67,20 @@ module Gyaazle
|
|
67
67
|
"Content-Type" => "multipart/related; boundary=___#{Time.now.to_f}___",
|
68
68
|
}
|
69
69
|
)
|
70
|
+
# Note: deeplink is https://drive.google.com/uc?export=view&id={fileId}
|
70
71
|
MultiJson.load(response.body, :symbolize_keys => true)
|
71
72
|
end
|
72
73
|
|
73
74
|
def set_permissions(file_id, permissions = nil)
|
74
|
-
json = MultiJson.dump(
|
75
|
-
:
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
75
|
+
json = MultiJson.dump(
|
76
|
+
permissions || credentials[:permissions] || {
|
77
|
+
:role => "reader",
|
78
|
+
:type => "#{"anyone"}",
|
79
|
+
:value => "#{"me"}",
|
80
|
+
:withLink => "true",
|
81
|
+
:additionalRoles => ["commenter"],
|
82
|
+
}
|
83
|
+
)
|
81
84
|
client.post_content(
|
82
85
|
"https://www.googleapis.com/drive/v2/files/#{file_id}/permissions",
|
83
86
|
json,
|
data/lib/gyaazle/version.rb
CHANGED