nova-api 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b216822cbce6773c2c57891e535c183cce4fa84a659c58ea03b57f9137fd7a06
4
- data.tar.gz: 9a0203ee8e6fffda09ea938d49d02394148ba5cb04514962aaa6150d8a918fa1
3
+ metadata.gz: 2901a43e9252f408062dc2dc8277a7d725171d1a444b836b5183504253a18780
4
+ data.tar.gz: bcab8361a4cbac715fc77c9f7d1edfee01f9625a145b0d6a591fda100b37e369
5
5
  SHA512:
6
- metadata.gz: c02e39188f050e491dae8d8cea5cf96650e7718bef05b8d9bb0d5161396e89daecd10ff5751b2c1cb68030bdef3bfb07d8f0f6ff5489a5bdaefe2d31144fcd7d
7
- data.tar.gz: 603d6ec2bad145e6e7917819407c6db33f03ec9a2e23c0ab17768fc3b71763a3a239115110e622335ac0b838cb10d8a8fc25cebdb44a758aa0f8cba9d7ce83f6
6
+ metadata.gz: 606bbc5298434ce3924c205d0b59e84b400113ea21dbb640cb0ad587d5e868b8a688b637b247a402c77e28e7b2f96d7c695f5518f421ccf578ad06293bb38514
7
+ data.tar.gz: ba18520bb7f9daa0dc951539c9a321bd3a30c83a9b0d4ab8490a9827398c816771a2d76d867b9d1c4603e65417da5230698ba6cbfc1f44ccee32911f6a977dc3
data/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.8.0] - 2021-03-16
9
+
10
+ ### Added
11
+
12
+ - HTTP status code to Response and ListResponse classes
13
+
8
14
  ## [0.7.0] - 2021-03-12
9
15
 
10
16
  ### Added
@@ -67,7 +73,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
67
73
 
68
74
  - Apportionment related stuff
69
75
 
70
- [unreleased]: https://github.com/coyosoftware/nova-api/compare/0.6.0...HEAD
76
+ [unreleased]: https://github.com/coyosoftware/nova-api/compare/0.8.0...HEAD
77
+ [0.8.0]: https://github.com/coyosoftware/nova-api/releases/tag/0.8.0
78
+ [0.7.0]: https://github.com/coyosoftware/nova-api/releases/tag/0.7.0
71
79
  [0.6.0]: https://github.com/coyosoftware/nova-api/releases/tag/0.6.0
72
80
  [0.5.0]: https://github.com/coyosoftware/nova-api/releases/tag/0.5.0
73
81
  [0.4.0]: https://github.com/coyosoftware/nova-api/releases/tag/0.4.0
@@ -8,9 +8,11 @@ module Nova
8
8
  attribute :records, Dry::Types['strict.array'].of(Dry::Types['nominal.any']).optional
9
9
  attribute :errors, Dry::Types['strict.array'].of(Dry::Types['coercible.string'])
10
10
  attribute :success, Dry::Types['strict.bool']
11
+ attribute :status, Dry::Types['coercible.integer']
11
12
 
12
13
  def self.build(response, klass)
13
14
  success = response.success?
15
+ status = response.code
14
16
 
15
17
  parsed_response = response.parsed_response
16
18
 
@@ -27,7 +29,7 @@ module Nova
27
29
 
28
30
  errors ||= []
29
31
 
30
- new(success: success, errors: errors, records: records)
32
+ new(success: success, errors: errors, records: records, status: status)
31
33
  end
32
34
 
33
35
  private
@@ -6,11 +6,13 @@ module Nova
6
6
  module API
7
7
  class Response < Nova::API::Utils::BaseStruct
8
8
  attribute? :record, Dry::Types['nominal.any']
9
- attribute :errors, Dry::Types['strict.array'].of(Dry::Types['coercible.string'])
9
+ attribute :errors, Dry::Types['strict.array'].of(Dry::Types['coercible.string'])
10
10
  attribute :success, Dry::Types['strict.bool']
11
+ attribute :status, Dry::Types['coercible.integer']
11
12
 
12
13
  def self.build(response, object = nil)
13
14
  success = response.success?
15
+ status = response.code
14
16
 
15
17
  parsed_response = response.parsed_response.to_h
16
18
 
@@ -24,7 +26,7 @@ module Nova
24
26
  record = object.class.new(object.attributes.merge(parsed_response))
25
27
  end
26
28
 
27
- new(success: success, errors: errors, record: record)
29
+ new(success: success, errors: errors, record: record, status: status)
28
30
  end
29
31
 
30
32
  private
@@ -1,5 +1,5 @@
1
1
  module Nova
2
2
  module API
3
- VERSION = "0.7.0"
3
+ VERSION = "0.8.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nova-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Coyô Software
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-12 00:00:00.000000000 Z
11
+ date: 2021-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler