omniauth-docusign 0.1.0 → 0.2.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: 4e0611e5a7f5c77aad1c6dad229a2c3d01efb767
4
- data.tar.gz: 12b47745c1a146fa04ceb7d4185a39ec7351890e
2
+ SHA256:
3
+ metadata.gz: 5f9b8958f0f0a1589d79c5e4cc8198d2b64ed46f37260a00317c496f5bc26917
4
+ data.tar.gz: 897589dfa9c402b93a013c9cb099e184db6835c34fe914595ed00868d2cd46ba
5
5
  SHA512:
6
- metadata.gz: eefc3d72a33115dd38600bc7ef5e5f9cac9206565158ca60518602c8ccb9fae8d4fdfc2bb7cd14dc9272b15b1cff946dfca44aaf0ad68c669ce212690320d18f
7
- data.tar.gz: 96b3ba7cd0b3ef7aed92f4548b7abce28c14b6a926afeffa21d4eeed929de59b44f112e1c3c6014c3cc449aa8aabb2989b6775b67f34f068252f2125e275863a
6
+ metadata.gz: fd151994841348d5424bacfffd99866d6b65099b078e575f09a7a80562939e00018f954a1e2c2fcd0ac3ccd9cc51320d30fd9c588df4129f59427f5a52da2a48
7
+ data.tar.gz: 6e0f97ce78f57e1a7edf7cbd5c1a2c7b172726d50bb1c208dbbd878493a1455d8d1cf7aaf6c9d4ece0cb8ea0cf5bc14e4fe0ff2530636fae692799ac37957698
@@ -0,0 +1,23 @@
1
+ name: CI
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ ruby-version: ['2.7', '3.0', '3.1', '3.2']
11
+
12
+ steps:
13
+ - uses: actions/checkout@v3
14
+ - name: Set up Ruby ${{ matrix.ruby-version }}
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: ${{ matrix.ruby-version }}
18
+ bundler-cache: true # 'bundle install' and cache
19
+ - name: Rubocop
20
+ run: bundle exec rubocop
21
+
22
+ - name: RSpec
23
+ run: bundle exec rake
data/.rubocop.yml CHANGED
@@ -1,16 +1,28 @@
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rake
4
+ - rubocop-rspec
5
+
1
6
  AllCops:
2
- TargetRubyVersion: 2.2
7
+ NewCops: enable
8
+ TargetRubyVersion: 2.7
3
9
 
4
- Metrics/LineLength:
10
+ Layout/LineLength:
5
11
  Max: 100
6
12
 
7
- Style/Documentation:
8
- Enabled: false
9
-
10
- Style/FileName:
13
+ Naming/FileName:
11
14
  Exclude:
12
15
  - 'lib/omniauth-docusign.rb'
13
16
 
17
+ RSpec/FilePath:
18
+ Enabled: false
19
+ # This should work, but explodes
20
+ # CustomTransform:
21
+ # - OmniAuth: "omniauth"
22
+
23
+ Style/Documentation:
24
+ Enabled: false
25
+
14
26
  Style/RegexpLiteral:
15
27
  Exclude:
16
28
  - 'Guardfile'
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'http://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in omniauth-docusign.gemspec
data/Guardfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  guard 'bundler' do
2
4
  watch('Gemfile')
3
5
  watch('omniauth-docusign.gemspec')
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # OmniAuth DocuSign
2
2
 
3
+ ![Gem](https://img.shields.io/gem/v/omniauth-docusign.svg)
4
+ ![CI](https://img.shields.io/github/actions/workflow/status/Jetbuilt/omniauth-docusign/ci.yml?branch=main)
5
+
3
6
  This is an unofficial OmniAuth strategy for authenticating to DocuSign. To get started, sign up
4
7
  for a DocuSign sandbox account.
5
8
 
data/Rakefile CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env rake
2
+ # frozen_string_literal: true
3
+
2
4
  require 'bundler/gem_tasks'
3
5
  require 'rspec/core/rake_task'
4
6
 
@@ -1,23 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'omniauth-oauth2'
2
4
 
3
5
  module OmniAuth
4
6
  module Strategies
5
7
  class DocuSign < OmniAuth::Strategies::OAuth2
6
- SANDBOX_URL = 'https://account-d.docusign.com'.freeze
7
- PRODUCTION_URL = 'https://account.docusign.com'.freeze
8
+ SANDBOX_URL = 'https://account-d.docusign.com'
9
+ PRODUCTION_URL = 'https://account.docusign.com'
8
10
 
9
11
  option :client_options, {
10
- authorize_url: "/oauth/auth",
11
- token_url: "/oauth/token"
12
+ authorize_url: '/oauth/auth',
13
+ token_url: '/oauth/token'
12
14
  }
13
15
 
14
16
  uid { user_info['accounts'].first['account_id'] }
15
17
 
16
18
  info do
17
19
  {
18
- 'uid' => user_info['accounts'].first['account_id'],
19
- 'name' => user_info['name'],
20
- 'email' => user_info['email'],
20
+ 'uid' => user_info['accounts'].first['account_id'],
21
+ 'name' => user_info['name'],
22
+ 'email' => user_info['email'],
21
23
  'base_uri' => user_info['accounts'].first['base_uri']
22
24
  }
23
25
  end
@@ -44,18 +46,20 @@ module OmniAuth
44
46
  def user_info
45
47
  return @user_info if @user_info
46
48
 
47
- conn = Faraday.new(url: site) do |faraday|
48
- faraday.request :url_encoded
49
- faraday.adapter Faraday.default_adapter
50
- end
51
-
52
- response = conn.get do |req|
49
+ response = faraday_client.get do |req|
53
50
  req.url '/oauth/userinfo'
54
51
  req.headers['Content-Type'] = 'application/json'
55
52
  req.headers['Authorization'] = "Bearer #{access_token.token}"
56
53
  end
57
54
 
58
- @user_info = MultiJson.decode(response.body)
55
+ @user_info = JSON.parse(response.body)
56
+ end
57
+
58
+ def faraday_client
59
+ Faraday.new(url: site) do |faraday|
60
+ faraday.request :url_encoded
61
+ faraday.adapter Faraday.default_adapter
62
+ end
59
63
  end
60
64
  end
61
65
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OmniAuth
2
4
  module DocuSign
3
- VERSION = '0.1.0'.freeze
5
+ VERSION = '0.2.0'
4
6
  end
5
7
  end
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'omniauth-docusign/version'
2
4
  require 'omniauth/strategies/docusign'
@@ -1,6 +1,6 @@
1
- # -*- encoding: utf-8 -*-
1
+ # frozen_string_literal: true
2
2
 
3
- require File.expand_path('../lib/omniauth-docusign/version', __FILE__)
3
+ require File.expand_path('lib/omniauth-docusign/version', __dir__)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.authors = ['Jared Moody']
@@ -12,15 +12,21 @@ Gem::Specification.new do |gem|
12
12
 
13
13
  gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
14
14
  gem.files = `git ls-files`.split("\n")
15
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
15
  gem.name = 'omniauth-docusign'
17
16
  gem.require_paths = ['lib']
18
17
  gem.version = OmniAuth::DocuSign::VERSION
18
+ gem.required_ruby_version = '>= 2.7.0'
19
+ gem.metadata['rubygems_mfa_required'] = 'true'
19
20
 
20
- gem.add_dependency 'omniauth', '~> 1.0'
21
21
  gem.add_dependency 'omniauth-oauth2', '~> 1.0'
22
- gem.add_development_dependency 'rspec', '~> 2.7'
22
+
23
23
  gem.add_development_dependency 'rack-test'
24
+ gem.add_development_dependency 'rake', '~> 13.0'
25
+ gem.add_development_dependency 'rspec', '~> 3.12'
26
+ gem.add_development_dependency 'rubocop', '~> 1.41.0'
27
+ gem.add_development_dependency 'rubocop-performance', '~> 1.15.0'
28
+ gem.add_development_dependency 'rubocop-rake', '~> 0.6.0'
29
+ gem.add_development_dependency 'rubocop-rspec', '~> 2.16.0'
24
30
  gem.add_development_dependency 'simplecov'
25
31
  gem.add_development_dependency 'webmock'
26
32
  end
@@ -1,7 +1,41 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe OmniAuth::Strategies::DocuSign do
4
- it 'should do some testing' do
5
- pending
6
+ subject(:strategy) { described_class.new('USER', '123', sandbox: sandbox) }
7
+
8
+ let(:sandbox) { nil }
9
+
10
+ describe '#client' do
11
+ subject(:client) { strategy.client }
12
+
13
+ it 'uses the production site by default' do
14
+ expect(client.site).to eq(OmniAuth::Strategies::DocuSign::PRODUCTION_URL)
15
+ end
16
+
17
+ context 'when sandbox option is true' do
18
+ let(:sandbox) { true }
19
+
20
+ it 'uses the sandbox site' do
21
+ expect(client.site).to eq(OmniAuth::Strategies::DocuSign::SANDBOX_URL)
22
+ end
23
+ end
24
+ end
25
+
26
+ describe '#info.email' do
27
+ before do
28
+ allow(Faraday).to receive(:new).and_return(faraday_client)
29
+ allow(faraday_client).to receive(:get).and_return(faraday_response)
30
+ end
31
+
32
+ let(:faraday_client) { instance_double(Faraday::Connection) }
33
+ let(:faraday_response) { instance_double(Faraday::Response, body: JSON.generate(user_info)) }
34
+
35
+ let(:user_info) { { accounts: [{ account_id: '123' }], email: 'you@example.com' } }
36
+
37
+ it 'uses the email from the user info request' do
38
+ expect(strategy.info['email']).to eq('you@example.com')
39
+ end
6
40
  end
7
41
  end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,7 @@
1
- $LOAD_PATH.unshift File.expand_path('..', __FILE__)
2
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift File.expand_path(__dir__)
4
+ $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
3
5
  require 'simplecov'
4
6
  SimpleCov.start
5
7
  require 'rspec'
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-docusign
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Moody
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-24 00:00:00.000000000 Z
11
+ date: 2022-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: omniauth
14
+ name: omniauth-oauth2
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
@@ -25,47 +25,103 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: omniauth-oauth2
28
+ name: rack-test
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: '1.0'
34
- type: :runtime
47
+ version: '13.0'
48
+ type: :development
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: '1.0'
54
+ version: '13.0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rspec
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '2.7'
61
+ version: '3.12'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '2.7'
68
+ version: '3.12'
55
69
  - !ruby/object:Gem::Dependency
56
- name: rack-test
70
+ name: rubocop
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - ">="
73
+ - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '0'
75
+ version: 1.41.0
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - ">="
80
+ - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '0'
82
+ version: 1.41.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-performance
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 1.15.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 1.15.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.6.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.6.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 2.16.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 2.16.0
69
125
  - !ruby/object:Gem::Dependency
70
126
  name: simplecov
71
127
  requirement: !ruby/object:Gem::Requirement
@@ -101,6 +157,7 @@ executables: []
101
157
  extensions: []
102
158
  extra_rdoc_files: []
103
159
  files:
160
+ - ".github/workflows/ci.yml"
104
161
  - ".gitignore"
105
162
  - ".rspec"
106
163
  - ".rubocop.yml"
@@ -118,7 +175,8 @@ files:
118
175
  homepage: https://github.com/jetbuilt/omniauth-docusign
119
176
  licenses:
120
177
  - MIT
121
- metadata: {}
178
+ metadata:
179
+ rubygems_mfa_required: 'true'
122
180
  post_install_message:
123
181
  rdoc_options: []
124
182
  require_paths:
@@ -127,18 +185,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
185
  requirements:
128
186
  - - ">="
129
187
  - !ruby/object:Gem::Version
130
- version: '0'
188
+ version: 2.7.0
131
189
  required_rubygems_version: !ruby/object:Gem::Requirement
132
190
  requirements:
133
191
  - - ">="
134
192
  - !ruby/object:Gem::Version
135
193
  version: '0'
136
194
  requirements: []
137
- rubyforge_project:
138
- rubygems_version: 2.6.14
195
+ rubygems_version: 3.1.6
139
196
  signing_key:
140
197
  specification_version: 4
141
198
  summary: OmniAuth strategy for DocuSign.
142
- test_files:
143
- - spec/omniauth/strategies/docusign_spec.rb
144
- - spec/spec_helper.rb
199
+ test_files: []