modulr-api 0.0.37 → 0.0.41

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: fe369be8d916cd8e22bd8189c0fda5718b69179c26dc85aef6e62dce4d0f1652
4
- data.tar.gz: 0e0ccde8a0780d964afbbe43397ebdfab93b1bec31a6db84b0936ef7bc42676a
3
+ metadata.gz: b785321b93c4589e2996011d3f8ed21b55e726c11f612aa7d0d7aba428e3431e
4
+ data.tar.gz: ff08457f58c8dc076664257cab5089e71e6087870a27e578853f70c76eede15f
5
5
  SHA512:
6
- metadata.gz: e93009870f75d25bbff369008005b31aa5cf0ca628ec6210549902f00a1f7995a32bbf620d7231dffc9e62d23a93bbd760add321c1748a83769dc33c960e8bf2
7
- data.tar.gz: 1603ea48040cf8f2639d1cb2c6818a847ae45e1295d3c42d4b7e5e517f9ef789e954e4c0e5ead35042ac385dbbc4810b2edcbcd3bae0eda501aed91c20c30b62
6
+ metadata.gz: d4e9f77ff3c94907fdec892b37397ff4661aeb6b57fdeb9c3f0d2764c48177eb4bf93bebb2612dbfd2c2337af3ec6562781f40ae5849f4aa78cdea23d5b02b70
7
+ data.tar.gz: d459b648d9050e4c5a3ad8f8dd4ce441612c9166345d189aae2c72533d903b6cdab5a5dc7992fc6b1135b23fd915671e48cd2020da5c5a5df97382213bf09160
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.1.4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- modulr-api (0.0.37)
4
+ modulr-api (0.0.41)
5
5
  faraday (~> 1.0)
6
6
  faraday_middleware (~> 1.0)
7
7
 
@@ -3,11 +3,19 @@
3
3
  module Modulr
4
4
  module API
5
5
  class AccountsService < Service
6
- def find(id:)
7
- response = client.get("/accounts/#{id}")
6
+ def find(id:, **opts)
7
+ query_parameters = {}
8
+ query_parameters[:statuses] = opts[:statuses] if opts[:statuses]
9
+ if opts[:include_pending_transactions]
10
+ query_parameters[:includePendingTransactions] = opts[:include_pending_transactions]
11
+ end
12
+
13
+ response = client.get("/accounts/#{id}", query_parameters)
14
+ attributes = response.body
15
+
8
16
  Resources::Accounts::Account.new(
9
- response.env[:raw_body],
10
- response.body,
17
+ response,
18
+ attributes,
11
19
  { requested_at: response.headers["date"] }
12
20
  )
13
21
  end
@@ -20,7 +28,9 @@ module Modulr
20
28
  payload[:externalReference] = opts[:external_reference] if opts[:external_reference]
21
29
 
22
30
  response = client.post("/customers/#{customer_id}/accounts", payload)
23
- Resources::Accounts::Account.new(response.env[:raw_body], response.body)
31
+ attributes = response.body
32
+
33
+ Resources::Accounts::Account.new(response, attributes)
24
34
  end
25
35
 
26
36
  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
- Resources::Customers::Customer.new(response.env[:raw_body], response.body)
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
- Resources::Customers::Customer.new(response.env[:raw_body], response.body)
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
- Resources::Notifications::Notification.new(response.env[:raw_body], response.body)
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
- Resources::Notifications::Collection.new(response.env[:raw_body], response.body)
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
- Resources::Notifications::Notification.new(response.env[:raw_body], response.body)
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
- Resources::Notifications::Notification.new(response.env[:raw_body], response.body)
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
- payment_attributes = response.body[:content]&.first
9
- raise ClientError, "Payment #{id} not found" unless payment_attributes
8
+ attributes = response.body[:content]&.first
9
+ raise ClientError, "Payment #{id} not found" unless attributes
10
10
 
11
- Resources::Payments::Payment.new(response.env[:raw_body], payment_attributes)
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
- Resources::Payments::Collection.new(response.env[:raw_body], response.body[:content])
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
- Resources::Payments::Payment.new(response.env[:raw_body], response.body, { network_scheme: false })
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
- Resources::Transactions::Transactions.new(response.env[:raw_body], response.body[:content])
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(raw_response, attributes = {}, opts = { requested_at: nil })
27
- super(raw_response, attributes)
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(raw_response, attributes_collection)
8
- super(raw_response, Identifier, attributes_collection)
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 :raw_response
6
+ attr_reader :response
7
7
 
8
- def initialize(raw_response, attributes = {})
9
- @raw_response = raw_response
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 :raw_response
6
+ attr_reader :response
7
7
 
8
8
  include Enumerable
9
9
 
10
- def initialize(raw_response, item_klass, attributes_collection = [])
11
- @raw_response = raw_response
12
- @attributes_collection = attributes_collection
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(raw_response, attributes_collection)
8
- super(raw_response, Notification, attributes_collection)
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(raw_response, attributes = {})
16
- super(raw_response, attributes)
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(raw_response, attributes_collection)
8
- super(raw_response, Payment, attributes_collection)
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(raw_response, attributes = {})
13
- super(raw_response, attributes)
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(raw_response, attributes = {})
13
- super(raw_response, attributes)
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(raw_response, attributes = {})
31
- super(raw_response, attributes)
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(raw_response, attributes = {})
17
- super(raw_response, attributes)
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(raw_response, attributes = {})
17
- super(raw_response, attributes)
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(raw_response, attributes = {}, opts = { network_scheme: true })
19
- super(raw_response, attributes)
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(raw_response, attributes_collection)
8
- super(raw_response, Transaction, attributes_collection)
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(raw_response, attributes = {})
22
- super(raw_response, attributes)
21
+ def initialize(response, attributes = {})
22
+ super(response, attributes)
23
23
 
24
24
  @balance = attributes[:account][:balance]
25
25
  @available_balance = attributes[:account][:availableBalance]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Modulr
4
- VERSION = "0.0.37"
4
+ VERSION = "0.0.41"
5
5
  end
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 = ["Aitor García Rey"]
9
- spec.email = ["aitor@devengo.com"]
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.37
4
+ version: 0.0.41
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-03 00:00:00.000000000 Z
16
+ date: 2024-01-18 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: []
@@ -203,6 +213,7 @@ files:
203
213
  - ".rspec"
204
214
  - ".rubocop.yml"
205
215
  - ".rubocop_devengo.yml"
216
+ - ".ruby-version"
206
217
  - CODE_OF_CONDUCT.md
207
218
  - Gemfile
208
219
  - Gemfile.lock
@@ -271,7 +282,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
282
  - !ruby/object:Gem::Version
272
283
  version: '0'
273
284
  requirements: []
274
- rubygems_version: 3.4.10
285
+ rubygems_version: 3.5.3
275
286
  signing_key:
276
287
  specification_version: 4
277
288
  summary: Ruby client for Modulr Finance API.