nova-api 1.2.0 → 1.4.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: 95a363b8ed0d3656f925c3364ad0fe2b9a0b3bd9f0dcc36b9ecd83ce2f16a7cc
4
- data.tar.gz: df9655cd2ffe645c767bf73f7a63d9b2b1a4fb6f1ee6511337a8503aab9bb0d6
3
+ metadata.gz: bc2131a65cde2912afd142dcba116a5978daed17e2e1a6edc1326bc39517ad1f
4
+ data.tar.gz: 062643eb92cbf096b3aaafdc8ee86f215f440c87bc179c669123e2181c07cb1d
5
5
  SHA512:
6
- metadata.gz: e177f013e8cdbfc4c0dcb9f3658ccb295d3d32835c96682c82552d07f46bcdc195faf4605015d301fe7a826ff2ec94a16689085ce953dbdf43c15aaac6d78046
7
- data.tar.gz: 5618212cf0a37f0a23c9d5e2d7265cf6bc88b8a01ec24ee93e25923deaffb5077bf11de225951d64a290d520d435c5ac5f4e6ccd2375b138fff4e54112949f36
6
+ metadata.gz: c2a9ed240b9b9737f65f204eeb8ea5b0b8952ca2aec4270f6fa7f36eb28c34c1d0f7012bd7551fb73bf43aafdeade5f118407af0a2fd8bfe1d69561671b5c9b8
7
+ data.tar.gz: 8d28637fdc47dd4068fbf3bded7c973055aa3ad5f8b83dd38d5b7d4dc04488169d97e1b18a76a0503bd01f98aa587c9226e95eb7609adc967369bb42ee6baf86
data/CHANGELOG.md CHANGED
@@ -5,6 +5,18 @@ 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
+ ## [1.4.0] - 2023-10-03
9
+
10
+ ### Added
11
+
12
+ - Complementary fields for company resource
13
+
14
+ ## [1.3.0] - 2023-10-03
15
+
16
+ ### Added
17
+
18
+ - Configuration to use the staging environment (```use_staging```)
19
+
8
20
  ## [1.2.0] - 2023-09-29
9
21
 
10
22
  ### Added
@@ -108,7 +120,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
108
120
 
109
121
  - Apportionment related stuff
110
122
 
111
- [unreleased]: https://github.com/coyosoftware/nova-api/compare/1.2.0...HEAD
123
+ [unreleased]: https://github.com/coyosoftware/nova-api/compare/1.4.0...HEAD
124
+ [1.4.0]: https://github.com/coyosoftware/nova-api/releases/tag/1.4.0
125
+ [1.3.0]: https://github.com/coyosoftware/nova-api/releases/tag/1.3.0
112
126
  [1.2.0]: https://github.com/coyosoftware/nova-api/releases/tag/1.2.0
113
127
  [1.1.0]: https://github.com/coyosoftware/nova-api/releases/tag/1.1.0
114
128
  [1.0.0]: https://github.com/coyosoftware/nova-api/releases/tag/1.0.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nova-api (1.2.0)
4
+ nova-api (1.4.0)
5
5
  dry-struct (~> 1.6)
6
6
  dry-types (~> 1.7)
7
7
  httparty (~> 0.1)
data/lib/nova/api/base.rb CHANGED
@@ -9,7 +9,8 @@ module Nova
9
9
  format :json
10
10
 
11
11
  SCHEME = 'https'
12
- HOST = 'nova.money'
12
+ PRODUCTION_HOST = 'nova.money'
13
+ STAGING_HOST = 'staging.nova.money'
13
14
 
14
15
  def self.endpoint
15
16
  raise EndpointNotConfiguredError, 'Each class must implement its own endpoint'
@@ -18,7 +19,9 @@ module Nova
18
19
  def self.base_url
19
20
  raise Nova::API::MissingSubdomainError, 'The subdomain must be informed' if configuration.subdomain.nil? || configuration.subdomain.empty?
20
21
 
21
- "#{SCHEME}://#{configuration.subdomain}.#{HOST}"
22
+ host = configuration.use_staging? ? STAGING_HOST : PRODUCTION_HOST
23
+
24
+ "#{SCHEME}://#{configuration.subdomain}.#{host}"
22
25
  end
23
26
 
24
27
  def endpoint
@@ -4,8 +4,15 @@ module Nova
4
4
  class Company < Nova::API::Base
5
5
  ALLOWED_ATTRIBUTES = %i[]
6
6
 
7
+ attribute? :active, Dry::Types['strict.bool'].optional
8
+ attribute? :address, Dry::Types['coercible.string'].optional
7
9
  attribute? :id, Dry::Types['coercible.integer'].optional
10
+ attribute? :identification, Dry::Types['coercible.string'].optional
8
11
  attribute? :name, Dry::Types['coercible.string'].optional
12
+ attribute? :phone, Dry::Types['coercible.string'].optional
13
+ attribute? :social_contract_date, Dry::Types['coercible.string'].constrained(format: DATE_REGEX)
14
+ attribute? :social_contract_number, Dry::Types['coercible.string'].optional
15
+ attribute? :state_inscription, Dry::Types['coercible.string'].optional
9
16
  attribute? :trading_name, Dry::Types['coercible.string'].optional
10
17
 
11
18
  def self.endpoint
@@ -1,5 +1,5 @@
1
1
  module Nova
2
2
  module API
3
- VERSION = "1.2.0"
3
+ VERSION = "1.4.0"
4
4
  end
5
5
  end
@@ -1,9 +1,13 @@
1
1
  module Nova
2
2
  module API
3
3
  class Configuration
4
- attr_accessor :api_key, :subdomain
4
+ attr_accessor :api_key, :subdomain, :use_staging
5
5
  attr_reader :host
6
6
  attr_reader :scheme
7
+
8
+ def use_staging?
9
+ [true, 'true'].include?(use_staging)
10
+ end
7
11
  end
8
12
  end
9
13
  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: 1.2.0
4
+ version: 1.4.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: 2023-09-29 00:00:00.000000000 Z
11
+ date: 2023-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler