zaig 1.0.7 → 1.0.8

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
  SHA256:
3
- metadata.gz: 8772408f0511d1fe3a5de65ddf6344af3d32754bdb7ce95252a05cb3e3cb144c
4
- data.tar.gz: d01ca6b7f88430671f09a61a1af872650438113fac5bce59aa74838808b267cc
3
+ metadata.gz: 05cec7da728cfbfdf5457960a2d289e4963d22874f9790e12408eb2498aff1de
4
+ data.tar.gz: 1b73d0fe9a384e2bb73dd6af74939117329142fa9bf9aa27eeb28ccca5af2f95
5
5
  SHA512:
6
- metadata.gz: bacc2f06a07747edfff29022645d937cca069244b7857604bcebb0926578a498a3224c62153e8b5d18d40bc5754ed61dc29701db2bae3cab247db95b73cee06d
7
- data.tar.gz: f1d7438aae92727b67056b38ddea0e39760ecc9ae925883682faed8b5ef4740cbdc0d9fd5b691740087b72b4555b95e0f45c915658ba8e14eb7f0d9450b06bf2
6
+ metadata.gz: 7f5c7152922f7a0823b805ad584986ed2c4b2f86484b5ca1f0c5544960cc15a20cbc48a1c0c299eb7b8e226a09d61eb74b5915a928fc4492876b0d7ca8fe4443
7
+ data.tar.gz: fa24fdd51580ef3a9f64bc02eda165e2c928fbc087b8595b5570324657e2509def4a510f84ca3452f0b54e24dd15c58ba44a01a9bd41e0a85e780ec8a88944a0
@@ -18,7 +18,7 @@ module Zaig
18
18
  Accept: "application/json"
19
19
  }
20
20
 
21
- return headers if @jwt_secret.nil? || @jwt_secret.empty?
21
+ return headers if @jwt_secret.nil? || @jwt_secret&.empty?
22
22
 
23
23
  headers[:Authorization] = "Bearer #{access_token}"
24
24
  headers
@@ -48,8 +48,8 @@ module Zaig
48
48
  unless parsed_res.key?(:resposta_zaig)
49
49
  detail = JSON.parse(res.body, symbolize_names: true)[:detail]
50
50
 
51
- error = ::Zaig::FieldValidationError.new I18n.t("zaig.errors.validation_error", field_name: "resposta_zaig")
52
- error.detail = JSON.parse(res.body, symbolize_names: true)[:detail]
51
+ error = ::Zaig::FieldValidationError.new I18n.t("zaig.errors.validation_error")
52
+ error.detail = detail
53
53
 
54
54
  raise error
55
55
  end
@@ -36,9 +36,8 @@ module Zaig
36
36
  end
37
37
 
38
38
  def build_address(obj_address)
39
- {
39
+ address = {
40
40
  city: obj_address[:city],
41
- complement: obj_address[:complement] || "",
42
41
  country: obj_address[:country] || "BRA",
43
42
  neighborhood: obj_address[:neighborhood],
44
43
  number: obj_address[:number],
@@ -46,6 +45,8 @@ module Zaig
46
45
  street: obj_address[:street],
47
46
  uf: obj_address[:uf]
48
47
  }
48
+ address[:complement] = obj_address[:complement] if !obj_address[:complement].nil? || !obj_address[:complement]&.empty?
49
+ address
49
50
  end
50
51
 
51
52
  def build_phone(obj)
data/lib/zaig/version.rb CHANGED
@@ -8,5 +8,5 @@ module Zaig
8
8
  # Major - Incremented for incompatible changes with previous release (or big enough new features)
9
9
  # Minor - Incremented for new backwards-compatible features + deprecations
10
10
  # Patch - Incremented for backwards-compatible bug fixes
11
- VERSION = "1.0.7"
11
+ VERSION = "1.0.8"
12
12
  end
data/lib/zaig.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  require "cpf_cnpj"
4
4
  require "flash_integration"
5
5
  require "i18n"
6
+ require "jwt"
6
7
  require "singleton"
7
8
 
8
9
  require "zaig/base_error"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zaig
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danilo Carolino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-20 00:00:00.000000000 Z
11
+ date: 2022-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cpf_cnpj