gyaazle 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c0d9ae977f0adc26ee26ed3824260bcab996e09e
4
- data.tar.gz: cd246022a2a2ad71637ca3db31e4a7007d4ad4bc
3
+ metadata.gz: cd7758c9dbc613c89561a922691f28b624aef943
4
+ data.tar.gz: 453f8c594fa93bcfb9055cbe774734f1c219dbcf
5
5
  SHA512:
6
- metadata.gz: fa2f348c040367ccf160e2bbe435ddb9442c18f13064af2f5f167b92e659a4e8eb2685356ca978635c410f4f7aaeb5cd3062175cfdc2927ddfd5889f088a14ca
7
- data.tar.gz: 3f92778199e8963581e35437af28a71f00f6aea0dd9a597909527c77dd8b8707170f622705875707f5fb30bc7a6363605881f27fb49786d76b270068e1095ca8
6
+ metadata.gz: 341020bcb4d18d26ee6605bb4d08642314a01ecf97fd96f4a0d1dfa6fe133a61f52bc8168e4fab640e5050765c478dcdf7fa50796921a001fe4bd04b95f276be
7
+ data.tar.gz: 0abe5cbe6dd9ddbe15340a7d17b2ad755c8e97091c3846a86b45bb2021d7ca9ff1967cd108e32b5e31067a801d7e60b5602056dce17e0ccffa0ad6028ab16be2
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Gyaazle
2
2
 
3
- TODO: Write a gem description
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
- TODO: Write usage instructions here
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
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require File.expand_path("../../lib/gyaazle.rb", __FILE__)
4
- require "gyaazle"
5
4
 
6
5
  Gyaazle::CLI.new(ARGV).run!
@@ -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(permissions || {
75
- :role => "reader",
76
- :type => "#{"anyone"}",
77
- :value => "#{"me"}",
78
- :withLink => "true",
79
- :additionalRoles => ["commenter"],
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,
@@ -1,3 +1,3 @@
1
1
  module Gyaazle
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gyaazle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - uu59