belvo 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 +4 -4
- data/.github/workflows/danger-pr-reviews.yml +4 -3
- data/Gemfile.lock +1 -1
- data/lib/belvo/options.rb +13 -12
- data/lib/belvo/resources.rb +31 -28
- data/lib/belvo/version.rb +1 -1
- data/lib/belvo.rb +6 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a629a7752ddbb1913f5313eeab072774c4ecd36748fb3cdf306a78f2bd4f6bbb
|
4
|
+
data.tar.gz: fd1d6c751d71663622e94f076ab1b4fbd606fdafdfc62ca5e1574d6cf4b17ef4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d2c41f8f976ec9a67622b12ed5f5ff1ef5373b1f7d170cd17a85f341e1313028be9f323f57102fc8f5c105c56f4572e1960fc45f051ed4fe210e0c90c13d195
|
7
|
+
data.tar.gz: ff9552fe45ccf2ea98bf53c2392b8e68120e4c965aa9f2843132f664bf24bfd7c7b9ad5c60eb54e8b0f29d7dda2dddf2d14a25b44890939127a5e1066ada95ab
|
@@ -14,10 +14,11 @@ jobs:
|
|
14
14
|
fetch-depth: 10
|
15
15
|
|
16
16
|
# Setup ruby
|
17
|
-
- name: Set up Ruby 2
|
18
|
-
uses:
|
17
|
+
- name: Set up Ruby 3.2
|
18
|
+
uses: ruby/setup-ruby@v1
|
19
19
|
with:
|
20
|
-
ruby-version: 2
|
20
|
+
ruby-version: 3.2
|
21
|
+
bundler-cache: true
|
21
22
|
|
22
23
|
# Install the right bundler version
|
23
24
|
- name: Install bundler
|
data/Gemfile.lock
CHANGED
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
|
@@ -201,16 +214,4 @@ module Belvo
|
|
201
214
|
# @!attribute token [rw] OTP token required by the institution
|
202
215
|
class InvestmentsPortfolioOptions < Faraday::Options.new(:token, :save_data)
|
203
216
|
end
|
204
|
-
|
205
|
-
# @!class InvestmentsTransactionOptions < Faraday::Options
|
206
|
-
# Contains configurable properties of an InvestmentsTransaction
|
207
|
-
# @!attribute date_to [rw] Date string (YYYY-MM-DD)
|
208
|
-
# @!attribute save_data [rw] Should data be persisted or not.
|
209
|
-
# @!attribute token [rw] OTP token required by the institution
|
210
|
-
class InvestmentsTransactionOptions < Faraday::Options.new(
|
211
|
-
:date_to,
|
212
|
-
:token,
|
213
|
-
:save_data
|
214
|
-
)
|
215
|
-
end
|
216
217
|
end
|
data/lib/belvo/resources.rb
CHANGED
@@ -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.
|
@@ -624,32 +655,4 @@ module Belvo
|
|
624
655
|
@session.post(@endpoint, body)
|
625
656
|
end
|
626
657
|
end
|
627
|
-
|
628
|
-
# A InvestmentsTransaction gets the existing transactions for an instrument
|
629
|
-
class InvestmentsTransaction < Resource
|
630
|
-
def initialize(session)
|
631
|
-
super(session)
|
632
|
-
@endpoint = 'investments/transactions/'
|
633
|
-
end
|
634
|
-
|
635
|
-
# Retrieve investments transactions from an existing link
|
636
|
-
# @param link [String] Link UUID
|
637
|
-
# @param date_from [String] Date string (YYYY-MM-DD)
|
638
|
-
# @param options [InvestmentsTransactionOptions] Configurable properties
|
639
|
-
# @return [Hash] created investments transactions details
|
640
|
-
# @raise [RequestError] If response code is different than 2XX
|
641
|
-
def retrieve(link:, date_from:, options: nil)
|
642
|
-
options = InvestmentsTransactionOptions.from(options)
|
643
|
-
date_to = options.date_to || Date.today.to_s
|
644
|
-
body = {
|
645
|
-
link: link,
|
646
|
-
date_from: date_from,
|
647
|
-
date_to: date_to,
|
648
|
-
token: options.token,
|
649
|
-
save_data: options.save_data || true
|
650
|
-
}.merge(options)
|
651
|
-
body = clean body: body
|
652
|
-
@session.post(@endpoint, body)
|
653
|
-
end
|
654
|
-
end
|
655
658
|
end
|
data/lib/belvo/version.rb
CHANGED
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
|
@@ -133,11 +139,5 @@ module Belvo
|
|
133
139
|
def investments_portfolio
|
134
140
|
@investments_portfolio = InvestmentsPortfolio.new @session
|
135
141
|
end
|
136
|
-
|
137
|
-
# Provides access to InvestmentsTransaction resource
|
138
|
-
# @return [InvestmentsTransaction]
|
139
|
-
def investments_transaction
|
140
|
-
@investments_transaction = InvestmentsTransaction.new @session
|
141
|
-
end
|
142
142
|
end
|
143
143
|
end
|
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.
|
4
|
+
version: 1.4.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:
|
11
|
+
date: 2023-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -195,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
195
|
- !ruby/object:Gem::Version
|
196
196
|
version: '0'
|
197
197
|
requirements: []
|
198
|
-
rubygems_version: 3.3.
|
198
|
+
rubygems_version: 3.3.26
|
199
199
|
signing_key:
|
200
200
|
specification_version: 4
|
201
201
|
summary: The Ruby gem for the Belvo API
|