omniauth-gocardless 1.0.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.
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in omniauth_gocardless.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,38 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-gocardless (1.0.0)
5
+ omniauth-oauth2
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ faraday (0.8.6)
11
+ multipart-post (~> 1.1)
12
+ hashie (1.2.0)
13
+ httpauth (0.2.0)
14
+ jwt (0.1.5)
15
+ multi_json (>= 1.0)
16
+ multi_json (1.6.1)
17
+ multipart-post (1.2.0)
18
+ oauth2 (0.8.1)
19
+ faraday (~> 0.8)
20
+ httpauth (~> 0.1)
21
+ jwt (~> 0.1.4)
22
+ multi_json (~> 1.0)
23
+ rack (~> 1.2)
24
+ omniauth (1.1.3)
25
+ hashie (~> 1.2)
26
+ rack
27
+ omniauth-oauth2 (1.1.1)
28
+ oauth2 (~> 0.8.0)
29
+ omniauth (~> 1.0)
30
+ rack (1.5.2)
31
+ rake (10.0.3)
32
+
33
+ PLATFORMS
34
+ ruby
35
+
36
+ DEPENDENCIES
37
+ omniauth-gocardless!
38
+ rake
data/MIT_LICENSE.txt ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2013 Thilo Utke
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,38 @@
1
+ ### About
2
+
3
+ This gem provides an [OmniAuth](https://github.com/intridea/omniauth) strategy for authenticating with [GoCardless](http://gocardless.com).
4
+
5
+ ### Usage Rails
6
+
7
+ Add the gem to your gemfile.
8
+
9
+ gem 'omniauth-gocardless', require: 'omniauth-gocardless'
10
+
11
+ Add the following as an initializer:
12
+
13
+ Rails.application.config.middleware.use OmniAuth::Builder do
14
+ provider :gocardless, '<client_id>', '<client_secret>', scope: 'manage_merchant'
15
+ end
16
+
17
+ This gives you access to a variable `request.env['omniauth.auth']` in your authentication callback that looks like this:
18
+
19
+ * `uid` - the id of the user
20
+ * `info` - `{'email' => '<user email>', 'name' => '<business name>', 'first_name' => '<first name>', 'last_name' => '<last name>'}`
21
+ * `extra` - `{'raw_info' => {'balance' => '<amount>', 'created_at' => '<date time with tz>', 'description' => '<Text>', 'hide_variable_amount' => '<bool>', 'id' => '<id of user>' 'name' => '<business name>', 'first_name' => '<first name>', 'last_name' => '<last name>', 'next_payout_amount' => <amount>, 'next_payout_date' => '<date time with tz>', 'pending_balance' => <amount> …}}`
22
+
23
+ #### Options
24
+
25
+ To authorize against your gocardless sandbox environment set the site url to `https://sandbox.gocardless.com/` like this:
26
+
27
+ Rails.application.config.middleware.use OmniAuth::Builder do
28
+ provider :gocardless, '<client_id>', '<client_secret>', scope: 'manage_merchant',
29
+ client_options: {site: 'https://sandbox.gocardless.com'}
30
+ end
31
+
32
+ To set a fixed redirect_uri e.g. if you call from different subdomains you can set it like this:
33
+
34
+ Rails.application.config.middleware.use OmniAuth::Builder do
35
+ provider :gocardless, '<client_id>', '<client_secret>', scope: 'manage_merchant',
36
+ redirect_uri: 'https://cobot.me/'
37
+ end
38
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,2 @@
1
+ require 'omniauth'
2
+ require 'omniauth/strategies/gocardless'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Gocardless
3
+ VERSION = '1.0.0'
4
+ end
5
+ end
@@ -0,0 +1,39 @@
1
+ require 'omniauth/strategies/oauth2'
2
+ module OmniAuth
3
+ module Strategies
4
+ class Gocardless < OmniAuth::Strategies::OAuth2
5
+ option :name, 'gocardless'
6
+ option :redirect_uri, nil
7
+ option :client_options, {
8
+ :site => 'https://gocardless.com',
9
+ :authorize_url => '/oauth/authorize',
10
+ :token_url => '/oauth/access_token'
11
+ }
12
+
13
+
14
+ uid { raw_info['id'] }
15
+
16
+ info do
17
+ {
18
+ 'email' => raw_info['email'],
19
+ 'name' => raw_info['name'],
20
+ 'first_name' => raw_info['first_name'],
21
+ 'last_name' => raw_info['last_name'],
22
+ }
23
+ end
24
+
25
+ extra do
26
+ {:raw_info => raw_info}
27
+ end
28
+
29
+ def callback_url
30
+ options[:redirect_uri] || super
31
+ end
32
+
33
+ def raw_info
34
+ merchant_id = access_token.params['scope'].split(':').last
35
+ @raw_info ||= access_token.get("/api/v1/merchants/#{merchant_id}.json").parsed
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "omniauth/gocardless/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "omniauth-gocardless"
7
+ s.summary = "OmniAuth strategy for GoCardless"
8
+ s.email = "thilo@cobot.me"
9
+ s.homepage = "http://github.com/cobot/omniauth-gocardless"
10
+ s.description = "OmniAuth strategy for GoCardless"
11
+ s.authors = ["Thilo Utke"]
12
+ s.version = OmniAuth::Gocardless::VERSION
13
+ s.platform = Gem::Platform::RUBY
14
+
15
+ s.add_dependency 'omniauth-oauth2'
16
+
17
+ s.add_development_dependency 'rake'
18
+
19
+ s.files = `git ls-files`.split("\n")
20
+ s.require_paths = ["lib"]
21
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-gocardless
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Thilo Utke
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-05 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: omniauth-oauth2
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: OmniAuth strategy for GoCardless
47
+ email: thilo@cobot.me
48
+ executables: []
49
+ extensions: []
50
+ extra_rdoc_files: []
51
+ files:
52
+ - .gitignore
53
+ - Gemfile
54
+ - Gemfile.lock
55
+ - MIT_LICENSE.txt
56
+ - README.md
57
+ - Rakefile
58
+ - lib/omniauth-gocardless.rb
59
+ - lib/omniauth/gocardless/version.rb
60
+ - lib/omniauth/strategies/gocardless.rb
61
+ - omniauth-gocardless.gemspec
62
+ homepage: http://github.com/cobot/omniauth-gocardless
63
+ licenses: []
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubyforge_project:
82
+ rubygems_version: 1.8.23
83
+ signing_key:
84
+ specification_version: 3
85
+ summary: OmniAuth strategy for GoCardless
86
+ test_files: []
87
+ has_rdoc: