mifiel 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +3 -0
- data/README.md +1 -0
- data/lib/mifiel/document.rb +14 -4
- data/lib/mifiel/version.rb +1 -1
- data/mifiel.gemspec +5 -7
- data/spec/mifiel/document_spec.rb +16 -0
- data/spec/spec_helper.rb +5 -3
- metadata +16 -62
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1569646681fcf22ebc9758654ea1cd69335c0de8fea3be1d91a2141c0c06f83d
|
4
|
+
data.tar.gz: fab079bd4ba6f4edb93a458c934b8e2f783b90296c00bc4e0d0ae0b9d8992d3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34ea17ff1b1e888dec3ee6f9f5c2b3460bfa29dfc3629330880d0dfe831760e60e3271c2f80511d8edf2b9e0de3f5708944f221581cbf424b9ac13f7c3be303f
|
7
|
+
data.tar.gz: 6f04cbd056834f0709067c43223c2f695c63e9ea9d2d51a2d6419cef800047065be3d46fe739406c9ed9d260cb7c01a6a123b89ae7e21bb6800b6f57726248ac
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -38,6 +38,7 @@ Then you can configure the gem with:
|
|
38
38
|
Mifiel.config do |config|
|
39
39
|
config.app_id = '<APP_ID>'
|
40
40
|
config.app_secret = '<APP_SECRET>'
|
41
|
+
config.base_url = 'https://app-sandbox.mifiel.com/api/v1' #remove this line when you wish to use the prod environment
|
41
42
|
end
|
42
43
|
```
|
43
44
|
|
data/lib/mifiel/document.rb
CHANGED
@@ -42,14 +42,24 @@ module Mifiel
|
|
42
42
|
Mifiel::Document._request("#{Mifiel.config.base_url}/documents/#{id}/request_signature", :post, params)
|
43
43
|
end
|
44
44
|
|
45
|
-
def
|
45
|
+
def raw_data
|
46
46
|
response = Mifiel::Document.process_request("/documents/#{id}/file", :get)
|
47
|
-
|
47
|
+
|
48
|
+
response.body
|
48
49
|
end
|
49
50
|
|
50
|
-
def
|
51
|
+
def save_file(path)
|
52
|
+
File.open(path, 'wb') { |file| file.write(raw_data) }
|
53
|
+
end
|
54
|
+
|
55
|
+
def raw_signed_data
|
51
56
|
response = Mifiel::Document.process_request("/documents/#{id}/file_signed", :get)
|
52
|
-
|
57
|
+
|
58
|
+
response.body
|
59
|
+
end
|
60
|
+
|
61
|
+
def save_file_signed(path)
|
62
|
+
File.open(path, 'wb') { |file| file.write(raw_signed_data) }
|
53
63
|
end
|
54
64
|
|
55
65
|
def save_xml(path)
|
data/lib/mifiel/version.rb
CHANGED
data/mifiel.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ['lib']
|
21
|
-
spec.required_ruby_version = '
|
21
|
+
spec.required_ruby_version = '>= 2.3'
|
22
22
|
|
23
23
|
spec.add_runtime_dependency 'activesupport'
|
24
24
|
spec.add_runtime_dependency 'api-auth', '~> 1.4'
|
@@ -29,12 +29,10 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency 'appraisal'
|
30
30
|
spec.add_development_dependency 'bump', '~> 0.5', '>= 0.5.3'
|
31
31
|
spec.add_development_dependency 'bundler'
|
32
|
-
spec.add_development_dependency '
|
33
|
-
spec.add_development_dependency '
|
34
|
-
spec.add_development_dependency '
|
35
|
-
spec.add_development_dependency '
|
36
|
-
spec.add_development_dependency 'rubocop', '~> 0.79.0'
|
37
|
-
spec.add_development_dependency 'simplecov', '~> 0.15'
|
32
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
33
|
+
spec.add_development_dependency 'rspec', '~> 3.10'
|
34
|
+
spec.add_development_dependency 'rubocop', '~> 1.24'
|
35
|
+
spec.add_development_dependency 'simplecov', '~> 0.21'
|
38
36
|
spec.add_development_dependency 'sinatra'
|
39
37
|
spec.add_development_dependency 'webmock'
|
40
38
|
end
|
@@ -70,6 +70,22 @@ describe Mifiel::Document do
|
|
70
70
|
describe 'working with a document' do
|
71
71
|
let!(:document) { Mifiel::Document.all.first }
|
72
72
|
|
73
|
+
describe '#raw_data' do
|
74
|
+
let(:document_content) { 'some-pdf-formatted-string' }
|
75
|
+
|
76
|
+
it 'should get the file raw data' do
|
77
|
+
expect(document.raw_data).to eq document_content
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe '#raw_signed_data' do
|
82
|
+
let(:document_content) { 'some-pdf-formatted-string' }
|
83
|
+
|
84
|
+
it 'should get the file raw signed data' do
|
85
|
+
expect(document.raw_signed_data).to eq document_content
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
73
89
|
describe '#save_file' do
|
74
90
|
let!(:path) { 'tmp/the-file.pdf' }
|
75
91
|
before { File.unlink(path) if File.exist?(path) }
|
data/spec/spec_helper.rb
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'pry'
|
4
|
-
require 'byebug'
|
5
|
-
require 'pry-byebug'
|
6
4
|
require 'mifiel'
|
7
5
|
require 'webmock/rspec'
|
8
|
-
|
9
6
|
require 'simplecov'
|
10
7
|
require 'coveralls'
|
8
|
+
|
11
9
|
SimpleCov.start do
|
12
10
|
add_filter '/spec/'
|
13
11
|
end
|
12
|
+
|
14
13
|
Coveralls.wear!
|
15
14
|
|
16
15
|
Dir['./spec/support/**/*.rb'].sort.each { |f| require f }
|
@@ -22,6 +21,9 @@ RSpec.configure do |config|
|
|
22
21
|
conf.app_secret = 'APP_SECRET'
|
23
22
|
conf.base_url = 'http://www.mifiel.com/api/v1'
|
24
23
|
end
|
24
|
+
|
25
|
+
# Creates ruby-api-client/tmp folder so signed files can be saved correctly
|
26
|
+
Dir.mkdir 'tmp' unless File.directory? 'tmp'
|
25
27
|
end
|
26
28
|
|
27
29
|
config.before(:each) do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mifiel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genaro Madrid
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -128,108 +128,62 @@ dependencies:
|
|
128
128
|
- - ">="
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
|
-
- !ruby/object:Gem::Dependency
|
132
|
-
name: byebug
|
133
|
-
requirement: !ruby/object:Gem::Requirement
|
134
|
-
requirements:
|
135
|
-
- - "~>"
|
136
|
-
- !ruby/object:Gem::Version
|
137
|
-
version: '9.0'
|
138
|
-
- - "<"
|
139
|
-
- !ruby/object:Gem::Version
|
140
|
-
version: 9.0.6
|
141
|
-
type: :development
|
142
|
-
prerelease: false
|
143
|
-
version_requirements: !ruby/object:Gem::Requirement
|
144
|
-
requirements:
|
145
|
-
- - "~>"
|
146
|
-
- !ruby/object:Gem::Version
|
147
|
-
version: '9.0'
|
148
|
-
- - "<"
|
149
|
-
- !ruby/object:Gem::Version
|
150
|
-
version: 9.0.6
|
151
|
-
- !ruby/object:Gem::Dependency
|
152
|
-
name: pry-byebug
|
153
|
-
requirement: !ruby/object:Gem::Requirement
|
154
|
-
requirements:
|
155
|
-
- - ">="
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
version: 3.3.0
|
158
|
-
- - "~>"
|
159
|
-
- !ruby/object:Gem::Version
|
160
|
-
version: '3.4'
|
161
|
-
type: :development
|
162
|
-
prerelease: false
|
163
|
-
version_requirements: !ruby/object:Gem::Requirement
|
164
|
-
requirements:
|
165
|
-
- - ">="
|
166
|
-
- !ruby/object:Gem::Version
|
167
|
-
version: 3.3.0
|
168
|
-
- - "~>"
|
169
|
-
- !ruby/object:Gem::Version
|
170
|
-
version: '3.4'
|
171
131
|
- !ruby/object:Gem::Dependency
|
172
132
|
name: rake
|
173
133
|
requirement: !ruby/object:Gem::Requirement
|
174
134
|
requirements:
|
175
135
|
- - "~>"
|
176
136
|
- !ruby/object:Gem::Version
|
177
|
-
version: '
|
137
|
+
version: '13.0'
|
178
138
|
type: :development
|
179
139
|
prerelease: false
|
180
140
|
version_requirements: !ruby/object:Gem::Requirement
|
181
141
|
requirements:
|
182
142
|
- - "~>"
|
183
143
|
- !ruby/object:Gem::Version
|
184
|
-
version: '
|
144
|
+
version: '13.0'
|
185
145
|
- !ruby/object:Gem::Dependency
|
186
146
|
name: rspec
|
187
147
|
requirement: !ruby/object:Gem::Requirement
|
188
148
|
requirements:
|
189
149
|
- - "~>"
|
190
150
|
- !ruby/object:Gem::Version
|
191
|
-
version: '3.
|
192
|
-
- - ">="
|
193
|
-
- !ruby/object:Gem::Version
|
194
|
-
version: 3.1.7
|
151
|
+
version: '3.10'
|
195
152
|
type: :development
|
196
153
|
prerelease: false
|
197
154
|
version_requirements: !ruby/object:Gem::Requirement
|
198
155
|
requirements:
|
199
156
|
- - "~>"
|
200
157
|
- !ruby/object:Gem::Version
|
201
|
-
version: '3.
|
202
|
-
- - ">="
|
203
|
-
- !ruby/object:Gem::Version
|
204
|
-
version: 3.1.7
|
158
|
+
version: '3.10'
|
205
159
|
- !ruby/object:Gem::Dependency
|
206
160
|
name: rubocop
|
207
161
|
requirement: !ruby/object:Gem::Requirement
|
208
162
|
requirements:
|
209
163
|
- - "~>"
|
210
164
|
- !ruby/object:Gem::Version
|
211
|
-
version:
|
165
|
+
version: '1.24'
|
212
166
|
type: :development
|
213
167
|
prerelease: false
|
214
168
|
version_requirements: !ruby/object:Gem::Requirement
|
215
169
|
requirements:
|
216
170
|
- - "~>"
|
217
171
|
- !ruby/object:Gem::Version
|
218
|
-
version:
|
172
|
+
version: '1.24'
|
219
173
|
- !ruby/object:Gem::Dependency
|
220
174
|
name: simplecov
|
221
175
|
requirement: !ruby/object:Gem::Requirement
|
222
176
|
requirements:
|
223
177
|
- - "~>"
|
224
178
|
- !ruby/object:Gem::Version
|
225
|
-
version: '0.
|
179
|
+
version: '0.21'
|
226
180
|
type: :development
|
227
181
|
prerelease: false
|
228
182
|
version_requirements: !ruby/object:Gem::Requirement
|
229
183
|
requirements:
|
230
184
|
- - "~>"
|
231
185
|
- !ruby/object:Gem::Version
|
232
|
-
version: '0.
|
186
|
+
version: '0.21'
|
233
187
|
- !ruby/object:Gem::Dependency
|
234
188
|
name: sinatra
|
235
189
|
requirement: !ruby/object:Gem::Requirement
|
@@ -258,7 +212,7 @@ dependencies:
|
|
258
212
|
- - ">="
|
259
213
|
- !ruby/object:Gem::Version
|
260
214
|
version: '0'
|
261
|
-
description:
|
215
|
+
description:
|
262
216
|
email:
|
263
217
|
- genmadrid@gmail.com
|
264
218
|
executables: []
|
@@ -303,13 +257,13 @@ homepage: https://www.mifiel.com
|
|
303
257
|
licenses:
|
304
258
|
- MIT
|
305
259
|
metadata: {}
|
306
|
-
post_install_message:
|
260
|
+
post_install_message:
|
307
261
|
rdoc_options: []
|
308
262
|
require_paths:
|
309
263
|
- lib
|
310
264
|
required_ruby_version: !ruby/object:Gem::Requirement
|
311
265
|
requirements:
|
312
|
-
- - "
|
266
|
+
- - ">="
|
313
267
|
- !ruby/object:Gem::Version
|
314
268
|
version: '2.3'
|
315
269
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -318,8 +272,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
318
272
|
- !ruby/object:Gem::Version
|
319
273
|
version: '0'
|
320
274
|
requirements: []
|
321
|
-
rubygems_version: 3.
|
322
|
-
signing_key:
|
275
|
+
rubygems_version: 3.1.6
|
276
|
+
signing_key:
|
323
277
|
specification_version: 4
|
324
278
|
summary: Ruby SDK for mifiel.com.
|
325
279
|
test_files:
|