omniauth-smashrun 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6eeb562178892dd71207a90fc6ce2941f8a459f1
4
+ data.tar.gz: 15fe90955c9e9e693d1ec6415aa47d2bcd464e41
5
+ SHA512:
6
+ metadata.gz: ae9141d0c103a83cb35e046b98d75b949ce9b1b422e0bdc0738abd0a6fff246060d082466b48477ed3a5ef96ef9eb64a3ef6c3b5d6515ffd85ebd51f82b1222a
7
+ data.tar.gz: d77318a53ace9640662becf9ad6a6d725c2841772f22d5ae8007eb933f24e6d1028226feb5470321b3c4bca85b3f687f8f3ae4c39b93308ef50674c6c987dead
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ source "https://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ source 'https://rubygems.org'
7
+ gem 'omniauth-oauth2', '~> 1.0'
8
+ gem 'oj', '~> 3.3.5'
9
+
10
+ # Add dependencies to develop your gem here.
11
+ # Include everything needed to run rake, tests, features, etc.
12
+ group :development do
13
+ gem "rdoc", "~> 3.12"
14
+ gem "bundler", "~> 1.0"
15
+ gem "juwelier", "~> 2.1.0"
16
+ gem "simplecov", ">= 0"
17
+ end
@@ -0,0 +1,77 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ addressable (2.4.0)
5
+ builder (3.2.3)
6
+ descendants_tracker (0.0.4)
7
+ thread_safe (~> 0.3, >= 0.3.1)
8
+ docile (1.1.5)
9
+ faraday (0.9.2)
10
+ multipart-post (>= 1.2, < 3)
11
+ git (1.3.0)
12
+ github_api (0.17.0)
13
+ addressable (~> 2.4.0)
14
+ descendants_tracker (~> 0.0.4)
15
+ faraday (~> 0.8, < 0.10)
16
+ hashie (>= 3.4)
17
+ mime-types (>= 1.16, < 3.0)
18
+ oauth2 (~> 1.0)
19
+ hashie (3.5.6)
20
+ highline (1.7.8)
21
+ json (1.8.6)
22
+ juwelier (2.1.3)
23
+ builder
24
+ bundler (>= 1.13)
25
+ git (>= 1.2.5)
26
+ github_api
27
+ highline (>= 1.6.15)
28
+ nokogiri (>= 1.5.10)
29
+ rake
30
+ rdoc
31
+ semver
32
+ jwt (1.5.6)
33
+ mime-types (2.99.3)
34
+ mini_portile2 (2.2.0)
35
+ multi_json (1.12.1)
36
+ multi_xml (0.6.0)
37
+ multipart-post (2.0.0)
38
+ nokogiri (1.8.0)
39
+ mini_portile2 (~> 2.2.0)
40
+ oauth2 (1.4.0)
41
+ faraday (>= 0.8, < 0.13)
42
+ jwt (~> 1.0)
43
+ multi_json (~> 1.3)
44
+ multi_xml (~> 0.5)
45
+ rack (>= 1.2, < 3)
46
+ oj (3.3.5)
47
+ omniauth (1.6.1)
48
+ hashie (>= 3.4.6, < 3.6.0)
49
+ rack (>= 1.6.2, < 3)
50
+ omniauth-oauth2 (1.4.0)
51
+ oauth2 (~> 1.0)
52
+ omniauth (~> 1.2)
53
+ rack (2.0.3)
54
+ rake (12.0.0)
55
+ rdoc (3.12.2)
56
+ json (~> 1.4)
57
+ semver (1.0.1)
58
+ simplecov (0.15.0)
59
+ docile (~> 1.1.0)
60
+ json (>= 1.8, < 3)
61
+ simplecov-html (~> 0.10.0)
62
+ simplecov-html (0.10.2)
63
+ thread_safe (0.3.6)
64
+
65
+ PLATFORMS
66
+ ruby
67
+
68
+ DEPENDENCIES
69
+ bundler (~> 1.0)
70
+ juwelier (~> 2.1.0)
71
+ oj (~> 3.3.5)
72
+ omniauth-oauth2 (~> 1.0)
73
+ rdoc (~> 3.12)
74
+ simplecov
75
+
76
+ BUNDLED WITH
77
+ 1.13.6
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Naveed Ahmad
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2017 Naveed Ahmad
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.
@@ -0,0 +1,18 @@
1
+ = omniauth-smashrun
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to omniauth-smashrun
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
+ * Fork the project.
10
+ * Start a feature/bugfix branch.
11
+ * Commit and push until you are happy with your contribution.
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2017 Naveed Ahmad. See LICENSE.txt for
18
+ further details.
@@ -0,0 +1,50 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+ require 'juwelier'
14
+ Juwelier::Tasks.new do |gem|
15
+ # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
16
+ gem.name = "omniauth-smashrun"
17
+ gem.homepage = "http://github.com/naveed-ahmad/omniauth-smashrun"
18
+ gem.license = "MIT"
19
+ gem.summary = "OmniAuth strategy for Smashrun"
20
+ gem.description = gem.summary
21
+ gem.email = "naveedahmada036@gmail.com"
22
+ gem.authors = ["Naveed Ahmad"]
23
+
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Juwelier::RubygemsDotOrgTasks.new
27
+ require 'rake/testtask'
28
+ Rake::TestTask.new(:test) do |test|
29
+ test.libs << 'lib' << 'test'
30
+ test.pattern = 'test/**/test_*.rb'
31
+ test.verbose = true
32
+ end
33
+
34
+ desc "Code coverage detail"
35
+ task :simplecov do
36
+ ENV['COVERAGE'] = "true"
37
+ Rake::Task['test'].execute
38
+ end
39
+
40
+ task :default => :test
41
+
42
+ require 'rdoc/task'
43
+ Rake::RDocTask.new do |rdoc|
44
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
45
+
46
+ rdoc.rdoc_dir = 'rdoc'
47
+ rdoc.title = "omniauth-smashrun #{version}"
48
+ rdoc.rdoc_files.include('README*')
49
+ rdoc.rdoc_files.include('lib/**/*.rb')
50
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,2 @@
1
+ require 'omniauth-smashrun/version'
2
+ require 'omniauth/strategies/smashrun'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Smashrun
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
@@ -0,0 +1,54 @@
1
+ require 'omniauth-oauth2'
2
+ require 'oj'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class Strava < OmniAuth::Strategies::OAuth2
7
+ option :name, 'smashrun'
8
+ option :client_options, { site: 'https://api.smashrun.com',
9
+ authorize_url: 'https://secure.smashrun.com/oauth2/authenticate',
10
+ token_url: 'https://secure.smashrun.com/oauth2/token'
11
+ }
12
+ option :scope, 'read_activity'
13
+
14
+ def request_phase
15
+ super
16
+ end
17
+
18
+ def callback_phase
19
+ super
20
+ end
21
+
22
+ uid { "#{athlete['id']}" }
23
+
24
+ extra do
25
+ athlete_info = athlete
26
+
27
+ {
28
+ recent_run_date_utc: athlete_info['dateTimeUTCOfLastRun'],
29
+ distance_unit: athlete_info['unitDistance'],
30
+ time_zone_offset: athlete_info['timeZoneOffsetMinutes'],
31
+ raw_info: athlete_info
32
+ }
33
+ end
34
+
35
+ info do
36
+ athlete_info = athlete
37
+
38
+ {
39
+ name: "#{athlete_info['firstName']} #{athlete_info['lastName']}",
40
+ first_name: athlete_info['firstName'],
41
+ last_name: athlete_info['lastName'],
42
+ username: athlete_info['username']
43
+ }
44
+ end
45
+
46
+ def athlete
47
+ access_token.options[:mode] = :query
48
+ access_token.options[:param_name] = :access_token
49
+ @athlete ||= Oj.dump(access_token.get('/my/userinfo', { access_token: access_token.token }).body)
50
+ end
51
+
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,68 @@
1
+ # Generated by juwelier
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+ # stub: omniauth-smashrun 0.0.1 ruby lib
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "omniauth-smashrun"
9
+ s.version = "0.0.1"
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
13
+ s.authors = ["Naveed Ahmad"]
14
+ s.date = "2017-08-28"
15
+ s.description = "OmniAuth strategy for Smashrun"
16
+ s.email = "naveedahmada036@gmail.com"
17
+ s.extra_rdoc_files = [
18
+ "LICENSE",
19
+ "LICENSE.txt",
20
+ "README.rdoc"
21
+ ]
22
+ s.files = [
23
+ ".document",
24
+ "Gemfile",
25
+ "Gemfile.lock",
26
+ "LICENSE",
27
+ "LICENSE.txt",
28
+ "README.rdoc",
29
+ "Rakefile",
30
+ "VERSION",
31
+ "lib/omniauth-smashrun.rb",
32
+ "lib/omniauth-smashrun/version.rb",
33
+ "lib/omniauth/strategies/smashrun.rb",
34
+ "omniauth-smashrun.gemspec"
35
+ ]
36
+ s.homepage = "http://github.com/naveed-ahmad/omniauth-smashrun"
37
+ s.licenses = ["MIT"]
38
+ s.rubygems_version = "2.4.8"
39
+ s.summary = "OmniAuth strategy for Smashrun"
40
+
41
+ if s.respond_to? :specification_version then
42
+ s.specification_version = 4
43
+
44
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
+ s.add_runtime_dependency(%q<omniauth-oauth2>, ["~> 1.0"])
46
+ s.add_runtime_dependency(%q<oj>, ["~> 3.3.5"])
47
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
48
+ s.add_development_dependency(%q<bundler>, ["~> 1.0"])
49
+ s.add_development_dependency(%q<juwelier>, ["~> 2.1.0"])
50
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
51
+ else
52
+ s.add_dependency(%q<omniauth-oauth2>, ["~> 1.0"])
53
+ s.add_dependency(%q<oj>, ["~> 3.3.5"])
54
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
55
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
56
+ s.add_dependency(%q<juwelier>, ["~> 2.1.0"])
57
+ s.add_dependency(%q<simplecov>, [">= 0"])
58
+ end
59
+ else
60
+ s.add_dependency(%q<omniauth-oauth2>, ["~> 1.0"])
61
+ s.add_dependency(%q<oj>, ["~> 3.3.5"])
62
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
63
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
64
+ s.add_dependency(%q<juwelier>, ["~> 2.1.0"])
65
+ s.add_dependency(%q<simplecov>, [">= 0"])
66
+ end
67
+ end
68
+
metadata ADDED
@@ -0,0 +1,142 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-smashrun
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Naveed Ahmad
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-08-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth-oauth2
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: oj
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 3.3.5
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 3.3.5
41
+ - !ruby/object:Gem::Dependency
42
+ name: rdoc
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.12'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.12'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: juwelier
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 2.1.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 2.1.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 Smashrun
98
+ email: naveedahmada036@gmail.com
99
+ executables: []
100
+ extensions: []
101
+ extra_rdoc_files:
102
+ - LICENSE
103
+ - LICENSE.txt
104
+ - README.rdoc
105
+ files:
106
+ - ".document"
107
+ - Gemfile
108
+ - Gemfile.lock
109
+ - LICENSE
110
+ - LICENSE.txt
111
+ - README.rdoc
112
+ - Rakefile
113
+ - VERSION
114
+ - lib/omniauth-smashrun.rb
115
+ - lib/omniauth-smashrun/version.rb
116
+ - lib/omniauth/strategies/smashrun.rb
117
+ - omniauth-smashrun.gemspec
118
+ homepage: http://github.com/naveed-ahmad/omniauth-smashrun
119
+ licenses:
120
+ - MIT
121
+ metadata: {}
122
+ post_install_message:
123
+ rdoc_options: []
124
+ require_paths:
125
+ - lib
126
+ required_ruby_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ required_rubygems_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ requirements: []
137
+ rubyforge_project:
138
+ rubygems_version: 2.4.8
139
+ signing_key:
140
+ specification_version: 4
141
+ summary: OmniAuth strategy for Smashrun
142
+ test_files: []