assently 1.0.0 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2dfe9ef608a7d4b21fefc72daf6e6bcbac12c324
4
- data.tar.gz: 933d4e2be8bd8dfc8fdf82e17c0277ce2d288110
3
+ metadata.gz: ae386da167d1126a40df180c207dfbd8e060f29a
4
+ data.tar.gz: 8146b97046c8cf296ca139c55a3edad5120cfca0
5
5
  SHA512:
6
- metadata.gz: ec3268fb2c1f49d750a79b6e1d3aa796ec48255b8be21f5eb999cf935a27044ecfba8b9661bc9b1d324d7d2ff909ab2428f957a4d0993a4d73919ebb558b820d
7
- data.tar.gz: 01abcc51f769c4fced4cbe3d264f9091187deae82a6821ec1c2bf5b81e82664e97fb6d2aaa3ef43a4ced399e2dac3bd147f7ebba4845f7333ec5fa9fcccd40bf
6
+ metadata.gz: a74f98aba88071dc62695b0b19efaadf1892198f8331ac9441e64a45fc7f3547f054565f0b1dacd153ea7ca345167b04245019b6e531df403cd4f9083f2dfa93
7
+ data.tar.gz: 98726b50af4b5a93efe470d4267811944652d93509a624f61f8e6ae597bdd4fd96de4d193f3029214796c6deab88cbd74c06da517e124d99338664075b51c7bf
data/README.md CHANGED
@@ -19,9 +19,10 @@ Ruby client for the [Assently API v2](https://assently.com/). Check out [the off
19
19
  | `remindcase ` | |
20
20
  | `deletecase ` | |
21
21
  | `recallcase ` | |
22
- | `findcases ` | |
22
+ | `findcases` | ✔️|
23
+ | `createcasefromtemplate ` | |
23
24
  | `findtemplates ` | |
24
- | `getdocumentdata ` | |
25
+ | `getdocumentdata` | ✔️ |
25
26
  | `createagent ` | |
26
27
  | `createssoticket ` | |
27
28
 
@@ -29,6 +29,14 @@ module Assently
29
29
  get "/api/v2/getcase", { id: id }
30
30
  end
31
31
 
32
+ def find_cases options = {}
33
+ get "/api/v2/findcases", options
34
+ end
35
+
36
+ def get_document_data case_id, document_id
37
+ get "/api/v2/getdocumentdata", { "caseId" => case_id, "documentId" => document_id }
38
+ end
39
+
32
40
  def post api_command, body = nil
33
41
  make_response make_post(api_command, body)
34
42
  end
@@ -1,3 +1,3 @@
1
1
  module Assently
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -0,0 +1,46 @@
1
+ require "spec_helper"
2
+ require "assently/client"
3
+
4
+ module Assently
5
+ describe Assently::Client do
6
+ let :client do
7
+ Assently::Client.new ENV["ASSENTLY_API_KEY"], ENV["ASSENTLY_API_SECRET"], :test
8
+ end
9
+
10
+ describe "#find_cases" do
11
+ describe "with no arguments" do
12
+ it "sends the findcase query" do
13
+ allow(client).to receive :get
14
+
15
+ client.find_cases
16
+
17
+ expect(client).to have_received(:get).with "/api/v2/findcases", {}
18
+ end
19
+ end
20
+
21
+ describe "with arguments" do
22
+ it "sends the findcase query" do
23
+ allow(client).to receive :get
24
+
25
+ client.find_cases("Status" => "Finished")
26
+
27
+ expect(client).to have_received(:get).with "/api/v2/findcases", { "Status" => "Finished"}
28
+ end
29
+ end
30
+
31
+ describe "it returns a list of cases", vcr: { cassette_name: "Assently_Client/_find_cases/cases" } do
32
+ describe "result" do
33
+ it "is successful" do
34
+ result = client.find_cases
35
+
36
+ expect(result.success?).to be true
37
+
38
+ expect(result.response.size).to eq 2
39
+ expect(result.response[0]["Id"]).to eq "1833fe9e-271d-45cc-a97a-3e4b1c800408"
40
+ expect(result.response[1]["Id"]).to eq "8174467c-3c3a-4f73-a96e-7166c998a648"
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -81,4 +81,3 @@ module Assently
81
81
  end
82
82
  end
83
83
  end
84
-
@@ -0,0 +1,65 @@
1
+ require "luhn"
2
+ require "securerandom"
3
+ require "spec_helper"
4
+
5
+ require "assently/client"
6
+ require "assently/case"
7
+ require "assently/document"
8
+ require "assently/party"
9
+
10
+ module Assently
11
+ describe Assently::Client do
12
+ let :client do
13
+ Assently::Client.new ENV["ASSENTLY_API_KEY"], ENV["ASSENTLY_API_SECRET"], :test
14
+ end
15
+
16
+ describe "#get_document_data" do
17
+ describe "with a case_id and document_id as argument" do
18
+ it "sends the getdocumentdata query with the case id and document id" do
19
+ allow(client).to receive :get
20
+
21
+ case_id = SecureRandom.uuid
22
+ document_id = SecureRandom.uuid
23
+
24
+ client.get_document_data case_id, document_id
25
+
26
+ expect(client).to have_received(:get).with "/api/v2/getdocumentdata", { "caseId" => case_id, "documentId" => document_id }
27
+ end
28
+ end
29
+
30
+ describe "when the case exists", vcr: { cassette_name: "Assently_Client/_get_document_data/case_exists" } do
31
+ let (:case_id) { "d9013f71-8983-4365-9450-19ea3c42cc90" }
32
+
33
+ before do
34
+ create_case case_id
35
+ end
36
+
37
+ describe "result" do
38
+ it "contains the file" do
39
+ exisiting_case = client.get_case(case_id).response
40
+ document_id = exisiting_case["Documents"][0]["Id"]
41
+
42
+ result = client.get_document_data exisiting_case["Id"], document_id
43
+
44
+ expect(result).to be_a Assently::Client::SuccessResult
45
+ expect(result.raw).to start_with("%PDF-1.3")
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+ private
52
+
53
+ def create_case case_id = nil
54
+ signature_case = Assently::Case.new "Agreement", ["touch"], id: case_id
55
+ signature_case.add_party Assently::Party.new_with_attributes({
56
+ name: "First Last",
57
+ email: "name@example.com",
58
+ social_security_number: Luhn::CivicNumber.generate
59
+ })
60
+ signature_case.add_document Assently::Document.new(File.join(Dir.pwd, "spec/fixtures/agreement.pdf"))
61
+
62
+ client.create_case signature_case
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://test.assently.com/api/v2/findcases
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Authorization:
13
+ - Basic <ASSENTLY_API_AUTH_HEADER>
14
+ Connection:
15
+ - close
16
+ Host:
17
+ - test.assently.com
18
+ User-Agent:
19
+ - http.rb/2.2.1
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Wed, 12 Jun 2019 07:34:21 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Content-Length:
30
+ - '50622'
31
+ Connection:
32
+ - close
33
+ Cache-Control:
34
+ - private, s-maxage=0
35
+ X-Frame-Options:
36
+ - SAMEORIGIN
37
+ Set-Cookie:
38
+ - sid=royhyla0yz2kjneee41puekh; path=/; HttpOnly
39
+ X-Subenvironment:
40
+ - Test
41
+ X-Content-Type-Options:
42
+ - nosniff
43
+ X-Xss-Protection:
44
+ - 1; mode=block
45
+ body:
46
+ encoding: UTF-8
47
+ string: '[
48
+ {
49
+ "Id":"1833fe9e-271d-45cc-a97a-3e4b1c800408",
50
+ "Status":"Sent"
51
+ },
52
+ {
53
+ "Id":"8174467c-3c3a-4f73-a96e-7166c998a648",
54
+ "Status":"Sent"
55
+ }]'
56
+ http_version:
57
+ recorded_at: Wed, 12 Jun 2019 07:34:21 GMT
58
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,173 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://test.assently.com/api/v2/createcase
6
+ body:
7
+ encoding: UTF-8
8
+ string: |-
9
+ {
10
+ "Id": "d9013f71-8983-4365-9450-19ea3c42cc90",
11
+ "Name": "Agreement",
12
+ "Documents": [
13
+ {
14
+ "Filename": "agreement.pdf",
15
+ "Data": ""
16
+ "ContentType": "application/pdf",
17
+ "Size": 6925,
18
+ "FormFields": [
19
+
20
+ ]
21
+ }
22
+ ],
23
+ "Parties": [
24
+ {
25
+ "Name": "First Last",
26
+ "EmailAddress": "name@example.com",
27
+ "SocialSecurityNumber": "1207269273"
28
+ }
29
+ ],
30
+ "AllowedSignatureTypes": [
31
+ "touch"
32
+ ]
33
+ }
34
+ headers:
35
+ Accept:
36
+ - application/json
37
+ Authorization:
38
+ - Basic <ASSENTLY_API_AUTH_HEADER>
39
+ Content-Type:
40
+ - application/json; charset=utf-8
41
+ Connection:
42
+ - close
43
+ Host:
44
+ - test.assently.com
45
+ User-Agent:
46
+ - http.rb/2.2.1
47
+ response:
48
+ status:
49
+ code: 200
50
+ message: OK
51
+ headers:
52
+ Date:
53
+ - Wed, 12 Jun 2019 08:28:36 GMT
54
+ Content-Length:
55
+ - '0'
56
+ Connection:
57
+ - close
58
+ Cache-Control:
59
+ - private, s-maxage=0
60
+ X-Frame-Options:
61
+ - SAMEORIGIN
62
+ Set-Cookie:
63
+ - sid=g5kgw2me5s3y0z3fzjoqoake; path=/; HttpOnly
64
+ X-Subenvironment:
65
+ - Test
66
+ X-Content-Type-Options:
67
+ - nosniff
68
+ X-Xss-Protection:
69
+ - 1; mode=block
70
+ body:
71
+ encoding: ASCII-8BIT
72
+ string: ''
73
+ http_version:
74
+ recorded_at: Wed, 12 Jun 2019 08:28:36 GMT
75
+ - request:
76
+ method: get
77
+ uri: https://test.assently.com/api/v2/getcase?id=d9013f71-8983-4365-9450-19ea3c42cc90
78
+ body:
79
+ encoding: US-ASCII
80
+ string: ''
81
+ headers:
82
+ Accept:
83
+ - application/json
84
+ Authorization:
85
+ - Basic <ASSENTLY_API_AUTH_HEADER>
86
+ Connection:
87
+ - close
88
+ Host:
89
+ - test.assently.com
90
+ User-Agent:
91
+ - http.rb/2.2.1
92
+ response:
93
+ status:
94
+ code: 200
95
+ message: OK
96
+ headers:
97
+ Date:
98
+ - Wed, 12 Jun 2019 08:28:36 GMT
99
+ Content-Type:
100
+ - application/json; charset=utf-8
101
+ Content-Length:
102
+ - '1818'
103
+ Connection:
104
+ - close
105
+ Cache-Control:
106
+ - private, s-maxage=0
107
+ X-Frame-Options:
108
+ - SAMEORIGIN
109
+ Set-Cookie:
110
+ - sid=f2kgfyffitgbwcrqo4rf3yyu; path=/; HttpOnly
111
+ X-Subenvironment:
112
+ - Test
113
+ X-Content-Type-Options:
114
+ - nosniff
115
+ X-Xss-Protection:
116
+ - 1; mode=block
117
+ body:
118
+ encoding: UTF-8
119
+ string: '{"Id":"d9013f71-8983-4365-9450-19ea3c42cc90","Status":"Draft","Name":"Agreement","NameAlias":"","AccountId":216,"MasterAccountId":null,"Parties":[{"Id":"ce67","Name":"First
120
+ Last","GroupName":null,"EmailAddress":"name@example.com","SocialSecurityNumber":"1207269273","EidSerialNumber":"","SignedOn":null,"SignatureData":null,"PartyUrl":"https://test.assently.com/c/uvfk9g-v1ghJaSNDhriKsTIc2OAxNWgRLSy4JclM/uvfk9g-v1giZ6PeF9mznemTpNewR-0GsOz0I8uXR","MobilePhone":"","Culture":"","AnyoneCanSign":false,"IpAddress":"","Provider":"Unknown","SignatureType":"Unknown","SignatureUrl":null}],"Documents":[{"Id":"aa0e","Filename":"agreement.pdf","Data":null,"ContentType":"application/pdf","Size":6925,"Hash":"c466b4b118f825d7fe38d8fc878874daf750160f1227e92a457857acb10b1534945804e0e7071f51696fe8ae5c874abf773ab851d4a35727f2876d87162d0813","Type":"Original","FormFields":{}}],"Visibility":"Group","AllowedSignatureTypes":["Touch"],"Description":"","Stakeholders":[],"Metadata":{},"CancelUrl":null,"ContinueUrl":"","ContinueName":"","ContinueAuto":false,"NotificationMethods":["Email"],"SendSignRequestEmailToParties":false,"SendFinishEmailToCreator":false,"SendFinishEmailToParties":false,"SendRecallEmailToParties":false,"RequestMessage":null,"RequestMessageSms":null,"FinishedMessage":null,"FinishedMessageSms":null,"Culture":"en-US","SignInSequence":false,"IdentityCheck":false,"IsEditable":false,"MergeOnSend":false,"UseGroupNames":false,"ExpireAfterDays":0,"ExpireOn":null,"RemindAfterDays":0,"RemindOn":null,"CreatedOn":"2019-06-12T08:28:36","TemplateId":null,"ApprovalRequired":false,"Approvers":[],"ApprovalRequestedOn":null,"SentOn":null,"ReminderSentOn":null,"Hash":null,"AgentUrl":"https://test.assently.com/a/case/view/d9013f71-8983-4365-9450-19ea3c42cc90","EventCallback":null,"Procedure":"Default","Rejected":null}'
121
+ http_version:
122
+ recorded_at: Wed, 12 Jun 2019 08:28:36 GMT
123
+ - request:
124
+ method: get
125
+ uri: https://test.assently.com/api/v2/getdocumentdata?caseId=d9013f71-8983-4365-9450-19ea3c42cc90&documentId=aa0e
126
+ body:
127
+ encoding: US-ASCII
128
+ string: ''
129
+ headers:
130
+ Accept:
131
+ - application/json
132
+ Authorization:
133
+ - Basic <ASSENTLY_API_AUTH_HEADER>
134
+ Connection:
135
+ - close
136
+ Host:
137
+ - test.assently.com
138
+ User-Agent:
139
+ - http.rb/2.2.1
140
+ response:
141
+ status:
142
+ code: 200
143
+ message: OK
144
+ headers:
145
+ Date:
146
+ - Wed, 12 Jun 2019 08:28:36 GMT
147
+ Content-Type:
148
+ - application/pdf
149
+ Content-Length:
150
+ - '6925'
151
+ Connection:
152
+ - close
153
+ Cache-Control:
154
+ - private, s-maxage=0
155
+ X-Frame-Options:
156
+ - SAMEORIGIN
157
+ Set-Cookie:
158
+ - sid=g1omepcbryvwj02rg32hcwp3; path=/; HttpOnly
159
+ Content-Disposition:
160
+ - attachment; filename=agreement.pdf
161
+ X-Subenvironment:
162
+ - Test
163
+ X-Content-Type-Options:
164
+ - nosniff
165
+ X-Xss-Protection:
166
+ - 1; mode=block
167
+ body:
168
+ encoding: ASCII-8BIT
169
+ string: !binary |-
170
+ JVBERi0xLjMKJcTl8uXrp/Og0MTGCjQgMCBvYmoKPDwgL0xlbmd0aCA1IDAgUiAvRmlsdGVyIC9GbGF0ZURlY29kZSA+PgpzdHJlYW0KeAFFjrEKwkA
171
+ http_version:
172
+ recorded_at: Wed, 12 Jun 2019 08:28:36 GMT
173
+ recorded_with: VCR 3.0.3
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assently
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Junström
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-02-20 00:00:00.000000000 Z
12
+ date: 2019-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: http
@@ -165,7 +165,9 @@ files:
165
165
  - spec/assently/case_event_subscription_spec.rb
166
166
  - spec/assently/case_spec.rb
167
167
  - spec/assently/client/create_case_spec.rb
168
+ - spec/assently/client/find_cases_spec.rb
168
169
  - spec/assently/client/get_case_spec.rb
170
+ - spec/assently/client/get_document_data_spec.rb
169
171
  - spec/assently/client_spec.rb
170
172
  - spec/assently/document_spec.rb
171
173
  - spec/assently/form_field_spec.rb
@@ -175,8 +177,10 @@ files:
175
177
  - spec/assently_spec.rb
176
178
  - spec/fixtures/agreement.pdf
177
179
  - spec/fixtures/cassettes/Assently_Client/_create_case/valid_case.yml
180
+ - spec/fixtures/cassettes/Assently_Client/_find_cases/cases.yml
178
181
  - spec/fixtures/cassettes/Assently_Client/_get_case/case_exists.yml
179
182
  - spec/fixtures/cassettes/Assently_Client/_get_case/case_missing.yml
183
+ - spec/fixtures/cassettes/Assently_Client/_get_document_data/case_exists.yml
180
184
  - spec/spec_helper.rb
181
185
  homepage: https://github.com/Oktavilla/assently-ruby
182
186
  licenses:
@@ -198,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
202
  version: '0'
199
203
  requirements: []
200
204
  rubyforge_project:
201
- rubygems_version: 2.6.8
205
+ rubygems_version: 2.6.10
202
206
  signing_key:
203
207
  specification_version: 4
204
208
  summary: Client for the Assently APIv2
@@ -212,7 +216,9 @@ test_files:
212
216
  - spec/assently/case_event_subscription_spec.rb
213
217
  - spec/assently/case_spec.rb
214
218
  - spec/assently/client/create_case_spec.rb
219
+ - spec/assently/client/find_cases_spec.rb
215
220
  - spec/assently/client/get_case_spec.rb
221
+ - spec/assently/client/get_document_data_spec.rb
216
222
  - spec/assently/client_spec.rb
217
223
  - spec/assently/document_spec.rb
218
224
  - spec/assently/form_field_spec.rb
@@ -222,6 +228,8 @@ test_files:
222
228
  - spec/assently_spec.rb
223
229
  - spec/fixtures/agreement.pdf
224
230
  - spec/fixtures/cassettes/Assently_Client/_create_case/valid_case.yml
231
+ - spec/fixtures/cassettes/Assently_Client/_find_cases/cases.yml
225
232
  - spec/fixtures/cassettes/Assently_Client/_get_case/case_exists.yml
226
233
  - spec/fixtures/cassettes/Assently_Client/_get_case/case_missing.yml
234
+ - spec/fixtures/cassettes/Assently_Client/_get_document_data/case_exists.yml
227
235
  - spec/spec_helper.rb