omniauth-pachube 0.0.1
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 +6 -0
- data/.rbenv-version +1 -0
- data/Gemfile +4 -0
- data/README.md +3 -0
- data/Rakefile +11 -0
- data/lib/omniauth-pachube.rb +2 -0
- data/lib/omniauth-pachube/version.rb +5 -0
- data/lib/omniauth/strategies/pachube.rb +14 -0
- data/omniauth-pachube.gemspec +26 -0
- data/spec/omniauth/strategies/pachube_spec.rb +41 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/support/shared_examples.rb +37 -0
- metadata +121 -0
data/.gitignore
ADDED
data/.rbenv-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.2-p290
|
data/Gemfile
ADDED
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Pachube < OmniAuth::Strategies::OAuth2
|
6
|
+
option :client_options, {
|
7
|
+
:site => 'https://pachube.com',
|
8
|
+
:http_method => :get,
|
9
|
+
:authorize_url => "/oauth/authenticate"
|
10
|
+
}
|
11
|
+
option :skip_info, true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "omniauth-pachube/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "omniauth-pachube"
|
7
|
+
s.version = OmniAuth::Pachube::VERSION
|
8
|
+
s.authors = ["Levent Ali"]
|
9
|
+
s.email = ["lebreeze@gmail.com"]
|
10
|
+
s.homepage = "https://github.com/levent/omniauth-pachube"
|
11
|
+
s.summary = %q{OmniAuth2 strategy for Pachube}
|
12
|
+
s.description = %q{OmniAuth2 strategy for Pachube}
|
13
|
+
|
14
|
+
s.rubyforge_project = "omniauth-pachube"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_runtime_dependency 'omniauth-oauth2', '~> 1.0'
|
22
|
+
s.add_development_dependency 'rspec', '~> 2.7'
|
23
|
+
s.add_development_dependency 'rack-test'
|
24
|
+
s.add_development_dependency 'simplecov'
|
25
|
+
s.add_development_dependency 'webmock'
|
26
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'omniauth-pachube'
|
3
|
+
|
4
|
+
describe OmniAuth::Strategies::Pachube do
|
5
|
+
before :each do
|
6
|
+
@request = double('Request')
|
7
|
+
@request.stub(:params) { {} }
|
8
|
+
end
|
9
|
+
|
10
|
+
subject do
|
11
|
+
OmniAuth::Strategies::Pachube.new(nil, @options || {}).tap do |strategy|
|
12
|
+
strategy.stub(:request) { @request }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it_should_behave_like 'an oauth2 strategy'
|
17
|
+
|
18
|
+
describe '#client' do
|
19
|
+
it 'has correct Pachube site' do
|
20
|
+
subject.client.site.should eq('https://pachube.com')
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'has correct authorize url' do
|
24
|
+
subject.client.options[:authorize_url].should eq('/oauth/authenticate')
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'has correct token url' do
|
28
|
+
subject.client.options[:token_url].should eq('/oauth/token')
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'has correct http_method' do
|
32
|
+
subject.client.options[:http_method].should eq(:get)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe '#skip_info' do
|
37
|
+
it 'should be true' do
|
38
|
+
subject.should be_skip_info
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# NOTE it would be useful if this lived in omniauth-oauth2 eventually
|
2
|
+
shared_examples 'an oauth2 strategy' do
|
3
|
+
describe '#client' do
|
4
|
+
it 'should be initialized with symbolized client_options' do
|
5
|
+
@options = { :client_options => { 'authorize_url' => 'https://example.com' } }
|
6
|
+
subject.client.options[:authorize_url].should == 'https://example.com'
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#authorize_params' do
|
11
|
+
it 'should include any authorize params passed in the :authorize_params option' do
|
12
|
+
@options = { :authorize_params => { :foo => 'bar', :baz => 'zip' } }
|
13
|
+
subject.authorize_params['foo'].should eq('bar')
|
14
|
+
subject.authorize_params['baz'].should eq('zip')
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should include top-level options that are marked as :authorize_options' do
|
18
|
+
@options = { :authorize_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
|
19
|
+
subject.authorize_params['scope'].should eq('bar')
|
20
|
+
subject.authorize_params['foo'].should eq('baz')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#token_params' do
|
25
|
+
it 'should include any authorize params passed in the :authorize_params option' do
|
26
|
+
@options = { :token_params => { :foo => 'bar', :baz => 'zip' } }
|
27
|
+
subject.token_params['foo'].should eq('bar')
|
28
|
+
subject.token_params['baz'].should eq('zip')
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should include top-level options that are marked as :authorize_options' do
|
32
|
+
@options = { :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
|
33
|
+
subject.token_params['scope'].should eq('bar')
|
34
|
+
subject.token_params['foo'].should eq('baz')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-pachube
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Levent Ali
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-01-09 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: omniauth-oauth2
|
16
|
+
requirement: &70200059223940 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70200059223940
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rspec
|
27
|
+
requirement: &70200059223120 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.7'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70200059223120
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rack-test
|
38
|
+
requirement: &70200059222560 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70200059222560
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: simplecov
|
49
|
+
requirement: &70200059221820 !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: *70200059221820
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: webmock
|
60
|
+
requirement: &70200059221100 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70200059221100
|
69
|
+
description: OmniAuth2 strategy for Pachube
|
70
|
+
email:
|
71
|
+
- lebreeze@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- .rbenv-version
|
78
|
+
- Gemfile
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- lib/omniauth-pachube.rb
|
82
|
+
- lib/omniauth-pachube/version.rb
|
83
|
+
- lib/omniauth/strategies/pachube.rb
|
84
|
+
- omniauth-pachube.gemspec
|
85
|
+
- spec/omniauth/strategies/pachube_spec.rb
|
86
|
+
- spec/spec_helper.rb
|
87
|
+
- spec/support/shared_examples.rb
|
88
|
+
homepage: https://github.com/levent/omniauth-pachube
|
89
|
+
licenses: []
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ! '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
segments:
|
101
|
+
- 0
|
102
|
+
hash: -716608865406707020
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
105
|
+
requirements:
|
106
|
+
- - ! '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
segments:
|
110
|
+
- 0
|
111
|
+
hash: -716608865406707020
|
112
|
+
requirements: []
|
113
|
+
rubyforge_project: omniauth-pachube
|
114
|
+
rubygems_version: 1.8.10
|
115
|
+
signing_key:
|
116
|
+
specification_version: 3
|
117
|
+
summary: OmniAuth2 strategy for Pachube
|
118
|
+
test_files:
|
119
|
+
- spec/omniauth/strategies/pachube_spec.rb
|
120
|
+
- spec/spec_helper.rb
|
121
|
+
- spec/support/shared_examples.rb
|