signaturit-sdk 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 037bd35cedc20fe874d582632a5bcfb831a5caa7
4
- data.tar.gz: 971dff460cd1887b677381850f32c31372ec044f
3
+ metadata.gz: 66f1d1637ac7b7d18378bfbacb4769d08511d269
4
+ data.tar.gz: 9d7f84f0d4f7b1691028a62cad5469df34fff2d1
5
5
  SHA512:
6
- metadata.gz: 072a70412f160c241773ef55bc908e8220b27c2ee8018b9d0e9fef27abc4004e79d30a8dced9f5b908cc9b0f6aa865678f7dfe1691fae82e23cf2089c7eccda2
7
- data.tar.gz: 0744ca43f5bf0786dda15bc0e112441186f2eec47981cb11c784eebced4080498deb3eefb6abcb693bcbe3fc05fad17bfb820c58d3a932418dc084e79a1098dd
6
+ metadata.gz: ba7a5e2a4df1ce24fc2e6442fb786e7ab05f101c26e6a20d72d6b5ca01dfa9b6493771ff10ba6e0df13a63390c8d82b46c4aff4d867c1bb289e75500c5a27f2e
7
+ data.tar.gz: 899a307d90e475f78493fef6c1843e9028eca0b6ebe7d2f464355b587ded4eabd5cd7e9d98bf2bddf6acfb65d64b62e43033dd611f666a05e3826f980bd02ea5
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  Signaturit Ruby SDK
2
2
  ===================
3
+
3
4
  This package is a wrapper for Signaturit Api. If you didn't read the documentation yet, maybe it's time to take a look [here](http://docs.signaturit.com/).
4
5
 
5
6
  You can install the package through gem.
@@ -12,16 +13,19 @@ Configuration
12
13
  -------------
13
14
 
14
15
  Just import the Signaturit Client this way
16
+
15
17
  ```
16
18
  require 'signaturit_client'
17
19
  ```
18
20
 
19
21
  Then you can authenticate yourself using your AuthToken
22
+
20
23
  ```
21
24
  client = SignaturitClient.new('TOKEN')
22
25
  ```
23
26
 
24
27
  Remember, the default calls are made to our Sandbox server. If you want to do in production, just set the flag when you do the call.
28
+
25
29
  ```
26
30
  client = SignaturitClient.new('TOKEN', true)
27
31
  ```
@@ -32,59 +36,75 @@ Examples
32
36
  ## Signature request
33
37
 
34
38
  ### Get all signature requests
39
+
35
40
  Retrieve all data from your signature requests using different filters.
36
41
 
37
42
  ##### All signatures
43
+
38
44
  ```
39
45
  response = client.get_signatures()
40
46
  ```
41
47
 
42
48
  ##### Getting the last 50 signatures
49
+
43
50
  ```
44
51
  response = client.get_signatures(50)
45
52
  ```
46
53
 
47
54
  ##### Getting the following last 50 signatures
55
+
48
56
  ```
49
57
  response = client.get_signatures(50, 50)
50
58
  ```
51
59
 
52
60
  ##### Getting only the finished signatures
61
+
53
62
  ```
54
63
  response = client.get_signatures(100, 0, 3)
55
64
  ```
56
65
 
57
66
  ##### Getting the finished signatures created since July 20th of 2014
67
+
58
68
  ```
59
69
  response = client.get_signatures(100, 0, 3, '2014-7-20')
60
70
  ```
61
71
 
62
72
  ### Count signature requests
73
+
63
74
  Count your signature requests.
75
+
64
76
  ```
65
77
  response = client.count_signatures()
66
78
  ```
67
79
 
68
80
  ### Get signature request
81
+
69
82
  Get a single signature request.
83
+
70
84
  ```
71
85
  response = client.get_signature('SIGNATURE_ID')
72
86
  ```
73
87
 
74
88
  ### Get signature documents
89
+
75
90
  Get all documents from a signature request.
91
+
76
92
  ```
77
93
  response = client.get_signature_documents('SIGNATURE_ID')
78
94
  ```
79
95
 
80
96
  ### Get signature document
97
+
81
98
  Get a single document from a signature request.
99
+
82
100
  ```
83
101
  response = client.get_signature_document('SIGNATURE_ID','DOCUMENT_ID')
84
102
  ```
85
103
 
86
104
  ### Signature request
105
+
87
106
  Create a new signature request. Check all [params](http://docs.signaturit.com/api/#sign_create_sign).
107
+
88
108
  ```
89
109
  recipients = ['bobsoap@signatur.it']
90
110
  params = {:subject: 'Receipt number 250', :body: 'Please, can you sign this document?'}
@@ -93,13 +113,17 @@ response = client.create_signature_request(file_path, recipients, params)
93
113
  ```
94
114
 
95
115
  ### Get audit trail
116
+
96
117
  Get the audit trail of a signature request document and save it in the submitted path.
118
+
97
119
  ```
98
120
  response = client.get_audit_trail('ID', 'DOCUMENT_ID', '/path/doc.pdf')
99
121
  ```
100
122
 
101
123
  ### Get signed document
124
+
102
125
  Get the signed document of a signature request document and save it in the submitted path.
126
+
103
127
  ```
104
128
  response = client.get_signed_document('ID', 'DOCUMENT_ID', '/path/doc.pdf')
105
129
  ```
@@ -107,13 +131,17 @@ response = client.get_signed_document('ID', 'DOCUMENT_ID', '/path/doc.pdf')
107
131
  ## Account
108
132
 
109
133
  ### Get account
134
+
110
135
  Retrieve the information of your account.
136
+
111
137
  ```
112
138
  response = client.get_account()
113
139
  ```
114
140
 
115
141
  ### Set document storage
142
+
116
143
  Set your own storage credentials, to store a copy of the documents. You can get all the info of credential types [here](http://docs.signaturit.com/api/#account_set_credentials).
144
+
117
145
  ```
118
146
  credentials = {
119
147
  :user: 'john',
@@ -126,22 +154,36 @@ credentials = {
126
154
  response = client.set_document_storage('sftp', credentials)
127
155
  ```
128
156
 
157
+ ### Revert to default document storage
158
+
159
+ If you ever want to store your files in Signaturit's servers just run this method:
160
+
161
+ ```
162
+ client.revert_to_default_document_storage()
163
+ ```
164
+
129
165
  ## Branding
130
166
 
131
167
  ### Get brandings
168
+
132
169
  Get all account brandings.
170
+
133
171
  ```
134
172
  response = client.get_brandings()
135
173
  ```
136
174
 
137
175
  ### Get branding
176
+
138
177
  Get a single branding.
178
+
139
179
  ```
140
180
  response = client.get_branding('BRANDING_ID')
141
181
  ```
142
182
 
143
183
  ### Create branding
184
+
144
185
  Create a new branding. You can check all branding params [here](http://docs.signaturit.com/api/#set_branding).`
186
+
145
187
  ```
146
188
  params = {
147
189
  :corporate_layout_color: '#FFBF00',
@@ -152,21 +194,27 @@ response = client.create_branding(params)
152
194
  ```
153
195
 
154
196
  ### Update branding
197
+
155
198
  Update a single branding.
199
+
156
200
  ```
157
201
  params = { :application_texts: { :send_button: 'Send!' } }
158
202
  response = client.update_branding('BRANDING_ID', params)
159
203
  ```
160
204
 
161
205
  ### Update branding logo
206
+
162
207
  Change the branding logo.
208
+
163
209
  ```
164
210
  file_path = '/path/new_logo.png'
165
211
  response = client.update_branding_logo('BRANDING_ID', file_path)
166
212
  ```
167
213
 
168
214
  ### Update branding template
215
+
169
216
  Change a template. Learn more about the templates [here](http://docs.signaturit.com/api/#put_template_branding).
217
+
170
218
  ```
171
219
  file_path = '/path/new_template.html'
172
220
  response = client.update_branding_template('BRANDING_ID', 'sign_request', file_path)
@@ -174,8 +222,10 @@ response = client.update_branding_template('BRANDING_ID', 'sign_request', file_p
174
222
 
175
223
  ## Template
176
224
 
177
- ###Get all templates
225
+ ### Get all templates
226
+
178
227
  Retrieve all data from your templates.
228
+
179
229
  ```
180
230
  response = client.get_templates()
181
231
  ```
@@ -42,7 +42,12 @@ class SignaturitClient
42
42
  def set_document_storage(type, params)
43
43
  params[:type] = type
44
44
 
45
- request :patch, '/v2/account.json', params
45
+ request :post, '/v2/account/storage.json', params
46
+ end
47
+
48
+ # Revert the document storage to the signaturit's default
49
+ def revert_to_default_document_storage
50
+ request :delete, '/v2/account/storage.json'
46
51
  end
47
52
 
48
53
  # Get a concrete signature object
@@ -267,11 +272,11 @@ class SignaturitClient
267
272
  base = @production ? 'https://api.signaturit.com' : 'http://api.sandbox.signaturit.com'
268
273
 
269
274
  case method
270
- when :get
275
+ when :get, :delete
271
276
  encoded = URI.encode_www_form(params)
272
277
  path = "#{path}?#{encoded}" if encoded.length > 0
273
278
 
274
- body = RestClient.get("#{base}#{path}", :Authorization => "Bearer #{@token}")
279
+ body = RestClient.send(method, "#{base}#{path}", :Authorization => "Bearer #{@token}")
275
280
 
276
281
  else
277
282
  body = RestClient.send(method, "#{base}#{path}", params, :Authorization => "Bearer #{@token}")
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.platform = Gem::Platform::RUBY
3
3
  s.name = 'signaturit-sdk'
4
- s.version = '0.0.1'
4
+ s.version = '0.0.2'
5
5
  s.date = '2014-09-04'
6
6
  s.summary = 'Signaturit Ruby SDK'
7
7
  s.description = 'Sign Documents Online'
@@ -25,7 +25,15 @@ class TestSignaturitClient < Test::Unit::TestCase
25
25
 
26
26
  @client.set_document_storage('sftp', {})
27
27
 
28
- assert_requested :patch, 'https://api.signaturit.com/v2/account.json', :headers => { :Authorization => 'Bearer a_token' }
28
+ assert_requested :post, 'https://api.signaturit.com/v2/account/storage.json', :headers => { :Authorization => 'Bearer a_token' }
29
+ end
30
+
31
+ def test_revert_to_default_document_storage
32
+ stub_request(:any, /.*/).to_return(:body => '{}')
33
+
34
+ @client.revert_to_default_document_storage()
35
+
36
+ assert_requested :delete, 'https://api.signaturit.com/v2/account/storage.json', :headers => { :Authorization => 'Bearer a_token' }
29
37
  end
30
38
 
31
39
  def test_get_signature
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: signaturit-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Signaturit