omniauth-resourceguru 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.travis.yaml +14 -0
- data/Gemfile +12 -0
- data/Guardfile +10 -0
- data/LICENSE +0 -0
- data/README.md +25 -0
- data/Rakefile +8 -0
- data/lib/omniauth-resourceguru.rb +2 -0
- data/lib/omniauth-resourceguru/version.rb +5 -0
- data/lib/omniauth/strategies/resourceguru.rb +40 -0
- data/omniauth-resourceguru.gemspec +24 -0
- data/spec/omniauth/strategies/resourceguru_spec.rb +43 -0
- data/spec/spec_helper.rb +16 -0
- metadata +142 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fbce7496438b45f188f63186863057ed554ed128
|
4
|
+
data.tar.gz: 620ea3714a7ec13d41235a285a621ae2dd447ecf
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4387e3c6e532b8206f5d0bbf42f1fe7a15834f0f0413e66c9fc241d018b96f0b1a5f3611e88022d6159775cc4173418dadd116fea22c3548af0148b44583c9af
|
7
|
+
data.tar.gz: ecabc278c834af1b12a61a99fd0002fbf18de759ba82709e3e8913342514b4e6f4237896168735bd79a8ab4279956c725d0e4cd7e7fc0983f9978e4651f16222
|
data/.gitignore
ADDED
data/.travis.yaml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
data/LICENSE
ADDED
File without changes
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# OmniAuth strategy for ResourceGuruApp
|
2
|
+
|
3
|
+
[![CI Build Status](https://secure.travis-ci.org/kamerblauwlicht/omniauth-resourceguru.png?branch=master)][travis]
|
4
|
+
[![Code Climate](https://codeclimate.com/github/kamerblauwlicht/omniauth-resourceguru)][codeclimate]
|
5
|
+
|
6
|
+
[travis]: http://travis-ci.org/kamerblauwlicht/omniauth-resourceguru
|
7
|
+
[codeclimate]: https://codeclimate.com/github/kamerblauwlicht/omniauth-resourceguru
|
8
|
+
|
9
|
+
|
10
|
+
## Basic Usage
|
11
|
+
|
12
|
+
use OmniAuth::Builder do
|
13
|
+
provider :resource_guru, ENV['RESOURCE_GURU_CLIENT_ID'], ENV['RESOURCE_GURU_SECRET']
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
## License
|
18
|
+
|
19
|
+
Copyright (c) 2013 Daniël van Gils and Steam Advertising B.V.
|
20
|
+
|
21
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
22
|
+
|
23
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
24
|
+
|
25
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class ResourceGuru < OmniAuth::Strategies::OAuth2
|
6
|
+
option :name, "resourceguru"
|
7
|
+
|
8
|
+
option :client_options, {
|
9
|
+
:site => 'https://api.resourceguruapp.com/v1',
|
10
|
+
:authorize_url => 'https://api.resourceguruapp.com/oauth/authorize',
|
11
|
+
:token_url => 'https://api.resourceguruapp.com/oauth/token'
|
12
|
+
}
|
13
|
+
|
14
|
+
uid { accounts[0]['id'].to_s }
|
15
|
+
|
16
|
+
info do
|
17
|
+
{
|
18
|
+
'nickname' => accounts[0]['login'],
|
19
|
+
'email' => 'none',
|
20
|
+
'name' => accounts[0]['name'],
|
21
|
+
'subdomain' => accounts[0]['subdomain'],
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
extra do
|
26
|
+
{:raw_info => accounts}
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
def accounts
|
32
|
+
access_token.options[:mode] = :query
|
33
|
+
@accounts ||= access_token.get('accounts').parsed
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
OmniAuth.config.add_camelization 'resourceguru', 'ResourceGuru'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/omniauth-resourceguru/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Daniel van Gils"]
|
6
|
+
gem.email = ["daniel@steam.nl"]
|
7
|
+
gem.description = %q{OmniAuth strategy for ResourceGuru.}
|
8
|
+
gem.summary = %q{OmniAuth strategy for ResourceGuru.}
|
9
|
+
gem.homepage = "https://github.com/kamerblauwlicht/omniauth-resourceguru"
|
10
|
+
|
11
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
gem.name = "omniauth-resourceguru"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = OmniAuth::ResourceGuru::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency 'omniauth', '~> 1.0'
|
19
|
+
gem.add_dependency 'omniauth-oauth2', '~> 1.1'
|
20
|
+
gem.add_development_dependency 'rspec', '~> 2.7'
|
21
|
+
gem.add_development_dependency 'rack-test'
|
22
|
+
gem.add_development_dependency 'simplecov'
|
23
|
+
gem.add_development_dependency 'webmock'
|
24
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe OmniAuth::Strategies::ResourceGuru do
|
4
|
+
let(:access_token) { stub('AccessToken', :options => {}) }
|
5
|
+
let(:parsed_response) { stub('ParsedResponse') }
|
6
|
+
let(:response) { stub('Response', :parsed => parsed_response) }
|
7
|
+
|
8
|
+
|
9
|
+
subject do
|
10
|
+
OmniAuth::Strategies::ResourceGuru.new({})
|
11
|
+
end
|
12
|
+
|
13
|
+
before(:each) do
|
14
|
+
subject.stub(:access_token).and_return(access_token)
|
15
|
+
end
|
16
|
+
|
17
|
+
context "client options" do
|
18
|
+
it 'should have correct site' do
|
19
|
+
subject.options.client_options.site.should eq("https://api.resourceguruapp.com/v1")
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should have correct authorize url' do
|
23
|
+
subject.options.client_options.authorize_url.should eq('https://api.resourceguruapp.com/oauth/authorize')
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should have correct token url' do
|
27
|
+
subject.options.client_options.token_url.should eq('https://api.resourceguruapp.com/oauth/token')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
context "#accounts" do
|
33
|
+
it "should respond" do
|
34
|
+
access_token.should_receive(:get).with('accounts').and_return(response)
|
35
|
+
subject.accounts.should eq(parsed_response)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
#end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
$:.unshift File.expand_path('..', __FILE__)
|
2
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
require 'simplecov'
|
4
|
+
SimpleCov.start
|
5
|
+
require 'rspec'
|
6
|
+
require 'rack/test'
|
7
|
+
require 'webmock/rspec'
|
8
|
+
require 'omniauth'
|
9
|
+
require 'omniauth-resourceguru'
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.include WebMock::API
|
13
|
+
config.include Rack::Test::Methods
|
14
|
+
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
|
15
|
+
end
|
16
|
+
|
metadata
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-resourceguru
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel van Gils
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: omniauth
|
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: omniauth-oauth2
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rack-test
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: OmniAuth strategy for ResourceGuru.
|
98
|
+
email:
|
99
|
+
- daniel@steam.nl
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- .gitignore
|
105
|
+
- .travis.yaml
|
106
|
+
- Gemfile
|
107
|
+
- Guardfile
|
108
|
+
- LICENSE
|
109
|
+
- README.md
|
110
|
+
- Rakefile
|
111
|
+
- lib/omniauth-resourceguru.rb
|
112
|
+
- lib/omniauth-resourceguru/version.rb
|
113
|
+
- lib/omniauth/strategies/resourceguru.rb
|
114
|
+
- omniauth-resourceguru.gemspec
|
115
|
+
- spec/omniauth/strategies/resourceguru_spec.rb
|
116
|
+
- spec/spec_helper.rb
|
117
|
+
homepage: https://github.com/kamerblauwlicht/omniauth-resourceguru
|
118
|
+
licenses: []
|
119
|
+
metadata: {}
|
120
|
+
post_install_message:
|
121
|
+
rdoc_options: []
|
122
|
+
require_paths:
|
123
|
+
- lib
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
requirements: []
|
135
|
+
rubyforge_project:
|
136
|
+
rubygems_version: 2.0.3
|
137
|
+
signing_key:
|
138
|
+
specification_version: 4
|
139
|
+
summary: OmniAuth strategy for ResourceGuru.
|
140
|
+
test_files:
|
141
|
+
- spec/omniauth/strategies/resourceguru_spec.rb
|
142
|
+
- spec/spec_helper.rb
|