googleoauth 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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/googleoauth/client.rb +45 -0
  3. metadata +37 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ee2d2eb9d667fb2d2167111c6d8f249eb3158413
4
- data.tar.gz: 07f6e0f73849d6ad5b19d07109b25973b183d853
3
+ metadata.gz: 0e714c9ece6fc2c866f58a603b3d62fb0f823411
4
+ data.tar.gz: 61de94d37fd3e03f6940db472cc206dbd4fc5ab7
5
5
  SHA512:
6
- metadata.gz: d5d97d487ae760ec488e496113ce815fe442aeac3e25acac9ad5c89c51953688185b04a1fd52dbfdd125038165e566b05ca316d3052a0fff66f52195181518cb
7
- data.tar.gz: eb728f8a23eb363e0ff7d82543a2087d43d9c5b7ffc71eaf3ca10298b91a824c4d27f67b54178d5dfc214be017468a68013d0fe52c1bf13ca01a8d9fa062ba73
6
+ metadata.gz: 018f01fb8d20ccd38d2da387ca45ca036c0a7ea39304124648141c01f245c67ed43459d924b7cd23ca8473d9d3802a2fd1a4faaa5dbde31928a5b5d1781a3fcb
7
+ data.tar.gz: cfbbf40672c5e7b7600c335b2fc0cba257f716e7d528a0228ea3fea5377e4942b1a09a106fcbbff22fb3b15b1f012f85a72bdb73d53facd55f20773ced453a0c
@@ -0,0 +1,45 @@
1
+ #require 'googleoauth/hash_response'
2
+
3
+ module GoogleOAuth
4
+ class Client
5
+
6
+
7
+
8
+ def initialize(options = {})
9
+ @client_id = options[:client_id]
10
+ @client_secret = options[:client_secret]
11
+ @redirect = options[:redirect]
12
+ end
13
+
14
+ def authorize_url(options = {})
15
+ consumer.auth_code.authorize_url(
16
+ :response_type => 'code',
17
+ :client_id => @client_id,
18
+ :redirect_uri => @redirect,
19
+ :scope => options[:scope]
20
+ )
21
+ end
22
+
23
+ def authorize(options = {})
24
+ consumer.auth_code.get_token(
25
+ options[:code],
26
+ :redirect_uri => @redirect
27
+ )
28
+ end
29
+
30
+ def request(token, request_uri)
31
+ token.get(request_uri)
32
+ end
33
+
34
+ private
35
+ def consumer
36
+ OAuth2::Client.new(
37
+ @client_id,
38
+ @client_secret,
39
+ :site => "https://accounts.google.com",
40
+ :authorize_url => '/o/oauth2/auth',
41
+ :token_url => '/o/oauth2/token'
42
+ )
43
+ end
44
+ end
45
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: googleoauth
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
  - iamdual
@@ -9,7 +9,41 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2015-11-29 00:00:00.000000000 Z
12
- dependencies: []
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: oauth2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.8'
34
+ - - '>='
35
+ - !ruby/object:Gem::Version
36
+ version: 1.8.3
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: '1.8'
44
+ - - '>='
45
+ - !ruby/object:Gem::Version
46
+ version: 1.8.3
13
47
  description: This is a Google OAuth library for Ruby.
14
48
  email: i@ekin.pw
15
49
  executables: []
@@ -17,6 +51,7 @@ extensions: []
17
51
  extra_rdoc_files: []
18
52
  files:
19
53
  - lib/googleoauth.rb
54
+ - lib/googleoauth/client.rb
20
55
  homepage: https://rubygems.org/gems/googleoauth
21
56
  licenses:
22
57
  - MIT