enotas_api 1.0.1 → 1.0.2

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: 22d87c29df9db036de3e5a322f8526aab4f71070921567d39fb0e99f4b8ee3a5
4
- data.tar.gz: fccd18305a5a179e2e60ffb443ae4fd65eaada2ea744739d651c7bbd2e5956c5
3
+ metadata.gz: aebce3c20a825b7d6081c72b4a656634c5c5b71ba8df4b1bbcf72d2145ca8033
4
+ data.tar.gz: f613fdd47e28d4f8d0f210122b973cbfe6a92002705329b8b696195d59de8b9d
5
5
  SHA512:
6
- metadata.gz: 06626a5268ffb2aaca2b2b86d2bce7d50eeebc2c44a5148ac2388b2e75a14cea795770d830ca2f075621783bb099d2d88089519bb94926359f2d531eb42f244b
7
- data.tar.gz: faf80c71d948c470a040fd8d0e488fae5175094767ea3391d51c25cc391800120eac50bc5179776e8688c6df04dd7dada6c243084da049ec2ae9810fb0fe5c3f
6
+ metadata.gz: e64f6bcca0685b09aa54e652b5de4d8b4b4a48a1bcbb17180160f90b6e5b0dabf7616db592875bb878401049da3e9ce02dd5b1403e90a4a5634d816e581e7056
7
+ data.tar.gz: db850da3b638d066912e421d4fe7c908f6e679dd2955ea27246ba1751f3d8c5374be87c7ddbb3b0a96130b3c9ef0dde3e49fe01dced2cc7158e691cc4e508691
@@ -1,3 +1,5 @@
1
+ # 1.0.2
2
+ - Ajustando bug na renderização de json, que trazia o atributo inválido @attributes no json
1
3
  # 1.0.1
2
4
  - Suportando valores BigDecimal para tipo :decimal
3
5
  # 1.0.0
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- enotas_api (1.0.1)
4
+ enotas_api (1.0.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -7,11 +7,22 @@ module EnotasApi
7
7
  class Entity
8
8
  include EnotasApi::Attributable
9
9
 
10
- def to_json(options = nil)
10
+ def as_json(_options = nil)
11
11
  self.class.attributes.keys
12
- .map { |att| [att, send(att)] }
12
+ .map { |att| [att, json_value(att)] }
13
13
  .reject { |e| e[1].nil? && !attribute_changed?(e[0]) }
14
- .to_h.to_json(options)
14
+ .to_h
15
+ end
16
+
17
+ def to_json(options = nil)
18
+ as_json.to_json(options)
19
+ end
20
+
21
+ private
22
+
23
+ def json_value(attr)
24
+ value = send(attr)
25
+ value.is_a?(EnotasApi::Entity) ? value.as_json : value
15
26
  end
16
27
  end
17
28
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EnotasApi
4
- VERSION = '1.0.1'
4
+ VERSION = '1.0.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enotas_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo Bohrer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-23 00:00:00.000000000 Z
11
+ date: 2020-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake