omniauth-docusign 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4e0611e5a7f5c77aad1c6dad229a2c3d01efb767
4
+ data.tar.gz: 12b47745c1a146fa04ceb7d4185a39ec7351890e
5
+ SHA512:
6
+ metadata.gz: eefc3d72a33115dd38600bc7ef5e5f9cac9206565158ca60518602c8ccb9fae8d4fdfc2bb7cd14dc9272b15b1cff946dfca44aaf0ad68c669ce212690320d18f
7
+ data.tar.gz: 96b3ba7cd0b3ef7aed92f4548b7abce28c14b6a926afeffa21d4eeed929de59b44f112e1c3c6014c3cc449aa8aabb2989b6775b67f34f068252f2125e275863a
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ /pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
data/.rubocop.yml ADDED
@@ -0,0 +1,16 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.2
3
+
4
+ Metrics/LineLength:
5
+ Max: 100
6
+
7
+ Style/Documentation:
8
+ Enabled: false
9
+
10
+ Style/FileName:
11
+ Exclude:
12
+ - 'lib/omniauth-docusign.rb'
13
+
14
+ Style/RegexpLiteral:
15
+ Exclude:
16
+ - 'Guardfile'
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth-docusign.gemspec
4
+ gemspec
5
+
6
+ group :development, :test do
7
+ gem 'guard'
8
+ gem 'guard-bundler'
9
+ gem 'guard-rspec'
10
+ gem 'guard-rubocop'
11
+ gem 'rb-fsevent'
12
+ end
data/Guardfile ADDED
@@ -0,0 +1,9 @@
1
+ guard 'bundler' do
2
+ watch('Gemfile')
3
+ watch('omniauth-docusign.gemspec')
4
+ end
5
+
6
+ guard :rubocop do
7
+ watch(%r{.+\.rb$})
8
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
9
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Jetbuilt
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # OmniAuth DocuSign
2
+
3
+ This is an unofficial OmniAuth strategy for authenticating to DocuSign. To get started, sign up
4
+ for a DocuSign sandbox account.
5
+
6
+ ## Basic Usage
7
+
8
+ use OmniAuth::Builder do
9
+ provider :docusign, ENV['DOCUSIGN_CLIENT_ID'], ENV['DOCUSIGN_CLIENT_SECRET'], sandbox: true
10
+ end
11
+
12
+ ## Auth Hash
13
+
14
+ The hash in `env['omniauth.auth']` will have the following information:
15
+
16
+ - in `credentials`:
17
+ - `token`: The access token.
18
+ - `refresh_token`: The refresh token. Use this to get a new token when the one in `token` has been expired.
19
+ - `expires_at`: Timestamp that indicates when `token` will expire.
20
+ - `expires`: `true`
21
+ - in `extra`:
22
+ - in `user_info`: The complete response from the `/oauth/getuserinfo` endpoint.
23
+ - in `info`:
24
+ - `uid`: The `accountId` of the first account returned by the /oauth/getuserinfo endpoint.
25
+ - `name`: The full name of the user_info
26
+ - `email`: The email of the user
27
+ - `base_uri`: The base uri that should be used to access the API for this user
28
+
29
+ - in `uid`: The account id of the first account the user belongs to
30
+
31
+ ## See Also
32
+
33
+ https://docs.docusign.com/esign/ has the DocuSign API documentation.
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env rake
2
+ require 'bundler/gem_tasks'
3
+ require 'rspec/core/rake_task'
4
+
5
+ desc 'Default: run specs.'
6
+ task default: :spec
7
+
8
+ desc 'Run specs'
9
+ RSpec::Core::RakeTask.new
@@ -0,0 +1,2 @@
1
+ require 'omniauth-docusign/version'
2
+ require 'omniauth/strategies/docusign'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module DocuSign
3
+ VERSION = '0.1.0'.freeze
4
+ end
5
+ end
@@ -0,0 +1,64 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class DocuSign < OmniAuth::Strategies::OAuth2
6
+ SANDBOX_URL = 'https://account-d.docusign.com'.freeze
7
+ PRODUCTION_URL = 'https://account.docusign.com'.freeze
8
+
9
+ option :client_options, {
10
+ authorize_url: "/oauth/auth",
11
+ token_url: "/oauth/token"
12
+ }
13
+
14
+ uid { user_info['accounts'].first['account_id'] }
15
+
16
+ info do
17
+ {
18
+ 'uid' => user_info['accounts'].first['account_id'],
19
+ 'name' => user_info['name'],
20
+ 'email' => user_info['email'],
21
+ 'base_uri' => user_info['accounts'].first['base_uri']
22
+ }
23
+ end
24
+
25
+ extra do
26
+ { 'user_info' => user_info }
27
+ end
28
+
29
+ # Overrride client to merge in site based on sandbox option
30
+ def client
31
+ ::OAuth2::Client.new(
32
+ options.client_id,
33
+ options.client_secret,
34
+ deep_symbolize(options.client_options).merge(site: site)
35
+ )
36
+ end
37
+
38
+ private
39
+
40
+ def site
41
+ options.sandbox ? SANDBOX_URL : PRODUCTION_URL
42
+ end
43
+
44
+ def user_info
45
+ return @user_info if @user_info
46
+
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|
53
+ req.url '/oauth/userinfo'
54
+ req.headers['Content-Type'] = 'application/json'
55
+ req.headers['Authorization'] = "Bearer #{access_token.token}"
56
+ end
57
+
58
+ @user_info = MultiJson.decode(response.body)
59
+ end
60
+ end
61
+ end
62
+ end
63
+
64
+ OmniAuth.config.add_camelization 'docusign', 'DocuSign'
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require File.expand_path('../lib/omniauth-docusign/version', __FILE__)
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.authors = ['Jared Moody']
7
+ gem.email = ['jared@jetbuilt.com']
8
+ gem.description = 'OmniAuth strategy for DocuSign.'
9
+ gem.summary = 'OmniAuth strategy for DocuSign.'
10
+ gem.homepage = 'https://github.com/jetbuilt/omniauth-docusign'
11
+ gem.licenses = 'MIT'
12
+
13
+ gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
14
+ gem.files = `git ls-files`.split("\n")
15
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ gem.name = 'omniauth-docusign'
17
+ gem.require_paths = ['lib']
18
+ gem.version = OmniAuth::DocuSign::VERSION
19
+
20
+ gem.add_dependency 'omniauth', '~> 1.0'
21
+ gem.add_dependency 'omniauth-oauth2', '~> 1.0'
22
+ gem.add_development_dependency 'rspec', '~> 2.7'
23
+ gem.add_development_dependency 'rack-test'
24
+ gem.add_development_dependency 'simplecov'
25
+ gem.add_development_dependency 'webmock'
26
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe OmniAuth::Strategies::DocuSign do
4
+ it 'should do some testing' do
5
+ pending
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ $LOAD_PATH.unshift File.expand_path('..', __FILE__)
2
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
3
+ require 'simplecov'
4
+ SimpleCov.start
5
+ require 'rspec'
6
+ require 'rack/test'
7
+ require 'webmock/rspec'
8
+ require 'omniauth'
9
+ require 'omniauth-docusign'
10
+
11
+ RSpec.configure do |config|
12
+ config.include WebMock::API
13
+ config.include Rack::Test::Methods
14
+ config.extend OmniAuth::Test::StrategyMacros, type: :strategy
15
+ end
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-docusign
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jared Moody
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-10-24 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.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: omniauth-oauth2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rack-test
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: OmniAuth strategy for DocuSign.
98
+ email:
99
+ - jared@jetbuilt.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - ".rubocop.yml"
107
+ - Gemfile
108
+ - Guardfile
109
+ - LICENSE
110
+ - README.md
111
+ - Rakefile
112
+ - lib/omniauth-docusign.rb
113
+ - lib/omniauth-docusign/version.rb
114
+ - lib/omniauth/strategies/docusign.rb
115
+ - omniauth-docusign.gemspec
116
+ - spec/omniauth/strategies/docusign_spec.rb
117
+ - spec/spec_helper.rb
118
+ homepage: https://github.com/jetbuilt/omniauth-docusign
119
+ licenses:
120
+ - MIT
121
+ metadata: {}
122
+ post_install_message:
123
+ rdoc_options: []
124
+ require_paths:
125
+ - lib
126
+ required_ruby_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ required_rubygems_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ requirements: []
137
+ rubyforge_project:
138
+ rubygems_version: 2.6.14
139
+ signing_key:
140
+ specification_version: 4
141
+ summary: OmniAuth strategy for DocuSign.
142
+ test_files:
143
+ - spec/omniauth/strategies/docusign_spec.rb
144
+ - spec/spec_helper.rb