belvo 0.14.0 → 0.18.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: '038fbaeb161f1c341855ded020989160dc8ebbbcea33f5fe05fa0c92c81d0bcf'
4
- data.tar.gz: 4eee5f78d13eb4fff6a3a01ed50aa673a4b62b0bb10b45b86795d8e980f1a48d
3
+ metadata.gz: fbba449f201c38edea545d7fe6872cc9a8c9889e4f80d8d8a40b7b61818cbe63
4
+ data.tar.gz: 5cf8afcb0d4399501fd3164574bc11b809d0b13fb424c903853c5de48af286f8
5
5
  SHA512:
6
- metadata.gz: 4845b72c9a053c7bc8fabe97d6990cd1006fc75b4493f42944aac21cc3aea72860a2d9d7ab0cc0ae56f1a68f465c9c0aff1c9ca76c39e3ee82a4f638862f955b
7
- data.tar.gz: d41485f0c38659baa74b675d9220f3f1a07086d62c0ead42c886e3dedd06d0c4bcaab7ee878cc5cbe1dcf06e01eb7cd0d71413925be407c26af1617b596e1e1f
6
+ metadata.gz: ee61c813d1e3ee24c121cbfa153177cd74b651a6f5166c34d233823d2dba0de28a823d572dc25f0be326b488dd5b69a522c203ed3a6fe2175a3ed0731b03dfc7
7
+ data.tar.gz: f13e6b50640906ba4bb72be13f5157eae26be7b5bb23c480ada64574e4e032d762832702bc2fc3f510374cc973995ecfcd90ed097dae6651c77b460d1d168fc8
@@ -0,0 +1,54 @@
1
+ version: 2.1
2
+ orbs:
3
+ ruby: circleci/ruby@1.0.4
4
+ jobs:
5
+ test:
6
+ docker:
7
+ - image: cimg/ruby:2.7
8
+ steps:
9
+ - checkout
10
+ - ruby/install-deps
11
+ - run:
12
+ name: Install deps
13
+ command: gem install bundler -v 2.1.4
14
+ - run:
15
+ name: Run tests
16
+ command: |
17
+ bundle exec rubocop
18
+ bundle exec rspec spec
19
+ deploy-to-rubygems:
20
+ docker:
21
+ - image: cimg/ruby:2.7
22
+ steps:
23
+ - checkout
24
+ - ruby/install-deps
25
+ - run:
26
+ name: Set Rubygems credentials
27
+ command: |
28
+ mkdir ~/.gem
29
+ echo -e "---\r\n:rubygems_api_key: $GEM_HOST_API_KEY" > ~/.gem/credentials
30
+ chmod 0600 /home/circleci/.gem/credentials
31
+ - run:
32
+ name: Publish gem to Rubygems
33
+ command: bundle exec rake release
34
+
35
+ workflows:
36
+ build-test-deploy:
37
+ jobs:
38
+ - test:
39
+ filters:
40
+ tags:
41
+ only: /v.*/
42
+ context:
43
+ - shared
44
+ - deploy-to-rubygems:
45
+ requires:
46
+ - test
47
+ filters:
48
+ branches:
49
+ only:
50
+ - master
51
+ tags:
52
+ only: /^v.*/
53
+ context:
54
+ - shared
@@ -11,7 +11,7 @@ jobs:
11
11
  - name: Checkout Code
12
12
  uses: actions/checkout@v2
13
13
  with:
14
- fetch-depth: 1
14
+ fetch-depth: 10
15
15
 
16
16
  # Setup ruby
17
17
  - name: Set up Ruby 2.6
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ source 'https://rubygems.org'
6
6
  # Specify your gem's dependencies in belvo.gemspec
7
7
  gemspec
8
8
 
9
- gem 'coveralls', require: false
9
+ gem 'coveralls_reborn', require: false
10
10
  gem 'faraday'
11
11
  gem 'faraday_middleware'
12
12
  gem 'rake', '~> 12.0'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- belvo (0.14.0)
4
+ belvo (0.18.0)
5
5
  faraday
6
6
  faraday_middleware
7
7
  typhoeus
@@ -9,7 +9,7 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- addressable (2.7.0)
12
+ addressable (2.8.0)
13
13
  public_suffix (>= 2.0.2, < 5.0)
14
14
  ast (2.4.1)
15
15
  claide (1.0.3)
@@ -20,12 +20,11 @@ GEM
20
20
  colored2 (3.1.2)
21
21
  cork (0.3.0)
22
22
  colored2 (~> 3.1)
23
- coveralls (0.8.23)
24
- json (>= 1.8, < 3)
25
- simplecov (~> 0.16.1)
26
- term-ansicolor (~> 1.3)
27
- thor (>= 0.19.4, < 2.0)
28
- tins (~> 1.6)
23
+ coveralls_reborn (0.23.0)
24
+ simplecov (>= 0.18.1, < 0.22.0)
25
+ term-ansicolor (~> 1.6)
26
+ thor (>= 0.20.3, < 2.0)
27
+ tins (~> 1.16)
29
28
  crack (0.4.4)
30
29
  danger (8.2.1)
31
30
  claide (~> 1.0)
@@ -41,7 +40,7 @@ GEM
41
40
  octokit (~> 4.7)
42
41
  terminal-table (~> 1)
43
42
  diff-lcs (1.4.4)
44
- docile (1.3.2)
43
+ docile (1.4.0)
45
44
  ethon (0.12.0)
46
45
  ffi (>= 1.3.0)
47
46
  faraday (1.1.0)
@@ -56,7 +55,6 @@ GEM
56
55
  rchardet (~> 1.8)
57
56
  hashdiff (1.0.1)
58
57
  jaro_winkler (1.5.4)
59
- json (2.3.1)
60
58
  kramdown (2.3.1)
61
59
  rexml
62
60
  kramdown-parser-gfm (1.1.0)
@@ -104,18 +102,19 @@ GEM
104
102
  sawyer (0.8.2)
105
103
  addressable (>= 2.3.5)
106
104
  faraday (> 0.8, < 2.0)
107
- simplecov (0.16.1)
105
+ simplecov (0.21.2)
108
106
  docile (~> 1.1)
109
- json (>= 1.8, < 3)
110
- simplecov-html (~> 0.10.0)
111
- simplecov-html (0.10.2)
107
+ simplecov-html (~> 0.11)
108
+ simplecov_json_formatter (~> 0.1)
109
+ simplecov-html (0.12.3)
110
+ simplecov_json_formatter (0.1.3)
112
111
  sync (0.5.0)
113
112
  term-ansicolor (1.7.1)
114
113
  tins (~> 1.0)
115
114
  terminal-table (1.8.0)
116
115
  unicode-display_width (~> 1.1, >= 1.1.1)
117
- thor (1.0.1)
118
- tins (1.26.0)
116
+ thor (1.1.0)
117
+ tins (1.29.1)
119
118
  sync
120
119
  typhoeus (1.4.0)
121
120
  ethon (>= 0.9.0)
@@ -130,7 +129,7 @@ PLATFORMS
130
129
 
131
130
  DEPENDENCIES
132
131
  belvo!
133
- coveralls
132
+ coveralls_reborn
134
133
  danger (= 8.2.1)
135
134
  faraday
136
135
  faraday_middleware
@@ -142,4 +141,4 @@ DEPENDENCIES
142
141
  webmock
143
142
 
144
143
  BUNDLED WITH
145
- 2.1.4
144
+ 2.2.22
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <h1 align="center">Belvo Ruby Gem</h1>
2
2
  <p align="center">
3
3
  <a href="https://rubygems.org/gems/belvo"><img alt="Rubygems.org" src="https://img.shields.io/gem/v/belvo?style=for-the-badge"></a>
4
- <a href="https://travis-ci.com/belvo-finance/belvo-ruby"><img alt="Travis (.com)" src="https://img.shields.io/travis/com/belvo-finance/belvo-ruby/master?style=for-the-badge"></a>
4
+ <a href="https://app.circleci.com/pipelines/github/belvo-finance/belvo-ruby"><img alt="CircleCI (.com)" src="https://img.shields.io/travis/com/belvo-finance/belvo-ruby/master?style=for-the-badge"></a>
5
5
  <a href="https://coveralls.io/github/belvo-finance/belvo-ruby"><img alt="Coveralls github" src="https://img.shields.io/coveralls/github/belvo-finance/belvo-ruby?style=for-the-badge"></a>
6
6
  <a href="https://codeclimate.com/github/belvo-finance/belvo-ruby"><img alt="CodeClimate maintainability" src="https://img.shields.io/codeclimate/maintainability/belvo-finance/belvo-ruby?style=for-the-badge"></a>
7
7
  </p>
@@ -33,31 +33,60 @@ Or install it yourself as:
33
33
 
34
34
  $ gem install belvo
35
35
 
36
- ## Usage
36
+ ## Usage (create link via widget)
37
+
38
+ When your user successfully links their account using the [Connect Widget](https://developers.belvo.com/docs/connect-widget), your implemented callback funciton will return the `link_id` required to make further API to retrieve information.
39
+
37
40
 
38
41
  ```ruby
39
42
  require 'belvo'
40
43
 
41
44
  belvo = Belvo::Client.new(
42
- 'af6e69ff-43fa-4e10-8d90-3d217309a1e5',
43
- 'gdi64m68Lc6xUjIKN3aJF2fZd51wD36lTjGVyJO5xQBfL7PRsgFef-ADXBxIhUnd',
44
- 'https://sandbox.belvo.com'
45
+ 'your-secret-id',
46
+ 'your-secret-password',
47
+ 'sandbox'
45
48
  )
46
49
 
47
50
  begin
48
- new_link = belvo.links.register(
49
- institution: 'banamex_mx_retail',
50
- username: 'janedoe',
51
- password: 'super-secret',
52
- options: { access_mode: Belvo::Link::AccessMode::SINGLE }
53
- )
51
+ # Get the link_id from the result of your widget callback function
52
+ link_id = result_from_callback_function.id
53
+
54
+ belvo.accounts.retrieve(link: link_id)
55
+
56
+ puts belvo.accounts.list
57
+ rescue Belvo::RequestError => e
58
+ puts e.status_code
59
+ puts e.detail
60
+ end
61
+ ```
54
62
 
55
- belvo.accounts.retrieve(link: new_link['id'])
63
+ ## Usage (create link via SDK)
56
64
 
57
- puts belvo.accounts.list
65
+ You can also manually create the link using the SDK. However, for security purposes, we highly recommend, that you use the [Connect Widget](https://developers.belvo.com/docs/connect-widget) to create the link and follow the **Usage (create link via widget)** example.
66
+
67
+ ```ruby
68
+ require 'belvo'
69
+
70
+ belvo = Belvo::Client.new(
71
+ 'your-secret-id',
72
+ 'your-secret-password',
73
+ 'sandbox'
74
+ )
75
+
76
+ begin
77
+ new_link = belvo.links.register( # Creating the link
78
+ institution: 'erebor_mx_retail',
79
+ username: 'janedoe',
80
+ password: 'super-secret',
81
+ options: { access_mode: Belvo::Link::AccessMode::SINGLE }
82
+ )
83
+
84
+ belvo.accounts.retrieve(link: new_link['id'])
85
+
86
+ puts belvo.accounts.list
58
87
  rescue Belvo::RequestError => e
59
- puts e.status_code
60
- puts e.detail
88
+ puts e.status_code
89
+ puts e.detail
61
90
  end
62
91
  ```
63
92
 
@@ -67,7 +96,14 @@ end
67
96
 
68
97
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
69
98
 
70
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
99
+ To install this gem onto your local machine, run `bundle exec rake install`.
100
+
101
+ To release a new version:
102
+ - Create a new branch from master.
103
+ - Update the version number in `version.rb`
104
+ - Run `bundle exec rake install` to update `Gemfile.lock` version
105
+ - Create a new pull request for the new version.
106
+ - Once the new version is merged in `master`, create a `tag` matching the new version.
71
107
 
72
108
  ## Contributing
73
109
 
data/belvo.gemspec CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_dependency 'faraday_middleware'
34
34
  spec.add_dependency 'typhoeus'
35
35
 
36
- spec.add_development_dependency 'coveralls'
36
+ spec.add_development_dependency 'coveralls_reborn'
37
37
  spec.add_development_dependency 'rake', '~> 12.0'
38
38
  spec.add_development_dependency 'rspec', '~> 3.0'
39
39
  spec.add_development_dependency 'rubocop', '~> 0.81.0'
data/lib/belvo/options.rb CHANGED
@@ -85,8 +85,12 @@ module Belvo
85
85
  # @!class IncomeOptions < Faraday::Options
86
86
  # Contains configurable properties of an Income
87
87
  # @!attribute save_data [rw] Should data be persisted or not.
88
+ # @!attribute date_from [rw] Date string (YYYY-MM-DD)
89
+ # @!attribute date_to [rw] Date string (YYYY-MM-DD)
88
90
  class IncomeOptions < Faraday::Options.new(
89
- :save_data
91
+ :save_data,
92
+ :date_from,
93
+ :date_to
90
94
  )
91
95
  end
92
96
 
@@ -103,6 +107,22 @@ module Belvo
103
107
  )
104
108
  end
105
109
 
110
+ # @!class RecurringExpensesOptions < Faraday::Options
111
+ # Contains configurable properties of a Recurring Expense
112
+ # @!attribute save_data [rw] Should data be persisted or not.
113
+ class RecurringExpensesOptions < Faraday::Options.new(
114
+ :save_data
115
+ )
116
+ end
117
+
118
+ # @!class RiskInsights < Faraday::Options
119
+ # Contains configurable properties of a RiskInsights object
120
+ # @!attribute save_data [rw] Should data be persisted or not.
121
+ class RiskInsightsOptions < Faraday::Options.new(
122
+ :save_data
123
+ )
124
+ end
125
+
106
126
  # @!class TaxComplianceStatusOptions < Faraday::Options
107
127
  # Contains configurable properties of a TaxComplianceStatus
108
128
  # @!attribute save_data [rw] Should data be persisted or not.
@@ -309,7 +309,9 @@ module Belvo
309
309
  options = IncomeOptions.from(options)
310
310
  body = {
311
311
  link: link,
312
- save_data: options.save_data || true
312
+ save_data: options.save_data || true,
313
+ date_from: options.date_from,
314
+ date_to: options.date_to
313
315
  }.merge(options)
314
316
  body = clean body: body
315
317
  @session.post(@endpoint, body)
@@ -347,6 +349,54 @@ module Belvo
347
349
  end
348
350
  end
349
351
 
352
+ # Recurring Expenses contain a resume of one year
353
+ # of Transactions inside an Account.
354
+ class RecurringExpenses < Resource
355
+ def initialize(session)
356
+ super(session)
357
+ @endpoint = 'recurring-expenses/'
358
+ end
359
+
360
+ # Retrieve recurring expenses information from a specific banking link
361
+ # @param link [String] Link UUID
362
+ # @param options [RecurringExpensesOptions] Configurable properties
363
+ # @return [Hash] created RecurringExpenses details
364
+ # @raise [RequestError] If response code is different than 2XX
365
+ def retrieve(link:, options: nil)
366
+ options = RecurringExpensesOptions.from(options)
367
+ body = {
368
+ link: link,
369
+ save_data: options.save_data || true
370
+ }.merge(options)
371
+ body = clean body: body
372
+ @session.post(@endpoint, body)
373
+ end
374
+ end
375
+
376
+ # RiskInsights contain relevant metrics about
377
+ # the credit risk of a Link
378
+ class RiskInsights < Resource
379
+ def initialize(session)
380
+ super(session)
381
+ @endpoint = 'risk-insights/'
382
+ end
383
+
384
+ # Retrieve risk insights information from a specific banking link
385
+ # @param link [String] Link UUID
386
+ # @param options [RiskInsightsOptions] Configurable properties
387
+ # @return [Hash] created RiskInsights details
388
+ # @raise [RequestError] If response code is different than 2XX
389
+ def retrieve(link:, options: nil)
390
+ options = RiskInsightsOptions.from(options)
391
+ body = {
392
+ link: link,
393
+ save_data: options.save_data || true
394
+ }.merge(options)
395
+ body = clean body: body
396
+ @session.post(@endpoint, body)
397
+ end
398
+ end
399
+
350
400
  # A Tax compliance status is the representation of the tax situation
351
401
  # of a person or a business to the tax authority in the country.
352
402
  class TaxComplianceStatus < Resource
data/lib/belvo/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Belvo
4
4
  # belvo-ruby current version
5
- VERSION = '0.14.0'
5
+ VERSION = '0.18.0'
6
6
  end
data/lib/belvo.rb CHANGED
@@ -80,6 +80,18 @@ module Belvo
80
80
  @invoices = Invoice.new @session
81
81
  end
82
82
 
83
+ # Provides access to RecurringExpenses resource
84
+ # @return [RecurringExpense]
85
+ def recurring_expenses
86
+ @recurring_expenses = RecurringExpenses.new @session
87
+ end
88
+
89
+ # Provides access to RiskInsights resource
90
+ # @return [RiskInsights]
91
+ def risk_insights
92
+ @risk_insights = RiskInsights.new @session
93
+ end
94
+
83
95
  # Provides access to TaxComplianceStatus resource
84
96
  # @return [TaxComplianceStatus]
85
97
  def tax_compliance_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: 0.14.0
4
+ version: 0.18.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: 2021-07-05 00:00:00.000000000 Z
11
+ date: 2021-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: coveralls
56
+ name: coveralls_reborn
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -146,6 +146,7 @@ executables: []
146
146
  extensions: []
147
147
  extra_rdoc_files: []
148
148
  files:
149
+ - ".circleci/config.yml"
149
150
  - ".codeclimate.yml"
150
151
  - ".github/ISSUE_TEMPLATE/feature_request.md"
151
152
  - ".github/pull_request_template.md"
@@ -153,7 +154,6 @@ files:
153
154
  - ".gitignore"
154
155
  - ".rspec"
155
156
  - ".rubocop.yml"
156
- - ".travis.yml"
157
157
  - CODE_OF_CONDUCT.md
158
158
  - Dangerfile
159
159
  - Gemfile
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  requirements: []
196
- rubygems_version: 3.0.8
196
+ rubygems_version: 3.2.22
197
197
  signing_key:
198
198
  specification_version: 4
199
199
  summary: The Ruby gem for the Belvo API
data/.travis.yml DELETED
@@ -1,18 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- rvm:
4
- - 2.5.5
5
- before_install: gem install bundler -v 2.1.4
6
- script:
7
- - bundle exec rubocop
8
- - bundle exec rspec spec
9
- deploy:
10
- provider: rubygems
11
- api_key:
12
- secure: nsKurIEds1W6zwyj0mDmYx77amlDJOycegZV9o+OrBOzRRcpT+O3oFHGouMzAQyIbdUtmWyXp9uJHBEz7Q6Zc5fy6iG05sGO7tFoJMlKiPE5piiOTM5y6qt1GjZ1MYIU0rpnsp9QDsVUR1ATGpoD9O/zzn/lOPbxp2FoWHqWra84D/1jvVXPTqslLgup+GDsxseiAfwTMoTy65TXodISkvoYtlPL3EBV4/XQVBjVGGtM5mdjDJg+YA4yVA2NwCCjhFcj88fRxBmqWRnG/pzmX3nyRlMGjtUBm8OpLSR1NiXXqgzYUAVMD8/8VL/h3OsBqvwqgjZKMO6rXqNKFJQAxYUqvJaLcHP8D05dxWlumqwxlHzscKWLjAe7JbVo2DiAMvMTR8NTJOI7LOraU10iFHtmwAVnyBOaSJUVJuFgAoybq9tqYoZ/uZ7shCuWVNUIWIQM7HN9v99tfvemXMB+2RIN565bzBWSorn5MvXsApvqCLLDFuRnt7urR+0ZyT4dKXgvWRhnNOQgiMwEE/8+Y66nKVB7iNxFDw6LtittyoOZ0HvbHQDtqXOkzT/yaq2Ff2zwuUNYrCHqcdnxg5TBOYg5ndurcFxAc77ZlNSvidEC9tgXHA1m+r0Vq+ZCWOiyyohX33ZfA/UsAIStKr7a6ZLZZywuiqXasg1O9XoRB74=
13
- gem: belvo
14
- on:
15
- tags: true
16
- repo: belvo-finance/belvo-ruby
17
- branch: master
18
- skip_cleanup: 'true'