mifiel 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/lib/mifiel.rb +1 -1
- data/lib/mifiel/base.rb +2 -2
- data/lib/mifiel/certificate.rb +1 -1
- data/lib/mifiel/config.rb +3 -3
- data/lib/mifiel/document.rb +10 -2
- data/lib/mifiel/version.rb +1 -1
- data/mifiel.gemspec +9 -4
- data/spec/mifiel/certificate_spec.rb +1 -1
- data/spec/mifiel/document_spec.rb +7 -7
- data/spec/support/fake_mifiel.rb +1 -1
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36fb92b3ebd8ee48db492aa83ef01ab696f0f8c3
|
4
|
+
data.tar.gz: d5d3473df052bc3156a68dc16f819ae4cc186623
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73fe847fb0de5584e33f4e936d823ad23296baa4fc8254431e4febc1e2b2951be9cb439d5c0fa24f0bc20142adaef0fcfb6725f26b669e0f083d44adee21df2d
|
7
|
+
data.tar.gz: 4876287da937bc6db321c1b2cc0714c1f84674d484d89fbadf355f3a19f8897f81a7d68f0cda9a4d53015b507716549a440cfb8a66aef57f15e20504e71af4fe
|
data/.travis.yml
CHANGED
data/lib/mifiel.rb
CHANGED
data/lib/mifiel/base.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'rest-client'
|
2
2
|
|
3
3
|
module Mifiel
|
4
|
-
class Base <
|
4
|
+
class Base < Flexirest::Base
|
5
5
|
after_request :rescue_errors
|
6
6
|
|
7
7
|
def rescue_errors(_name, response)
|
8
8
|
if (400..499).cover?(response.status)
|
9
|
-
result = JSON.
|
9
|
+
result = JSON.parse(response.body)
|
10
10
|
message = result['errors'] || [result['error']]
|
11
11
|
raise BadRequestError, message.to_a.join(', ')
|
12
12
|
elsif (500..599).cover?(response.status)
|
data/lib/mifiel/certificate.rb
CHANGED
data/lib/mifiel/config.rb
CHANGED
@@ -27,9 +27,9 @@ module Mifiel
|
|
27
27
|
private
|
28
28
|
|
29
29
|
def set_api_auth_credentials
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
Flexirest::Base.base_url = base_url
|
31
|
+
Flexirest::Base.api_auth_credentials(app_id, app_secret)
|
32
|
+
Flexirest::Base.request_body_type = :json
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
data/lib/mifiel/document.rb
CHANGED
@@ -7,7 +7,13 @@ module Mifiel
|
|
7
7
|
put :save, '/documents/:id'
|
8
8
|
delete :delete, '/documents/:id'
|
9
9
|
|
10
|
-
|
10
|
+
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
11
|
+
def self.create(args)
|
12
|
+
signatories = args[:signatories]
|
13
|
+
file = args[:file]
|
14
|
+
hash = args[:hash]
|
15
|
+
name = args[:name]
|
16
|
+
callback_url = args[:callback_url]
|
11
17
|
raise ArgumentError, 'Either file or hash must be provided' if !file && !hash
|
12
18
|
raise ArgumentError, 'Only one of file or hash must be provided' if file && hash
|
13
19
|
payload = {
|
@@ -17,9 +23,11 @@ module Mifiel
|
|
17
23
|
original_hash: hash,
|
18
24
|
name: name
|
19
25
|
}
|
26
|
+
payload = args.merge(payload)
|
20
27
|
response = process_request('/documents', :post, payload)
|
21
|
-
JSON.
|
28
|
+
Mifiel::Document.new(JSON.parse(response))
|
22
29
|
end
|
30
|
+
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
|
23
31
|
|
24
32
|
def request_signature(email, cc: nil)
|
25
33
|
params = { email: email }
|
data/lib/mifiel/version.rb
CHANGED
data/mifiel.gemspec
CHANGED
@@ -3,6 +3,7 @@ lib = File.expand_path('../lib', __FILE__)
|
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
require 'mifiel/version'
|
5
5
|
|
6
|
+
# rubocop:disable Metrics/BlockLength
|
6
7
|
Gem::Specification.new do |spec|
|
7
8
|
spec.name = 'mifiel'
|
8
9
|
spec.version = Mifiel::VERSION
|
@@ -19,10 +20,14 @@ Gem::Specification.new do |spec|
|
|
19
20
|
spec.required_ruby_version = '~> 2.1'
|
20
21
|
|
21
22
|
spec.add_runtime_dependency 'rest-client', '~> 1.7'
|
22
|
-
spec.add_runtime_dependency 'json', '
|
23
|
-
spec.add_runtime_dependency 'api-auth', '
|
24
|
-
|
25
|
-
|
23
|
+
spec.add_runtime_dependency 'json', '> 0'
|
24
|
+
spec.add_runtime_dependency 'api-auth', '> 1.4'
|
25
|
+
if Gem::Version.new(RUBY_VERSION) > Gem::Version.new('2.2.2')
|
26
|
+
spec.add_runtime_dependency 'activesupport'
|
27
|
+
else
|
28
|
+
spec.add_runtime_dependency 'activesupport', '~> 4.2.7'
|
29
|
+
end
|
30
|
+
spec.add_runtime_dependency 'flexirest'
|
26
31
|
|
27
32
|
spec.add_development_dependency 'bundler', '~> 1.6'
|
28
33
|
spec.add_development_dependency 'rake', '~> 10.0'
|
@@ -15,7 +15,7 @@ describe Mifiel::Document do
|
|
15
15
|
)
|
16
16
|
end
|
17
17
|
|
18
|
-
it { expect(document).to be_a(
|
18
|
+
it { expect(document).to be_a(Mifiel::Document) }
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -23,8 +23,8 @@ describe Mifiel::Document do
|
|
23
23
|
let!(:document) { Mifiel::Document.all.first }
|
24
24
|
|
25
25
|
describe '#save_file' do
|
26
|
-
let!(:path) {'tmp/the-file.pdf' }
|
27
|
-
before { File.unlink(path) if File.exist?(path)}
|
26
|
+
let!(:path) { 'tmp/the-file.pdf' }
|
27
|
+
before { File.unlink(path) if File.exist?(path) }
|
28
28
|
|
29
29
|
it 'should get the file' do
|
30
30
|
document.save_file(path)
|
@@ -33,8 +33,8 @@ describe Mifiel::Document do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
describe '#save_file_signed' do
|
36
|
-
let!(:path) {'tmp/the-file-signed.pdf' }
|
37
|
-
before { File.unlink(path) if File.exist?(path)}
|
36
|
+
let!(:path) { 'tmp/the-file-signed.pdf' }
|
37
|
+
before { File.unlink(path) if File.exist?(path) }
|
38
38
|
|
39
39
|
it 'should get the file' do
|
40
40
|
document.save_file_signed(path)
|
@@ -43,8 +43,8 @@ describe Mifiel::Document do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
describe '#save_xml' do
|
46
|
-
let!(:path) {'tmp/the-xml.xml' }
|
47
|
-
before { File.unlink(path) if File.exist?(path)}
|
46
|
+
let!(:path) { 'tmp/the-xml.xml' }
|
47
|
+
before { File.unlink(path) if File.exist?(path) }
|
48
48
|
|
49
49
|
it 'should get the file' do
|
50
50
|
document.save_xml(path)
|
data/spec/support/fake_mifiel.rb
CHANGED
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.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genaro Madrid
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -28,28 +28,28 @@ dependencies:
|
|
28
28
|
name: json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: api-auth
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.4'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.4'
|
55
55
|
- !ruby/object:Gem::Dependency
|
@@ -67,19 +67,19 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 4.2.7
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: flexirest
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: bundler
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|