omniauth-mapmyfitness-oauth2 0.1.0
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.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.gitignore +17 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +20 -0
- data/README.md +46 -0
- data/Rakefile +1 -0
- data/VERSION +1 -0
- data/lib/omniauth-mapmyfitness-oauth2.rb +2 -0
- data/lib/omniauth-mapmyfitness-oauth2/version.rb +5 -0
- data/lib/omniauth/strategies/mapmyfitness.rb +52 -0
- data/omniauth-mapmyfitness-oauth2.gemspec +28 -0
- metadata +126 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1adbe1b10480660f1d3479ef8cbab69db46ac8f8
|
4
|
+
data.tar.gz: f597ab491059907662168fdbe0ea71d27044c323
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f43a10c9e81922e3da89ddf95c098dceb7f42c0229ebedff1f830c6a511e92f3d0c78e0e7412f05369b84966d4d0d90138fe53a1a500156f99a8bbe9cc57bfff
|
7
|
+
data.tar.gz: 2172a69c60a3078b6f2120943cec59fb970441309f089b65d1f9f54969caa9351ece77adac0e20507f1af36ae632c89e5f67fb907d57ce1a0d03b8d5f62922f3
|
data/.document
ADDED
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 Jeff Casimir
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# OmniAuth MapMyFitness OAuth2
|
2
|
+
|
3
|
+
This gem contains the MapMyFitness strategy for OmniAuth using OAuth2.
|
4
|
+
|
5
|
+
## Setup
|
6
|
+
|
7
|
+
### Install the Gem
|
8
|
+
|
9
|
+
Add the dependency to your application's Gemfile:
|
10
|
+
|
11
|
+
```
|
12
|
+
gem 'omniauth-mapmyfitness-oauth2'
|
13
|
+
```
|
14
|
+
|
15
|
+
### Key & Secret Variables
|
16
|
+
|
17
|
+
Your secret credentials should be stored in environment variables. You can do this in a your `.bash_profile` with the following:
|
18
|
+
|
19
|
+
```plain
|
20
|
+
export MMF_API_KEY=your_key_goes_here
|
21
|
+
export MMF_API_SECRET=your_secret_goes_here
|
22
|
+
```
|
23
|
+
|
24
|
+
#### Checking Environment Variables
|
25
|
+
|
26
|
+
Once you have those ENV variables set, you can check them from IRB:
|
27
|
+
|
28
|
+
```plain
|
29
|
+
$ irb
|
30
|
+
> ENV['MMF_API_KEY']
|
31
|
+
=> "09375ijkds9072l"
|
32
|
+
> ENV['MMF_API_SECRET']
|
33
|
+
=> "08993mhjd8721lk"
|
34
|
+
```
|
35
|
+
|
36
|
+
### Create an Initializer
|
37
|
+
|
38
|
+
Create a `config/initializers/omniauth.rb` with the following:
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
42
|
+
provider :mapmyfitness, ENV['MMF_API_KEY'], ENV['MMF_API_SECRET']
|
43
|
+
end
|
44
|
+
```
|
45
|
+
|
46
|
+
**NOTE**: The `ENV['MMF_API_KEY']` is unsed in an unusual place in this strategy. It *must* be defined for the library to work.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.0
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
require 'pry'
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
class MapMyFitness < OmniAuth::Strategies::OAuth2
|
7
|
+
option :name, "mapmyfitness"
|
8
|
+
|
9
|
+
option :client_options, {
|
10
|
+
:site => "https://oauth2-api.mapmyapi.com",
|
11
|
+
:authorize_url => "https://www.mapmyfitness.com/v7.0/oauth2/authorize/",
|
12
|
+
:token_url => "https://oauth2-api.mapmyapi.com/v7.0/oauth2/access_token/",
|
13
|
+
:connection_opts => {
|
14
|
+
:headers => {'Api-Key' => ENV['MMF_API_KEY']}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
option :token_options, {
|
19
|
+
:grant_type => 'authorization_code',
|
20
|
+
}
|
21
|
+
|
22
|
+
uid {
|
23
|
+
raw_info['user_id']
|
24
|
+
}
|
25
|
+
|
26
|
+
info do
|
27
|
+
{
|
28
|
+
:name => "#{raw_info['first_name']} #{raw_info['last_name']}",
|
29
|
+
:email => raw_info['email'],
|
30
|
+
:nickname => raw_info['username'],
|
31
|
+
:first_name => raw_info['first_name'],
|
32
|
+
:last_name => raw_info['last_name'],
|
33
|
+
:location => [raw_info['start_city'], raw_info['start_state'], raw_info['start_country']].join(', '),
|
34
|
+
#:image => "http://api.mapmyfitness.com/3.1/users/get_avatar?uid=#{raw_info['user_id']}",
|
35
|
+
:urls => {:mapmyfitness => "http://www.mapmyfitness.com/profile/#{raw_info['username']}"}
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
extra do
|
40
|
+
{
|
41
|
+
'raw_info' => raw_info
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
def raw_info
|
46
|
+
@raw_info = JSON.parse(access_token.get("/v7.0/user/self").body)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
OmniAuth.config.add_camelization 'mapmyfitness', 'MapMyFitness'
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'omniauth-mapmyfitness-oauth2/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "omniauth-mapmyfitness-oauth2"
|
8
|
+
|
9
|
+
spec.version = OmniAuth::MapMyFitness::VERSION
|
10
|
+
spec.authors = ["Jeff Casimir"]
|
11
|
+
spec.email = ["jeff@casimircreative.com"]
|
12
|
+
spec.description = "OmniAuth strategy for authenticating against MapMyFitness with OAuth 2"
|
13
|
+
spec.summary = "OmniAuth strategy for MapMyFitness OAuth2"
|
14
|
+
spec.homepage = "http://github.com/jcasimir/omniauth-mapmyfitness-oauth2"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files`.split($/)
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
spec.add_development_dependency "pry"
|
25
|
+
|
26
|
+
spec.add_runtime_dependency "json"
|
27
|
+
spec.add_runtime_dependency "omniauth-oauth2"
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-mapmyfitness-oauth2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jeff Casimir
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: json
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
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: omniauth-oauth2
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: OmniAuth strategy for authenticating against MapMyFitness with OAuth
|
84
|
+
2
|
85
|
+
email:
|
86
|
+
- jeff@casimircreative.com
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- .document
|
92
|
+
- .gitignore
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- VERSION
|
98
|
+
- lib/omniauth-mapmyfitness-oauth2.rb
|
99
|
+
- lib/omniauth-mapmyfitness-oauth2/version.rb
|
100
|
+
- lib/omniauth/strategies/mapmyfitness.rb
|
101
|
+
- omniauth-mapmyfitness-oauth2.gemspec
|
102
|
+
homepage: http://github.com/jcasimir/omniauth-mapmyfitness-oauth2
|
103
|
+
licenses:
|
104
|
+
- MIT
|
105
|
+
metadata: {}
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
require_paths:
|
109
|
+
- lib
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - '>='
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
requirements: []
|
121
|
+
rubyforge_project:
|
122
|
+
rubygems_version: 2.0.6
|
123
|
+
signing_key:
|
124
|
+
specification_version: 4
|
125
|
+
summary: OmniAuth strategy for MapMyFitness OAuth2
|
126
|
+
test_files: []
|