omniauth-moves 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b4924f529edba06f4dabe34afb080dc9c8dad025
4
+ data.tar.gz: b6fad1b104d00c0d3348d8c2499ac97f3749b90b
5
+ SHA512:
6
+ metadata.gz: e111f9fa0fa0abe5c6558044602bd02790692ea56353bc2602897e6488dd96ecbda67dba94e3591b9bd517f4b7e2a6da1dac1f6836799b9274c550fd84a12c2b
7
+ data.tar.gz: 869508de64fd3e4207c7758f2d226df24547267d106e3367ac4853388b2b7b3abf7e8f32b95a068efee4b93bfa5701c5d9f3c604c41e4616896fe7bef32129c9
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ /coverage/
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth-moves.gemspec
4
+ gemspec
5
+
6
+ group :development, :test do
7
+ gem 'guard'
8
+ gem 'guard-rspec'
9
+ gem 'guard-bundler'
10
+ gem 'rb-fsevent'
11
+ gem 'growl'
12
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,94 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-moves (0.0.1)
5
+ multi_json (~> 1.0)
6
+ omniauth (~> 1.0)
7
+ omniauth-oauth2 (~> 1.0)
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ coderay (1.0.9)
13
+ diff-lcs (1.2.4)
14
+ faraday (0.8.7)
15
+ multipart-post (~> 1.1)
16
+ ffi (1.8.1)
17
+ formatador (0.2.4)
18
+ growl (1.0.3)
19
+ guard (1.8.0)
20
+ formatador (>= 0.2.4)
21
+ listen (>= 1.0.0)
22
+ lumberjack (>= 1.0.2)
23
+ pry (>= 0.9.10)
24
+ thor (>= 0.14.6)
25
+ guard-bundler (1.0.0)
26
+ bundler (~> 1.0)
27
+ guard (~> 1.1)
28
+ guard-rspec (3.0.1)
29
+ guard (>= 1.8)
30
+ rspec (~> 2.13)
31
+ hashie (2.0.5)
32
+ httpauth (0.2.0)
33
+ jwt (0.1.8)
34
+ multi_json (>= 1.5)
35
+ listen (1.1.5)
36
+ rb-fsevent (>= 0.9.3)
37
+ rb-inotify (>= 0.9)
38
+ rb-kqueue (>= 0.2)
39
+ lumberjack (1.0.3)
40
+ method_source (0.8.1)
41
+ multi_json (1.7.6)
42
+ multipart-post (1.2.0)
43
+ oauth2 (0.8.1)
44
+ faraday (~> 0.8)
45
+ httpauth (~> 0.1)
46
+ jwt (~> 0.1.4)
47
+ multi_json (~> 1.0)
48
+ rack (~> 1.2)
49
+ omniauth (1.1.4)
50
+ hashie (>= 1.2, < 3)
51
+ rack
52
+ omniauth-oauth2 (1.1.1)
53
+ oauth2 (~> 0.8.0)
54
+ omniauth (~> 1.0)
55
+ pry (0.9.12.2)
56
+ coderay (~> 1.0.5)
57
+ method_source (~> 0.8)
58
+ slop (~> 3.4)
59
+ rack (1.5.2)
60
+ rack-test (0.6.2)
61
+ rack (>= 1.0)
62
+ rb-fsevent (0.9.3)
63
+ rb-inotify (0.9.0)
64
+ ffi (>= 0.5.0)
65
+ rb-kqueue (0.2.0)
66
+ ffi (>= 0.5.0)
67
+ rspec (2.13.0)
68
+ rspec-core (~> 2.13.0)
69
+ rspec-expectations (~> 2.13.0)
70
+ rspec-mocks (~> 2.13.0)
71
+ rspec-core (2.13.1)
72
+ rspec-expectations (2.13.0)
73
+ diff-lcs (>= 1.1.3, < 2.0)
74
+ rspec-mocks (2.13.1)
75
+ simplecov (0.7.1)
76
+ multi_json (~> 1.0)
77
+ simplecov-html (~> 0.7.1)
78
+ simplecov-html (0.7.1)
79
+ slop (3.4.5)
80
+ thor (0.18.1)
81
+
82
+ PLATFORMS
83
+ ruby
84
+
85
+ DEPENDENCIES
86
+ growl
87
+ guard
88
+ guard-bundler
89
+ guard-rspec
90
+ omniauth-moves!
91
+ rack-test
92
+ rb-fsevent
93
+ rspec (~> 2.7)
94
+ simplecov
data/Guardfile ADDED
@@ -0,0 +1,10 @@
1
+ guard 'rspec', :version => 2 do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
4
+ watch('spec/spec_helper.rb') { "spec" }
5
+ end
6
+
7
+ guard 'bundler' do
8
+ watch('Gemfile')
9
+ watch('omniauth-moves.gemspec')
10
+ end
data/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # OmniAuth Moves
2
+
3
+ This is the OmniAuth strategy for authenticating to the Moves site. To
4
+ use it, you'll need to sign up for an OAuth2 Application ID and Secret
5
+ on the [Moves Site](https://dev.moves-app.com/).
6
+
7
+ ## Basic Usage
8
+
9
+ use OmniAuth::Builder do
10
+ provider :moves, ENV['MOVES_KEY'], ENV['MOVES_SECRET']
11
+ end
12
+
13
+ ## License
14
+
15
+ Copyright (c) 2013 Nick Elser
16
+ Based on https://github.com/intridea/omniauth-github (Copyright (c) 2011 Michael Bleigh and Intridea, Inc.)
17
+
18
+ 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:
19
+
20
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
21
+
22
+ 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,12 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require 'rspec/core/rake_task'
4
+
5
+ desc 'Default: run specs.'
6
+ task :default => :spec
7
+
8
+ desc "Run specs"
9
+ RSpec::Core::RakeTask.new
10
+
11
+ desc 'Run specs'
12
+ task :default => :spec
@@ -0,0 +1,38 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Moves < OmniAuth::Strategies::OAuth2
6
+ DEFAULT_SCOPE = 'default'
7
+
8
+ option :client_options, {
9
+ :site => 'https://api.moves-app.com/',
10
+ :authorize_url => '/oauth/v1/authorize',
11
+ :token_url => '/oauth/v1/access_token'
12
+ }
13
+
14
+ uid { raw_info['userId'] }
15
+ info do { :firstDate => (raw_info['profile'] || {})['firstDate'] } end
16
+ extra do { :raw_info => raw_info } end
17
+
18
+ def request_phase
19
+ options[:authorize_params] = client_params.merge(options[:authorize_params])
20
+ super
21
+ end
22
+
23
+ def auth_hash
24
+ OmniAuth::Utils.deep_merge(super, client_params.merge({:grant_type => 'authorization_code'}))
25
+ end
26
+
27
+ def raw_info
28
+ @raw_info ||= access_token.get('https://api.moves-app.com/api/v1/user/profile').parsed
29
+ end
30
+
31
+ private
32
+
33
+ def client_params
34
+ {:client_id => options[:client_id], :redirect_uri => callback_url ,:response_type => "code", :scope => DEFAULT_SCOPE}
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Moves
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require 'omniauth-moves/version'
2
+ require 'omniauth/strategies/moves'
Binary file
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/omniauth-moves/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Nick Elser"]
6
+ gem.email = ["nick.elser@gmail.com"]
7
+ gem.description = %q{OmniAuth strategy for Moves.}
8
+ gem.summary = %q{OmniAuth strategy for Moves.}
9
+ gem.homepage = "https://github.com/nickelser/omniauth-moves"
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-moves"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = OmniAuth::Moves::VERSION
17
+
18
+ gem.add_dependency 'omniauth', '~> 1.0'
19
+ gem.add_dependency 'omniauth-oauth2', '~> 1.0'
20
+ gem.add_dependency 'multi_json', '~> 1.0'
21
+
22
+ gem.add_development_dependency 'rspec', '~> 2.7'
23
+ gem.add_development_dependency 'rack-test'
24
+ gem.add_development_dependency 'simplecov'
25
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe OmniAuth::Strategies::Moves do
4
+ subject do
5
+ OmniAuth::Strategies::Moves.new({})
6
+ end
7
+
8
+ context "client options" do
9
+ it 'should have correct site' do
10
+ subject.options.client_options.site.should eq('https://api.moves-app.com/')
11
+ end
12
+
13
+ it 'should have correct authorize url' do
14
+ subject.options.client_options.authorize_url.should eq('/oauth/v1/authorize')
15
+ end
16
+
17
+ it 'should have correct token url' do
18
+ subject.options.client_options.token_url.should eq('/oauth/v1/access_token')
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,14 @@
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 'omniauth'
8
+ require 'omniauth-moves'
9
+
10
+ RSpec.configure do |config|
11
+ config.include Rack::Test::Methods
12
+ config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
13
+ end
14
+
metadata ADDED
@@ -0,0 +1,142 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-moves
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Nick Elser
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-06-04 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.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: multi_json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '2.7'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '2.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rack-test
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: simplecov
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 Moves.
98
+ email:
99
+ - nick.elser@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - .gitignore
105
+ - Gemfile
106
+ - Gemfile.lock
107
+ - Guardfile
108
+ - README.md
109
+ - Rakefile
110
+ - lib/omniauth-moves.rb
111
+ - lib/omniauth-moves/version.rb
112
+ - lib/omniauth/strategies/moves.rb
113
+ - omniauth-moves-0.0.1.gem
114
+ - omniauth-moves.gemspec
115
+ - spec/omniauth/strategies/moves_spec.rb
116
+ - spec/spec_helper.rb
117
+ homepage: https://github.com/nickelser/omniauth-moves
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.2
137
+ signing_key:
138
+ specification_version: 4
139
+ summary: OmniAuth strategy for Moves.
140
+ test_files:
141
+ - spec/omniauth/strategies/moves_spec.rb
142
+ - spec/spec_helper.rb