bunq_rb 0.0.15 → 0.0.16
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/README.md +5 -2
- data/bunq_rb.gemspec +1 -0
- data/lib/bunq_rb/client.rb +2 -19
- data/lib/bunq_rb/configuration.rb +2 -0
- data/lib/bunq_rb/objects/monetary_account.rb +9 -3
- data/lib/bunq_rb/objects/payment.rb +21 -0
- data/lib/bunq_rb/objects/user.rb +4 -0
- data/lib/bunq_rb/version.rb +1 -1
- data/lib/bunq_rb.rb +1 -0
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ffc213e4c6739d4db6e41209925e105c87ad3be
|
4
|
+
data.tar.gz: aba900ae7cbe9dcfda0ad3260b6b7feef1296870
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e67deb7a39d4195516584f37c1127ea7ac7ea858c0d8a6b47593e484000881692cd05774f80e8dca5bb22fb4cc73d8acf91b303fb473179f68c80da2e817bf4
|
7
|
+
data.tar.gz: 1c52fe3989fa76185000a68becb60a66372fc5ba50f0072f7f283088a7b7d5f0e905881ced8c3c7c6304842125255073e6941168e5c2a73798ddf0c163d05584
|
data/README.md
CHANGED
@@ -29,6 +29,7 @@ First configure the gem
|
|
29
29
|
BunqRb.configure do |config|
|
30
30
|
config.api_key = ENV.fetch("API_KEY")
|
31
31
|
config.key = key # OpenSSL::PKey::RSA.new 2048
|
32
|
+
config.url = "https://sandbox.public.api.bunq.com"
|
32
33
|
end
|
33
34
|
```
|
34
35
|
|
@@ -36,8 +37,8 @@ end
|
|
36
37
|
|
37
38
|
- Use Cases
|
38
39
|
- ~~Create Session~~
|
39
|
-
- Making a payment request
|
40
|
-
- Creating a tab payment
|
40
|
+
- ~~Making a payment request~~
|
41
|
+
- ~~Creating a tab payment~~
|
41
42
|
|
42
43
|
---
|
43
44
|
|
@@ -146,6 +147,8 @@ end
|
|
146
147
|
- Monetary account bank
|
147
148
|
- PAYMENTS
|
148
149
|
- Payment
|
150
|
+
- ~~LIST~~
|
151
|
+
- GET
|
149
152
|
- Draft payment
|
150
153
|
- Payment batch
|
151
154
|
- Request inquiry
|
data/bunq_rb.gemspec
CHANGED
data/lib/bunq_rb/client.rb
CHANGED
@@ -46,30 +46,13 @@ module BunqRb
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
|
50
|
-
require_relative "objects/device_server"
|
51
|
-
require_relative "objects/installation"
|
52
|
-
require_relative "objects/installation_server_public_key"
|
53
|
-
require_relative "objects/session_server"
|
54
|
-
require_relative "objects/user"
|
55
|
-
require_relative "objects/permitted_ip"
|
56
|
-
require_relative "objects/monetary_account"
|
57
|
-
require_relative "objects/attachment_monetary_account"
|
58
|
-
require_relative "objects/request_inquiry"
|
59
|
-
require_relative "objects/avatar"
|
60
|
-
require_relative "objects/permitted_ip"
|
61
|
-
require_relative "objects/attachment_public"
|
62
|
-
require_relative "objects/avatar"
|
63
|
-
require_relative "objects/cash_register"
|
64
|
-
require_relative "objects/tab_usage_single"
|
49
|
+
Dir[File.dirname(__FILE__) + "/objects/**/*.rb"].each { |f| require f }
|
65
50
|
|
66
51
|
module BunqRb
|
67
52
|
# Client
|
68
53
|
class Client
|
69
|
-
BASE_URL = "https://sandbox.public.api.bunq.com".freeze
|
70
|
-
|
71
54
|
def self.connection
|
72
|
-
@connection ||= Faraday.new(url:
|
55
|
+
@connection ||= Faraday.new(url: BunqRb.configuration.url) do |config|
|
73
56
|
config.use Headers
|
74
57
|
config.use SignRequest
|
75
58
|
config.request :json
|
@@ -1,20 +1,26 @@
|
|
1
1
|
module BunqRb
|
2
2
|
# MonetaryAccount
|
3
3
|
class MonetaryAccount
|
4
|
-
attr_reader :id, :currency
|
4
|
+
attr_reader :id, :currency, :description
|
5
5
|
|
6
6
|
def initialize(hsh = {})
|
7
7
|
@id = hsh["id"]
|
8
|
+
@user_id = hsh["user_id"]
|
8
9
|
@currency = hsh["currency"]
|
10
|
+
@description = hsh["description"]
|
9
11
|
end
|
10
12
|
|
11
13
|
def self.url(user_id)
|
12
14
|
"/v1/user/#{user_id}/monetary-account"
|
13
15
|
end
|
14
16
|
|
15
|
-
def self.all
|
16
|
-
response = Client.send_method(:get, url(
|
17
|
+
def self.all(user_id)
|
18
|
+
response = Client.send_method(:get, url(user_id))
|
17
19
|
response.map { |resp| new(resp["MonetaryAccountBank"]) }
|
18
20
|
end
|
21
|
+
|
22
|
+
def payments
|
23
|
+
BunqRb::Payment.all(@user_id, @id)
|
24
|
+
end
|
19
25
|
end
|
20
26
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module BunqRb
|
2
|
+
# Payment
|
3
|
+
class Payment
|
4
|
+
attr_reader :id, :description, :amount
|
5
|
+
|
6
|
+
def initialize(hsh = {})
|
7
|
+
@id = hsh["id"]
|
8
|
+
@description = hsh["description"]
|
9
|
+
@amount = Money.new(hsh["amount"]["value"].to_f * 100, hsh["amount"]["currency"])
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.url(user_id, monetary_account_id)
|
13
|
+
"/v1/user/#{user_id}/monetary-account/#{monetary_account_id}/payment"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.all(user_id, monetary_account_id)
|
17
|
+
response = Client.send_method(:get, url(user_id, monetary_account_id))
|
18
|
+
response.map { |resp| new(resp["Payment"]) }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/bunq_rb/objects/user.rb
CHANGED
data/lib/bunq_rb/version.rb
CHANGED
data/lib/bunq_rb.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bunq_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dunya Kirkali
|
@@ -25,6 +25,20 @@ dependencies:
|
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: money
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
28
42
|
description: Bunq API Client
|
29
43
|
email:
|
30
44
|
- dunyakirkali@gmail.com
|
@@ -59,6 +73,7 @@ files:
|
|
59
73
|
- lib/bunq_rb/objects/installation.rb
|
60
74
|
- lib/bunq_rb/objects/installation_server_public_key.rb
|
61
75
|
- lib/bunq_rb/objects/monetary_account.rb
|
76
|
+
- lib/bunq_rb/objects/payment.rb
|
62
77
|
- lib/bunq_rb/objects/permitted_ip.rb
|
63
78
|
- lib/bunq_rb/objects/request_inquiry.rb
|
64
79
|
- lib/bunq_rb/objects/session_server.rb
|