nordigen-ruby 2.0.0 → 2.1.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: 55e72e3ae468d31197df1d31c3ed1ab62d54c2e3f138bf2c8f946559a605d4db
4
- data.tar.gz: 55f1a55b4c854d9cc96d701999b832c59388cf707d26f611cf43f7dc17205fd1
3
+ metadata.gz: 17eb0e953a7008d324ff2cb96bf8eda218e2850820cf0c3bdb26c447af241475
4
+ data.tar.gz: e00b83c675d89256540bdaa4871415583f7a92db420047ae3dccb90aff8706a9
5
5
  SHA512:
6
- metadata.gz: 0432d6819c810c20cf5424c9d771e44192c8e27506cb01e8d40fb83395c645efa6c975e61f78493cfc9a348a22e687a7cb373668ff2408ba15e4411630c8d990
7
- data.tar.gz: 417f3953480f7bcc91d6f88d6c0ad2256ee915bdab43a88d395005e36fc516f5383393e1db92603f707f15a7ea53271f2e3ffbb03af669c2224922e69317b77c
6
+ metadata.gz: 3dc4521ffefdc1d2f927db335345a647737b19339c5b26d42fccaee7d52ccddd467abf9f6db4ff5cea3068ce843e1f3e9e688ef1cf9c11807dc81f916ff6d17c
7
+ data.tar.gz: '09ce3ce0cf5dca4d3457ab1d2b2dfde3b6fd508ea383a7dfb3c0a8408bd7903cb1a28480532e5b564094cb39388240c6fa131ac5df66774928b00f307a5ad40a'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.1.0] - 2022-12-15
4
+
5
+ - [Add user_language and account_selection params for requisition #18](https://github.com/nordigen/nordigen-ruby/pull/18)
6
+ - [Add a transactions premium option #19](https://github.com/nordigen/nordigen-ruby/pull/19)
7
+
8
+ ## [2.0.1] - 2022-12-09
9
+
10
+ - [Fix date filter #15](https://github.com/nordigen/nordigen-ruby/pull/15)
11
+
3
12
  ## [2.0.0] - 2022-05-05
4
13
 
5
14
  - Use JSON response instead of OpenStruct
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in nordigen.gemspec
6
6
  gemspec
7
7
 
8
- gem "faraday", "~> 2.5.2"
8
+ gem "faraday", "~> 2.5"
9
9
 
10
10
  group :development do
11
11
  gem "rake", "~> 13.0"
data/README.md CHANGED
@@ -66,7 +66,11 @@ init = client.init_session(
66
66
  # institution id
67
67
  institution_id: id,
68
68
  # a unique user ID of someone who's using your services, usually it's a UUID
69
- reference_id: SecureRandom.uuid
69
+ reference_id: SecureRandom.uuid,
70
+ # A two-letter country code (ISO 639-1)
71
+ user_language: "en",
72
+ # option to enable account selection view for the end user
73
+ account_selection: true
70
74
  )
71
75
 
72
76
  link = init["link"] # bank authorization link
@@ -97,6 +101,8 @@ details = account.get_details()
97
101
  balances = account.get_balances()
98
102
  # Fetch transactions
99
103
  transactions = account.get_transactions()
104
+ # Fetch premium transactions
105
+ transactions = account.get_premium_transactions(date_from: "2021-12-01", date_to: "2022-01-30", country: "LV")
100
106
  # Filter transactions by specific date range
101
107
  transactions = account.get_transactions(date_from: "2021-12-01", date_to: "2022-01-30")
102
108
  ```
data/lib/nordigen-ruby.rb CHANGED
@@ -26,15 +26,8 @@ module Nordigen
26
26
  @requisition = RequisitionsApi.new(client=self)
27
27
  end
28
28
 
29
- def request(params = nil)
29
+ def request
30
30
  # HTTP client request
31
- parameters = {}
32
- params&.each do |key, value|
33
- if value
34
- parameters[key] = value
35
- end
36
- end
37
-
38
31
  @request ||= Faraday.new do |conn|
39
32
  conn.url_prefix = BASE_URL
40
33
  conn.headers = @@headers
@@ -84,7 +77,7 @@ module Nordigen
84
77
  return AccountApi.new(client: self, account_id: account_id)
85
78
  end
86
79
 
87
- def init_session(redirect_url:, institution_id:, reference_id:, max_historical_days: 90)
80
+ def init_session(redirect_url:, institution_id:, reference_id:, max_historical_days: 90, user_language: "en", account_selection: false)
88
81
  # Factory method that creates authorization in a specific institution
89
82
  # and are responsible for the following steps:
90
83
  # * Creates agreement
@@ -100,6 +93,8 @@ module Nordigen
100
93
  redirect_url: redirect_url,
101
94
  reference: reference_id,
102
95
  institution_id: institution_id,
96
+ user_language: user_language,
97
+ account_selection: account_selection,
103
98
  agreement: new_agreement["id"]
104
99
  )
105
100
 
@@ -2,6 +2,7 @@ module Nordigen
2
2
  class AccountApi
3
3
 
4
4
  ENDPOINT = "accounts/"
5
+ PREMIUM_ENDPOINT = "accounts/premium/"
5
6
  attr_reader :client, :account_id
6
7
 
7
8
  def initialize(client:, account_id:)
@@ -9,14 +10,19 @@ module Nordigen
9
10
  @account_id = account_id
10
11
  end
11
12
 
12
- def get(path = nil, params = nil)
13
+ def get(path = nil, params = nil, premium: nil)
13
14
  # Create Get request
14
- url = "#{ENDPOINT}#{@account_id}/"
15
+ if premium
16
+ url = "#{PREMIUM_ENDPOINT}#{@account_id}/"
17
+ else
18
+ url = "#{ENDPOINT}#{@account_id}/"
19
+ end
20
+
15
21
  if path
16
22
  url = "#{url}#{path}/"
17
23
  end
18
24
 
19
- return client.request(params).get(url).body
25
+ return client.request.get(url, params).body
20
26
  end
21
27
 
22
28
  def get_metadata
@@ -44,5 +50,15 @@ module Nordigen
44
50
  return get("transactions", date_range)
45
51
  end
46
52
 
53
+ def get_premium_transactions(date_from: nil, date_to: nil, country: nil)
54
+ # Access account transactions
55
+ params = {
56
+ "date_from" => date_from,
57
+ "date_to" => date_to,
58
+ "country" => country
59
+ }
60
+ return get("transactions", params, premium: true )
61
+ end
62
+
47
63
  end
48
64
  end
@@ -1,4 +1,3 @@
1
-
2
1
  module Nordigen
3
2
  class RequisitionsApi
4
3
 
@@ -10,14 +9,15 @@ module Nordigen
10
9
  @client = client
11
10
  end
12
11
 
13
- def create_requisition(redirect_url:, reference:, institution_id:, user_language: "en", agreement: nil)
12
+ def create_requisition(redirect_url:, reference:, institution_id:, user_language: "en", agreement: nil, account_selection: false)
14
13
  # Create requisition. For creating links and retrieving accounts.
15
14
  payload = {
16
15
  "redirect": redirect_url,
17
16
  "reference": reference,
18
17
  "institution_id": institution_id,
19
18
  "user_language": user_language,
20
- }
19
+ "account_selection": account_selection,
20
+ }
21
21
 
22
22
  if agreement
23
23
  payload["agreement"] = agreement
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nordigen
4
- VERSION = "2.0.0"
4
+ VERSION = "2.1.0"
5
5
  end
data/nordigen.gemspec CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.executables = `git ls-files -- bin/*`.split("\n")
34
34
  .map { |f| ::File.basename(f) }
35
35
 
36
- spec.add_dependency "faraday", "~> 2.5.2"
36
+ spec.add_dependency "faraday", "~> 2.5"
37
37
 
38
38
  spec.require_paths = ["lib"]
39
39
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nordigen-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nordigen Solutions
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-23 00:00:00.000000000 Z
11
+ date: 2022-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.5.2
19
+ version: '2.5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.5.2
26
+ version: '2.5'
27
27
  description: Nordigen official API client for Ruby
28
28
  email:
29
29
  - support@nordigen.com
@@ -35,7 +35,6 @@ extra_rdoc_files: []
35
35
  files:
36
36
  - CHANGELOG.md
37
37
  - Gemfile
38
- - Gemfile.lock
39
38
  - LICENSE.txt
40
39
  - README.md
41
40
  - Rakefile
@@ -73,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
72
  - !ruby/object:Gem::Version
74
73
  version: '0'
75
74
  requirements: []
76
- rubygems_version: 3.1.2
75
+ rubygems_version: 3.0.3.1
77
76
  signing_key:
78
77
  specification_version: 4
79
78
  summary: Nordigen client for Ruby
data/Gemfile.lock DELETED
@@ -1,32 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- nordigen-ruby (2.0.0)
5
- faraday (~> 2.5.2)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- dotenv (2.8.1)
11
- faraday (2.5.2)
12
- faraday-net_http (>= 2.0, < 3.1)
13
- ruby2_keywords (>= 0.0.4)
14
- faraday-net_http (3.0.0)
15
- power_assert (2.0.1)
16
- rake (13.0.6)
17
- ruby2_keywords (0.0.5)
18
- test-unit (3.5.3)
19
- power_assert
20
-
21
- PLATFORMS
22
- x86_64-linux
23
-
24
- DEPENDENCIES
25
- dotenv (~> 2.8.1)
26
- faraday (~> 2.5.2)
27
- nordigen-ruby!
28
- rake (~> 13.0)
29
- test-unit (~> 3.5.3)
30
-
31
- BUNDLED WITH
32
- 2.3.4