omniauth-dailymile 1.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: 1578b073ff6a22f3823d2affd59d0e790e811eac
4
+ data.tar.gz: a50f5485a5cefc8f785a109eeb52cf3970904ac4
5
+ SHA512:
6
+ metadata.gz: cfe7964e8c6e897d4d9246855c932c9536bc51f4765331b2dca030aac6d41c85de10733286628050102b075675d1a1b0461c48965fb22e60da44d6617a30c1c2
7
+ data.tar.gz: 4004464de88c5a06420c9cbe00a66d46b2b2dc2dcfc37e9738cd7cd18df68de24519810bb747e0083fc86b8dc0ae0f5045208d02fbd8dcc4e5f2623c5d703694
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/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth-dailymile.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-dailymile.gemspec')
10
+ end
data/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # OmniAuth DailyMile
2
+
3
+ This is the OmniAuth strategy for authenticating to the DailyMile site. To
4
+ use it, you'll need to sign up for an OAuth2 Application ID and Secret
5
+ on the [DailyMile Applications Page](http://www.dailymile.com/api/consumers/new).
6
+
7
+ ## Basic Usage
8
+
9
+ use OmniAuth::Builder do
10
+ provider :dailymile, ENV['DAILYMILE_KEY'], ENV['DAILYMILE_SECRET']
11
+ end
12
+
13
+ ## License
14
+
15
+ Copyright (c) 2012 Henk van der Veen, inteleme.com
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,44 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class DailyMile < OmniAuth::Strategies::OAuth2
6
+ option :client_options, {
7
+ :site => 'https://api.dailymile.com',
8
+ :authorize_url => 'https://api.dailymile.com/oauth/authorize',
9
+ :token_url => 'https://api.dailymile.com/oauth/token'
10
+ }
11
+
12
+ def request_phase
13
+ super
14
+ end
15
+
16
+ uid { raw_info['username'] }
17
+
18
+ info do
19
+ {
20
+ 'nickname' => raw_info['username'],
21
+ 'name' => raw_info['display_name'],
22
+ 'image' => raw_info['photo_url'],
23
+ 'urls' => {
24
+ 'DailyMile' => raw_info['url']
25
+ },
26
+ 'timezone' => raw_info['time_zone']
27
+ }
28
+ end
29
+
30
+ extra do
31
+ {:raw_info => raw_info}
32
+ end
33
+
34
+ def raw_info
35
+ # set these here instead of using 'option token_params' since omniauth-oath2 is passing those incorrectly
36
+ access_token.options[:param_name] = 'oauth_token'
37
+ access_token.options[:mode] = :query
38
+ @raw_info = JSON.parse access_token.get('/people/me.json').body
39
+ end
40
+ end
41
+ end
42
+ end
43
+
44
+ OmniAuth.config.add_camelization 'dailymile', 'DailyMile'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module DailyMile
3
+ VERSION = "1.0.1"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require "omniauth-dailymile/version"
2
+ require 'omniauth/strategies/dailymile'
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/omniauth-dailymile/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Henk van der Veen"]
6
+ gem.email = ["henk@vanderveen.name"]
7
+ gem.description = %q{OmniAuth strategy for DailyMile.}
8
+ gem.summary = %q{OmniAuth strategy for DailyMile.}
9
+ gem.homepage = "https://github.com/hampei/omniauth-dailymile"
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-dailymile"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = OmniAuth::DailyMile::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
+ gem.add_development_dependency 'webmock'
26
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe OmniAuth::Strategies::DailyMile do
4
+ subject do
5
+ OmniAuth::Strategies::DailyMile.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.dailymile.com")
11
+ end
12
+
13
+ it 'should have correct authorize url' do
14
+ subject.options.client_options.authorize_url.should eq('https://api.dailymile.com/oauth/authorize')
15
+ end
16
+
17
+ it 'should have correct token url' do
18
+ subject.options.client_options.token_url.should eq('https://api.dailymile.com/oauth/token')
19
+ end
20
+ end
21
+ 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-dailymile'
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,155 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-dailymile
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Henk van der Veen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-19 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
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: OmniAuth strategy for DailyMile.
112
+ email:
113
+ - henk@vanderveen.name
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - .gitignore
119
+ - .rspec
120
+ - Gemfile
121
+ - Guardfile
122
+ - README.md
123
+ - Rakefile
124
+ - lib/omniauth-dailymile.rb
125
+ - lib/omniauth-dailymile/version.rb
126
+ - lib/omniauth/strategies/dailymile.rb
127
+ - omniauth-dailymile.gemspec
128
+ - spec/omniauth/strategies/dailymile_spec.rb
129
+ - spec/spec_helper.rb
130
+ homepage: https://github.com/hampei/omniauth-dailymile
131
+ licenses: []
132
+ metadata: {}
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - '>='
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubyforge_project:
149
+ rubygems_version: 2.0.3
150
+ signing_key:
151
+ specification_version: 4
152
+ summary: OmniAuth strategy for DailyMile.
153
+ test_files:
154
+ - spec/omniauth/strategies/dailymile_spec.rb
155
+ - spec/spec_helper.rb