sign_host 0.0.1 → 0.0.2
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 +4 -4
- data/lib/sign_host/api_client.rb +36 -0
- data/lib/sign_host/version.rb +1 -1
- data/spec/fixtures/postback_transaction.json +1 -1
- data/spec/lib/sign_host/api_client_spec.rb +2 -2
- data/spec/spec_helper.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 560a5c4cb2422b2790683f09de351bd32de0dd6d
|
4
|
+
data.tar.gz: c3bedaaafee861baef7dbb39e68e7e7f0f1c210b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eaadb406ee3a0a7e79fb7684ced26d054bbbef1afa4e9b762ddf0bff6c2b8f7c2b5749add8bb22a28cb5fd035fe992a2607893b7b3ec739f72179632f9f1e8b3
|
7
|
+
data.tar.gz: c7f895f42f7cd935b1af5d10558f1468176c453f3f8e52de57dfabac866ef35d253759ec63320ce5e3e8517d3b87660a05cfc35e102c0a54eb6814232a18a714
|
data/lib/sign_host/api_client.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
|
1
3
|
module SignHost
|
2
4
|
class ApiClient
|
3
5
|
attr_reader :configuration
|
@@ -39,6 +41,32 @@ module SignHost
|
|
39
41
|
}
|
40
42
|
end
|
41
43
|
|
44
|
+
def get_signed_document(file_id)
|
45
|
+
RestClient.get(signed_document_url(file_id), auth_headers){ |response, request, result, &block |
|
46
|
+
case response.code
|
47
|
+
when 200
|
48
|
+
file = Tempfile.new(['receipt', '.pdf'])
|
49
|
+
file.write response.body
|
50
|
+
file.path
|
51
|
+
else
|
52
|
+
response.return!(request, result, &block)
|
53
|
+
end
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
def get_receipt(transaction_id)
|
58
|
+
RestClient.get(receipt_url(transaction_id), auth_headers){ |response, request, result, &block |
|
59
|
+
case response.code
|
60
|
+
when 200
|
61
|
+
file = Tempfile.new(['receipt', '.pdf'])
|
62
|
+
file.write response.body
|
63
|
+
file.path
|
64
|
+
else
|
65
|
+
response.return!(request, result, &block)
|
66
|
+
end
|
67
|
+
}
|
68
|
+
end
|
69
|
+
|
42
70
|
private
|
43
71
|
|
44
72
|
def new_transaction_url
|
@@ -53,6 +81,14 @@ module SignHost
|
|
53
81
|
api_url + "transaction/" + transaction_id
|
54
82
|
end
|
55
83
|
|
84
|
+
def signed_document_url(file_id)
|
85
|
+
api_url + "file/document/#{file_id}"
|
86
|
+
end
|
87
|
+
|
88
|
+
def receipt_url(transaction_id)
|
89
|
+
api_url + "file/receipt/#{transaction_id}"
|
90
|
+
end
|
91
|
+
|
56
92
|
def api_url
|
57
93
|
"https://api.signhost.com/api/"
|
58
94
|
end
|
data/lib/sign_host/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"Id":"a8056bf4-0c2a-47df-baa4-cd4363c182fd","Status":30,"File":{"Id":"32226fbe-3d00-414a-8901-1872110545b4","Name":"golang.pdf"},"Seal":false,"Signers":[{"Id":"ce3f4965-f61f-4efa-a0aa-29cf7d5409d2","Email":"sander.kuijper+test15@holder.nl","Mobile":"+31642715674","RequireScribble":true,"RequireEmailVerification":true,"RequireSmsVerification":false,"SendSignRequest":false,"ReturnUrl":null,"SignRequestMessage":null,"Reference":"Signer #x","Activities":[{"Id":"1ec33513-8104-4f27-8dcc-babe8d8bc15c","Activity":"Opened","CreatedDateTime":"2014-09-10T15:32:00.477"},{"Id":"40406c27-4b23-4bdd-8c33-f11e5507231d","Activity":"Signed","CreatedDateTime":"2014-09-10T15:32:41.068645+02:00"}],"RejectReason":null,"SignUrl":"https://woeler.signhost.com/sign/ce3f4965-f61f-4efa-a0aa-29cf7d5409d2","SignedDateTime":"2014-09-10T15:32:35.7022356+02:00","RejectDateTime":null,"CreatedDateTime":"2014-09-10T15:28:41.17","ModifiedDateTime":"2014-09-10T15:32:41.068645+02:00"}],"Reference":"Sander #15","PostbackUrl":"http://requestb.in/qs3youqs","CreatedDateTime":"2014-09-10T15:28:41.157","ModifiedDateTime":"2014-09-10T15:32:40.9750449+02:00","CanceledDateTime":null,"Checksum":"
|
1
|
+
{"Id":"a8056bf4-0c2a-47df-baa4-cd4363c182fd","Status":30,"File":{"Id":"32226fbe-3d00-414a-8901-1872110545b4","Name":"golang.pdf"},"Seal":false,"Signers":[{"Id":"ce3f4965-f61f-4efa-a0aa-29cf7d5409d2","Email":"sander.kuijper+test15@holder.nl","Mobile":"+31642715674","RequireScribble":true,"RequireEmailVerification":true,"RequireSmsVerification":false,"SendSignRequest":false,"ReturnUrl":null,"SignRequestMessage":null,"Reference":"Signer #x","Activities":[{"Id":"1ec33513-8104-4f27-8dcc-babe8d8bc15c","Activity":"Opened","CreatedDateTime":"2014-09-10T15:32:00.477"},{"Id":"40406c27-4b23-4bdd-8c33-f11e5507231d","Activity":"Signed","CreatedDateTime":"2014-09-10T15:32:41.068645+02:00"}],"RejectReason":null,"SignUrl":"https://woeler.signhost.com/sign/ce3f4965-f61f-4efa-a0aa-29cf7d5409d2","SignedDateTime":"2014-09-10T15:32:35.7022356+02:00","RejectDateTime":null,"CreatedDateTime":"2014-09-10T15:28:41.17","ModifiedDateTime":"2014-09-10T15:32:41.068645+02:00"}],"Reference":"Sander #15","PostbackUrl":"http://requestb.in/qs3youqs","CreatedDateTime":"2014-09-10T15:28:41.157","ModifiedDateTime":"2014-09-10T15:32:40.9750449+02:00","CanceledDateTime":null,"Checksum":"4b29d84bcd22d3565ca809a0b7971032343f17d1"}
|
@@ -17,8 +17,8 @@ describe SignHost::ApiClient do
|
|
17
17
|
with(:body => "{}",
|
18
18
|
:headers => {'Accept'=>'application/json',
|
19
19
|
'Accept-Encoding'=>'gzip, deflate',
|
20
|
-
'Application'=>"APPKey
|
21
|
-
'Authorization'=>"APIKey
|
20
|
+
'Application'=>"APPKey your app name your app key",
|
21
|
+
'Authorization'=>"APIKey your api key",
|
22
22
|
}).
|
23
23
|
to_return(:status => status, :body => load_signhost_fixture("successful_new_transaction"), :headers => {})
|
24
24
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -4,10 +4,10 @@ require "webmock/rspec"
|
|
4
4
|
require_relative "support/signhost_helper"
|
5
5
|
|
6
6
|
$configuration = SignHost::Configuration.new({
|
7
|
-
api_key: "
|
8
|
-
app_name: "
|
9
|
-
app_key: "
|
10
|
-
shared_secret: "
|
7
|
+
api_key: "your api key",
|
8
|
+
app_name: "your app name",
|
9
|
+
app_key: "your app key",
|
10
|
+
shared_secret: "your shared secret"
|
11
11
|
})
|
12
12
|
|
13
13
|
RSpec.configure do |config|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sign_host
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephan Kaag
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-11-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|