omniauth-uphold 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rubocop.yml +34 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +46 -0
- data/Rakefile +7 -0
- data/lib/omniauth/strategies/uphold.rb +23 -0
- data/lib/omniauth-uphold/version.rb +5 -0
- data/lib/omniauth-uphold.rb +2 -0
- data/omniauth-uphold.gemspec +28 -0
- data/spec/omniauth/strategies/bitreserve_spec.rb +29 -0
- data/spec/spec_helper.rb +2 -0
- metadata +161 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 80b21be8edc7f5ed4f087b00b41a335b045d0f96
|
4
|
+
data.tar.gz: d653e88c55659c510aa5f2104413af6f9beefad6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f4d5e9217c03a31aebde51f0d11e2be5b435737e8c2d21dddaddccb7dac88ca3cebb0b37628de56bd762ae5ae8f93b32a2e842ad04ccf3d1392ba85a141193eb
|
7
|
+
data.tar.gz: 73a86b446180b4a2bec90c9bb4b134398f0e0ddf272abe3b842b328643147f49e67ccdf26b57f10e25532f1913cdcbbbb63eb5d3181177d1c2e3d02f3ef753f1
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
AllCops:
|
2
|
+
Include:
|
3
|
+
- '**/Rakefile'
|
4
|
+
- '**/config.ru'
|
5
|
+
Exclude:
|
6
|
+
- 'db/**/*'
|
7
|
+
- 'config/**/*'
|
8
|
+
- 'script/**/*'
|
9
|
+
- 'bin/**/*'
|
10
|
+
- 'vendor/**/*'
|
11
|
+
|
12
|
+
Metrics/LineLength:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Style/AlignParameters:
|
16
|
+
EnforcedStyle: with_fixed_indentation
|
17
|
+
|
18
|
+
Style/ClassAndModuleChildren:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Style/Documentation:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Style/DotPosition:
|
25
|
+
EnforcedStyle: trailing
|
26
|
+
|
27
|
+
Style/IfUnlessModifier:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
Style/RegexpLiteral:
|
31
|
+
MaxSlashes: 0
|
32
|
+
|
33
|
+
Style/FileName:
|
34
|
+
Enabled: false
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Group Buddies
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Omniauth Uphold
|
2
|
+
|
3
|
+
This gem contains the [Uphold](https://uphold.com/) strategy for OmniAuth
|
4
|
+
|
5
|
+
## Using this strategy
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'omniauth-uphold'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install omniauth-uphold
|
20
|
+
|
21
|
+
Now you must tell OmniAuth about this provider, For a Rails app, your `config/initializers/omniauth.rb` file should look like this:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
25
|
+
provider :uphold, 'API_KEY', 'API_SECRET'
|
26
|
+
end
|
27
|
+
```
|
28
|
+
|
29
|
+
## Sandbox API
|
30
|
+
|
31
|
+
Uphold supports a sandbox environment for testing purposes. To use it with this strategy, you'll need to use the following environment variables:
|
32
|
+
|
33
|
+
```
|
34
|
+
uphold_URL="https://sandbox.uphold.com"
|
35
|
+
uphold_API_URL="https://api-sandbox.uphold.com"
|
36
|
+
```
|
37
|
+
|
38
|
+
We recommend [dotenv](https://github.com/bkeepers/dotenv) for this.
|
39
|
+
|
40
|
+
## Contributing
|
41
|
+
|
42
|
+
1. Fork it ( https://github.com/[my-github-username]/omniauth-uphold/fork )
|
43
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
44
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
45
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
46
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Uphold < ::OmniAuth::Strategies::OAuth2
|
6
|
+
include ::OmniAuth::Strategy
|
7
|
+
|
8
|
+
UPHOLD_URL = ENV['UPHOLD_URL'] || 'https://uphold.com'
|
9
|
+
UPHOLD_API_URL = ENV['UPHOLD_API_URL'] || 'https://api.uphold.com'
|
10
|
+
|
11
|
+
option :name, :uphold
|
12
|
+
option :client_options, {
|
13
|
+
site: UPHOLD_API_URL,
|
14
|
+
token_url: 'oauth2/token'
|
15
|
+
}
|
16
|
+
|
17
|
+
def initialize(app, *args, &block)
|
18
|
+
super
|
19
|
+
options[:client_options][:authorize_url] = "#{UPHOLD_URL}/authorize/#{args[0]}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -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-uphold/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'omniauth-uphold'
|
8
|
+
spec.version = Omniauth::Uphold::VERSION
|
9
|
+
spec.authors = ['Miguel Palhas']
|
10
|
+
spec.email = ['miguel@subvisual.co']
|
11
|
+
spec.summary = 'OAuth2 strategy for the Uphold API, by Subvisual'
|
12
|
+
spec.description = 'OAuth2 strategy for the Uphold API, by Subvisual'
|
13
|
+
spec.homepage = 'https://github.com/subvisual/omniauth-uphold'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_dependency 'omniauth', '~> 1.2', '>= 1.2.2'
|
22
|
+
spec.add_dependency 'omniauth-oauth2', '~> 1.2', '>= 1.2.0'
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
spec.add_development_dependency 'rubocop', '~> 0.27.1'
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.1', '~> 3.1.0'
|
28
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'omniauth/strategies/uphold'
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
describe Uphold do
|
7
|
+
let(:request) { double('Request', params: {}, cookies: {}, env: {}) }
|
8
|
+
|
9
|
+
subject do
|
10
|
+
args = ['appid', 'secret', @options || {}].compact
|
11
|
+
OmniAuth::Strategies::Uphold.new(*args).tap do |strategy|
|
12
|
+
allow(strategy).to receive(:request) {
|
13
|
+
request
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'client options' do
|
19
|
+
it 'should have correct name' do
|
20
|
+
expect(subject.options.name).to eq(:uphold)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should have correct site' do
|
24
|
+
expect(subject.options.client_options.site).to eq('https://api.uphold.com')
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-uphold
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Miguel Palhas
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-10-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: omniauth
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.2'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.2.2
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.2'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.2.2
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: omniauth-oauth2
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.2'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 1.2.0
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.2'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.2.0
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: bundler
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '1.7'
|
60
|
+
type: :development
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - "~>"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '1.7'
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: rake
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - "~>"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '10.0'
|
74
|
+
type: :development
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - "~>"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '10.0'
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: rubocop
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - "~>"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 0.27.1
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - "~>"
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 0.27.1
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: rspec
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - "~>"
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '3.1'
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 3.1.0
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '3.1'
|
112
|
+
- - "~>"
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: 3.1.0
|
115
|
+
description: OAuth2 strategy for the Uphold API, by Subvisual
|
116
|
+
email:
|
117
|
+
- miguel@subvisual.co
|
118
|
+
executables: []
|
119
|
+
extensions: []
|
120
|
+
extra_rdoc_files: []
|
121
|
+
files:
|
122
|
+
- ".gitignore"
|
123
|
+
- ".rubocop.yml"
|
124
|
+
- Gemfile
|
125
|
+
- LICENSE.txt
|
126
|
+
- README.md
|
127
|
+
- Rakefile
|
128
|
+
- lib/omniauth-uphold.rb
|
129
|
+
- lib/omniauth-uphold/version.rb
|
130
|
+
- lib/omniauth/strategies/uphold.rb
|
131
|
+
- omniauth-uphold.gemspec
|
132
|
+
- spec/omniauth/strategies/bitreserve_spec.rb
|
133
|
+
- spec/spec_helper.rb
|
134
|
+
homepage: https://github.com/subvisual/omniauth-uphold
|
135
|
+
licenses:
|
136
|
+
- MIT
|
137
|
+
metadata: {}
|
138
|
+
post_install_message:
|
139
|
+
rdoc_options: []
|
140
|
+
require_paths:
|
141
|
+
- lib
|
142
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
requirements: []
|
153
|
+
rubyforge_project:
|
154
|
+
rubygems_version: 2.4.6
|
155
|
+
signing_key:
|
156
|
+
specification_version: 4
|
157
|
+
summary: OAuth2 strategy for the Uphold API, by Subvisual
|
158
|
+
test_files:
|
159
|
+
- spec/omniauth/strategies/bitreserve_spec.rb
|
160
|
+
- spec/spec_helper.rb
|
161
|
+
has_rdoc:
|