omniauth-nikeplus 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: fc94d60f9ac0dccbeeb29a7d0cd84c60c1e59e26
4
+ data.tar.gz: 69e3383479d7e5411ed5e0f3cb57d7085890c0ac
5
+ SHA512:
6
+ metadata.gz: 81426966346b3d10734aae135ace6a47a78e9ba943b8715fe15dad81e7378577940bbe5997c813cf3b9f037f5d0f0face9bcd00a4d56106a2d3717a4c0811e0a
7
+ data.tar.gz: d9484ef6d558820fbfeaa63c01b3faac38b03431535d344b91c5287a5d6eac22fda28d82cbe1cac8fbda02e8315d0b1b68de482cc4142abe81371cdd9610b283
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ /pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth-nikeplus.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/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-nikeplus.gemspec')
10
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Benny Wong
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # OmniAuth Nike
2
+
3
+ Updated 2014.04.04 to work with the officially released Nike+ API.
4
+
5
+ This is an OmniAuth strategy for authenticating to Nike+ Api. To
6
+ use it, you'll need to the Application ID and Secret from Nike+.
7
+
8
+ ## Basic Usage
9
+
10
+ use OmniAuth::Builder do
11
+ provider :nikeplus,
12
+ ENV['NIKEPLUS_CLIENT_ID'],
13
+ ENV['NIKEPLUS_CLIENT_SECRET']
14
+ end
15
+
16
+ ## Original License
17
+
18
+ Copyright (c) 2014 Benny Wong.
19
+
20
+ 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:
21
+
22
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
23
+
24
+ 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,50 @@
1
+ require 'cgi'
2
+ require 'uri'
3
+ require 'oauth2'
4
+ require 'omniauth'
5
+ require 'timeout'
6
+ require 'securerandom'
7
+ require 'omniauth-oauth2'
8
+
9
+ module OmniAuth
10
+ module Strategies
11
+ class Nikeplus < OmniAuth::Strategies::OAuth2
12
+
13
+ option :client_options, {
14
+ :site => 'https://api.nike.com',
15
+ :authorize_url => '/oauth/2.0/authorize',
16
+ :token_url => '/oauth/2.0/token'
17
+ }
18
+
19
+ option :authorize_params, {
20
+ :response_type => 'code'
21
+ }
22
+
23
+ # uid { raw_info['data']['xid'].to_s }
24
+ #
25
+ # info do
26
+ # {
27
+ # 'id' => raw_info['data']['xid'],
28
+ # 'photo' => raw_info['data']['image'],
29
+ # 'first_name' => raw_info['data']['first'],
30
+ # 'last_name' => raw_info['data']['last'],
31
+ # }
32
+ # end #
33
+ #
34
+ # def user_data
35
+ # access_token.options[:mode] = :query
36
+ # user_data ||= access_token.get('/nudge/api/users/@me').parsed
37
+ # end
38
+ #
39
+ # def raw_info
40
+ # @raw_info ||= MultiJson.load(access_token.get('/nudge/api/users/@me').body)
41
+ # rescue ::Errno::ETIMEDOUT
42
+ # raise ::Timeout::Error
43
+ # end
44
+
45
+ end
46
+ end
47
+ end
48
+
49
+
50
+ OmniAuth.config.add_camelization 'nikeplus', 'Nikeplus'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Nikeplus
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require "omniauth-nikeplus/version"
2
+ require "omniauth/strategies/nikeplus"
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/omniauth-nikeplus/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Benny Wong"]
6
+ gem.email = ["benny@gofitcause.com"]
7
+ gem.description = %q{OmniAuth 2.0 strategy for Nike Plus.}
8
+ gem.summary = %q{OmniAuth 2.0 strategy for Nike Plus.}
9
+ gem.homepage = "https://github.com/bennycwong/omniauth-nikeplus"
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-nikeplus"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = OmniAuth::Nikeplus::VERSION
17
+
18
+ gem.add_dependency 'omniauth', '~> 1.0'
19
+ gem.add_dependency 'omniauth-oauth2', '~> 1.0'
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,24 @@
1
+ require 'spec_helper'
2
+ require_relative '../../../lib/omniauth/strategies/nikeplus'
3
+
4
+ describe OmniAuth::Strategies::Nikeplus do
5
+
6
+ subject do
7
+ OmniAuth::Strategies::Nikeplus.new({})
8
+ end
9
+
10
+ context "client options" do
11
+ it "should have correct site" do
12
+ subject.options.client_options.site.should eq("https://api.nike.com")
13
+ end
14
+
15
+ it "should have correct authorize path" do
16
+ subject.options.client_options.authorize_url.should eq("/oauth/2.0/authorize")
17
+ end
18
+
19
+ it "should have the correct request token path" do
20
+ subject.options.client_options.token_url.should eq("/oauth/2.0/token")
21
+ end
22
+
23
+ end
24
+ end
@@ -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-nikeplus'
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,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-nikeplus
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Benny Wong
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-07 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: 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 2.0 strategy for Nike Plus.
98
+ email:
99
+ - benny@gofitcause.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - Gemfile
106
+ - Guardfile
107
+ - LICENSE.txt
108
+ - README.md
109
+ - Rakefile
110
+ - lib/omniauth-nikeplus.rb
111
+ - lib/omniauth-nikeplus/version.rb
112
+ - lib/omniauth/strategies/nikeplus.rb
113
+ - omniauth-nikeplus.gemspec
114
+ - spec/omniauth/strategies/nikeplus_spec.rb
115
+ - spec/spec_helper.rb
116
+ homepage: https://github.com/bennycwong/omniauth-nikeplus
117
+ licenses: []
118
+ metadata: {}
119
+ post_install_message:
120
+ rdoc_options: []
121
+ require_paths:
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubyforge_project:
135
+ rubygems_version: 2.2.1
136
+ signing_key:
137
+ specification_version: 4
138
+ summary: OmniAuth 2.0 strategy for Nike Plus.
139
+ test_files:
140
+ - spec/omniauth/strategies/nikeplus_spec.rb
141
+ - spec/spec_helper.rb