signaturit-sdk 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +2 -0
- data/Rakefile +1 -5
- data/lib/signaturit_client.rb +382 -4
- data/signaturit-sdk.gemspec +1 -1
- data/test/test_signaturit_client.rb +308 -1
- metadata +6 -12
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0155dec9b1d7ef4d3fcdce0c2daa7de9dc28ff69
|
4
|
+
data.tar.gz: f7a1cb65fd4c17ecd923651003431c481414abf1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2b179e179c59802fc23be8b074aa055ab715e2498567d5d0c62c24ea7e79c10992fe408c0c3e581ac56cfbd6b0bd1dfc09abcb87ef3db70f5d9d0d75e5bfa290
|
7
|
+
data.tar.gz: 7af59c75dc582195225af601696b9034460568e8872f169bbbde9670039fc1a3e216e573c4df2a3d0e915d4bffc9b9dbc4ee91ad240e857290eaeb08234a45b7
|
data/CHANGELOG.md
CHANGED
data/Rakefile
CHANGED
@@ -12,11 +12,7 @@ task :release => :build do
|
|
12
12
|
puts 'You must be on the master branch to release!'
|
13
13
|
exit!
|
14
14
|
end
|
15
|
-
|
16
|
-
sh "git commit --allow-empty -m 'Release :gem: #{spec.version}'"
|
17
|
-
sh "git tag #{spec.version}"
|
18
|
-
sh 'git push origin master'
|
19
|
-
sh "git push origin #{spec.version}"
|
15
|
+
|
20
16
|
sh "gem push pkg/signaturit-sdk-#{spec.version}.gem"
|
21
17
|
end
|
22
18
|
|
data/lib/signaturit_client.rb
CHANGED
@@ -11,7 +11,7 @@ class SignaturitClient
|
|
11
11
|
def initialize(token, production = false)
|
12
12
|
base = production ? 'https://api.signaturit.com' : 'https://api.sandbox.signaturit.com'
|
13
13
|
|
14
|
-
@client = RestClient::Resource.new base, :headers => { :Authorization => "Bearer #{token}", :user_agent => 'signaturit-ruby-sdk 1.
|
14
|
+
@client = RestClient::Resource.new base, :headers => { :Authorization => "Bearer #{token}", :user_agent => 'signaturit-ruby-sdk 1.1.0' }, :ssl_version => :TLSv1_2
|
15
15
|
end
|
16
16
|
|
17
17
|
# Get a concrete signature object
|
@@ -77,6 +77,14 @@ class SignaturitClient
|
|
77
77
|
params[:recipients] = {}
|
78
78
|
|
79
79
|
[recipients].flatten.each_with_index do |recipient, index|
|
80
|
+
# if only email is given, transform it to a object
|
81
|
+
recipient = { email: recipient, name: recipient } if recipient.is_a? String
|
82
|
+
|
83
|
+
# workaround for a bug in rest_client not dealing with objects inside an array
|
84
|
+
if recipient[:require_signature_in_coordinates]
|
85
|
+
recipient[:require_signature_in_coordinates] = array2hash recipient[:require_signature_in_coordinates]
|
86
|
+
end
|
87
|
+
|
80
88
|
params[:recipients][index] = recipient
|
81
89
|
end
|
82
90
|
|
@@ -126,7 +134,7 @@ class SignaturitClient
|
|
126
134
|
request :post, "/v3/brandings.json", params
|
127
135
|
end
|
128
136
|
|
129
|
-
# Update
|
137
|
+
# Update an existing branding
|
130
138
|
#
|
131
139
|
# Params:
|
132
140
|
# +branding_id+:: Id of the branding to update
|
@@ -207,15 +215,385 @@ class SignaturitClient
|
|
207
215
|
# Get the audit trail of concrete certificate
|
208
216
|
#
|
209
217
|
# Params:
|
210
|
-
# +email_id++:: The id of the
|
211
|
-
# +certificate_id++:: The id of the
|
218
|
+
# +email_id++:: The id of the email object
|
219
|
+
# +certificate_id++:: The id of the certificate object
|
212
220
|
def download_email_audit_trail(email_id, certificate_id)
|
213
221
|
request :get, "/v3/emails/#{email_id}/certificates/#{certificate_id}/download/audit_trail", {}, false
|
214
222
|
end
|
215
223
|
|
224
|
+
# Get all SMS
|
225
|
+
#
|
226
|
+
# Params:
|
227
|
+
# +limit+:: Maximum number of results to return
|
228
|
+
# +offset+:: Offset of results to skip
|
229
|
+
# +conditions+:: Query conditions
|
230
|
+
def get_sms(limit = 100, offset = 0, conditions = {})
|
231
|
+
params = extract_query_params conditions
|
232
|
+
|
233
|
+
params['limit'] = limit
|
234
|
+
params['offset'] = offset
|
235
|
+
|
236
|
+
request :get, "/v3/sms.json", params
|
237
|
+
end
|
238
|
+
|
239
|
+
# Count all SMS
|
240
|
+
#
|
241
|
+
# Params:
|
242
|
+
# +conditions+:: Query conditions
|
243
|
+
def count_sms(conditions = {})
|
244
|
+
params = extract_query_params conditions
|
245
|
+
|
246
|
+
request :get, "/v3/sms/count.json", params
|
247
|
+
end
|
248
|
+
|
249
|
+
# Get a single SMS
|
250
|
+
#
|
251
|
+
# Params:
|
252
|
+
# +sms_id+:: Id of SMS
|
253
|
+
def get_single_sms(sms_id)
|
254
|
+
request :get, "/v3/sms/#{sms_id}.json"
|
255
|
+
end
|
256
|
+
|
257
|
+
# Create a new SMS
|
258
|
+
#
|
259
|
+
# Params:
|
260
|
+
# +files+:: File or files to send with the SMS
|
261
|
+
# +recipients+:: Recipients for the SMS
|
262
|
+
# +body+:: SMS body
|
263
|
+
# +params+:: Extra params
|
264
|
+
def create_sms(files, recipients, body, params = {})
|
265
|
+
params[:recipients] = {}
|
266
|
+
|
267
|
+
[recipients].flatten.each_with_index do |recipient, index|
|
268
|
+
params[:recipients][index] = recipient
|
269
|
+
end
|
270
|
+
|
271
|
+
if files
|
272
|
+
params[:attachments] = [files].flatten.map do |filepath|
|
273
|
+
File.new(filepath, 'rb')
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
params[:body] = body
|
278
|
+
|
279
|
+
request :post, "/v3/sms.json", params
|
280
|
+
end
|
281
|
+
|
282
|
+
# Get the audit trail of concrete certificate
|
283
|
+
#
|
284
|
+
# Params:
|
285
|
+
# +sms_id++:: The id of the SMS object
|
286
|
+
# +certificate_id++:: The id of the certificate object
|
287
|
+
def download_sms_audit_trail(sms_id, certificate_id)
|
288
|
+
request :get, "/v3/sms/#{sms_id}/certificates/#{certificate_id}/download/audit_trail", {}, false
|
289
|
+
end
|
290
|
+
|
291
|
+
# Get all subscription
|
292
|
+
#
|
293
|
+
# Params:
|
294
|
+
# +limit+:: Maximum number of results to return
|
295
|
+
# +offset+:: Offset of results to skip
|
296
|
+
# +conditions+:: Query conditions
|
297
|
+
def get_subscriptions(limit = 100, offset = 0, conditions = {})
|
298
|
+
params = extract_query_params conditions
|
299
|
+
|
300
|
+
params['limit'] = limit
|
301
|
+
params['offset'] = offset
|
302
|
+
|
303
|
+
request :get, "/v3/subscriptions.json", params
|
304
|
+
end
|
305
|
+
|
306
|
+
# Count all subscription
|
307
|
+
#
|
308
|
+
# Params:
|
309
|
+
# +conditions+:: Query conditions
|
310
|
+
def count_subscriptions(conditions = {})
|
311
|
+
params = extract_query_params conditions
|
312
|
+
|
313
|
+
request :get, "/v3/subscriptions/count.json", params
|
314
|
+
end
|
315
|
+
|
316
|
+
# Get a single subscription
|
317
|
+
#
|
318
|
+
# Params:
|
319
|
+
# +subscription_id+:: Id of subscription
|
320
|
+
def get_subscription(subscription_id)
|
321
|
+
request :get, "/v3/subscriptions/#{subscription_id}.json"
|
322
|
+
end
|
323
|
+
|
324
|
+
# Create a new subscription
|
325
|
+
#
|
326
|
+
# Params:
|
327
|
+
# +url+:: A url where to send the events.
|
328
|
+
# +events+:: The list of events to subscribe.
|
329
|
+
def create_subscription(url, events)
|
330
|
+
params = { url: url, events: events }
|
331
|
+
|
332
|
+
request :post, "/v3/subscriptions.json", params
|
333
|
+
end
|
334
|
+
|
335
|
+
# Update an existing subscription
|
336
|
+
#
|
337
|
+
# Params:
|
338
|
+
# +subscription_id+:: Id of the subscription to update
|
339
|
+
# +params+:: Same params as method create_subscription, see above
|
340
|
+
def update_subscription(subscription_id, params)
|
341
|
+
request :patch, "/v3/subscriptions/#{subscription_id}.json", params
|
342
|
+
end
|
343
|
+
|
344
|
+
# Delete an existing subscription
|
345
|
+
#
|
346
|
+
# Params:
|
347
|
+
# +subscription_id+:: Id of the subscription to update
|
348
|
+
def delete_subscription(subscription_id)
|
349
|
+
request :delete, "/v3/subscriptions/#{subscription_id}.json"
|
350
|
+
end
|
351
|
+
|
352
|
+
# Get all contacts
|
353
|
+
#
|
354
|
+
# Params:
|
355
|
+
# +limit+:: Maximum number of results to return
|
356
|
+
# +offset+:: Offset of results to skip
|
357
|
+
# +conditions+:: Query conditions
|
358
|
+
def get_contacts(limit = 100, offset = 0, conditions = {})
|
359
|
+
params = extract_query_params conditions
|
360
|
+
|
361
|
+
params['limit'] = limit
|
362
|
+
params['offset'] = offset
|
363
|
+
|
364
|
+
request :get, "/v3/contacts.json", params
|
365
|
+
end
|
366
|
+
|
367
|
+
# Count all contacts
|
368
|
+
#
|
369
|
+
# Params:
|
370
|
+
# +conditions+:: Query conditions
|
371
|
+
def count_contacts(conditions = {})
|
372
|
+
params = extract_query_params conditions
|
373
|
+
|
374
|
+
request :get, "/v3/contacts/count.json", params
|
375
|
+
end
|
376
|
+
|
377
|
+
# Get a single contact
|
378
|
+
#
|
379
|
+
# Params:
|
380
|
+
# +contact_id+:: Id of contact
|
381
|
+
def get_contact(contact_id)
|
382
|
+
request :get, "/v3/contacts/#{contact_id}.json"
|
383
|
+
end
|
384
|
+
|
385
|
+
# Create a new contact
|
386
|
+
#
|
387
|
+
# Params:
|
388
|
+
# +email+:: Contact email
|
389
|
+
# +name+:: Contact name
|
390
|
+
def create_contact(email, name)
|
391
|
+
params = { email: email, name: name }
|
392
|
+
|
393
|
+
request :post, "/v3/contacts.json", params
|
394
|
+
end
|
395
|
+
|
396
|
+
# Update an existing contact
|
397
|
+
#
|
398
|
+
# Params:
|
399
|
+
# +contact_id+:: Id of the contact to update
|
400
|
+
# +params+:: Same params as method create_contact, see above
|
401
|
+
def update_contact(contact_id, params)
|
402
|
+
request :patch, "/v3/contacts/#{contact_id}.json", params
|
403
|
+
end
|
404
|
+
|
405
|
+
# Delete an existing contact
|
406
|
+
#
|
407
|
+
# Params:
|
408
|
+
# +contact_id+:: Id of the contact to update
|
409
|
+
def delete_contact(contact_id)
|
410
|
+
request :delete, "/v3/contacts/#{contact_id}.json"
|
411
|
+
end
|
412
|
+
|
413
|
+
# Get all users
|
414
|
+
#
|
415
|
+
# Params:
|
416
|
+
# +limit+:: Maximum number of results to return
|
417
|
+
# +offset+:: Offset of results to skip
|
418
|
+
# +conditions+:: Query conditions
|
419
|
+
def get_users(limit = 100, offset = 0, conditions = {})
|
420
|
+
params = extract_query_params conditions
|
421
|
+
|
422
|
+
params['limit'] = limit
|
423
|
+
params['offset'] = offset
|
424
|
+
|
425
|
+
request :get, "/v3/team/users.json", params
|
426
|
+
end
|
427
|
+
|
428
|
+
# Get a single user
|
429
|
+
#
|
430
|
+
# Params:
|
431
|
+
# +user_id+:: Id of user
|
432
|
+
def get_user(user_id)
|
433
|
+
request :get, "/v3/team/users/#{user_id}.json"
|
434
|
+
end
|
435
|
+
|
436
|
+
# Invites a user to the team
|
437
|
+
#
|
438
|
+
# Params:
|
439
|
+
# +email+:: User email
|
440
|
+
# +role+:: User role
|
441
|
+
def invite_user(email, role)
|
442
|
+
params = { email: email, role: role }
|
443
|
+
|
444
|
+
request :post, "/v3/team/users.json", params
|
445
|
+
end
|
446
|
+
|
447
|
+
# Update an existing user role
|
448
|
+
#
|
449
|
+
# Params:
|
450
|
+
# +user_id+:: Id of the user to update
|
451
|
+
# +role+:: The new role
|
452
|
+
def change_user_role(user_id, role)
|
453
|
+
params = { role: role }
|
454
|
+
|
455
|
+
request :patch, "/v3/team/users/#{user_id}.json", params
|
456
|
+
end
|
457
|
+
|
458
|
+
# Delete an existing user from the team
|
459
|
+
#
|
460
|
+
# Params:
|
461
|
+
# +user_id+:: Id of the user to remove
|
462
|
+
def remove_user(user_id)
|
463
|
+
request :delete, "/v3/team/users/#{user_id}.json"
|
464
|
+
end
|
465
|
+
|
466
|
+
# Get all groups
|
467
|
+
#
|
468
|
+
# Params:
|
469
|
+
# +limit+:: Maximum number of results to return
|
470
|
+
# +offset+:: Offset of results to skip
|
471
|
+
# +conditions+:: Query conditions
|
472
|
+
def get_groups(limit = 100, offset = 0, conditions = {})
|
473
|
+
params = extract_query_params conditions
|
474
|
+
|
475
|
+
params['limit'] = limit
|
476
|
+
params['offset'] = offset
|
477
|
+
|
478
|
+
request :get, "/v3/team/groups.json", params
|
479
|
+
end
|
480
|
+
|
481
|
+
# Get a single group
|
482
|
+
#
|
483
|
+
# Params:
|
484
|
+
# +group_id+:: Id of group
|
485
|
+
def get_group(group_id)
|
486
|
+
request :get, "/v3/team/groups/#{group_id}.json"
|
487
|
+
end
|
488
|
+
|
489
|
+
# Create a new group
|
490
|
+
#
|
491
|
+
# Params:
|
492
|
+
# +name+:: Group name
|
493
|
+
def create_group(name)
|
494
|
+
params = { name: name }
|
495
|
+
|
496
|
+
request :post, "/v3/team/groups.json", params
|
497
|
+
end
|
498
|
+
|
499
|
+
# Update an existing group
|
500
|
+
#
|
501
|
+
# Params:
|
502
|
+
# +group_id+:: Id of the group to update
|
503
|
+
# +params+:: Same params as method create_group, see above
|
504
|
+
def update_group(group_id, name)
|
505
|
+
params = { name: name }
|
506
|
+
|
507
|
+
request :patch, "/v3/team/groups/#{group_id}.json", params
|
508
|
+
end
|
509
|
+
|
510
|
+
# Delete an existing group
|
511
|
+
#
|
512
|
+
# Params:
|
513
|
+
# +group_id+:: Id of the group to delete
|
514
|
+
def delete_group(group_id)
|
515
|
+
request :delete, "/v3/team/groups/#{group_id}.json"
|
516
|
+
end
|
517
|
+
|
518
|
+
# Add a new manager to the group
|
519
|
+
#
|
520
|
+
# Params:
|
521
|
+
# +group_id+:: Id of the group where to add the user
|
522
|
+
# +user_id+:: Id of the user to add
|
523
|
+
def add_manager_to_group(group_id, user_id)
|
524
|
+
request :post, "/v3/team/groups/#{group_id}/managers/#{user_id}.json"
|
525
|
+
end
|
526
|
+
|
527
|
+
# Remove a manager from the group
|
528
|
+
#
|
529
|
+
# Params:
|
530
|
+
# +group_id+:: Id of the group where to add the user
|
531
|
+
# +user_id+:: Id of the user to add
|
532
|
+
def remove_manager_from_group(group_id, user_id)
|
533
|
+
request :delete, "/v3/team/groups/#{group_id}/managers/#{user_id}.json"
|
534
|
+
end
|
535
|
+
|
536
|
+
# Add a new member to the group
|
537
|
+
#
|
538
|
+
# Params:
|
539
|
+
# +group_id+:: Id of the group where to add the user
|
540
|
+
# +user_id+:: Id of the user to add
|
541
|
+
def add_member_to_group(group_id, user_id)
|
542
|
+
request :post, "/v3/team/groups/#{group_id}/members/#{user_id}.json"
|
543
|
+
end
|
544
|
+
|
545
|
+
# Remove a member from the group
|
546
|
+
#
|
547
|
+
# Params:
|
548
|
+
# +group_id+:: Id of the group where to add the user
|
549
|
+
# +user_id+:: Id of the user to add
|
550
|
+
def remove_member_from_group(group_id, user_id)
|
551
|
+
request :delete, "/v3/team/groups/#{group_id}/members/#{user_id}.json"
|
552
|
+
end
|
553
|
+
|
554
|
+
# Get all seats
|
555
|
+
#
|
556
|
+
# Params:
|
557
|
+
# +limit+:: Maximum number of results to return
|
558
|
+
# +offset+:: Offset of results to skip
|
559
|
+
# +conditions+:: Query conditions
|
560
|
+
def get_seats(limit = 100, offset = 0, conditions = {})
|
561
|
+
params = extract_query_params conditions
|
562
|
+
|
563
|
+
params['limit'] = limit
|
564
|
+
params['offset'] = offset
|
565
|
+
|
566
|
+
request :get, "/v3/team/seats.json", params
|
567
|
+
end
|
568
|
+
|
569
|
+
# Remove a seat
|
570
|
+
#
|
571
|
+
# Params:
|
572
|
+
# +seat_id+:: Id of the seat to remove
|
573
|
+
def remove_seat(seat_id)
|
574
|
+
request :delete, "/v3/team/seats/#{seat_id}.json"
|
575
|
+
end
|
576
|
+
|
216
577
|
# PRIVATE METHODS FROM HERE
|
217
578
|
private
|
218
579
|
|
580
|
+
# convert array to hash recursively
|
581
|
+
def array2hash(array)
|
582
|
+
unless array.is_a?(Array)
|
583
|
+
return array
|
584
|
+
end
|
585
|
+
|
586
|
+
Hash[
|
587
|
+
array.map.with_index do |x, i|
|
588
|
+
if x.is_a?(Array)
|
589
|
+
x = array2hash(x)
|
590
|
+
end
|
591
|
+
|
592
|
+
[i, x]
|
593
|
+
end
|
594
|
+
]
|
595
|
+
end
|
596
|
+
|
219
597
|
# Parse query parameters
|
220
598
|
def extract_query_params(conditions)
|
221
599
|
params = {}
|
data/signaturit-sdk.gemspec
CHANGED
@@ -36,7 +36,6 @@ class TestSignaturitClient < Test::Unit::TestCase
|
|
36
36
|
assert_requested :get, 'https://api.signaturit.com/v3/signatures/count.json?status=signed&since=1982-07-27', :headers => { :Authorization => 'Bearer a_token' }
|
37
37
|
end
|
38
38
|
|
39
|
-
|
40
39
|
def test_get_audit_trail
|
41
40
|
stub_request(:any, /.*/).to_return(:body => '')
|
42
41
|
|
@@ -132,4 +131,312 @@ class TestSignaturitClient < Test::Unit::TestCase
|
|
132
131
|
assert_requested :get, 'https://api.signaturit.com/v3/templates.json?limit=5&offset=10', :headers => { :Authorization => 'Bearer a_token' }
|
133
132
|
end
|
134
133
|
|
134
|
+
def test_get_email
|
135
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
136
|
+
|
137
|
+
@client.get_email 'an_id'
|
138
|
+
|
139
|
+
assert_requested :get, 'https://api.signaturit.com/v3/emails/an_id.json', :headers => { :Authorization => 'Bearer a_token' }
|
140
|
+
end
|
141
|
+
|
142
|
+
def test_get_emails
|
143
|
+
stub_request(:any, /.*/).to_return(:body => '[]')
|
144
|
+
|
145
|
+
@client.get_emails(5, 10)
|
146
|
+
|
147
|
+
assert_requested :get, 'https://api.signaturit.com/v3/emails.json?limit=5&offset=10', :headers => { :Authorization => 'Bearer a_token' }
|
148
|
+
end
|
149
|
+
|
150
|
+
def test_count_emails
|
151
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
152
|
+
|
153
|
+
@client.count_emails({:status => 'delivered'})
|
154
|
+
|
155
|
+
assert_requested :get, 'https://api.signaturit.com/v3/emails/count.json?status=delivered', :headers => { :Authorization => 'Bearer a_token' }
|
156
|
+
end
|
157
|
+
|
158
|
+
def test_get_audit_trail
|
159
|
+
stub_request(:any, /.*/).to_return(:body => '')
|
160
|
+
|
161
|
+
@client.download_email_audit_trail('an_id', 'another_id')
|
162
|
+
|
163
|
+
assert_requested :get, 'https://api.signaturit.com/v3/emails/an_id/certificates/another_id/download/audit_trail', :headers => { :Authorization => 'Bearer a_token' }
|
164
|
+
end
|
165
|
+
|
166
|
+
def test_create_email
|
167
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
168
|
+
|
169
|
+
path = File.join(File.expand_path(File.dirname(__FILE__)), 'file.pdf')
|
170
|
+
|
171
|
+
@client.create_email path, 'admin@signatur.it', 'a subject', 'a body'
|
172
|
+
|
173
|
+
assert_requested :post, 'https://api.signaturit.com/v3/emails.json', :headers => { :Authorization => 'Bearer a_token' }
|
174
|
+
end
|
175
|
+
|
176
|
+
def test_get_single_sms
|
177
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
178
|
+
|
179
|
+
@client.get_single_sms 'an_id'
|
180
|
+
|
181
|
+
assert_requested :get, 'https://api.signaturit.com/v3/sms/an_id.json', :headers => { :Authorization => 'Bearer a_token' }
|
182
|
+
end
|
183
|
+
|
184
|
+
def test_get_sms
|
185
|
+
stub_request(:any, /.*/).to_return(:body => '[]')
|
186
|
+
|
187
|
+
@client.get_sms(5, 10)
|
188
|
+
|
189
|
+
assert_requested :get, 'https://api.signaturit.com/v3/sms.json?limit=5&offset=10', :headers => { :Authorization => 'Bearer a_token' }
|
190
|
+
end
|
191
|
+
|
192
|
+
def test_count_sms
|
193
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
194
|
+
|
195
|
+
@client.count_sms({:status => 'delivered'})
|
196
|
+
|
197
|
+
assert_requested :get, 'https://api.signaturit.com/v3/sms/count.json?status=delivered', :headers => { :Authorization => 'Bearer a_token' }
|
198
|
+
end
|
199
|
+
|
200
|
+
def test_get_audit_trail
|
201
|
+
stub_request(:any, /.*/).to_return(:body => '')
|
202
|
+
|
203
|
+
@client.download_sms_audit_trail('an_id', 'another_id')
|
204
|
+
|
205
|
+
assert_requested :get, 'https://api.signaturit.com/v3/sms/an_id/certificates/another_id/download/audit_trail', :headers => { :Authorization => 'Bearer a_token' }
|
206
|
+
end
|
207
|
+
|
208
|
+
def test_create_sms
|
209
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
210
|
+
|
211
|
+
path = File.join(File.expand_path(File.dirname(__FILE__)), 'file.pdf')
|
212
|
+
|
213
|
+
@client.create_sms path, 'admin@signatur.it', 'a body'
|
214
|
+
|
215
|
+
assert_requested :post, 'https://api.signaturit.com/v3/sms.json', :headers => { :Authorization => 'Bearer a_token' }
|
216
|
+
end
|
217
|
+
|
218
|
+
def test_get_single_subscription
|
219
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
220
|
+
|
221
|
+
@client.get_subscription 'an_id'
|
222
|
+
|
223
|
+
assert_requested :get, 'https://api.signaturit.com/v3/subscriptions/an_id.json', :headers => { :Authorization => 'Bearer a_token' }
|
224
|
+
end
|
225
|
+
|
226
|
+
def test_get_subscriptions
|
227
|
+
stub_request(:any, /.*/).to_return(:body => '[]')
|
228
|
+
|
229
|
+
@client.get_subscriptions(5, 10)
|
230
|
+
|
231
|
+
assert_requested :get, 'https://api.signaturit.com/v3/subscriptions.json?limit=5&offset=10', :headers => { :Authorization => 'Bearer a_token' }
|
232
|
+
end
|
233
|
+
|
234
|
+
def test_count_subscriptions
|
235
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
236
|
+
|
237
|
+
@client.count_subscriptions()
|
238
|
+
|
239
|
+
assert_requested :get, 'https://api.signaturit.com/v3/subscriptions/count.json', :headers => { :Authorization => 'Bearer a_token' }
|
240
|
+
end
|
241
|
+
|
242
|
+
def test_create_subscriptions
|
243
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
244
|
+
|
245
|
+
@client.create_subscription 'https://www.signaturit.com', 'email_delivered'
|
246
|
+
|
247
|
+
assert_requested :post, 'https://api.signaturit.com/v3/subscriptions.json', :headers => { :Authorization => 'Bearer a_token' }
|
248
|
+
end
|
249
|
+
|
250
|
+
def test_update_subscription
|
251
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
252
|
+
|
253
|
+
@client.update_subscription('an_id', {})
|
254
|
+
|
255
|
+
assert_requested :patch, 'https://api.signaturit.com/v3/subscriptions/an_id.json', :headers => { :Authorization => 'Bearer a_token' }
|
256
|
+
end
|
257
|
+
|
258
|
+
def test_delete_subscription
|
259
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
260
|
+
|
261
|
+
@client.delete_subscription('an_id')
|
262
|
+
|
263
|
+
assert_requested :delete, 'https://api.signaturit.com/v3/subscriptions/an_id.json', :headers => { :Authorization => 'Bearer a_token' }
|
264
|
+
end
|
265
|
+
|
266
|
+
def test_get_single_contact
|
267
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
268
|
+
|
269
|
+
@client.get_contact 'an_id'
|
270
|
+
|
271
|
+
assert_requested :get, 'https://api.signaturit.com/v3/contacts/an_id.json', :headers => { :Authorization => 'Bearer a_token' }
|
272
|
+
end
|
273
|
+
|
274
|
+
def test_get_contacts
|
275
|
+
stub_request(:any, /.*/).to_return(:body => '[]')
|
276
|
+
|
277
|
+
@client.get_contacts(5, 10)
|
278
|
+
|
279
|
+
assert_requested :get, 'https://api.signaturit.com/v3/contacts.json?limit=5&offset=10', :headers => { :Authorization => 'Bearer a_token' }
|
280
|
+
end
|
281
|
+
|
282
|
+
def test_count_contacts
|
283
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
284
|
+
|
285
|
+
@client.count_contacts()
|
286
|
+
|
287
|
+
assert_requested :get, 'https://api.signaturit.com/v3/contacts/count.json', :headers => { :Authorization => 'Bearer a_token' }
|
288
|
+
end
|
289
|
+
|
290
|
+
def test_create_contacts
|
291
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
292
|
+
|
293
|
+
@client.create_contact 'email@domain.com', 'Email'
|
294
|
+
|
295
|
+
assert_requested :post, 'https://api.signaturit.com/v3/contacts.json', :headers => { :Authorization => 'Bearer a_token' }
|
296
|
+
end
|
297
|
+
|
298
|
+
def test_update_contact
|
299
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
300
|
+
|
301
|
+
@client.update_contact('an_id', {})
|
302
|
+
|
303
|
+
assert_requested :patch, 'https://api.signaturit.com/v3/contacts/an_id.json', :headers => { :Authorization => 'Bearer a_token' }
|
304
|
+
end
|
305
|
+
|
306
|
+
def test_delete_contact
|
307
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
308
|
+
|
309
|
+
@client.delete_contact('an_id')
|
310
|
+
|
311
|
+
assert_requested :delete, 'https://api.signaturit.com/v3/contacts/an_id.json', :headers => { :Authorization => 'Bearer a_token' }
|
312
|
+
end
|
313
|
+
|
314
|
+
def test_get_single_user
|
315
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
316
|
+
|
317
|
+
@client.get_user 'an_id'
|
318
|
+
|
319
|
+
assert_requested :get, 'https://api.signaturit.com/v3/team/users/an_id.json', :headers => { :Authorization => 'Bearer a_token' }
|
320
|
+
end
|
321
|
+
|
322
|
+
def test_get_users
|
323
|
+
stub_request(:any, /.*/).to_return(:body => '[]')
|
324
|
+
|
325
|
+
@client.get_users(5, 10)
|
326
|
+
|
327
|
+
assert_requested :get, 'https://api.signaturit.com/v3/team/users.json?limit=5&offset=10', :headers => { :Authorization => 'Bearer a_token' }
|
328
|
+
end
|
329
|
+
|
330
|
+
def test_invite_user
|
331
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
332
|
+
|
333
|
+
@client.invite_user 'email@domain.com', 'admin'
|
334
|
+
|
335
|
+
assert_requested :post, 'https://api.signaturit.com/v3/team/users.json', :headers => { :Authorization => 'Bearer a_token' }
|
336
|
+
end
|
337
|
+
|
338
|
+
def test_change_user_role
|
339
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
340
|
+
|
341
|
+
@client.change_user_role('an_id', 'admin')
|
342
|
+
|
343
|
+
assert_requested :patch, 'https://api.signaturit.com/v3/team/users/an_id.json', :headers => { :Authorization => 'Bearer a_token' }
|
344
|
+
end
|
345
|
+
|
346
|
+
def test_remove_user
|
347
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
348
|
+
|
349
|
+
@client.remove_user('an_id')
|
350
|
+
|
351
|
+
assert_requested :delete, 'https://api.signaturit.com/v3/team/users/an_id.json', :headers => { :Authorization => 'Bearer a_token' }
|
352
|
+
end
|
353
|
+
|
354
|
+
def test_get_single_group
|
355
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
356
|
+
|
357
|
+
@client.get_group 'an_id'
|
358
|
+
|
359
|
+
assert_requested :get, 'https://api.signaturit.com/v3/team/groups/an_id.json', :headers => { :Authorization => 'Bearer a_token' }
|
360
|
+
end
|
361
|
+
|
362
|
+
def test_get_groups
|
363
|
+
stub_request(:any, /.*/).to_return(:body => '[]')
|
364
|
+
|
365
|
+
@client.get_groups(5, 10)
|
366
|
+
|
367
|
+
assert_requested :get, 'https://api.signaturit.com/v3/team/groups.json?limit=5&offset=10', :headers => { :Authorization => 'Bearer a_token' }
|
368
|
+
end
|
369
|
+
|
370
|
+
def test_create_groups
|
371
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
372
|
+
|
373
|
+
@client.create_group 'SDKs'
|
374
|
+
|
375
|
+
assert_requested :post, 'https://api.signaturit.com/v3/team/groups.json', :headers => { :Authorization => 'Bearer a_token' }
|
376
|
+
end
|
377
|
+
|
378
|
+
def test_update_group
|
379
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
380
|
+
|
381
|
+
@client.update_group('an_id', 'SDK')
|
382
|
+
|
383
|
+
assert_requested :patch, 'https://api.signaturit.com/v3/team/groups/an_id.json', :headers => { :Authorization => 'Bearer a_token' }
|
384
|
+
end
|
385
|
+
|
386
|
+
def test_delete_group
|
387
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
388
|
+
|
389
|
+
@client.delete_group('an_id')
|
390
|
+
|
391
|
+
assert_requested :delete, 'https://api.signaturit.com/v3/team/groups/an_id.json', :headers => { :Authorization => 'Bearer a_token' }
|
392
|
+
end
|
393
|
+
|
394
|
+
def test_add_manager_to_group
|
395
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
396
|
+
|
397
|
+
@client.add_manager_to_group 'an_id', 'another_id'
|
398
|
+
|
399
|
+
assert_requested :post, 'https://api.signaturit.com/v3/team/groups/an_id/managers/another_id.json', :headers => { :Authorization => 'Bearer a_token' }
|
400
|
+
end
|
401
|
+
|
402
|
+
def test_remove_manager_from_group
|
403
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
404
|
+
|
405
|
+
@client.remove_manager_from_group 'an_id', 'another_id'
|
406
|
+
|
407
|
+
assert_requested :delete, 'https://api.signaturit.com/v3/team/groups/an_id/managers/another_id.json', :headers => { :Authorization => 'Bearer a_token' }
|
408
|
+
end
|
409
|
+
|
410
|
+
def test_add_member_to_group
|
411
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
412
|
+
|
413
|
+
@client.add_member_to_group 'an_id', 'another_id'
|
414
|
+
|
415
|
+
assert_requested :post, 'https://api.signaturit.com/v3/team/groups/an_id/members/another_id.json', :headers => { :Authorization => 'Bearer a_token' }
|
416
|
+
end
|
417
|
+
|
418
|
+
def test_remove_member_from_group
|
419
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
420
|
+
|
421
|
+
@client.remove_member_from_group 'an_id', 'another_id'
|
422
|
+
|
423
|
+
assert_requested :delete, 'https://api.signaturit.com/v3/team/groups/an_id/members/another_id.json', :headers => { :Authorization => 'Bearer a_token' }
|
424
|
+
end
|
425
|
+
|
426
|
+
def test_get_seats
|
427
|
+
stub_request(:any, /.*/).to_return(:body => '[]')
|
428
|
+
|
429
|
+
@client.get_seats(5, 10)
|
430
|
+
|
431
|
+
assert_requested :get, 'https://api.signaturit.com/v3/team/seats.json?limit=5&offset=10', :headers => { :Authorization => 'Bearer a_token' }
|
432
|
+
end
|
433
|
+
|
434
|
+
def test_remove_seat
|
435
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
436
|
+
|
437
|
+
@client.remove_seat('an_id')
|
438
|
+
|
439
|
+
assert_requested :delete, 'https://api.signaturit.com/v3/team/seats/an_id.json', :headers => { :Authorization => 'Bearer a_token' }
|
440
|
+
end
|
441
|
+
|
135
442
|
end
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: signaturit-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Signaturit
|
@@ -14,7 +13,6 @@ dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rest-client
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: webmock
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -65,27 +60,26 @@ files:
|
|
65
60
|
homepage: https://signaturit.com/
|
66
61
|
licenses:
|
67
62
|
- MIT
|
63
|
+
metadata: {}
|
68
64
|
post_install_message:
|
69
65
|
rdoc_options: []
|
70
66
|
require_paths:
|
71
67
|
- lib
|
72
68
|
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
69
|
requirements:
|
75
|
-
- -
|
70
|
+
- - '>='
|
76
71
|
- !ruby/object:Gem::Version
|
77
72
|
version: '0'
|
78
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
-
none: false
|
80
74
|
requirements:
|
81
|
-
- -
|
75
|
+
- - '>='
|
82
76
|
- !ruby/object:Gem::Version
|
83
77
|
version: '0'
|
84
78
|
requirements: []
|
85
79
|
rubyforge_project:
|
86
|
-
rubygems_version:
|
80
|
+
rubygems_version: 2.0.14.1
|
87
81
|
signing_key:
|
88
|
-
specification_version:
|
82
|
+
specification_version: 4
|
89
83
|
summary: Signaturit Ruby SDK
|
90
84
|
test_files:
|
91
85
|
- test/file.html
|