omniauth-recharge 0.1.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
+ SHA256:
3
+ metadata.gz: f98764df5988f063e20841cac090072e9556228cf158330963d1dadd99c3d10c
4
+ data.tar.gz: e829106c49c8d24d17bd325ecf3da21750dec75b19b3067688ad649639b5425f
5
+ SHA512:
6
+ metadata.gz: 92bce01f172fef88f5d476577c6db52075799d420b54474b861ade87030109aa3a6c14cfd41dc7c38a5a9c72b60dc53b620036d7e7478db0de762f710c6a4596
7
+ data.tar.gz: fafddca0131c518d7a4df656b585b66ff06bb1b36aed0fbbcb1ebc041a4a3eabae915c492f662455e05b6eb73617ed314063bba6643a8b38c5a4b15cbd946df4
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /.idea
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ before_install: gem install bundler -v 1.11.2
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/README.md ADDED
@@ -0,0 +1,50 @@
1
+
2
+ # OmniAuth ReCharge
3
+
4
+ ReCharge OAuth2 Strategy for OmniAuth 1.0.
5
+
6
+ ## Installing
7
+
8
+ Add to your `Gemfile`:
9
+
10
+ ```ruby
11
+ gem 'omniauth-recharge'
12
+ ```
13
+
14
+ Then `bundle install`.
15
+
16
+ ## Usage
17
+
18
+ `OmniAuth::Strategies::Recharge` is simply a Rack middleware. Read [the OmniAuth 1.0 docs](https://github.com/intridea/omniauth) for detailed instructions.
19
+
20
+ Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
21
+
22
+ ```ruby
23
+ Rails.application.config.middleware.use OmniAuth::Builder do
24
+ provider :recharge, ENV['RECHARGE_CLIENT_ID'], ENV['RECHARGE_CLIENT_SECRET']
25
+ end
26
+ ```
27
+
28
+ ## Authentication Hash
29
+
30
+ Here's an example *Authentication Hash* available in `request.env['omniauth.auth']`:
31
+
32
+ ```ruby
33
+ {
34
+ :provider => 'recharge',
35
+ :uid => '1234',
36
+ :credentials => {
37
+ :token => 'afasd923kjh0934kf', # OAuth 2.0 access_token, which you store and use to authenticate API requests
38
+ }
39
+ }
40
+ ```
41
+
42
+ ## License
43
+
44
+ Copyright (c) 2016 by LeadDyno, LLC
45
+
46
+ 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:
47
+
48
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
49
+
50
+ 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,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :spec
@@ -0,0 +1 @@
1
+ require 'omniauth/recharge'
@@ -0,0 +1,2 @@
1
+ require 'omniauth/recharge/version'
2
+ require 'omniauth/strategies/recharge'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Recharge
3
+ VERSION = "0.1.1"
4
+ end
5
+ end
@@ -0,0 +1,41 @@
1
+ require 'omniauth/strategies/oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Recharge < OmniAuth::Strategies::OAuth2
6
+
7
+ option :provider_ignores_state, false
8
+
9
+ option :client_options, {
10
+ :site => 'https://shopifysubscriptions.com',
11
+ :authorize_url => '/oauth/authorize',
12
+ :token_url => '/oauth/token'
13
+ }
14
+
15
+ uid{ raw_info['store']['store_id'] }
16
+
17
+ info do
18
+ {
19
+ :email => raw_info['store']['email'],
20
+ }
21
+ end
22
+
23
+ extra do
24
+ {
25
+ 'raw_info' => raw_info['store']
26
+ }
27
+ end
28
+
29
+ def raw_info
30
+ api_url = ENV['RECHARGE_API_URL'] || 'https://api.rechargeapps.com/'
31
+ @raw_info ||= access_token.get(api_url).parsed
32
+ end
33
+
34
+ def callback_url
35
+ # make sure the query string doesnt get added to the redirect_uri
36
+ # https://github.com/intridea/omniauth-oauth2/issues/93
37
+ full_host + script_name + callback_path
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'omniauth/recharge/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "omniauth-recharge"
8
+ spec.version = OmniAuth::Recharge::VERSION
9
+ spec.authors = ["Mike Machado", "Paul Robertson"]
10
+ spec.email = ["mike@leaddyno.com", "t.paulrobertson@gmail.com"]
11
+
12
+ spec.summary = %q{ReCharge strategy for OmniAuth.}
13
+ spec.homepage = "https://github.com/ReChargePayments/omniauth-recharge"
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.2'
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.11"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "minitest", "~> 5.0"
25
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-recharge
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Mike Machado
8
+ - Paul Robertson
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2018-10-05 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: omniauth-oauth2
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.2'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.2'
28
+ - !ruby/object:Gem::Dependency
29
+ name: bundler
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '1.11'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '1.11'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rake
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '10.0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '10.0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: minitest
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '5.0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '5.0'
70
+ description:
71
+ email:
72
+ - mike@leaddyno.com
73
+ - t.paulrobertson@gmail.com
74
+ executables: []
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - ".gitignore"
79
+ - ".travis.yml"
80
+ - Gemfile
81
+ - README.md
82
+ - Rakefile
83
+ - lib/omniauth-recharge.rb
84
+ - lib/omniauth/recharge.rb
85
+ - lib/omniauth/recharge/version.rb
86
+ - lib/omniauth/strategies/recharge.rb
87
+ - omniauth-recharge.gemspec
88
+ homepage: https://github.com/ReChargePayments/omniauth-recharge
89
+ licenses:
90
+ - MIT
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubyforge_project:
108
+ rubygems_version: 2.7.6
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: ReCharge strategy for OmniAuth.
112
+ test_files: []