mifiel 1.1.2 → 1.1.3

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: 6b81aa9ae009760bdbf21c71d2af638956d898e7
4
- data.tar.gz: 7b62d15b2abe554804ba41b5eaf9d13fe2a06199
3
+ metadata.gz: 36fb92b3ebd8ee48db492aa83ef01ab696f0f8c3
4
+ data.tar.gz: d5d3473df052bc3156a68dc16f819ae4cc186623
5
5
  SHA512:
6
- metadata.gz: 4aa349459b1752a1e682cd4dc8c959dede12e95b519cda0497b1d6c4cc381b1000c9eb7bf147e983ab6d6166c97ddcfa3638d261ab998352526042d5bcc0bb95
7
- data.tar.gz: 484c3f9becf2180f30e3bc11c105ba79e72c764c2ac07632897c6333b52b731c598bd5e566914bfd0ba18e513609322fce3c1d1f6bf45c221f9f99fd508ecefd
6
+ metadata.gz: 73fe847fb0de5584e33f4e936d823ad23296baa4fc8254431e4febc1e2b2951be9cb439d5c0fa24f0bc20142adaef0fcfb6725f26b669e0f083d44adee21df2d
7
+ data.tar.gz: 4876287da937bc6db321c1b2cc0714c1f84674d484d89fbadf355f3a19f8897f81a7d68f0cda9a4d53015b507716549a440cfb8a66aef57f15e20504e71af4fe
@@ -11,4 +11,5 @@ notifications:
11
11
  on_failure: always
12
12
  script:
13
13
  - mkdir ./tmp/
14
+ - bundle exec rubocop
14
15
  - bundle exec rspec spec
@@ -1,4 +1,4 @@
1
- require 'active_rest_client'
1
+ require 'flexirest'
2
2
 
3
3
  module Mifiel
4
4
  require 'mifiel/errors'
@@ -1,12 +1,12 @@
1
1
  require 'rest-client'
2
2
 
3
3
  module Mifiel
4
- class Base < ActiveRestClient::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.load(response.body)
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)
@@ -15,7 +15,7 @@ module Mifiel
15
15
  ssl_version: 'SSLv23'
16
16
  )
17
17
  req = ApiAuth.sign!(rest_request, Mifiel.config.app_id, Mifiel.config.app_secret)
18
- JSON.load(req.execute)
18
+ Mifiel::Certificate.new(JSON.parse(req.execute))
19
19
  end
20
20
  end
21
21
  end
@@ -27,9 +27,9 @@ module Mifiel
27
27
  private
28
28
 
29
29
  def set_api_auth_credentials
30
- ActiveRestClient::Base.base_url = base_url
31
- ActiveRestClient::Base.api_auth_credentials(app_id, app_secret)
32
- ActiveRestClient::Base.request_body_type = :json
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
 
@@ -7,7 +7,13 @@ module Mifiel
7
7
  put :save, '/documents/:id'
8
8
  delete :delete, '/documents/:id'
9
9
 
10
- def self.create(signatories:, file: nil, hash: nil, name: nil, callback_url: nil)
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.load(response)
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 }
@@ -1,3 +1,3 @@
1
1
  module Mifiel
2
- VERSION = '1.1.2'.freeze
2
+ VERSION = '1.1.3'.freeze
3
3
  end
@@ -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', '~> 1.8'
23
- spec.add_runtime_dependency 'api-auth', '~> 1.4'
24
- spec.add_runtime_dependency 'activesupport', '~> 4.2.7'
25
- spec.add_runtime_dependency 'active_rest_client', '~> 1.2'
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'
@@ -6,7 +6,7 @@ describe Mifiel::Certificate do
6
6
  )
7
7
  end
8
8
 
9
- it { expect(certificate).to be_a(Hash) }
9
+ it { expect(certificate).to be_a(Mifiel::Certificate) }
10
10
  end
11
11
 
12
12
  end
@@ -15,7 +15,7 @@ describe Mifiel::Document do
15
15
  )
16
16
  end
17
17
 
18
- it { expect(document).to be_a(Hash) }
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)
@@ -1,5 +1,5 @@
1
1
  require 'sinatra/base'
2
-
2
+ # rubocop:disable Metrics/ClassLength
3
3
  class FakeMifiel < Sinatra::Base
4
4
  get '/api/v1/keys' do
5
5
  content_type :json
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.2
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-08-08 00:00:00.000000000 Z
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: '1.8'
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: '1.8'
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: active_rest_client
70
+ name: flexirest
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '1.2'
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: '1.2'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement