paperlex 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/paperlex.rb +1 -0
- data/lib/paperlex/base/base.rb +2 -2
- data/lib/paperlex/contract.rb +31 -0
- data/lib/paperlex/contract/signatures.rb +31 -0
- data/lib/paperlex/signature.rb +9 -0
- data/lib/paperlex/slaw.rb +4 -4
- data/lib/paperlex/version.rb +1 -1
- metadata +6 -4
data/lib/paperlex.rb
CHANGED
data/lib/paperlex/base/base.rb
CHANGED
@@ -16,7 +16,7 @@ module Paperlex
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def get(url, attrs = {})
|
19
|
-
parse(RestClient
|
19
|
+
parse(RestClient.get("#{Paperlex.base_url}/#{url}?#{attrs.merge(:token => Paperlex.token).to_query}"))
|
20
20
|
end
|
21
21
|
|
22
22
|
def post(url, attrs = {})
|
@@ -28,7 +28,7 @@ module Paperlex
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def delete(url, attrs = {})
|
31
|
-
parse(RestClient
|
31
|
+
parse(RestClient.delete("#{Paperlex.base_url}/#{url}?#{attrs.merge(:token => Paperlex.token).to_query}"))
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
data/lib/paperlex/contract.rb
CHANGED
@@ -4,6 +4,7 @@ module Paperlex
|
|
4
4
|
|
5
5
|
extend ActiveSupport::Autoload
|
6
6
|
autoload :Signers
|
7
|
+
autoload :Signatures
|
7
8
|
autoload :Responses
|
8
9
|
autoload :ReviewSessions
|
9
10
|
autoload :Versions
|
@@ -134,6 +135,31 @@ module Paperlex
|
|
134
135
|
ReviewSessions[uuid].destroy(review_session_uuid)
|
135
136
|
end
|
136
137
|
|
138
|
+
# Signatures
|
139
|
+
# Requires access to the remote signature program:
|
140
|
+
# https://api.paperlex.com/remote_signature.html
|
141
|
+
def signatures=(signatures)
|
142
|
+
self[:signatures] = signatures.map {|signature| signature.is_a?(Paperlex::Signature) ? signature : Paperlex::Signature.new(signature.merge(:contract_uuid => uuid)) }
|
143
|
+
end
|
144
|
+
|
145
|
+
def fetch_signatures
|
146
|
+
self.signatures = Signatures[uuid].all
|
147
|
+
signatures
|
148
|
+
end
|
149
|
+
|
150
|
+
def fetch_signature(signature_uuid)
|
151
|
+
remove_signature!(signature_uuid)
|
152
|
+
new_signature = Signatures[uuid].find(signature_uuid)
|
153
|
+
self.signatures << new_signature
|
154
|
+
new_signature
|
155
|
+
end
|
156
|
+
|
157
|
+
def create_signature(attrs)
|
158
|
+
signature = Signatures[uuid].create(attrs)
|
159
|
+
self.signatures << signature
|
160
|
+
signature
|
161
|
+
end
|
162
|
+
|
137
163
|
# Versions
|
138
164
|
def versions
|
139
165
|
Versions[uuid].all.map {|version| Version.new(version) }
|
@@ -186,6 +212,11 @@ module Paperlex
|
|
186
212
|
signers.delete_if {|signer| signer['uuid'] == signer_uuid }
|
187
213
|
end
|
188
214
|
|
215
|
+
def remove_signature!(signature_to_remove)
|
216
|
+
signature_uuid = to_uuid(signature_to_remove)
|
217
|
+
signatures.delete_if {|signature| signature['uuid'] == signature_uuid }
|
218
|
+
end
|
219
|
+
|
189
220
|
def remove_review_session!(review_session_to_remove)
|
190
221
|
review_session_uuid = to_uuid(review_session_to_remove)
|
191
222
|
review_sessions.delete_if {|review_session| review_session['uuid'] == review_session_uuid }
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Paperlex
|
2
|
+
class Contract < Base
|
3
|
+
class Signatures < Paperlex::Base
|
4
|
+
include SubObject
|
5
|
+
|
6
|
+
class << self
|
7
|
+
def create_fields
|
8
|
+
[:signer, :identity, :remote_ip, :user_agent]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def object_class
|
13
|
+
Paperlex::Signature
|
14
|
+
end
|
15
|
+
|
16
|
+
def short_name
|
17
|
+
:signature
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def collection_url
|
23
|
+
"contracts/#{contract_uuid}/signatures.json"
|
24
|
+
end
|
25
|
+
|
26
|
+
def url_for(uuid)
|
27
|
+
"contracts/#{contract_uuid}/signatures/#{to_uuid(uuid)}.json"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
module Paperlex
|
2
|
+
class Signature < Base
|
3
|
+
property :contract_uuid, :required => true
|
4
|
+
property :signer_uuid, :required => true
|
5
|
+
property :identity_verification_method, :required => true
|
6
|
+
property :identity_verification_value, :required => true
|
7
|
+
property :created_at, :required => true
|
8
|
+
end
|
9
|
+
end
|
data/lib/paperlex/slaw.rb
CHANGED
@@ -29,14 +29,14 @@ module Paperlex
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
def html_url(responses = nil)
|
33
|
-
params =
|
32
|
+
def html_url(responses = nil, options = {})
|
33
|
+
params = options.merge(:token => Paperlex.token)
|
34
34
|
params[:responses] = responses if responses.present?
|
35
35
|
"#{Paperlex.base_url}/slaws/#{uuid}.html?#{params.to_query}"
|
36
36
|
end
|
37
37
|
|
38
|
-
def to_html(responses = nil)
|
39
|
-
RestClient.get(html_url(responses))
|
38
|
+
def to_html(responses = nil, options = {})
|
39
|
+
RestClient.get(html_url(responses, options))
|
40
40
|
end
|
41
41
|
|
42
42
|
def destroy
|
data/lib/paperlex/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paperlex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 51
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 4
|
10
|
+
version: 0.9.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Paperlex
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-01-
|
18
|
+
date: 2012-01-10 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rest-client
|
@@ -146,10 +146,12 @@ files:
|
|
146
146
|
- lib/paperlex/base/sub_object.rb
|
147
147
|
- lib/paperlex/contract/responses.rb
|
148
148
|
- lib/paperlex/contract/review_sessions.rb
|
149
|
+
- lib/paperlex/contract/signatures.rb
|
149
150
|
- lib/paperlex/contract/signers.rb
|
150
151
|
- lib/paperlex/contract/versions.rb
|
151
152
|
- lib/paperlex/contract.rb
|
152
153
|
- lib/paperlex/review_session.rb
|
154
|
+
- lib/paperlex/signature.rb
|
153
155
|
- lib/paperlex/signer.rb
|
154
156
|
- lib/paperlex/slaw/versions.rb
|
155
157
|
- lib/paperlex/slaw.rb
|