modulr-api 0.0.12 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 413315e576a2c3e69679a961e99cdeeecafe47508c32e208213afc7598d9c6ee
4
- data.tar.gz: '07585a8c4482fc9f284942443e4bb557ed05eb2776ca0634644bdc7bb95691c8'
3
+ metadata.gz: 89f8e744ef9dc24c312a164bd9fc7dec490071098fd6a9faa2079bc5816fb841
4
+ data.tar.gz: e118a6d60a7f182896163ade6cb8fc3bb22c0da8323cfa1b72ceece90389579d
5
5
  SHA512:
6
- metadata.gz: 6e01d522da3a01c6a0025fe835378af4c0797b131e0f8cd766cd9ac463d9d011f07c8efc72b4d2ff8869fdac5aa6e1c55f79ed0d2247e955ff974128aa970e46
7
- data.tar.gz: 8b72174189e8c91d0653471eefaf49143c8764a6dcc26fd5b9f4fecf1f8495cc2cdac01e5f131abd3c69cc5f4537ccdaface65a2c9c5fe41cc65f6bec94f5792
6
+ metadata.gz: 9afbe0846768268eaa0768b56018938accd47f8954e7397051f28077b690324393bc1e6430cf7bdd5a8cc99aae9bfc9e73bc7e7ada2972a6b5a3985ff2c37f89
7
+ data.tar.gz: 675bc7c1c9d176aef8110bafd77d3bacb0f42a5b8809e0eeafa4a11bb6eae9853f1d21f6c10aed69318061961fb46d2b8fc8792fdeb84ce20af8f2a15907ef4d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- modulr-api (0.0.12)
4
+ modulr-api (0.0.14)
5
5
  faraday (~> 1.0)
6
6
  faraday_middleware (~> 1.0)
7
7
 
@@ -127,6 +127,7 @@ GEM
127
127
 
128
128
  PLATFORMS
129
129
  arm64-darwin-20
130
+ arm64-darwin-21
130
131
  x86_64-darwin-20
131
132
  x86_64-linux
132
133
 
@@ -1,4 +1,4 @@
1
- ### Transactions History
1
+ ### Transactions List
2
2
  GET {{base_url}}/accounts/{{account_id}}/transactions
3
3
  Content-Type: application/json
4
- Authorization: {{api_key}}
4
+ Authorization: {{api_key}}
@@ -3,10 +3,29 @@
3
3
  module Modulr
4
4
  module API
5
5
  class TransactionsService < Service
6
- def history(account_id:)
7
- response = client.get("/accounts/#{account_id}/transactions")
6
+ def list(account_id:, **opts)
7
+ response = client.get("/accounts/#{account_id}/transactions", build_query_params(opts))
8
8
  Resources::Transactions::Transactions.new(response, response.body[:content])
9
9
  end
10
+
11
+ private def build_query_params(opts) # rubocop:disable Metrics/AbcSize
12
+ same_name_params = [:credit, :type]
13
+ date_params = { to: :toTransactionDate, from: :fromTransactionDate, to_posted: :toPostedDate,
14
+ from_posted: :fromPostedDate, }
15
+ mapped_params = {
16
+ source_id: :sourceId,
17
+ description: :q,
18
+ min_amount: :minAmount,
19
+ max_amount: :maxAmount,
20
+ }
21
+ {}.tap do |params|
22
+ same_name_params.each { |param| params[param] = opts[param] if opts[param] }
23
+ date_params.each do |original, mapped|
24
+ params[mapped] = format_datetime(opts[original]) if opts[original]
25
+ end
26
+ mapped_params.each { |original, mapped| params[mapped] = opts[original] if opts[original] }
27
+ end
28
+ end
10
29
  end
11
30
  end
12
31
  end
@@ -10,10 +10,10 @@ module Modulr
10
10
  map :amount
11
11
  map :currency
12
12
  map :description
13
+ map :transactionDate, :created_at
14
+ map :postedDate, :final_at
13
15
  map :credit
14
16
  map :type
15
- map :transactionDate, :created_at
16
- map :postedDate, :posted_date
17
17
  map :sourceId, :source_id
18
18
  map :sourceExternalReference, :external_reference
19
19
  map :additionalInfo, :additional_info
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Modulr
4
- VERSION = "0.0.12"
4
+ VERSION = "0.0.14"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modulr-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aitor García Rey
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-14 00:00:00.000000000 Z
11
+ date: 2023-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -201,7 +201,7 @@ files:
201
201
  - doc/modulr_requests/accounts/close.http
202
202
  - doc/modulr_requests/accounts/create.http
203
203
  - doc/modulr_requests/http-client.env.json
204
- - doc/modulr_requests/transactions/history.http
204
+ - doc/modulr_requests/transactions/list.http
205
205
  - lib/modulr.rb
206
206
  - lib/modulr/api/accounts_service.rb
207
207
  - lib/modulr/api/customers_service.rb