omniauth-runkeeper 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in omniauth-runkeeper.gemspec
4
+ gemspec
data/README.markdown ADDED
@@ -0,0 +1,15 @@
1
+ # OmniAuth RunKeeper
2
+
3
+ This is the OmniAuth strategy for authenticating to RunKeeper. To use it,
4
+ you'll need to sign up for an OAuth2 Application ID and Secret on the
5
+ [RunKeeper Applications Page](http://runkeeper.com/partner/applications/registerForm).
6
+
7
+ ## Basic Usage
8
+
9
+ use OmniAuth::Builder do
10
+ provider :runkeeper, ENV['RUNKEEPER_CLIENT_ID'], ENV['RUNKEEPER_CLIENT_SECRET']
11
+ end
12
+
13
+ ## License
14
+
15
+ OmniAuth RunKeeper is released under the MIT license.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,42 @@
1
+ require 'omniauth-oauth2'
2
+ require 'multi_json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class RunKeeper < OmniAuth::Strategies::OAuth2
7
+ option :client_options, {
8
+ :site => 'http://api.runkeeper.com',
9
+ :authorize_url => 'https://runkeeper.com/apps/authorize',
10
+ :token_url => 'https://runkeeper.com/apps/token'
11
+ }
12
+
13
+ uid { raw_info['userID'] }
14
+
15
+ info do
16
+ name = raw_info['name'].to_s
17
+ username = raw_info['profile'][/[^\/]+$/]
18
+ {
19
+ 'name' => name.empty? ? username : name,
20
+ 'nickname' => username,
21
+ 'location' => raw_info['location'],
22
+ 'image' => raw_info['small_picture'],
23
+ 'urls' => { 'RunKeeper' => raw_info['profile'] },
24
+ }
25
+ end
26
+
27
+ extra do
28
+ { :raw_info => raw_info }
29
+ end
30
+
31
+ def raw_info
32
+ @raw_info ||= begin
33
+ user = MultiJson.decode(access_token.get('/user').body)
34
+ profile = MultiJson.decode(access_token.get(user['profile']).body)
35
+ { 'userID' => user['userID'] }.merge(profile)
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+
42
+ OmniAuth.config.add_camelization 'runkeeper', 'RunKeeper'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module RunKeeper
3
+ VERSION = '1.0.0'
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require 'omniauth-runkeeper/version'
2
+ require 'omniauth/strategies/runkeeper'
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "omniauth-runkeeper/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "omniauth-runkeeper"
7
+ s.version = OmniAuth::RunKeeper::VERSION
8
+ s.authors = ["Masaki Ishihara"]
9
+ s.email = ["m.ishihara@gmail.com"]
10
+ s.homepage = "https://github.com/m4i/omniauth-runkeeper"
11
+ s.summary = %q{OmniAuth strategy for RunKeeper}
12
+ s.description = s.summary
13
+
14
+ s.rubyforge_project = "omniauth-runkeeper"
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_runtime_dependency 'multi_json', '~> 1.0.4'
23
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-runkeeper
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Masaki Ishihara
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-12-21 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: omniauth-oauth2
16
+ requirement: &14180360 !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: *14180360
25
+ - !ruby/object:Gem::Dependency
26
+ name: multi_json
27
+ requirement: &13462420 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 1.0.4
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *13462420
36
+ description: OmniAuth strategy for RunKeeper
37
+ email:
38
+ - m.ishihara@gmail.com
39
+ executables: []
40
+ extensions: []
41
+ extra_rdoc_files: []
42
+ files:
43
+ - .gitignore
44
+ - Gemfile
45
+ - README.markdown
46
+ - Rakefile
47
+ - lib/omniauth-runkeeper.rb
48
+ - lib/omniauth-runkeeper/version.rb
49
+ - lib/omniauth/strategies/runkeeper.rb
50
+ - omniauth-runkeeper.gemspec
51
+ homepage: https://github.com/m4i/omniauth-runkeeper
52
+ licenses: []
53
+ post_install_message:
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ requirements: []
70
+ rubyforge_project: omniauth-runkeeper
71
+ rubygems_version: 1.8.10
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: OmniAuth strategy for RunKeeper
75
+ test_files: []