universign 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rbenv-gemsets +1 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +46 -0
- data/Rakefile +6 -0
- data/lib/universign.rb +95 -0
- data/lib/universign/version.rb +3 -0
- data/universign.gemspec +32 -0
- metadata +113 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 245525f3efc297113fca60faf3bf2c6ead5fc5a5
|
|
4
|
+
data.tar.gz: 3abc3c7567d78ab23be9e466a3c106a9f7a72cdd
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: c17cd284fb8974340179d021ae75975ca4e969c44939998541f2e1d384660908ac6f06120a8cf6ca2feed3dc2e5599d88b4bfaa51abe3cbad50a62323c15589d
|
|
7
|
+
data.tar.gz: 5f2debbcc3d1973088ab5195c306d433a219c31ba979c51f7e40c170848fa0748ae5d8bef12416463518494e8e2cc8c47cd7a0dccc4688605e2638ddc8e54d81
|
data/.gitignore
ADDED
data/.rbenv-gemsets
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
-global
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 Matthieu Foillard
|
|
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
|
|
13
|
+
all 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
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Universign
|
|
2
|
+
|
|
3
|
+
A ruby client for the Universign XML-RPC api.
|
|
4
|
+
Note : VERY EXPERIMENTAL AND INCOMPLETE
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
Add this line to your application's Gemfile:
|
|
9
|
+
|
|
10
|
+
```ruby
|
|
11
|
+
gem 'universign'
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
And then execute:
|
|
15
|
+
|
|
16
|
+
$ bundle
|
|
17
|
+
|
|
18
|
+
Or install it yourself as:
|
|
19
|
+
|
|
20
|
+
$ gem install universign
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
### Test
|
|
25
|
+
|
|
26
|
+
See [test.rb](https://github.com/mgtf/universign/blob/master/spec/test.rb)
|
|
27
|
+
|
|
28
|
+
### Configuration options
|
|
29
|
+
|
|
30
|
+
```ruby
|
|
31
|
+
Universign.configure do |config|
|
|
32
|
+
config.user = '<usually your email>'
|
|
33
|
+
config.password = '<password>'
|
|
34
|
+
config.language = 'fr'
|
|
35
|
+
end
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Contributing
|
|
39
|
+
|
|
40
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mgtf/universign.
|
|
41
|
+
This project is intended to be a safe, welcoming space for collaboration, and contributors are
|
|
42
|
+
expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
43
|
+
|
|
44
|
+
## License
|
|
45
|
+
|
|
46
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/lib/universign.rb
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
require 'universign/version'
|
|
3
|
+
require 'base64'
|
|
4
|
+
require 'xmlrpc/client'
|
|
5
|
+
|
|
6
|
+
module Universign
|
|
7
|
+
|
|
8
|
+
class << self
|
|
9
|
+
attr_accessor :configuration
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.configure
|
|
13
|
+
self.configuration ||= Configuration.new
|
|
14
|
+
yield(configuration) if block_given?
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class Configuration
|
|
18
|
+
attr_accessor :language, :production, :user, :password, :debug,
|
|
19
|
+
:profile
|
|
20
|
+
|
|
21
|
+
def initialize
|
|
22
|
+
@language = 'en'
|
|
23
|
+
@debug = false
|
|
24
|
+
@production = false
|
|
25
|
+
@profile = 'default'
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
module Sign
|
|
30
|
+
|
|
31
|
+
class << self
|
|
32
|
+
|
|
33
|
+
def client
|
|
34
|
+
raise 'You need to set config options' if Universign.configuration.nil?
|
|
35
|
+
host = Universign.configuration.production ? 'sign.cryptolog.com' : 'sign.test.cryptolog.com'
|
|
36
|
+
path = '/sign/rpc'
|
|
37
|
+
client = Universign::Sign::Client.new(
|
|
38
|
+
host, path, nil, nil, nil, Universign.configuration.user, Universign.configuration.password, true
|
|
39
|
+
)
|
|
40
|
+
client.set_debug if Universign.configuration.debug
|
|
41
|
+
client
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.transactionSigner(phoneNum, emailAddress, firstname, lastname)
|
|
47
|
+
Signer.new(phoneNum, emailAddress, firstname, lastname)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.transactionDocument(content, name)
|
|
51
|
+
Document.new(XMLRPC::Base64.new(content), name)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
Document = Struct.new(:content, :name)
|
|
55
|
+
Signer = Struct.new(:phoneNum, :emailAddress, :firstname, :lastname)
|
|
56
|
+
|
|
57
|
+
class Client < XMLRPC::Client
|
|
58
|
+
|
|
59
|
+
ContractSignatureRequest = Struct.new(
|
|
60
|
+
:documents,
|
|
61
|
+
:signers,
|
|
62
|
+
:successUrl,
|
|
63
|
+
:failUrl,
|
|
64
|
+
:cancelUrl,
|
|
65
|
+
:handwrittenSignatureMode,
|
|
66
|
+
:profile,
|
|
67
|
+
:certificateType,
|
|
68
|
+
:language
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
# Request signature (Client side)
|
|
72
|
+
def requestTransaction(transactionSigners, transactionDocuments, successUrl, failUrl, cancelUrl)
|
|
73
|
+
transactionSigners = [transactionSigners] unless transactionSigners.is_a? Array
|
|
74
|
+
transactionDocuments = [transactionDocuments] unless transactionDocuments.is_a? Array
|
|
75
|
+
request = ContractSignatureRequest.new(
|
|
76
|
+
transactionDocuments,
|
|
77
|
+
transactionSigners,
|
|
78
|
+
successUrl,
|
|
79
|
+
failUrl,
|
|
80
|
+
cancelUrl,
|
|
81
|
+
0,
|
|
82
|
+
Universign.configuration.profile,
|
|
83
|
+
'simple',
|
|
84
|
+
Universign.configuration.language
|
|
85
|
+
)
|
|
86
|
+
call('requester.requestTransaction', request)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def set_debug
|
|
90
|
+
@http.set_debug_output($stderr);
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
data/universign.gemspec
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'universign/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = 'universign'
|
|
8
|
+
spec.version = Universign::VERSION
|
|
9
|
+
spec.authors = ['Matthieu Foillard']
|
|
10
|
+
spec.email = ['mgf@iotanet.net']
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{A ruby client for the Universign XML-RPC api}
|
|
13
|
+
spec.description = %q{A ruby client for the Universign XML-RPC api. Note : VERY EXPERIMENTAL AND INCOMPLETE}
|
|
14
|
+
spec.homepage = 'https://www.github.com/mgtf/universign'
|
|
15
|
+
spec.license = 'MIT'
|
|
16
|
+
|
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
|
19
|
+
if spec.respond_to?(:metadata)
|
|
20
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
|
21
|
+
else
|
|
22
|
+
raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
26
|
+
spec.require_paths = ['lib']
|
|
27
|
+
|
|
28
|
+
spec.add_development_dependency 'bundler', '~> 1.11'
|
|
29
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
|
30
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
31
|
+
spec.add_development_dependency 'pry'
|
|
32
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: universign
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Matthieu Foillard
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2016-01-27 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.11'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.11'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.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: '3.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '3.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: pry
|
|
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
|
+
description: 'A ruby client for the Universign XML-RPC api. Note : VERY EXPERIMENTAL
|
|
70
|
+
AND INCOMPLETE'
|
|
71
|
+
email:
|
|
72
|
+
- mgf@iotanet.net
|
|
73
|
+
executables: []
|
|
74
|
+
extensions: []
|
|
75
|
+
extra_rdoc_files: []
|
|
76
|
+
files:
|
|
77
|
+
- ".gitignore"
|
|
78
|
+
- ".rbenv-gemsets"
|
|
79
|
+
- ".rspec"
|
|
80
|
+
- ".travis.yml"
|
|
81
|
+
- Gemfile
|
|
82
|
+
- LICENSE.txt
|
|
83
|
+
- README.md
|
|
84
|
+
- Rakefile
|
|
85
|
+
- lib/universign.rb
|
|
86
|
+
- lib/universign/version.rb
|
|
87
|
+
- universign.gemspec
|
|
88
|
+
homepage: https://www.github.com/mgtf/universign
|
|
89
|
+
licenses:
|
|
90
|
+
- MIT
|
|
91
|
+
metadata:
|
|
92
|
+
allowed_push_host: https://rubygems.org
|
|
93
|
+
post_install_message:
|
|
94
|
+
rdoc_options: []
|
|
95
|
+
require_paths:
|
|
96
|
+
- lib
|
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
|
+
requirements:
|
|
99
|
+
- - ">="
|
|
100
|
+
- !ruby/object:Gem::Version
|
|
101
|
+
version: '0'
|
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
|
+
requirements:
|
|
104
|
+
- - ">="
|
|
105
|
+
- !ruby/object:Gem::Version
|
|
106
|
+
version: '0'
|
|
107
|
+
requirements: []
|
|
108
|
+
rubyforge_project:
|
|
109
|
+
rubygems_version: 2.4.5.1
|
|
110
|
+
signing_key:
|
|
111
|
+
specification_version: 4
|
|
112
|
+
summary: A ruby client for the Universign XML-RPC api
|
|
113
|
+
test_files: []
|