investec_open_api 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +30 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +7 -1
- data/bin/console +4 -4
- data/lib/investec_open_api/camel_case_refinement.rb +12 -0
- data/lib/investec_open_api/client.rb +11 -2
- data/lib/investec_open_api/models/transaction.rb +5 -1
- data/lib/investec_open_api/version.rb +1 -1
- data/lib/investec_open_api.rb +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2dd0d8bf1f96bd2938b03a10a769c4a133756250d2241339d0c852f40e0af16b
|
4
|
+
data.tar.gz: 04fbd85515e99a1cf8f4bd016ad1d9f32eb69e1c5e49bb74a510d3e4db81183a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00a186874f8951b24da32ad631b354c72a3f8dba0a50b660d1307d258596b3aeb1e116e29a77775f20b5db6f861c6f4dcb55c4cb6dff8727b25ab72ac117f314
|
7
|
+
data.tar.gz: 859a6740f4d34260b0d026cb4d8ee3f647722cdcd714885fb0c60f90ebc6872b03a70dde2233f3e761586d5e811d9d6c2c172e6ce3e94658ee3add71dae522c2
|
@@ -0,0 +1,30 @@
|
|
1
|
+
name: CI
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches:
|
5
|
+
- master
|
6
|
+
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- master
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
build:
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
name: Run Specs
|
15
|
+
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v2
|
18
|
+
- uses: ruby/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: 3.1.1
|
21
|
+
|
22
|
+
- name: Run bundle install
|
23
|
+
run: |
|
24
|
+
gem install bundler
|
25
|
+
bundle install --jobs 4 --retry 3
|
26
|
+
|
27
|
+
- name: Build and test with rspec
|
28
|
+
env:
|
29
|
+
RAILS_ENV: test
|
30
|
+
run: bundle exec rspec spec
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
investec_open_api (1.1.
|
4
|
+
investec_open_api (1.1.1)
|
5
5
|
active_attr
|
6
6
|
faraday
|
7
7
|
faraday_middleware
|
@@ -37,6 +37,7 @@ GEM
|
|
37
37
|
addressable (2.8.4)
|
38
38
|
public_suffix (>= 2.0.2, < 6.0)
|
39
39
|
builder (3.2.4)
|
40
|
+
coderay (1.1.3)
|
40
41
|
concurrent-ruby (1.2.2)
|
41
42
|
crack (0.4.5)
|
42
43
|
rexml
|
@@ -74,6 +75,7 @@ GEM
|
|
74
75
|
loofah (2.20.0)
|
75
76
|
crass (~> 1.0.2)
|
76
77
|
nokogiri (>= 1.5.9)
|
78
|
+
method_source (1.0.0)
|
77
79
|
mini_portile2 (2.8.2)
|
78
80
|
minitest (5.18.0)
|
79
81
|
money (6.16.0)
|
@@ -82,6 +84,9 @@ GEM
|
|
82
84
|
nokogiri (1.14.3)
|
83
85
|
mini_portile2 (~> 2.8.0)
|
84
86
|
racc (~> 1.4)
|
87
|
+
pry (0.14.2)
|
88
|
+
coderay (~> 1.1)
|
89
|
+
method_source (~> 1.0)
|
85
90
|
public_suffix (5.0.1)
|
86
91
|
racc (1.6.2)
|
87
92
|
rack (2.2.7)
|
@@ -120,6 +125,7 @@ PLATFORMS
|
|
120
125
|
|
121
126
|
DEPENDENCIES
|
122
127
|
investec_open_api!
|
128
|
+
pry
|
123
129
|
rake
|
124
130
|
rspec
|
125
131
|
webmock
|
data/bin/console
CHANGED
@@ -7,8 +7,8 @@ require "investec_open_api"
|
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
8
8
|
|
9
9
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
|
11
|
-
|
10
|
+
require "pry"
|
11
|
+
Pry.start
|
12
12
|
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
13
|
+
# require "irb"
|
14
|
+
# IRB.start(__FILE__)
|
@@ -2,8 +2,10 @@ require "faraday"
|
|
2
2
|
require "faraday_middleware"
|
3
3
|
require "investec_open_api/models/account"
|
4
4
|
require "investec_open_api/models/transaction"
|
5
|
+
require "investec_open_api/camel_case_refinement"
|
5
6
|
|
6
7
|
class InvestecOpenApi::Client
|
8
|
+
using InvestecOpenApi::CamelCaseRefinement
|
7
9
|
INVESTEC_API_URL="https://openapi.investec.com/"
|
8
10
|
|
9
11
|
def authenticate!
|
@@ -17,8 +19,15 @@ class InvestecOpenApi::Client
|
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
20
|
-
def transactions(account_id)
|
21
|
-
|
22
|
+
def transactions(account_id, options = {})
|
23
|
+
endpoint_url = "za/pb/v1/accounts/#{account_id}/transactions"
|
24
|
+
|
25
|
+
unless options.empty?
|
26
|
+
query_string = URI.encode_www_form(options.camelize)
|
27
|
+
endpoint_url += "?#{query_string}"
|
28
|
+
end
|
29
|
+
|
30
|
+
response = connection.get(endpoint_url)
|
22
31
|
response.body["data"]["transactions"].map do |transaction_raw|
|
23
32
|
InvestecOpenApi::Models::Transaction.from_api(transaction_raw)
|
24
33
|
end
|
@@ -3,6 +3,7 @@ require "money"
|
|
3
3
|
module InvestecOpenApi::Models
|
4
4
|
class Transaction < Base
|
5
5
|
attribute :account_id
|
6
|
+
attribute :posted_order
|
6
7
|
attribute :type
|
7
8
|
attribute :status
|
8
9
|
attribute :card_number
|
@@ -27,7 +28,10 @@ module InvestecOpenApi::Models
|
|
27
28
|
if params['amount'].present?
|
28
29
|
adjusted_amount = params['amount'] * 100
|
29
30
|
adjusted_amount = -adjusted_amount if params['type'] == 'DEBIT'
|
30
|
-
|
31
|
+
|
32
|
+
Money.rounding_mode = BigDecimal::ROUND_HALF_UP
|
33
|
+
Money.locale_backend = :i18n
|
34
|
+
params['amount'] = Money.from_cents(adjusted_amount, "ZAR")
|
31
35
|
end
|
32
36
|
|
33
37
|
if params['transactionDate']
|
data/lib/investec_open_api.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: investec_open_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Community Core Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_attr
|
@@ -115,6 +115,7 @@ executables: []
|
|
115
115
|
extensions: []
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
|
+
- ".github/workflows/main.yml"
|
118
119
|
- ".gitignore"
|
119
120
|
- ".rspec"
|
120
121
|
- ".ruby-version"
|
@@ -129,6 +130,7 @@ files:
|
|
129
130
|
- bin/setup
|
130
131
|
- investec_open_api.gemspec
|
131
132
|
- lib/investec_open_api.rb
|
133
|
+
- lib/investec_open_api/camel_case_refinement.rb
|
132
134
|
- lib/investec_open_api/client.rb
|
133
135
|
- lib/investec_open_api/models/account.rb
|
134
136
|
- lib/investec_open_api/models/base.rb
|