omniauth-putio 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.
- data/.gitignore +18 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +36 -0
- data/README.md +46 -0
- data/lib/omniauth-putio.rb +2 -0
- data/lib/omniauth-putio/version.rb +5 -0
- data/lib/omniauth/strategies/putio.rb +47 -0
- data/omniauth-putio.gemspec +22 -0
- metadata +64 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
omniauth-putio (0.0.2)
|
5
|
+
omniauth-oauth2 (~> 1.1.1)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
faraday (0.8.6)
|
11
|
+
multipart-post (~> 1.1)
|
12
|
+
hashie (1.2.0)
|
13
|
+
httpauth (0.2.0)
|
14
|
+
jwt (0.1.5)
|
15
|
+
multi_json (>= 1.0)
|
16
|
+
multi_json (1.6.1)
|
17
|
+
multipart-post (1.2.0)
|
18
|
+
oauth2 (0.8.1)
|
19
|
+
faraday (~> 0.8)
|
20
|
+
httpauth (~> 0.1)
|
21
|
+
jwt (~> 0.1.4)
|
22
|
+
multi_json (~> 1.0)
|
23
|
+
rack (~> 1.2)
|
24
|
+
omniauth (1.1.3)
|
25
|
+
hashie (~> 1.2)
|
26
|
+
rack
|
27
|
+
omniauth-oauth2 (1.1.1)
|
28
|
+
oauth2 (~> 0.8.0)
|
29
|
+
omniauth (~> 1.0)
|
30
|
+
rack (1.5.2)
|
31
|
+
|
32
|
+
PLATFORMS
|
33
|
+
ruby
|
34
|
+
|
35
|
+
DEPENDENCIES
|
36
|
+
omniauth-putio!
|
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# OmniAuth Put.io
|
2
|
+
|
3
|
+
OmniAuth strategy for the Put.io v2 API.
|
4
|
+
|
5
|
+
# Usage
|
6
|
+
|
7
|
+
In a Rack application:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
use OmniAuth::Builder do
|
11
|
+
provider :putio, ENV['PUTIO_CLIENT_ID'], ENV['PUTIO_CLIENT_SECRET']
|
12
|
+
end
|
13
|
+
```
|
14
|
+
|
15
|
+
In a Rails applicaitons, put the following in `config/initializers/omniauth.rb`:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
19
|
+
provider :putio, ENV['PUTIO_CLIENT_ID'], ENV['PUTIO_CLIENT_SECRET']
|
20
|
+
end
|
21
|
+
```
|
22
|
+
|
23
|
+
Make sure to restart the server for the changes in the initializer to be taken into account.
|
24
|
+
The Put.io authentication endpoint in your app is `/auth/putio'.
|
25
|
+
|
26
|
+
# License
|
27
|
+
|
28
|
+
Copyright (c) 2013 Dimiter Petrov
|
29
|
+
|
30
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
31
|
+
this software and associated documentation files (the "Software"), to deal in
|
32
|
+
the Software without restriction, including without limitation the rights to
|
33
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
34
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
35
|
+
so, subject to the following conditions:
|
36
|
+
|
37
|
+
The above copyright notice and this permission notice shall be included in all
|
38
|
+
copies or substantial portions of the Software.
|
39
|
+
|
40
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
41
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
42
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
43
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
44
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
45
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
46
|
+
SOFTWARE.
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Putio < OmniAuth::Strategies::OAuth2
|
6
|
+
|
7
|
+
option :name, "putio"
|
8
|
+
|
9
|
+
option :client_options, {
|
10
|
+
:site => "https://api.put.io/v2/",
|
11
|
+
:authorize_url => '/v2/oauth2/authenticate',
|
12
|
+
:token_url => '/v2/oauth2/access_token',
|
13
|
+
:token_method => :get
|
14
|
+
}
|
15
|
+
|
16
|
+
option :provider_ignores_state, true
|
17
|
+
|
18
|
+
# The user name is the display name ("how people will see you when you
|
19
|
+
# share stuff") and can be modified.
|
20
|
+
# I think it's more likely to change than the email address.
|
21
|
+
|
22
|
+
uid { raw_info['mail'] }
|
23
|
+
|
24
|
+
info do
|
25
|
+
{
|
26
|
+
:name => raw_info['username'],
|
27
|
+
:email => raw_info['mail']
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
extra do
|
33
|
+
{
|
34
|
+
:raw_info => raw_info
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
def raw_info
|
39
|
+
access_token.options[:mode] = :query
|
40
|
+
access_token.options[:param_name] = 'oauth_token'
|
41
|
+
|
42
|
+
@raw_info ||= access_token.get('/v2/account/info').parsed['info']
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/omniauth-putio/version', __FILE__)
|
3
|
+
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = "omniauth-putio"
|
7
|
+
gem.version = OmniAuth::Putio::VERSION
|
8
|
+
gem.authors = ["Dimiter Petrov"]
|
9
|
+
gem.email = ["crackofdusk@gmail.com"]
|
10
|
+
gem.homepage = "https://github.com/jamiew/omniauth-youtube"
|
11
|
+
gem.description = %q{OmniAuth strategy for the Put.io v2 API}
|
12
|
+
gem.summary = gem.description
|
13
|
+
|
14
|
+
gem.files = `git ls-files`.split("\n")
|
15
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
gem.require_paths = ["lib"]
|
18
|
+
|
19
|
+
gem.add_runtime_dependency 'omniauth-oauth2', '~> 1.1.1'
|
20
|
+
|
21
|
+
gem.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if gem.respond_to? :required_rubygems_version=
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-putio
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Dimiter Petrov
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-02-26 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: omniauth-oauth2
|
16
|
+
requirement: &16808940 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.1.1
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *16808940
|
25
|
+
description: OmniAuth strategy for the Put.io v2 API
|
26
|
+
email:
|
27
|
+
- crackofdusk@gmail.com
|
28
|
+
executables: []
|
29
|
+
extensions: []
|
30
|
+
extra_rdoc_files: []
|
31
|
+
files:
|
32
|
+
- .gitignore
|
33
|
+
- Gemfile
|
34
|
+
- Gemfile.lock
|
35
|
+
- README.md
|
36
|
+
- lib/omniauth-putio.rb
|
37
|
+
- lib/omniauth-putio/version.rb
|
38
|
+
- lib/omniauth/strategies/putio.rb
|
39
|
+
- omniauth-putio.gemspec
|
40
|
+
homepage: https://github.com/jamiew/omniauth-youtube
|
41
|
+
licenses: []
|
42
|
+
post_install_message:
|
43
|
+
rdoc_options: []
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ! '>='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: 1.3.6
|
58
|
+
requirements: []
|
59
|
+
rubyforge_project:
|
60
|
+
rubygems_version: 1.8.10
|
61
|
+
signing_key:
|
62
|
+
specification_version: 3
|
63
|
+
summary: OmniAuth strategy for the Put.io v2 API
|
64
|
+
test_files: []
|