pfs 0.0.3 → 0.0.4
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/lib/pfs/api/accounts_service.rb +2 -2
- data/lib/pfs/api/authentication_service.rb +1 -1
- data/lib/pfs/api/statements_service.rb +1 -1
- data/lib/pfs/api/transactions_service.rb +1 -1
- data/lib/pfs/api/transfers_service.rb +1 -1
- data/lib/pfs/resources/authentication/token.rb +2 -2
- data/lib/pfs/resources/base.rb +4 -1
- data/lib/pfs/resources/collection.rb +4 -2
- data/lib/pfs/resources/transactions/transactions.rb +2 -2
- data/lib/pfs/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f06e43fb3cf05a637ffddb40603839f31b4f7cb61dd66b08f01b3d76484c2ae
|
4
|
+
data.tar.gz: 5df9f6b3946a646848a8a109bc9c646a3ac6d4b22400782f8e807e36566297b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82cb826b1fb37bd4dd5626f17b863385737ba5bddce16ce05d264d5fb54c9134cc4aee6b45d408ded9f1fa3aad530975adcd109c14fe0d60fc73c3ca0b9ada01
|
7
|
+
data.tar.gz: 01bb4d39ac2b493c1fa3443e286e93d5b2aa35511cca687cf31f3e5a752564b9b5e09210deffde84acd00ba3bc0d4a4ad505ae92a4cfd349fb1be8b6f04bee73
|
@@ -5,7 +5,7 @@ module PFS
|
|
5
5
|
class AccountsService < Service
|
6
6
|
def balance(account_id)
|
7
7
|
response = client.get("/Account/#{account_id}/Balance")
|
8
|
-
Resources::Accounts::Balance.new(response.body[:data])
|
8
|
+
Resources::Accounts::Balance.new(response, response.body[:data])
|
9
9
|
end
|
10
10
|
|
11
11
|
def credit(account_id, currency, amount, fee_code = "**API", description = "Deposit To Card API")
|
@@ -16,7 +16,7 @@ module PFS
|
|
16
16
|
transactionDescription: description,
|
17
17
|
}
|
18
18
|
response = client.post("/Account/#{account_id}/Balance/Credit", attributes)
|
19
|
-
Resources::Accounts::BalanceCredit.new(response.body[:data])
|
19
|
+
Resources::Accounts::BalanceCredit.new(response, response.body[:data])
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -5,7 +5,7 @@ module PFS
|
|
5
5
|
response = client.get(
|
6
6
|
"/BankPayment/#{account_id}/StatementById?statementitemid=#{statement_id}&InwardOutward=#{inward_outward}&Processor=#{processor}"
|
7
7
|
)
|
8
|
-
Resources::Statements::Statement.new(response.body.dig(:data, :transaction))
|
8
|
+
Resources::Statements::Statement.new(response, response.body.dig(:data, :transaction))
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -6,7 +6,7 @@ module PFS
|
|
6
6
|
def history(account_id:, start_date:, end_date:)
|
7
7
|
response = client.get("/Account/#{account_id}/Transactions?StartDate=#{start_date}&EndDate=#{end_date}")
|
8
8
|
transactions_raw = response.body.dig(:data, :transactions)
|
9
|
-
Resources::Transactions::Transactions.new(response.body.dig(:data, :transactions))
|
9
|
+
Resources::Transactions::Transactions.new(response, response.body.dig(:data, :transactions))
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -16,7 +16,7 @@ module PFS
|
|
16
16
|
data[:isinstant] = true if options[:instant]
|
17
17
|
data[:reference] = options[:reference] if options[:reference]
|
18
18
|
response = client.post("/BankPayment/#{account_id}/OneOffPayment", data, options)
|
19
|
-
Resources::Transfers::Transfer.new(response.body[:data])
|
19
|
+
Resources::Transfers::Transfer.new(response, response.body[:data])
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
data/lib/pfs/resources/base.rb
CHANGED
@@ -3,7 +3,10 @@
|
|
3
3
|
module PFS
|
4
4
|
module Resources
|
5
5
|
class Base
|
6
|
-
|
6
|
+
attr_reader :response
|
7
|
+
|
8
|
+
def initialize(response, attributes = {})
|
9
|
+
@response = response
|
7
10
|
attributes.each do |key, value|
|
8
11
|
m = "#{key}=".to_sym
|
9
12
|
send(m, value) if respond_to?(m)
|
@@ -4,10 +4,12 @@ module PFS
|
|
4
4
|
module Resources
|
5
5
|
class Collection
|
6
6
|
include Enumerable
|
7
|
+
attr_reader :response
|
7
8
|
|
8
|
-
def initialize(item_klass, attributes_collection = [])
|
9
|
+
def initialize(response, item_klass, attributes_collection = [])
|
10
|
+
@response = response
|
9
11
|
@attributes_collection = attributes_collection
|
10
|
-
@items = attributes_collection.map { |attributes_item| item_klass.new(attributes_item) }
|
12
|
+
@items = attributes_collection.map { |attributes_item| item_klass.new(nil, attributes_item) }
|
11
13
|
end
|
12
14
|
|
13
15
|
def each(&block)
|
@@ -4,8 +4,8 @@ module PFS
|
|
4
4
|
module Resources
|
5
5
|
module Transactions
|
6
6
|
class Transactions < Collection
|
7
|
-
def initialize(attributes_collection)
|
8
|
-
super(Transaction, attributes_collection)
|
7
|
+
def initialize(response, attributes_collection)
|
8
|
+
super(response, Transaction, attributes_collection)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
data/lib/pfs/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pfs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aitor García Rey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|