omniauth-coinbase 1.0.6 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 84535d3fe3bfe095ad8c058c97a321b009f1ed73
4
- data.tar.gz: 7a7a1f9f53aa26c3aafe07ebaa1a68da8b3c0413
3
+ metadata.gz: f69443a60ab099095aa58d742021708f5a786df8
4
+ data.tar.gz: f97c7eb92386e879ad37f4bfbb4644d9ea5f8543
5
5
  SHA512:
6
- metadata.gz: 23728b13e7c165f46df5a1031ae2a6728ed44741fba164e73b3de0cc525a73593cac146c8cf45b96f54c544efb12f95a6fa93ba8e20ab006b02e8006bdbe2537
7
- data.tar.gz: 584de68d02b62d21249c94bd89e9201cb16dca1f75fe6ae84541cd542230f135a3121355733588026570c99a3f311192bf7bdedbef4ca4008d784bd612cd3608
6
+ metadata.gz: 32aaa551fd50507cb92cee93eefc2603a7fdb2c26e1c56d619a763417634ef8d00bbc7343d4627c1bf87b3597ec641b642c56679dfc7bf7e943cedfbdadb2d0b
7
+ data.tar.gz: fd28d4923c6b8e79c8807b1c78ac08480bff080c858d2d83086ba96aceb15df6433305d27d014945ed02ae1bab1742fd30a93bbafc085d11c571222e9e40a526
data/README.md CHANGED
@@ -1,8 +1,12 @@
1
1
  # OmniAuth Coinbase
2
2
 
3
- OmniAuth 2 strategy for [Coinbase](https://coinbase.com/)
3
+ OmniAuth 2 strategy for [Coinbase](https://www.coinbase.com/)
4
4
 
5
- For more details, read the [Coinbase API Reference](https://coinbase.com/docs/api/overview#oauth2)
5
+ For more details, read the [Coinbase API Reference](https://developers.coinbase.com/api/v2)
6
+
7
+ # Release Notes
8
+
9
+ Note that version ~> 2.0 of this gem uses the new [Coinbase API v2](https://developers.coinbase.com/api/v2). Use this version if you are creating a new app. Do not upgrade existing apps to this version as the user ids in v2 of the API are not the same as those in v1. We will be adding v2 UUIDs to v1 responses to aid in migration efforts.
6
10
 
7
11
  # Installation
8
12
 
@@ -20,7 +24,7 @@ Here's an example, adding the middleware to a Rails app in config/initializers/o
20
24
 
21
25
  ```ruby
22
26
  Rails.application.config.middleware.use OmniAuth::Builder do
23
- provider :coinbase, ENV["COINBASE_KEY"], ENV["COINBASE_SECRET"]
27
+ provider :coinbase, ENV["COINBASE_CLIENT_ID"], ENV["COINBASE_CLIENT_SECRET"]
24
28
  end
25
29
  ```
26
30
 
@@ -32,10 +36,23 @@ You can configure permissions/scope, which you pass in to the `provider` method
32
36
 
33
37
  ```ruby
34
38
  Rails.application.config.middleware.use OmniAuth::Builder do
35
- provider :coinbase, ENV["COINBASE_KEY"], ENV["COINBASE_SECRET"], scope: 'user send addresses'
39
+ provider :coinbase, ENV["COINBASE_CLIENT_ID"], ENV["COINBASE_CLIENT_SECRET"], scope: 'wallet:user:read wallet:user:email wallet:accounts:read'
36
40
  end
37
41
  ```
38
42
 
39
- The format is a space separated list of strings from Coinbase's [list of OAuth Permissions](https://coinbase.com/docs/api/authentication#permissions). Remember that at minimum you MUST include either the `all` or `user` scopes.
43
+ The format is a space separated list of strings from Coinbase's [list of OAuth Permissions](https://developers.coinbase.com/api/v2#scopes).
40
44
 
41
45
  NOTE: While developing your application, if you change the scope in the initializer you will need to restart your app server.
46
+
47
+ # User info
48
+
49
+ The authenticated user's id and name are present in the omniauth auth object under auth.uid and auth.info.name.
50
+
51
+ The authenticated user's [raw information](https://developers.coinbase.com/api/v2#user-resource) is present under auth.extra.raw_info
52
+
53
+ ```ruby
54
+ auth.uid # "7eee8527-3439-52d9-98d6-a04c0d0dc6ce"
55
+ auth.info.name # "Alex Ianus"
56
+ auth.extra.raw_info.email # "aianus@example.com", only present with wallet:user:email scope
57
+ auth.extra.raw_info.time_zone # "Pacific Time (US & Canada)", only present with wallet:user:show scope
58
+ ```
@@ -1,30 +1,29 @@
1
1
  require 'omniauth-oauth2'
2
- require 'coinbase'
2
+ require 'coinbase/wallet'
3
3
 
4
4
  module OmniAuth
5
5
  module Strategies
6
6
  class Coinbase < OmniAuth::Strategies::OAuth2
7
7
  option :name, 'coinbase'
8
8
  option :client_options, {
9
- :site => 'https://coinbase.com',
9
+ :site => 'https://www.coinbase.com',
10
10
  :authorize_url => 'https://www.coinbase.com/oauth/authorize',
11
11
  :token_url => 'https://www.coinbase.com/oauth/token',
12
12
  :proxy => ENV['http_proxy'] ? URI(ENV['http_proxy']) : nil,
13
13
  :ssl => {
14
14
  :verify => true,
15
- :cert_store => ::Coinbase::Client.whitelisted_cert_store
15
+ :cert_store => ::Coinbase::Wallet::APIClient.whitelisted_certificates
16
16
  }
17
17
  }
18
18
  option :authorize_options, [:scope, :meta]
19
19
 
20
20
 
21
- uid { raw_info['id'] }
21
+ uid { raw_info.id }
22
22
 
23
23
  info do
24
24
  {
25
- :id => raw_info['id'],
26
- :name => raw_info['name'],
27
- :email => raw_info['email']
25
+ :id => raw_info.id,
26
+ :name => raw_info.name
28
27
  }
29
28
  end
30
29
 
@@ -33,14 +32,11 @@ module OmniAuth
33
32
  end
34
33
 
35
34
  def raw_info
36
- @raw_info ||= MultiJson.load(access_token.get('/api/v1/users').body)['users'][0]['user']
35
+ client = ::Coinbase::Wallet::OAuthClient.new(access_token: access_token.token)
36
+ @raw_info ||= client.current_user
37
37
  rescue ::Errno::ETIMEDOUT
38
38
  raise ::Timeout::Error
39
39
  end
40
-
41
- def callback_url
42
- options[:redirect_uri] || (full_host + script_name + callback_path)
43
- end
44
40
  end
45
41
  end
46
42
  end
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Coinbase
3
- VERSION = "1.0.6"
3
+ VERSION = "2.0.0"
4
4
  end
5
5
  end
@@ -5,13 +5,18 @@ require "omniauth-coinbase/version"
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "omniauth-coinbase"
7
7
  s.version = OmniAuth::Coinbase::VERSION
8
- s.authors = ["Miguel Palhas"]
9
- s.email = ["mpalhas@gmail.com"]
10
- s.homepage = "https://github.com/naps62/omniauth-coinbase"
8
+ s.authors = ["Miguel Palhas", "Alex Ianus"]
9
+ s.email = ["mpalhas@gmail.com", "hire@alexianus.com"]
10
+ s.homepage = "https://github.com/coinbase/omniauth-coinbase"
11
11
  s.summary = %q{OmniAuth strategy for Coinbase}
12
12
  s.description = %q{OmniAuth strategy for Coinbase}
13
13
  s.licenses = ['MIT']
14
14
 
15
+ s.post_install_message = <<MSG
16
+ Do not upgrade an existing app to this version of omniauth-coinbase.
17
+ See the release notes in the README for more information.
18
+ MSG
19
+
15
20
  s.rubyforge_project = "omniauth-coinbase"
16
21
 
17
22
  s.files = `git ls-files`.split("\n")
@@ -20,9 +25,9 @@ Gem::Specification.new do |s|
20
25
  s.require_paths = ["lib"]
21
26
 
22
27
  s.add_dependency 'multi_json', '~> 1.3'
23
- s.add_runtime_dependency 'omniauth-oauth2', '~> 1.3'
24
- s.add_runtime_dependency 'coinbase', '~> 2.0'
25
- s.add_development_dependency 'rspec', '~> 2.7'
28
+ s.add_runtime_dependency 'omniauth-oauth2', '~> 1.2'
29
+ s.add_runtime_dependency 'coinbase', '~> 4.0'
30
+ s.add_development_dependency 'rspec', '~> 3.0'
26
31
  s.add_development_dependency 'rack-test', '~> 0.6'
27
32
  s.add_development_dependency 'simplecov', '~> 0.10'
28
33
  s.add_development_dependency 'webmock', '~> 1.20'
@@ -11,7 +11,7 @@ describe OmniAuth::Strategies::Coinbase do
11
11
  end
12
12
 
13
13
  it 'should have correct site' do
14
- expect(subject.options.client_options.site).to eq('https://coinbase.com')
14
+ expect(subject.options.client_options.site).to eq('https://www.coinbase.com')
15
15
  end
16
16
  end
17
17
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-coinbase
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Palhas
8
+ - Alex Ianus
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2016-03-28 00:00:00.000000000 Z
12
+ date: 2015-08-26 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: multi_json
@@ -30,42 +31,42 @@ dependencies:
30
31
  requirements:
31
32
  - - "~>"
32
33
  - !ruby/object:Gem::Version
33
- version: '1.3'
34
+ version: '1.2'
34
35
  type: :runtime
35
36
  prerelease: false
36
37
  version_requirements: !ruby/object:Gem::Requirement
37
38
  requirements:
38
39
  - - "~>"
39
40
  - !ruby/object:Gem::Version
40
- version: '1.3'
41
+ version: '1.2'
41
42
  - !ruby/object:Gem::Dependency
42
43
  name: coinbase
43
44
  requirement: !ruby/object:Gem::Requirement
44
45
  requirements:
45
46
  - - "~>"
46
47
  - !ruby/object:Gem::Version
47
- version: '2.0'
48
+ version: '4.0'
48
49
  type: :runtime
49
50
  prerelease: false
50
51
  version_requirements: !ruby/object:Gem::Requirement
51
52
  requirements:
52
53
  - - "~>"
53
54
  - !ruby/object:Gem::Version
54
- version: '2.0'
55
+ version: '4.0'
55
56
  - !ruby/object:Gem::Dependency
56
57
  name: rspec
57
58
  requirement: !ruby/object:Gem::Requirement
58
59
  requirements:
59
60
  - - "~>"
60
61
  - !ruby/object:Gem::Version
61
- version: '2.7'
62
+ version: '3.0'
62
63
  type: :development
63
64
  prerelease: false
64
65
  version_requirements: !ruby/object:Gem::Requirement
65
66
  requirements:
66
67
  - - "~>"
67
68
  - !ruby/object:Gem::Version
68
- version: '2.7'
69
+ version: '3.0'
69
70
  - !ruby/object:Gem::Dependency
70
71
  name: rack-test
71
72
  requirement: !ruby/object:Gem::Requirement
@@ -111,6 +112,7 @@ dependencies:
111
112
  description: OmniAuth strategy for Coinbase
112
113
  email:
113
114
  - mpalhas@gmail.com
115
+ - hire@alexianus.com
114
116
  executables: []
115
117
  extensions: []
116
118
  extra_rdoc_files: []
@@ -128,11 +130,13 @@ files:
128
130
  - omniauth-coinbase.gemspec
129
131
  - spec/omniauth/strategies/coinbase_spec.rb
130
132
  - spec/spec_helper.rb
131
- homepage: https://github.com/naps62/omniauth-coinbase
133
+ homepage: https://github.com/coinbase/omniauth-coinbase
132
134
  licenses:
133
135
  - MIT
134
136
  metadata: {}
135
- post_install_message:
137
+ post_install_message: |
138
+ Do not upgrade an existing app to this version of omniauth-coinbase.
139
+ See the release notes in the README for more information.
136
140
  rdoc_options: []
137
141
  require_paths:
138
142
  - lib