omniauth-pco 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 78c87a46215278a399a5f292951b8edafc590850
4
+ data.tar.gz: 2dc7923fda9513689ef586210eb927c755e10570
5
+ SHA512:
6
+ metadata.gz: cd3a59d6435c1e83c6ad57069681ba9195d1938b1e3ee8bd17deaaff1345e19ebb4ae5a0d4f24d6a71f9b2ccda5e3a328d04f1c839ec0199de283c78128f438c
7
+ data.tar.gz: 6e78077c3355533b8b348ab74fb0600be7be2d75f1bca70be3a2b8446e9455df9a1f0be5153e76ae59ee0cf8ee476159d2454f910f232d081ccfe2ba000e545d
data/.gitignore ADDED
@@ -0,0 +1,18 @@
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
18
+ *.swp
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'rake'
4
+
5
+ gemspec
6
+
data/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2016 by Emerson Hall
4
+
5
+ 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:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ 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/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # OmniAuth for Planning Center Online (PCO)
2
+
3
+ OmniAuth for Planning Center Online's API.
4
+
5
+ ## How To Use It
6
+
7
+ Add this gem to your Gemfile:
8
+
9
+ ```ruby
10
+ gem 'omniauth-pco', git: 'git://github.com/emersonian/omniauth-pco.git'
11
+ ```
12
+
13
+ Add the following to your `config/initializers/omniauth.rb`:
14
+
15
+ ```ruby
16
+ Rails.application.config.middleware.use OmniAuth::Builder do
17
+ provider :pco, 'consumer_key', 'consumer_secret', scope: 'people'
18
+ end
19
+ ```
20
+
21
+ NOTE: If you are using Devise, add this instead to your
22
+ `config/initializers/devise.rb`
23
+
24
+ ```ruby
25
+ config.omniauth :pco, ENV['PCO_OAUTH2_KEY'], ENV['PCO_OAUTH2_SECRET'], scope: 'people'
26
+ ```
27
+
28
+ Set the PCO_OAUTH2* environmental variables to your key and secret,
29
+ which you can obtain from https://api.planningcenteronline.com
30
+
31
+
32
+ ## Todo
33
+
34
+ * Example project
35
+ * Tests
36
+
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ desc "Run specs"
5
+ RSpec::Core::RakeTask.new
6
+
7
+ desc 'Default: run specs.'
8
+ task :default => :spec
@@ -0,0 +1,2 @@
1
+ require "omniauth-pco/version"
2
+ require 'omniauth/strategies/pco'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Pco
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,39 @@
1
+ require 'omniauth-oauth2'
2
+ require 'multi_json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class Pco < OmniAuth::Strategies::OAuth2
7
+ option :name, 'pco'
8
+ option :client_options, site: 'https://api.planningcenteronline.com'
9
+
10
+ uid {
11
+ user_info['id']
12
+ }
13
+
14
+ info do
15
+ {
16
+ first_name: user_info['attributes']['first_name'],
17
+ last_name: user_info['attributes']['last_name'],
18
+ avatar_url: user_info['attributes']['avatar']
19
+ }
20
+ end
21
+
22
+ extra do
23
+ {
24
+ :raw_info => raw_info
25
+ }
26
+ end
27
+
28
+ def raw_info
29
+ @raw_info ||= MultiJson.decode(access_token.get('/people/v2/me?include=emails,phone_numbers').body)
30
+ rescue ::Errno::ETIMEDOUT
31
+ raise ::Timeout::Error
32
+ end
33
+
34
+ def user_info
35
+ @user_info ||= raw_info.nil? ? {} : raw_info['data']
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,26 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+ require "omniauth-pco/version"
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "omniauth-pco"
6
+ s.version = OmniAuth::Pco::VERSION
7
+ s.authors = ["Emerson Hall"]
8
+ s.email = ["e@emersonhall.com"]
9
+ s.homepage = "https://github.com/emersonian/omniauth-pco"
10
+ s.summary = %q{Omniauth strategy for Planning Center Online}
11
+ s.description = %q{Omniauth strategy for Planning Center Online}
12
+
13
+ s.rubyforge_project = "omniauth-pco"
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+
20
+ s.add_runtime_dependency 'omniauth-oauth2', '1.3.1'
21
+ s.add_development_dependency 'rspec', '~> 2.7'
22
+ s.add_development_dependency 'rack-test'
23
+ s.add_development_dependency 'simplecov'
24
+ s.add_development_dependency 'webmock'
25
+ end
26
+
File without changes
@@ -0,0 +1,15 @@
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-appfigures'
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
metadata ADDED
@@ -0,0 +1,126 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-pco
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Emerson Hall
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-09-21 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.3.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.3.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '2.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '2.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rack-test
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: simplecov
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: webmock
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
+ description: Omniauth strategy for Planning Center Online
84
+ email:
85
+ - e@emersonhall.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - .gitignore
91
+ - Gemfile
92
+ - LICENSE.md
93
+ - README.md
94
+ - Rakefile
95
+ - lib/omniauth-pco.rb
96
+ - lib/omniauth-pco/version.rb
97
+ - lib/omniauth/strategies/pco.rb
98
+ - omniauth-pco.gemspec
99
+ - spec/omniauth/strategies/pco_spec.rb
100
+ - spec/spec_helper.rb
101
+ homepage: https://github.com/emersonian/omniauth-pco
102
+ licenses: []
103
+ metadata: {}
104
+ post_install_message:
105
+ rdoc_options: []
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ requirements: []
119
+ rubyforge_project: omniauth-pco
120
+ rubygems_version: 2.0.14.1
121
+ signing_key:
122
+ specification_version: 4
123
+ summary: Omniauth strategy for Planning Center Online
124
+ test_files:
125
+ - spec/omniauth/strategies/pco_spec.rb
126
+ - spec/spec_helper.rb