omniauth-hellosign 1.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 +9 -0
- data/Gemfile +4 -0
- data/README.md +53 -0
- data/lib/omniauth-hellosign.rb +2 -0
- data/lib/omniauth-hellosign/version.rb +5 -0
- data/lib/omniauth/strategies/hellosign.rb +44 -0
- data/omniauth-hellosign.gemspec +21 -0
- metadata +91 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ee1eb74480666e7b3a6a09667f532d33fe02921b
|
4
|
+
data.tar.gz: ee97dbab58895298563c63f73e814cf719d726d7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5390e0236fecacb577423de413c4cb5f9fcdb4f592eff3f3f8cf6733776c91210213796adb3d7be8f0e6b0f0fc38b9ce37d0af970db3fc1e75639573a51e5b69
|
7
|
+
data.tar.gz: c86c79339f1aced9d5bec7d855d7e6cdb9b4b6a634b5b8f35814edfff8400c0c8c412a9886fe8ecc15e12be4cea0dce7e02578808145d055d7bf87f5fd7d7a80
|
data/.gitignore
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile ~/.gitignore_global
|
6
|
+
|
7
|
+
Gemfile.lock
|
8
|
+
.project
|
9
|
+
*.gem
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# omniauth-hellosign
|
2
|
+
HelloSign Developer API OAuth 2.0 Strategy for OmniAuth.
|
3
|
+
|
4
|
+
## Installing
|
5
|
+
Add to your `Gemfile`:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'omniauth-hellosign'
|
9
|
+
```
|
10
|
+
|
11
|
+
Then `bundle install`.
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
`OmniAuth::Strategies::HelloSign` is simply a Rack middleware.Read the [OAuth 2.0](https://github.com/intridea/oauth2) docs for detailed instructions
|
15
|
+
|
16
|
+
Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
20
|
+
provider :hellosign, ENV['HELLOSIGN_CLIENT_ID'], ENV['HELLOSIGN_SECRET']
|
21
|
+
end
|
22
|
+
```
|
23
|
+
|
24
|
+
## Auth Hash
|
25
|
+
Here's an example [Auth Hash](https://github.com/intridea/omniauth/wiki/Auth-Hash-Schema) available in `request.env['omniauth.auth']`:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
{
|
29
|
+
:provider => 'hellosign',
|
30
|
+
:uid => '5008b25c7f67153e57d5a357b1687968068fb465',
|
31
|
+
:info => {
|
32
|
+
email: 'email@hellosign.com'
|
33
|
+
},
|
34
|
+
:credentials => {
|
35
|
+
:token => 'ABCDEF...', # access token, which you may wish to store
|
36
|
+
:secret => '1321747205', # access token secret
|
37
|
+
},
|
38
|
+
:extra => {
|
39
|
+
:raw_info => {
|
40
|
+
account_id: "5008b25c7f67153e57d5a357b1687968068fb465",
|
41
|
+
email_address: 'email@hellosign.com'
|
42
|
+
}
|
43
|
+
}
|
44
|
+
```
|
45
|
+
|
46
|
+
## License
|
47
|
+
Copyright (c) 2015 by Mahmoud Ali
|
48
|
+
|
49
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
50
|
+
|
51
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
52
|
+
|
53
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
class HelloSign < OmniAuth::Strategies::OAuth2
|
7
|
+
# Strategy name
|
8
|
+
option :name, "hellosign"
|
9
|
+
|
10
|
+
# Options being passed to initialize client from the OAuth Gem.
|
11
|
+
# Reference: https://github.com/oauth-xx/oauth-ruby
|
12
|
+
option :client_options, {
|
13
|
+
site: "https://www.hellosign.com",
|
14
|
+
authorize_url: "/oauth/authorize",
|
15
|
+
token_url: "/oauth/token"
|
16
|
+
}
|
17
|
+
|
18
|
+
# Called after authentication has succeeded.
|
19
|
+
uid {
|
20
|
+
raw_info['account_id']
|
21
|
+
}
|
22
|
+
|
23
|
+
info do
|
24
|
+
{
|
25
|
+
email: raw_info['email_address'] }
|
26
|
+
end
|
27
|
+
|
28
|
+
extra do
|
29
|
+
{
|
30
|
+
'raw_info' => raw_info
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
def raw_info
|
35
|
+
raw_info = access_token.get('/v3/account')
|
36
|
+
|
37
|
+
data = raw_info.read_body
|
38
|
+
data = (data ? JSON.parse(data) : {} )
|
39
|
+
data['account'] || {}
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
OmniAuth.config.add_camelization "hellosign", "HelloSign"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/omniauth-hellosign/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.add_runtime_dependency 'omniauth-oauth2', '~> 1.3', '>= 1.3.1'
|
6
|
+
gem.add_runtime_dependency 'json', '~> 1.8', '>= 1.8.0'
|
7
|
+
|
8
|
+
gem.authors = ["Mahmoud Ali"]
|
9
|
+
gem.email = ["m7moud.said@gmail.com"]
|
10
|
+
gem.summary = %q{HelloSign strategy for OmniAuth.}
|
11
|
+
gem.description = %q{HelloSign OAuth 2.0 strategy for OmniAuth.}
|
12
|
+
gem.homepage = "https://github.com/m7moud/omniauth-hellosign"
|
13
|
+
gem.license = "MIT"
|
14
|
+
|
15
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
16
|
+
gem.files = `git ls-files`.split("\n")
|
17
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
gem.name = "omniauth-hellosign"
|
19
|
+
gem.require_paths = ["lib"]
|
20
|
+
gem.version = OmniAuth::HelloSign::VERSION
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-hellosign
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mahmoud Ali
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: omniauth-oauth2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.3.1
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.3'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.3.1
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: json
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.8'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 1.8.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.8'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.8.0
|
53
|
+
description: HelloSign OAuth 2.0 strategy for OmniAuth.
|
54
|
+
email:
|
55
|
+
- m7moud.said@gmail.com
|
56
|
+
executables: []
|
57
|
+
extensions: []
|
58
|
+
extra_rdoc_files: []
|
59
|
+
files:
|
60
|
+
- ".gitignore"
|
61
|
+
- Gemfile
|
62
|
+
- README.md
|
63
|
+
- lib/omniauth-hellosign.rb
|
64
|
+
- lib/omniauth-hellosign/version.rb
|
65
|
+
- lib/omniauth/strategies/hellosign.rb
|
66
|
+
- omniauth-hellosign.gemspec
|
67
|
+
homepage: https://github.com/m7moud/omniauth-hellosign
|
68
|
+
licenses:
|
69
|
+
- MIT
|
70
|
+
metadata: {}
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options: []
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
requirements: []
|
86
|
+
rubyforge_project:
|
87
|
+
rubygems_version: 2.4.8
|
88
|
+
signing_key:
|
89
|
+
specification_version: 4
|
90
|
+
summary: HelloSign strategy for OmniAuth.
|
91
|
+
test_files: []
|