belvo 1.2.0 → 1.3.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: d7c835bc36e3ffa4aed0c08effb1c7a7ec0f64b46955f4fb59bd9bd4aabd6e98
4
- data.tar.gz: 24fa5cb7a3ec5b0581eac4b04b2e58ffa9a08bd332d91512b0d33641a3185264
3
+ metadata.gz: 2451a25febe9bcc2e507d13977720f0886f89da8ff9e65d639846ca029717a53
4
+ data.tar.gz: 0ab5eb4ff9f6196ebc876011f3485e4bcba7a7888cbd20264f0abaaf9380e158
5
5
  SHA512:
6
- metadata.gz: 7f7843ca0c81834407decbcccc5a136ad29800041c4d5a090cfae523a27521e0aa0e8a44abd69310ad01aa403a80114341e7735ac9168fa53f6345eb1336146e
7
- data.tar.gz: 1fc654b148a1c0ff31480f593741064371baefef276d7e7df2f70d74fbe95dd8e31e15cf49e109f0468e48060d05d2b923b6a375675cf7c78d6771c1265ef0c3
6
+ metadata.gz: 0ecbbb2a7c36121c8f9bfffdb5dddc4e4d2eb9065e3405ae0574736c808b2d24796c292dfc98a2b50d3431875d8b25bf6db5aea9946f765f5a1dca3acf5fd4d9
7
+ data.tar.gz: 90490528e75a6cca01484b74094c750368191b726ad36530912c27dc560c49ae85b19856cb462947d6da9f07bce3eff5169265cb206e07a938eead59d3bd9ab1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- belvo (1.2.0)
4
+ belvo (1.3.0)
5
5
  faraday
6
6
  faraday_middleware
7
7
  typhoeus
data/lib/belvo/options.rb CHANGED
@@ -152,6 +152,19 @@ module Belvo
152
152
  )
153
153
  end
154
154
 
155
+ # @!class TaxDeclarationOptions < Faraday::Options
156
+ # Contains configurable properties of a TaxDeclaration
157
+ # @!attribute save_data [rw] Should data be persisted or not.
158
+ # @!attribute token [rw] OTP token required by the institution
159
+ # @!attribute attach_pdf [rw] Should the PDF file be included in the
160
+ # response or not.
161
+ class TaxDeclarationOptions < Faraday::Options.new(
162
+ :token,
163
+ :save_data,
164
+ :attach_pdf
165
+ )
166
+ end
167
+
155
168
  # @!class TaxRetentionsOptions < Faraday::Options
156
169
  # Contains configurable properties of a tax retention
157
170
  # @!attribute save_data [rw] Indicates whether or not to persist the
@@ -491,6 +491,37 @@ module Belvo
491
491
  end
492
492
  end
493
493
 
494
+ # A Tax declaration is the representation of the tax declaration document sent
495
+ # every year by a person or a business to the tax authority in the country.
496
+ class TaxDeclaration < Resource
497
+ def initialize(session)
498
+ super(session)
499
+ @endpoint = 'api/tax-declarations/'
500
+ end
501
+
502
+ # Retrieve tax declaration information for a specific fiscal link.
503
+ # @param link [String] Link UUID
504
+ # @param year_from [Integer]
505
+ # @param year_to [Integer]
506
+ # @param options [TaxDeclarationOptions] Configurable properties
507
+ # @return [Hash] created tax declarations details
508
+ # @raise [RequestError] If response code is different than 2XX
509
+ def retrieve(link:, year_from:, year_to:, options: nil)
510
+ options = TaxDeclarationOptions.from(options)
511
+ body = {
512
+ link: link,
513
+ year_from: year_from,
514
+ year_to: year_to,
515
+ token: options.token,
516
+ save_data: options.save_data || true,
517
+ attach_pdf: options.attach_pdf
518
+ }.merge(options)
519
+
520
+ body = clean body: body
521
+ @session.post(@endpoint, body)
522
+ end
523
+ end
524
+
494
525
  # A tax retention is the amount of money that the payer must deduct from the
495
526
  # total amount of a purchase invoice, according to the regulations of the
496
527
  # fiscal institution.
data/lib/belvo/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Belvo
4
4
  # belvo-ruby current version
5
- VERSION = '1.2.0'
5
+ VERSION = '1.3.0'
6
6
  end
data/lib/belvo.rb CHANGED
@@ -104,6 +104,12 @@ module Belvo
104
104
  @tax_returns = TaxReturn.new @session
105
105
  end
106
106
 
107
+ # Provides access to TaxDeclarations resource
108
+ # @return [TaxDeclaration]
109
+ def tax_declarations
110
+ @tax_declarations = TaxDeclaration.new @session
111
+ end
112
+
107
113
  # Provides access to TaxStatus resource
108
114
  # @return [TaxStatus]
109
115
  def tax_status
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: belvo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Belvo Finance S.L.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-28 00:00:00.000000000 Z
11
+ date: 2022-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday