google-simple-client 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -0
- data/lib/google-simple-client/session.rb +13 -0
- data/lib/google-simple-client/version.rb +1 -1
- metadata +8 -8
data/README.md
CHANGED
@@ -35,6 +35,9 @@ Make sure that you enable both the `Drive API` and the `Drive SDK`.
|
|
35
35
|
session.authenticate
|
36
36
|
pdf = session.get 'title', 'pdf'
|
37
37
|
|
38
|
+
|
39
|
+
Supported formats are (at least): 'pdf', 'html', 'csv', 'txt' etc.
|
40
|
+
|
38
41
|
## Usage CLI
|
39
42
|
|
40
43
|
$ google-simple-client [options] title
|
@@ -9,6 +9,15 @@ module GoogleSimpleClient
|
|
9
9
|
OAUTH_SCOPE = 'https://www.googleapis.com/auth/drive.readonly'
|
10
10
|
REDIRECT_URI = 'urn:ietf:wg:oauth:2.0:oob'
|
11
11
|
|
12
|
+
# Create the object and parse options
|
13
|
+
# @param [options]
|
14
|
+
# Required options are:
|
15
|
+
# :client_id, :client_secret, :email, and :password
|
16
|
+
# Optional options are:
|
17
|
+
# :redirect_uri, :scope, and :verbose
|
18
|
+
#
|
19
|
+
# Options may be provided as paramters or via an init file
|
20
|
+
# ./.google-simple-client or ~/.google-simple-client
|
12
21
|
def initialize options = {}
|
13
22
|
@options = {
|
14
23
|
redirect_uri: REDIRECT_URI,
|
@@ -25,6 +34,7 @@ module GoogleSimpleClient
|
|
25
34
|
raise Error.new("Missing option error #{@options.inspect}") unless @options.values.all?
|
26
35
|
end
|
27
36
|
|
37
|
+
# Authenticates with Google Drive
|
28
38
|
def authenticate
|
29
39
|
init_client
|
30
40
|
uri = @client.authorization.authorization_uri
|
@@ -34,6 +44,9 @@ module GoogleSimpleClient
|
|
34
44
|
@drive = @client.discovered_api('drive', 'v2')
|
35
45
|
end
|
36
46
|
|
47
|
+
# Gets the files matching the title in the requested format
|
48
|
+
# @param [title] The name of the requested document
|
49
|
+
# @param [format] The format, available formats are: 'pdf', 'html', 'csv', etc.
|
37
50
|
def get(title, format)
|
38
51
|
files = find_files(title)
|
39
52
|
return "No files found for title #{title}" if files.empty?
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-simple-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mechanize
|
16
|
-
requirement: &
|
16
|
+
requirement: &2160663120 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2160663120
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: google-api-client
|
27
|
-
requirement: &
|
27
|
+
requirement: &2160639680 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2160639680
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &2160599760 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2160599760
|
47
47
|
description: ! "Simplifies the usage of google-api-client and\n provides
|
48
48
|
a command line tool for finding and\n getting documents
|
49
49
|
from Google Drive."
|