bunq_rb 0.0.17 → 0.0.18
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 +29 -4
- data/lib/bunq_rb/client/sign_request.rb +2 -1
- data/lib/bunq_rb/client.rb +2 -1
- data/lib/bunq_rb/configuration.rb +2 -4
- data/lib/bunq_rb/objects/card.rb +2 -1
- data/lib/bunq_rb/objects/monetary_account.rb +4 -0
- data/lib/bunq_rb/objects/payment.rb +9 -2
- data/lib/bunq_rb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07155c178c48d25522a0a35a89954255133fdd62
|
4
|
+
data.tar.gz: 5e66516fbbd233367b8c30f880899b1ebf624b00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed00423dd7b99d1b53a1238112a4d32415040548b3bf922eb81e3242e84139536185a13e67fa97c15b0961f7caa5397230d66a41bec5acf10dc2b4a6293133f6
|
7
|
+
data.tar.gz: 2dbe44cb606c51c684b84b142d415fcb4896024aab35e80f1245440d6cfb5dc763bdd8fa2b1929dceea1cdc2d8e49658f51ddbed37fac1daa9d835061db7fa54
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
[](https://travis-ci.org/ahtung/bunq_rb)
|
2
2
|
[](https://badge.fury.io/rb/bunq_rb)
|
3
|
+
[](https://codeclimate.com/github/ahtung/bunq_rb/maintainability)
|
3
4
|
|
4
5
|
# BunqRb
|
5
6
|
|
@@ -27,9 +28,10 @@ First configure the gem
|
|
27
28
|
|
28
29
|
```
|
29
30
|
BunqRb.configure do |config|
|
30
|
-
config.api_key
|
31
|
-
config.key
|
32
|
-
config.url
|
31
|
+
config.api_key = ENV.fetch("API_KEY")
|
32
|
+
config.key = key # OpenSSL::PKey::RSA.new 2048
|
33
|
+
config.url = "https://sandbox.public.api.bunq.com"
|
34
|
+
config.page_size = 200
|
33
35
|
end
|
34
36
|
```
|
35
37
|
|
@@ -90,7 +92,7 @@ end
|
|
90
92
|
- GET
|
91
93
|
|
92
94
|
```ruby
|
93
|
-
device_server = BunqRb::DeviceServer.find(
|
95
|
+
device_server = BunqRb::DeviceServer.find(1434035)
|
94
96
|
```
|
95
97
|
|
96
98
|
- LIST
|
@@ -143,11 +145,20 @@ end
|
|
143
145
|
- MONETARY ACCOUNTS
|
144
146
|
- Monetary account
|
145
147
|
- ~~LIST~~
|
148
|
+
```ruby
|
149
|
+
user = BunqRb::User.find(1913)
|
150
|
+
monetary_accounts = user.monetary_accounts
|
151
|
+
```
|
146
152
|
- GET
|
147
153
|
- Monetary account bank
|
148
154
|
- PAYMENTS
|
149
155
|
- Payment
|
150
156
|
- ~~LIST~~
|
157
|
+
```ruby
|
158
|
+
user = BunqRb::User.find(1913)
|
159
|
+
monetary_account = user.monetary_accounts.first
|
160
|
+
payments = monetary_account.payments
|
161
|
+
```
|
151
162
|
- GET
|
152
163
|
- Draft payment
|
153
164
|
- Payment batch
|
@@ -176,7 +187,21 @@ end
|
|
176
187
|
- CARDS
|
177
188
|
- Card
|
178
189
|
- ~~GET~~
|
190
|
+
```ruby
|
191
|
+
user_id = 1913
|
192
|
+
card_id = 82082
|
193
|
+
card = BunqRb::Card.find(user_id, card_id)
|
194
|
+
```
|
179
195
|
- ~~LIST~~
|
196
|
+
```ruby
|
197
|
+
user_id = 1913
|
198
|
+
cards = BunqRb::Card.all(user_id)
|
199
|
+
|
200
|
+
# OR
|
201
|
+
|
202
|
+
user = BunqRb::User.find(1913)
|
203
|
+
cards = user.cards
|
204
|
+
```
|
180
205
|
- PUT
|
181
206
|
- Card debit
|
182
207
|
- Card name
|
@@ -55,7 +55,8 @@ class SignRequest < Faraday::Middleware
|
|
55
55
|
|
56
56
|
def request_string
|
57
57
|
uri = Addressable::URI.parse(@env[:url])
|
58
|
-
"#{
|
58
|
+
path = uri.query ? "#{uri.path}?#{uri.query}" : uri.path
|
59
|
+
"#{@env[:method].upcase} #{path}\n"
|
59
60
|
end
|
60
61
|
|
61
62
|
def sign?
|
data/lib/bunq_rb/client.rb
CHANGED
@@ -24,7 +24,8 @@ module BunqRb
|
|
24
24
|
end
|
25
25
|
when :list
|
26
26
|
define_singleton_method(:all) do
|
27
|
-
|
27
|
+
page_size = BunqRb.configuration.page_size
|
28
|
+
response = Client.send_method(:get, "#{uri}?count=#{page_size}")
|
28
29
|
response.map { |resp| new(resp.values.first) }
|
29
30
|
end
|
30
31
|
when :post
|
@@ -1,16 +1,14 @@
|
|
1
1
|
module BunqRb
|
2
2
|
# Configuration
|
3
3
|
class Configuration
|
4
|
-
attr_accessor :api_key
|
5
|
-
attr_accessor :key
|
6
|
-
attr_accessor :session_token
|
7
|
-
attr_accessor :url
|
4
|
+
attr_accessor :api_key, :key, :session_token, :url, :page_size
|
8
5
|
|
9
6
|
def initialize
|
10
7
|
@api_key = ""
|
11
8
|
@key = nil
|
12
9
|
@session_token = nil
|
13
10
|
@url = ""
|
11
|
+
@page_size = 10
|
14
12
|
end
|
15
13
|
end
|
16
14
|
end
|
data/lib/bunq_rb/objects/card.rb
CHANGED
@@ -10,7 +10,8 @@ module BunqRb
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.all(user_id)
|
13
|
-
|
13
|
+
page_size = BunqRb.configuration.page_size
|
14
|
+
response = Client.send_method(:get, "#{url(user_id)}?count=#{page_size}")
|
14
15
|
response.map { |resp| new(resp["CardDebit"]) }
|
15
16
|
end
|
16
17
|
|
@@ -1,12 +1,14 @@
|
|
1
1
|
module BunqRb
|
2
2
|
# Payment
|
3
3
|
class Payment
|
4
|
-
attr_reader :id, :description, :amount
|
4
|
+
attr_reader :id, :created, :updated, :description, :amount
|
5
5
|
|
6
6
|
def initialize(hsh = {})
|
7
7
|
@id = hsh["id"]
|
8
8
|
@description = hsh["description"]
|
9
9
|
@amount = Money.new(hsh["amount"]["value"].to_f * 100, hsh["amount"]["currency"])
|
10
|
+
@created = Time.parse(hsh["created"])
|
11
|
+
@updated = Time.parse(hsh["updated"])
|
10
12
|
end
|
11
13
|
|
12
14
|
def self.url(user_id, monetary_account_id)
|
@@ -14,8 +16,13 @@ module BunqRb
|
|
14
16
|
end
|
15
17
|
|
16
18
|
def self.all(user_id, monetary_account_id)
|
17
|
-
|
19
|
+
page_size = BunqRb.configuration.page_size
|
20
|
+
response = Client.send_method(:get, "#{url(user_id, monetary_account_id)}?count=#{page_size}")
|
18
21
|
response.map { |resp| new(resp["Payment"]) }
|
19
22
|
end
|
23
|
+
|
24
|
+
def to_s
|
25
|
+
"#{id} => €#{amount} on #{created} for #{description}"
|
26
|
+
end
|
20
27
|
end
|
21
28
|
end
|
data/lib/bunq_rb/version.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.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dunya Kirkali
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-03-
|
12
|
+
date: 2018-03-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: spyke
|