omniauth-digitalocean 0.2.1 → 0.3.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
- SHA1:
3
- metadata.gz: 1392de35285d7885830f50bf169e2982cba5acc2
4
- data.tar.gz: cd023a08a1dbf6257f0815a93e874431b21e8a18
2
+ SHA256:
3
+ metadata.gz: 3089eb8b19cfd8d47ac49c23190f8adcd1d9a79f3907f64fc8db8e321403170a
4
+ data.tar.gz: f956c939c0da134ef87ae28ffcd06becad2fa5ec896d289ae384fe2c8297f461
5
5
  SHA512:
6
- metadata.gz: c8c54ed63b31841d3e4f13cf2735def74c7a6dc9db84844d0fba1c6287efa5ae68a8ace336bebef0eaec53595c2926aa03747af8e1651f5daa6fa8bccb712c36
7
- data.tar.gz: d30fe46823e69769910bf1d3459ae3342bef2efc9baede78c671ffd22e9732b23d9ac023cb3adffa61af7035b1ae6a010bbac363dcc99ef8c4231d68edead485
6
+ metadata.gz: dcbc6f42cba89176ac91ecdfac794c4e3214da3bb6c2b3e1be6d9516be526027d5a2c518021e44b9859c48cbe341675f38d422be67d9a7cd543039f5ac69ec2b
7
+ data.tar.gz: 93b9bd4d4541bb162253cf23d82e656a26f6156f50cd9c7ea8146d7593cde71493b70a9dac25ae4cc1033b92b1eb1fbc9d29218ad03c33bf42dd3a7241f55b6d
@@ -0,0 +1,36 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ test:
11
+ strategy:
12
+ fail-fast: true
13
+ matrix:
14
+ os: [ ubuntu-latest, macos-latest ]
15
+ ruby: [ 2.5, 2.6, 2.7 ]
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v2
19
+ - uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby }}
22
+
23
+ # Cache dependencies.
24
+ - uses: actions/cache@v1
25
+ with:
26
+ path: vendor/bundle
27
+ key: bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/Gemfile.lock') }}
28
+ restore-keys: |
29
+ bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby }}-
30
+ - name: Setup
31
+ run: |
32
+ gem install bundler
33
+ bundle install --jobs 4 --retry 3
34
+ - name: Test
35
+ run: |
36
+ bundle exec rspec ./spec
@@ -0,0 +1,38 @@
1
+ # Publishes Ruby Gem for release when a tag is created
2
+ # that matches the pattern "v*" (ie. v0.1.0).
3
+ name: Publish Ruby Gem
4
+
5
+ on:
6
+ push:
7
+ tags:
8
+ - 'v*'
9
+
10
+ jobs:
11
+ build:
12
+ name: Build + Publish
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+
18
+ - uses: actions/setup-ruby@v1
19
+ with:
20
+ ruby-version: 2.6
21
+
22
+ - uses: actions/cache@v1
23
+ with:
24
+ path: vendor/bundle
25
+ key: bundle-use-ruby-ubuntu-latest-2.6-${{ hashFiles('**/Gemfile.lock') }}
26
+ restore-keys: |
27
+ bundle-use-ruby-ubuntu-latest-2.6-
28
+
29
+ - name: Publish to RubyGems
30
+ run: |
31
+ mkdir -p $HOME/.gem
32
+ touch $HOME/.gem/credentials
33
+ chmod 0600 $HOME/.gem/credentials
34
+ printf -- "---\n:rubygems_api_key: ${RUBYGEMS_AUTH_TOKEN}\n" > $HOME/.gem/credentials
35
+ gem build *.gemspec
36
+ gem push *.gem
37
+ env:
38
+ RUBYGEMS_AUTH_TOKEN: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Digitalocean
3
- VERSION = "0.2.1"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -11,6 +11,7 @@ module OmniAuth
11
11
  class Digitalocean < OmniAuth::Strategies::OAuth2
12
12
  AUTHENTICATION_PARAMETERS = %w(display account state scope)
13
13
  BASE_URL = "https://cloud.digitalocean.com"
14
+ API_URL = "https://api.digitalocean.com"
14
15
 
15
16
  option :name, "digitalocean"
16
17
 
@@ -30,6 +31,10 @@ module OmniAuth
30
31
 
31
32
  option :authorize_options, AUTHENTICATION_PARAMETERS
32
33
 
34
+ extra do
35
+ raw_info.parsed['account']
36
+ end
37
+
33
38
  uid do
34
39
  access_token.params['info']['uuid']
35
40
  end
@@ -58,6 +63,10 @@ module OmniAuth
58
63
  super
59
64
  end
60
65
 
66
+ def raw_info
67
+ @raw_info ||= access_token.get("#{API_URL}/v2/account")
68
+ end
69
+
61
70
  ##
62
71
  # You can pass +display+, +state+ or +scope+ params to the auth request, if
63
72
  # you need to set them dynamically. You can also set these options
@@ -5,11 +5,11 @@ require 'omniauth-digitalocean/version'
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "omniauth-digitalocean"
7
7
  spec.version = Omniauth::Digitalocean::VERSION
8
- spec.authors = ["Phillip Baker"]
9
- spec.email = ["phillip@digitalocean.com"]
8
+ spec.authors = ["DigitalOcean API Engineering team"]
9
+ spec.email = ["api-engineering@digitalocean.com"]
10
10
  spec.summary = %q{Official OmniAuth strategy for Digitalocean}
11
11
  spec.description = %q{Official OmniAuth strategy for Digitalocean}
12
- spec.homepage = ""
12
+ spec.homepage = "https://github.com/digitalocean/omniauth-digitalocean"
13
13
  spec.license = "MIT"
14
14
 
15
15
  spec.files = `git ls-files`.split($/)
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.add_dependency "omniauth", "~> 1.0"
21
21
  spec.add_dependency "omniauth-oauth2", "~> 1.0"
22
22
 
23
- spec.add_development_dependency "bundler", "~> 1.5"
23
+ spec.add_development_dependency "bundler", "~> 2.0"
24
24
  spec.add_development_dependency "rake"
25
25
  spec.add_development_dependency "rspec", "~> 2.7"
26
26
  spec.add_development_dependency "rack-test"
@@ -22,7 +22,18 @@ describe OmniAuth::Strategies::Digitalocean do
22
22
  }
23
23
  }
24
24
  }
25
- let(:access_token) { double('AccessToken', params: response_params) }
25
+ let(:account_response) {
26
+ { 'account' =>
27
+ {
28
+ 'droplet_limit' => 25,
29
+ 'email' => 'foo@example.com',
30
+ 'uuid' => 'b6fc48dbf6d990634ce5f3c78dc9851e757381ef',
31
+ 'email_verified' => true
32
+ }
33
+ }
34
+ }
35
+ let(:account_json) { double(:json, parsed: account_response) }
36
+ let(:access_token) { double('AccessToken', params: response_params, get: account_json) }
26
37
 
27
38
  before do
28
39
  allow(subject).to receive(:access_token).and_return(access_token)
@@ -33,5 +44,14 @@ describe OmniAuth::Strategies::Digitalocean do
33
44
  expect(subject.uid).to eq(uuid)
34
45
  end
35
46
  end
47
+
48
+ describe '#extra' do
49
+ it 'includes the information returned from the account endpoint' do
50
+ expect(subject.extra['droplet_limit']).to eq(25)
51
+ expect(subject.extra['email']).to eq("foo@example.com")
52
+ expect(subject.extra['uuid']).to eq("b6fc48dbf6d990634ce5f3c78dc9851e757381ef")
53
+ expect(subject.extra['email_verified']).to eq(true)
54
+ end
55
+ end
36
56
  end
37
57
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-digitalocean
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
- - Phillip Baker
7
+ - DigitalOcean API Engineering team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-12 00:00:00.000000000 Z
11
+ date: 2021-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.5'
47
+ version: '2.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.5'
54
+ version: '2.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -124,13 +124,14 @@ dependencies:
124
124
  version: '0'
125
125
  description: Official OmniAuth strategy for Digitalocean
126
126
  email:
127
- - phillip@digitalocean.com
127
+ - api-engineering@digitalocean.com
128
128
  executables: []
129
129
  extensions: []
130
130
  extra_rdoc_files: []
131
131
  files:
132
+ - ".github/workflows/ci.yaml"
133
+ - ".github/workflows/release.yaml"
132
134
  - ".gitignore"
133
- - ".travis.yml"
134
135
  - Gemfile
135
136
  - LICENSE.txt
136
137
  - README.md
@@ -144,7 +145,7 @@ files:
144
145
  - omniauth-digitalocean.gemspec
145
146
  - spec/omniauth/strategies/digitalocean_spec.rb
146
147
  - spec/spec_helper.rb
147
- homepage: ''
148
+ homepage: https://github.com/digitalocean/omniauth-digitalocean
148
149
  licenses:
149
150
  - MIT
150
151
  metadata: {}
@@ -163,8 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
164
  - !ruby/object:Gem::Version
164
165
  version: '0'
165
166
  requirements: []
166
- rubyforge_project:
167
- rubygems_version: 2.4.6
167
+ rubygems_version: 3.0.3
168
168
  signing_key:
169
169
  specification_version: 4
170
170
  summary: Official OmniAuth strategy for Digitalocean
@@ -1,14 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
-
4
- install:
5
- - "gem install bundler"
6
- - "bundle install --jobs=3 --retry=3"
7
-
8
- rvm:
9
- - "2.0.0"
10
- - "2.1.5"
11
- - "2.2.0"
12
-
13
- script:
14
- - bundle exec rspec ./spec