modulr-api 0.0.37 → 0.0.39
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/modulr/api/accounts_service.rb +7 -3
- data/lib/modulr/api/customers_service.rb +6 -2
- data/lib/modulr/api/notifications_service.rb +12 -4
- data/lib/modulr/api/payments_service.rb +9 -5
- data/lib/modulr/api/transactions_service.rb +3 -1
- data/lib/modulr/resources/accounts/account.rb +3 -2
- data/lib/modulr/resources/accounts/identifiers.rb +2 -2
- data/lib/modulr/resources/base.rb +3 -3
- data/lib/modulr/resources/base_collection.rb +4 -5
- data/lib/modulr/resources/notifications/collection.rb +2 -2
- data/lib/modulr/resources/notifications/notification.rb +3 -2
- data/lib/modulr/resources/payments/collection.rb +2 -2
- data/lib/modulr/resources/payments/counterparty.rb +3 -2
- data/lib/modulr/resources/payments/destination.rb +3 -2
- data/lib/modulr/resources/payments/details/incoming/general.rb +3 -2
- data/lib/modulr/resources/payments/details/incoming/internal.rb +3 -2
- data/lib/modulr/resources/payments/details/outgoing/general.rb +2 -2
- data/lib/modulr/resources/payments/payment.rb +3 -2
- data/lib/modulr/resources/transactions/collection.rb +2 -2
- data/lib/modulr/resources/transactions/transaction.rb +2 -2
- data/lib/modulr/version.rb +1 -1
- data/modulr.gemspec +8 -2
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27a16c92e9514f15c9212465bf91aaec997eb6817a91c6f66f01f067e72534cb
|
4
|
+
data.tar.gz: 19e0a02c1630b8695b833243bc072bc7a76d7e6ea478f91ec11747736f7c9e0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da4baea9c2368e7819683107ad39c00835cd91c2b96182d0b3e8e68678faca60f47444a3aaed5839143b19483e8bfce67a4a0993219a9601f80e670c3d6b559e
|
7
|
+
data.tar.gz: a381b55be37bd68c1f9d9a8e4c6802d2d2c4fd3cb1bdc8982a9914704ed77053289a2dcd02992bd09d132472d960b6d2e9cd5a58bd1189aa5a202606905794a5
|
data/Gemfile.lock
CHANGED
@@ -5,9 +5,11 @@ module Modulr
|
|
5
5
|
class AccountsService < Service
|
6
6
|
def find(id:)
|
7
7
|
response = client.get("/accounts/#{id}")
|
8
|
+
attributes = response.body
|
9
|
+
|
8
10
|
Resources::Accounts::Account.new(
|
9
|
-
response
|
10
|
-
|
11
|
+
response,
|
12
|
+
attributes,
|
11
13
|
{ requested_at: response.headers["date"] }
|
12
14
|
)
|
13
15
|
end
|
@@ -20,7 +22,9 @@ module Modulr
|
|
20
22
|
payload[:externalReference] = opts[:external_reference] if opts[:external_reference]
|
21
23
|
|
22
24
|
response = client.post("/customers/#{customer_id}/accounts", payload)
|
23
|
-
|
25
|
+
attributes = response.body
|
26
|
+
|
27
|
+
Resources::Accounts::Account.new(response, attributes)
|
24
28
|
end
|
25
29
|
|
26
30
|
def close(account_id:)
|
@@ -7,7 +7,9 @@ module Modulr
|
|
7
7
|
class CustomersService < Service
|
8
8
|
def find(id:)
|
9
9
|
response = client.get("/customers/#{id}")
|
10
|
-
|
10
|
+
attributes = response.body
|
11
|
+
|
12
|
+
Resources::Customers::Customer.new(response, attributes)
|
11
13
|
end
|
12
14
|
|
13
15
|
def create(type:, legal_entity:, **opts)
|
@@ -31,7 +33,9 @@ module Modulr
|
|
31
33
|
payload[:taxProfile] = opts[:tax_profile] if opts[:tax_profile]
|
32
34
|
|
33
35
|
response = client.post("/customers", payload)
|
34
|
-
|
36
|
+
attributes = response.body
|
37
|
+
|
38
|
+
Resources::Customers::Customer.new(response, attributes)
|
35
39
|
end
|
36
40
|
end
|
37
41
|
end
|
@@ -5,12 +5,16 @@ module Modulr
|
|
5
5
|
class NotificationsService < Service
|
6
6
|
def find(id:, **opts)
|
7
7
|
response = client.get("#{base_notification_url(opts)}/notifications/#{id}")
|
8
|
-
|
8
|
+
attributes = response.body
|
9
|
+
|
10
|
+
Resources::Notifications::Notification.new(response, attributes)
|
9
11
|
end
|
10
12
|
|
11
13
|
def list(**opts)
|
12
14
|
response = client.get("#{base_notification_url(opts)}/notifications")
|
13
|
-
|
15
|
+
attributes_collection = response.body
|
16
|
+
|
17
|
+
Resources::Notifications::Collection.new(response, attributes_collection)
|
14
18
|
end
|
15
19
|
|
16
20
|
def create(type:, channel:, destinations:, config:, **opts)
|
@@ -21,7 +25,9 @@ module Modulr
|
|
21
25
|
config: config,
|
22
26
|
}
|
23
27
|
response = client.post("#{base_notification_url(opts)}/notifications", payload)
|
24
|
-
|
28
|
+
attributes = response.body
|
29
|
+
|
30
|
+
Resources::Notifications::Notification.new(response, attributes)
|
25
31
|
end
|
26
32
|
|
27
33
|
def update(id:, status:, destinations:, config:, **opts)
|
@@ -31,7 +37,9 @@ module Modulr
|
|
31
37
|
config: config,
|
32
38
|
}
|
33
39
|
response = client.put("#{base_notification_url(opts)}/notifications/#{id}", payload)
|
34
|
-
|
40
|
+
attributes = response.body
|
41
|
+
|
42
|
+
Resources::Notifications::Notification.new(response, attributes)
|
35
43
|
end
|
36
44
|
|
37
45
|
protected def base_notification_url(opts)
|
@@ -5,17 +5,19 @@ module Modulr
|
|
5
5
|
class PaymentsService < Service
|
6
6
|
def find(id:)
|
7
7
|
response = client.get("/payments", { id: id })
|
8
|
-
|
9
|
-
raise ClientError, "Payment #{id} not found" unless
|
8
|
+
attributes = response.body[:content]&.first
|
9
|
+
raise ClientError, "Payment #{id} not found" unless attributes
|
10
10
|
|
11
|
-
Resources::Payments::Payment.new(response
|
11
|
+
Resources::Payments::Payment.new(response, attributes)
|
12
12
|
end
|
13
13
|
|
14
14
|
def list(**opts)
|
15
15
|
return find(id: opts[:id]) if opts[:id]
|
16
16
|
|
17
17
|
response = client.get("/payments", build_query_params(opts))
|
18
|
-
|
18
|
+
attributes_collection = response.body[:content]
|
19
|
+
|
20
|
+
Resources::Payments::Collection.new(response, attributes_collection)
|
19
21
|
end
|
20
22
|
|
21
23
|
def create(account_id:, destination:, reference:, currency:, amount:, **opts) # rubocop:disable Metrics/ParameterLists
|
@@ -31,7 +33,9 @@ module Modulr
|
|
31
33
|
payload[:endToEndReference] = opts[:e2e_reference] if opts[:e2e_reference]
|
32
34
|
|
33
35
|
response = client.post("/payments", payload)
|
34
|
-
|
36
|
+
attributes = response.body
|
37
|
+
|
38
|
+
Resources::Payments::Payment.new(response, attributes, { network_scheme: false })
|
35
39
|
end
|
36
40
|
|
37
41
|
private def build_query_params(opts) # rubocop:disable Metrics/AbcSize
|
@@ -5,7 +5,9 @@ module Modulr
|
|
5
5
|
class TransactionsService < Service
|
6
6
|
def list(account_id:, **opts)
|
7
7
|
response = client.get("/accounts/#{account_id}/transactions", build_query_params(opts))
|
8
|
-
|
8
|
+
attributes_collection = response.body[:content]
|
9
|
+
|
10
|
+
Resources::Transactions::Transactions.new(response, attributes_collection)
|
9
11
|
end
|
10
12
|
|
11
13
|
private def build_query_params(opts) # rubocop:disable Metrics/AbcSize
|
@@ -23,8 +23,9 @@ module Modulr
|
|
23
23
|
map :createdDate, :created_at
|
24
24
|
map :directDebit, :direct_debit
|
25
25
|
|
26
|
-
def initialize(
|
27
|
-
super(
|
26
|
+
def initialize(response, attributes, opts = { requested_at: nil })
|
27
|
+
super(response, attributes)
|
28
|
+
|
28
29
|
@requested_at = opts[:requested_at]
|
29
30
|
@identifiers = Accounts::Identifiers.new(nil, attributes[:identifiers])
|
30
31
|
end
|
@@ -4,8 +4,8 @@ module Modulr
|
|
4
4
|
module Resources
|
5
5
|
module Accounts
|
6
6
|
class Identifiers < BaseCollection
|
7
|
-
def initialize(
|
8
|
-
super(
|
7
|
+
def initialize(response, attributes_collection)
|
8
|
+
super(response, Identifier, attributes_collection)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -3,10 +3,10 @@
|
|
3
3
|
module Modulr
|
4
4
|
module Resources
|
5
5
|
class Base
|
6
|
-
attr_reader :
|
6
|
+
attr_reader :response
|
7
7
|
|
8
|
-
def initialize(
|
9
|
-
@
|
8
|
+
def initialize(response, attributes = {})
|
9
|
+
@response = response
|
10
10
|
|
11
11
|
attributes.each do |key, value|
|
12
12
|
m = "#{key}=".to_sym
|
@@ -3,14 +3,13 @@
|
|
3
3
|
module Modulr
|
4
4
|
module Resources
|
5
5
|
class BaseCollection
|
6
|
-
attr_reader :
|
6
|
+
attr_reader :response
|
7
7
|
|
8
8
|
include Enumerable
|
9
9
|
|
10
|
-
def initialize(
|
11
|
-
@
|
12
|
-
@
|
13
|
-
@items = attributes_collection.map { |attributes_item| item_klass.new(nil, attributes_item) }
|
10
|
+
def initialize(response, item_klass, attributes_collection = [])
|
11
|
+
@response = response
|
12
|
+
@items = attributes_collection.map { |attributes| item_klass.new(nil, attributes) }
|
14
13
|
end
|
15
14
|
|
16
15
|
def each(&block)
|
@@ -4,8 +4,8 @@ module Modulr
|
|
4
4
|
module Resources
|
5
5
|
module Notifications
|
6
6
|
class Collection < BaseCollection
|
7
|
-
def initialize(
|
8
|
-
super(
|
7
|
+
def initialize(response, attributes_collection)
|
8
|
+
super(response, Notification, attributes_collection)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -12,8 +12,9 @@ module Modulr
|
|
12
12
|
map :status
|
13
13
|
map :destinations
|
14
14
|
|
15
|
-
def initialize(
|
16
|
-
super(
|
15
|
+
def initialize(response, attributes = {})
|
16
|
+
super(response, attributes)
|
17
|
+
|
17
18
|
@config = Config.new(nil, attributes[:config])
|
18
19
|
end
|
19
20
|
end
|
@@ -4,8 +4,8 @@ module Modulr
|
|
4
4
|
module Resources
|
5
5
|
module Payments
|
6
6
|
class Collection < BaseCollection
|
7
|
-
def initialize(
|
8
|
-
super(
|
7
|
+
def initialize(response, attributes_collection)
|
8
|
+
super(response, Payment, attributes_collection)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -9,8 +9,9 @@ module Modulr
|
|
9
9
|
map :name
|
10
10
|
map :address
|
11
11
|
|
12
|
-
def initialize(
|
13
|
-
super(
|
12
|
+
def initialize(response, attributes = {})
|
13
|
+
super(response, attributes)
|
14
|
+
|
14
15
|
@identifier = Accounts::Identifier.new(nil, attributes[:identifier])
|
15
16
|
end
|
16
17
|
end
|
@@ -9,8 +9,9 @@ module Modulr
|
|
9
9
|
map :type
|
10
10
|
map :name
|
11
11
|
|
12
|
-
def initialize(
|
13
|
-
super(
|
12
|
+
def initialize(response, attributes = {})
|
13
|
+
super(response, attributes)
|
14
|
+
|
14
15
|
@identifier = Accounts::Identifier.new(nil, attributes)
|
15
16
|
end
|
16
17
|
end
|
@@ -27,8 +27,9 @@ module Modulr
|
|
27
27
|
map :schemeType, :scheme_type
|
28
28
|
map :details, :raw_details
|
29
29
|
|
30
|
-
def initialize(
|
31
|
-
super(
|
30
|
+
def initialize(response, attributes = {})
|
31
|
+
super(response, attributes)
|
32
|
+
|
32
33
|
@payer = Counterparty.new(nil, attributes[:payer])
|
33
34
|
@payee = Counterparty.new(nil, attributes[:payee])
|
34
35
|
@destination = parse_destination(attributes)
|
@@ -13,8 +13,9 @@ module Modulr
|
|
13
13
|
map :amount
|
14
14
|
map :reference
|
15
15
|
|
16
|
-
def initialize(
|
17
|
-
super(
|
16
|
+
def initialize(response, attributes = {})
|
17
|
+
super(response, attributes)
|
18
|
+
|
18
19
|
@destination = Destination.new(nil, attributes[:destination])
|
19
20
|
end
|
20
21
|
end
|
@@ -13,8 +13,8 @@ module Modulr
|
|
13
13
|
map :amount
|
14
14
|
map :reference
|
15
15
|
|
16
|
-
def initialize(
|
17
|
-
super(
|
16
|
+
def initialize(response, attributes = {})
|
17
|
+
super(response, attributes)
|
18
18
|
@destination = Destination.new(nil, attributes[:destination])
|
19
19
|
end
|
20
20
|
end
|
@@ -15,8 +15,9 @@ module Modulr
|
|
15
15
|
map :message, :message
|
16
16
|
map :type
|
17
17
|
|
18
|
-
def initialize(
|
19
|
-
super(
|
18
|
+
def initialize(response, attributes = {}, opts = { network_scheme: true })
|
19
|
+
super(response, attributes)
|
20
|
+
|
20
21
|
@attributes = attributes
|
21
22
|
@opts = opts
|
22
23
|
parse_attributes
|
@@ -4,8 +4,8 @@ module Modulr
|
|
4
4
|
module Resources
|
5
5
|
module Transactions
|
6
6
|
class Transactions < BaseCollection
|
7
|
-
def initialize(
|
8
|
-
super(
|
7
|
+
def initialize(response, attributes_collection)
|
8
|
+
super(response, Transaction, attributes_collection)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -18,8 +18,8 @@ module Modulr
|
|
18
18
|
map :sourceExternalReference, :external_reference
|
19
19
|
map :additionalInfo, :additional_info
|
20
20
|
|
21
|
-
def initialize(
|
22
|
-
super(
|
21
|
+
def initialize(response, attributes = {})
|
22
|
+
super(response, attributes)
|
23
23
|
|
24
24
|
@balance = attributes[:account][:balance]
|
25
25
|
@available_balance = attributes[:account][:availableBalance]
|
data/lib/modulr/version.rb
CHANGED
data/modulr.gemspec
CHANGED
@@ -5,8 +5,14 @@ require_relative "lib/modulr/version"
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "modulr-api"
|
7
7
|
spec.version = Modulr::VERSION
|
8
|
-
spec.authors = [
|
9
|
-
|
8
|
+
spec.authors = [
|
9
|
+
"Aitor García Rey", "Fran Moya", "Techi Rexach", "Iván Guardado",
|
10
|
+
"Carlos López", "Nacho Ortiz",
|
11
|
+
]
|
12
|
+
spec.email = [
|
13
|
+
"aitor@devengo.com", "fran@devengo.com", "techi@devengo.com", "ivan@devengo.com",
|
14
|
+
"carlos@devengo.com", "nacho@devengo.com",
|
15
|
+
]
|
10
16
|
|
11
17
|
spec.summary = "Ruby client for Modulr Finance API."
|
12
18
|
spec.description = "Ruby client for Modulr Finance API."
|
metadata
CHANGED
@@ -1,14 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: modulr-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.39
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aitor García Rey
|
8
|
+
- Fran Moya
|
9
|
+
- Techi Rexach
|
10
|
+
- Iván Guardado
|
11
|
+
- Carlos López
|
12
|
+
- Nacho Ortiz
|
8
13
|
autorequire:
|
9
14
|
bindir: exe
|
10
15
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
16
|
+
date: 2023-10-17 00:00:00.000000000 Z
|
12
17
|
dependencies:
|
13
18
|
- !ruby/object:Gem::Dependency
|
14
19
|
name: faraday
|
@@ -195,6 +200,11 @@ dependencies:
|
|
195
200
|
description: Ruby client for Modulr Finance API.
|
196
201
|
email:
|
197
202
|
- aitor@devengo.com
|
203
|
+
- fran@devengo.com
|
204
|
+
- techi@devengo.com
|
205
|
+
- ivan@devengo.com
|
206
|
+
- carlos@devengo.com
|
207
|
+
- nacho@devengo.com
|
198
208
|
executables: []
|
199
209
|
extensions: []
|
200
210
|
extra_rdoc_files: []
|