wizypay-api-client 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wizypay.rb +1 -0
- data/lib/wizypay/balance_report.rb +23 -0
- data/lib/wizypay/card_methods.rb +5 -0
- data/lib/wizypay/version.rb +1 -1
- data/spec/balance_report/balance_report_spec.rb +40 -0
- data/spec/debit_card/refund_card_spec.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b166c18169b5185bb68e585f7aea196578c7616
|
4
|
+
data.tar.gz: acf0e11988a65a550ddb3495b551c966452a6279
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c1b900450f63bb2fedcb455173b300b5b9557d75981b6f3603557bbe99f546222bed7636823082181ac466af3fa21918016a0251edede369ef8ad70373a94f4
|
7
|
+
data.tar.gz: fe84c6acf4ee8864ef6c4ea10f0af2f5dc93de822c35d40630c227afb4dbce74675defecef9cdff323d520b8dc4fabc81813e69927880db3b163f392d954856e
|
data/lib/wizypay.rb
CHANGED
@@ -15,6 +15,7 @@ require_relative 'wizypay/merchant_category'
|
|
15
15
|
require_relative 'wizypay/merchant'
|
16
16
|
require_relative 'wizypay/merchant_version'
|
17
17
|
require_relative 'wizypay/beneficiary'
|
18
|
+
require_relative 'wizypay/balance_report'
|
18
19
|
|
19
20
|
module Wizypay
|
20
21
|
def self.setup(api_key, api_secret, api_endpoint = 'https://api.wizypay.com')
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Wizypay
|
2
|
+
class BalanceReport < Resource
|
3
|
+
class Line < Resource
|
4
|
+
def date
|
5
|
+
return nil unless super.present?
|
6
|
+
Date.parse(super)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.show(granularity, opts = {})
|
11
|
+
raw = ApiClient.get('/balance_report', opts.merge(granularity: granularity))
|
12
|
+
Collection.new(Line, raw[:data], raw[:meta])
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.monthly(opts = {})
|
16
|
+
show('month', opts)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.daily(opts = {})
|
20
|
+
show('day', opts)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/wizypay/card_methods.rb
CHANGED
data/lib/wizypay/version.rb
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Wizypay
|
4
|
+
RSpec.describe BalanceReport do
|
5
|
+
let(:api_key) { 'key' }
|
6
|
+
let(:api_secret) { 'secret' }
|
7
|
+
let(:api_endpoint) { 'https://api.wizypay.com' }
|
8
|
+
let!(:request) { stub_request(:get, "#{api_endpoint}/balance_report?granularity=month").
|
9
|
+
with(headers: { 'Accept' => 'application/json',
|
10
|
+
'Authorization' => /WIZYPAY #{api_key}:.*/ }).
|
11
|
+
to_return(status: 200, body: '{"data": [{"date": "2016-02-01"}]}') }
|
12
|
+
before do
|
13
|
+
Wizypay.setup(api_key, api_secret, api_endpoint)
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '.show' do
|
17
|
+
it 'returns' do
|
18
|
+
response = BalanceReport.show('month')
|
19
|
+
expect(request).to have_been_made
|
20
|
+
expect(response.length).to eq 1
|
21
|
+
expect(response.first).to be_a(BalanceReport::Line)
|
22
|
+
expect(response.first.date).to be_a(Date)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '.monthly' do
|
27
|
+
it 'delegates to show' do
|
28
|
+
expect(BalanceReport).to receive(:show).with('month', {})
|
29
|
+
BalanceReport.monthly
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '.daily' do
|
34
|
+
it 'delegates to show' do
|
35
|
+
expect(BalanceReport).to receive(:show).with('day', {})
|
36
|
+
BalanceReport.daily
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wizypay-api-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chaker Nakhli
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-02-
|
13
|
+
date: 2016-02-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: simple-hmac
|
@@ -152,6 +152,7 @@ files:
|
|
152
152
|
- lib/wizypay.rb
|
153
153
|
- lib/wizypay/ad.rb
|
154
154
|
- lib/wizypay/api_client.rb
|
155
|
+
- lib/wizypay/balance_report.rb
|
155
156
|
- lib/wizypay/beneficiary.rb
|
156
157
|
- lib/wizypay/card_methods.rb
|
157
158
|
- lib/wizypay/collection.rb
|
@@ -164,6 +165,7 @@ files:
|
|
164
165
|
- lib/wizypay/resource.rb
|
165
166
|
- lib/wizypay/vdc_operation.rb
|
166
167
|
- lib/wizypay/version.rb
|
168
|
+
- spec/balance_report/balance_report_spec.rb
|
167
169
|
- spec/beneficiary/beneficiary_spec.rb
|
168
170
|
- spec/debit_card/cancel_card_spec.rb
|
169
171
|
- spec/debit_card/card_all_spec.rb
|
@@ -206,6 +208,7 @@ signing_key:
|
|
206
208
|
specification_version: 4
|
207
209
|
summary: Programmatic API to access Wizypay's API.
|
208
210
|
test_files:
|
211
|
+
- spec/balance_report/balance_report_spec.rb
|
209
212
|
- spec/beneficiary/beneficiary_spec.rb
|
210
213
|
- spec/debit_card/cancel_card_spec.rb
|
211
214
|
- spec/debit_card/card_all_spec.rb
|