omniauth-svpply 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -0
- data/.travis.yml +8 -0
- data/Gemfile +5 -0
- data/README.md +45 -0
- data/Rakefile +7 -0
- data/lib/omniauth-svpply.rb +1 -0
- data/lib/omniauth/strategies/svpply.rb +34 -0
- data/lib/omniauth/svpply.rb +2 -0
- data/lib/omniauth/svpply/version.rb +5 -0
- data/omniauth-svpply.gemspec +24 -0
- metadata +120 -0
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# Omniauth::Svpply
|
2
|
+
|
3
|
+
This gem is an OmniAuth 2.0 Strategy for the [Svpply API](https://developers.svpply.com)
|
4
|
+
|
5
|
+
It supports the OmniAuth REST API which uses OAuth 2.0
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'omniauth-svpply'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install omniauth-svpply
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Then integrate the strategy into your middleware:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
use OmniAuth::Builder do
|
27
|
+
provider :svpply, ENV['CC_KEY'], ENV['CC_SECRET']
|
28
|
+
end
|
29
|
+
```
|
30
|
+
|
31
|
+
In Rails, you'll want to add to the middleware stack:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
35
|
+
provider :svpply, ENV['CC_KEY'], ENV['CC_SECRET']
|
36
|
+
end
|
37
|
+
```
|
38
|
+
|
39
|
+
You will have to put in your consumer key and secret, which you can find at http://developers.svpply.com
|
40
|
+
|
41
|
+
For additional information, refer to the [OmniAuth wiki](https://github.com/intridea/omniauth/wiki).
|
42
|
+
|
43
|
+
## License
|
44
|
+
|
45
|
+
This source code released under an MIT license.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'omniauth/svpply'
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Svpply < OmniAuth::Strategies::OAuth2
|
6
|
+
option :name, 'svpply'
|
7
|
+
|
8
|
+
option :client_options, {
|
9
|
+
:site => 'https://api.svpply.com',
|
10
|
+
:authorize_url => 'https://svpply.com/oauth',
|
11
|
+
:token_url => 'https://svpply.com/oauth/access_token',
|
12
|
+
:token_method => :get,
|
13
|
+
}
|
14
|
+
|
15
|
+
uid { raw_info['user']['id'] }
|
16
|
+
|
17
|
+
info do
|
18
|
+
{
|
19
|
+
:name => raw_info['user']['display_name'],
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
extra do
|
24
|
+
{ :raw_info => raw_info }
|
25
|
+
end
|
26
|
+
|
27
|
+
def raw_info
|
28
|
+
access_token.options[:param_name] = 'access_token'
|
29
|
+
access_token.options[:mode] = :query
|
30
|
+
@raw_info ||= JSON.parse(access_token.get('/v1/users/me.json').body)['response']
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'omniauth/svpply/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'omniauth-svpply'
|
7
|
+
s.description = 'OmniAuth strategy for Svpply'
|
8
|
+
s.version = OmniAuth::Svpply::VERSION
|
9
|
+
s.authors = ['Guille Lopez', 'Jud Stephenson']
|
10
|
+
s.email = ['support@svpply.com']
|
11
|
+
s.summary = 'Svpply strategy for OmniAuth'
|
12
|
+
s.homepage = 'https://github.com/svpply/omniauth-svpply'
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
17
|
+
s.require_paths = ['lib']
|
18
|
+
|
19
|
+
s.add_runtime_dependency 'omniauth-oauth2', '~> 1.1'
|
20
|
+
|
21
|
+
s.add_development_dependency 'minitest'
|
22
|
+
s.add_development_dependency 'mocha'
|
23
|
+
s.add_development_dependency 'rake'
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-svpply
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Guille Lopez
|
9
|
+
- Jud Stephenson
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2012-09-24 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: omniauth-oauth2
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '1.1'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '1.1'
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: minitest
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
type: :development
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: mocha
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: rake
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
type: :development
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
description: OmniAuth strategy for Svpply
|
80
|
+
email:
|
81
|
+
- support@svpply.com
|
82
|
+
executables: []
|
83
|
+
extensions: []
|
84
|
+
extra_rdoc_files: []
|
85
|
+
files:
|
86
|
+
- .gitignore
|
87
|
+
- .travis.yml
|
88
|
+
- Gemfile
|
89
|
+
- README.md
|
90
|
+
- Rakefile
|
91
|
+
- lib/omniauth-svpply.rb
|
92
|
+
- lib/omniauth/strategies/svpply.rb
|
93
|
+
- lib/omniauth/svpply.rb
|
94
|
+
- lib/omniauth/svpply/version.rb
|
95
|
+
- omniauth-svpply.gemspec
|
96
|
+
homepage: https://github.com/svpply/omniauth-svpply
|
97
|
+
licenses: []
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options: []
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
104
|
+
requirements:
|
105
|
+
- - ! '>='
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
110
|
+
requirements:
|
111
|
+
- - ! '>='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
requirements: []
|
115
|
+
rubyforge_project:
|
116
|
+
rubygems_version: 1.8.24
|
117
|
+
signing_key:
|
118
|
+
specification_version: 3
|
119
|
+
summary: Svpply strategy for OmniAuth
|
120
|
+
test_files: []
|