enotas_nfe 0.0.16 → 0.0.17

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: 412f65731e9e70616efbcf9dbc63322d2b394902
4
- data.tar.gz: 3ad9a972b1e64d7ca5447ad804e761c602f26a90
3
+ metadata.gz: a53fbf29ac1b3cb257a1af2ae054735db71f5616
4
+ data.tar.gz: 455d90bee4405169603adf370ed5ae5978ff9e5b
5
5
  SHA512:
6
- metadata.gz: 75e29d5bb0e4982ada961b79b00a30c88c9f2995268132dec1c7cacc32e3dd69303e3373dbda9e1396f4eccb31c9361ba181df7ce8ab3317e79cfd7fa67e13c5
7
- data.tar.gz: 7ff9a380b9d161fee5ca442cb65ef071103e8aadb38aacac84833ab8fc42d8c79a4f72378bf7d1a12a8a8eac7cee08076e704d6174021273858bab878c949a6b
6
+ metadata.gz: 6087ae57439296c4fe54b683d99800c9794cd0d79de14b13cb0caa80479857d19765bcdf8e5d9cd41b579c801609c00123555282aa5686ec2937ddf0c426abee
7
+ data.tar.gz: '09b4159f1ef1ee5ff37fc900fc0cf41090648012ec60531cedf8b77a163666c65875c34ea453695a85c2cb71c3a9b79268d7274386d5f2eb8c871fcb4cdcdaaf'
@@ -18,9 +18,9 @@ module EnotasNfe
18
18
  connection.use Middleware, auth_token
19
19
  connection.use Faraday::Response::ParseJson
20
20
 
21
+ connection.request :multipart
21
22
  connection.adapter :net_http
22
23
  end
23
24
  end
24
-
25
25
  end
26
26
  end
@@ -16,7 +16,11 @@ module EnotasNfe
16
16
  end
17
17
 
18
18
  def set_logo(firm_id, body)
19
- post("empresas/#{firm_id}/logo", body)
19
+ multipart_post("empresas/#{firm_id}/logo", body)
20
+ end
21
+
22
+ def set_certificado_digital(firm_id, body)
23
+ multipart_post("empresas/#{firm_id}/certificadoDigital", body)
20
24
  end
21
25
 
22
26
  ## rota para carta de correcao
@@ -0,0 +1,11 @@
1
+ module EnotasNfe
2
+ module Model
3
+ class CertificadoDigital
4
+ include Virtus.model
5
+
6
+ attribute :empresaId, String
7
+ attribute :arquivo, Faraday::UploadIO
8
+ attribute :senha, String
9
+ end
10
+ end
11
+ end
@@ -14,8 +14,26 @@ module EnotasNfe
14
14
  request(:delete, path, body)
15
15
  end
16
16
 
17
+ def multipart_post(path, body = {})
18
+ request_multipart(path, body)
19
+ end
20
+
17
21
  private
18
22
 
23
+ def request_multipart(path, body)
24
+ response = connection.post do |request|
25
+ multipart_body = {}
26
+ multipart_body["arquivo"] = Faraday::UploadIO.new(body[:arquivo].tempfile, "application/x-pkcs12")
27
+ multipart_body["senha"] = body[:senha]
28
+
29
+ request.path = path
30
+ request.body = multipart_body
31
+ request.headers['Content-Type'] = 'multipart/form-data'
32
+ end
33
+
34
+ response.body
35
+ end
36
+
19
37
  def request(method, path, body)
20
38
  body_serialized = serialize_body(body)
21
39
 
@@ -38,6 +56,5 @@ module EnotasNfe
38
56
  def serialize_body(body)
39
57
  VirtusConvert.new(body, reject_nils: true).to_hash
40
58
  end
41
-
42
59
  end
43
60
  end
@@ -1,3 +1,3 @@
1
1
  module EnotasNfe
2
- VERSION = "0.0.16"
2
+ VERSION = "0.0.17"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enotas_nfe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis Fernando Pimenta
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-19 00:00:00.000000000 Z
11
+ date: 2018-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -133,6 +133,7 @@ files:
133
133
  - lib/enotas_nfe/model/ambiente_homologacao.rb
134
134
  - lib/enotas_nfe/model/ambiente_producao.rb
135
135
  - lib/enotas_nfe/model/carta_correcao.rb
136
+ - lib/enotas_nfe/model/certificado_digital.rb
136
137
  - lib/enotas_nfe/model/cliente.rb
137
138
  - lib/enotas_nfe/model/cofins.rb
138
139
  - lib/enotas_nfe/model/configuracoes_nfse_homologacao.rb