besepa 0.8.0 → 0.8.1
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/besepa/debit.rb +35 -40
- data/lib/besepa/utils/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 770c9e94a064e6335edafcef5803b4f7e4cff15d
|
4
|
+
data.tar.gz: bc0d59b48235374c6870eefd124ba7deac0569be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 291ff5d1108d3443b7b4695acb82b10e2c5be5964fede253b3758bc2ed09f16de7c6dd711f80867a63b48cb69c06eb373ae9464813796e5806a928adc7cdba53
|
7
|
+
data.tar.gz: 5cb6f6daff9b7bd16c90e34199a0a60c3776a3f45cd84dcc973f9f093b20ee7c9059c2b8065e103b166ea04313e0f067ff727c86fd91ff9e30dd523b3b878574
|
data/lib/besepa/debit.rb
CHANGED
@@ -1,19 +1,18 @@
|
|
1
1
|
module Besepa
|
2
|
-
|
3
2
|
class Debit < Besepa::Resource
|
4
|
-
|
3
|
+
|
5
4
|
include Besepa::ApiCalls::List
|
6
5
|
include Besepa::ApiCalls::Create
|
7
6
|
include Besepa::ApiCalls::Update
|
8
7
|
include Besepa::ApiCalls::Destroy
|
9
|
-
|
10
|
-
FIELDS = [:id, :reference, :amount, :currency, :status,
|
11
|
-
:collect_at, :sent_at, :description, :metadata,
|
8
|
+
|
9
|
+
FIELDS = [:id, :reference, :amount, :currency, :status,
|
10
|
+
:collect_at, :sent_at, :description, :metadata,
|
12
11
|
:error_code, :platform_error_code, :created_at, :rejected_at,
|
13
12
|
:debtor_bank_account_id, :creditor_bank_account_id]
|
14
|
-
|
13
|
+
|
15
14
|
ALLOWED_NILS = [:collect_at]
|
16
|
-
|
15
|
+
|
17
16
|
FIELDS.each do |f|
|
18
17
|
attr_accessor f
|
19
18
|
end
|
@@ -32,47 +31,43 @@ module Besepa
|
|
32
31
|
values[:subscription] = subscription.to_hash if subscription
|
33
32
|
values
|
34
33
|
end
|
35
|
-
|
34
|
+
|
36
35
|
def allowed_nils
|
37
36
|
ALLOWED_NILS
|
38
37
|
end
|
39
38
|
|
40
|
-
protected
|
41
|
-
|
42
|
-
def self.api_path(filters={})
|
43
|
-
if filters[:customer_id]
|
44
|
-
"#{Customer.api_path}/#{CGI.escape(filters[:customer_id])}/debits"
|
45
|
-
else
|
46
|
-
"#{Group.api_path}/#{CGI.escape(filters[:group_id])}/debits"
|
47
|
-
end
|
48
|
-
end
|
39
|
+
protected
|
49
40
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
end
|
41
|
+
def self.query_params(filters = {})
|
42
|
+
filters = filters.dup
|
43
|
+
filters.delete(:customer_id)
|
44
|
+
filters
|
45
|
+
end
|
56
46
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
47
|
+
def self.api_path(filters={})
|
48
|
+
customer_id = filters[:customer_id]
|
49
|
+
if customer_id
|
50
|
+
"#{Customer.api_path}/#{CGI.escape(customer_id)}/debits"
|
51
|
+
else
|
52
|
+
'/debits'
|
63
53
|
end
|
54
|
+
end
|
64
55
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
self.
|
72
|
-
self.remittance = Besepa::Remittance.new(attrs['remittance']) if attrs['remittance']
|
73
|
-
self.subscription = Besepa::Subscription.new(attrs['subscription']) if attrs['subscription']
|
74
|
-
process_activities(attrs)
|
75
|
-
self
|
56
|
+
def api_path(filters={})
|
57
|
+
"#{self.class.api_path(filters)}/#{CGI.escape(id)}"
|
58
|
+
end
|
59
|
+
|
60
|
+
def process_attributes(attrs)
|
61
|
+
self.class::FIELDS.each do |key|
|
62
|
+
self.send("#{key.to_s}=", attrs[key.to_s] || attrs[key.to_sym])
|
76
63
|
end
|
64
|
+
self.debtor_bank_account = Besepa::BankAccount.new(attrs['debtor_bank_account']) if attrs['debtor_bank_account']
|
65
|
+
self.creditor_bank_account = Besepa::BusinessAccount.new(attrs['creditor_bank_account']) if attrs['creditor_bank_account']
|
66
|
+
self.customer = Besepa::Customer.new(attrs['customer']) if attrs['customer']
|
67
|
+
self.remittance = Besepa::Remittance.new(attrs['remittance']) if attrs['remittance']
|
68
|
+
self.subscription = Besepa::Subscription.new(attrs['subscription']) if attrs['subscription']
|
69
|
+
process_activities(attrs)
|
70
|
+
self
|
71
|
+
end
|
77
72
|
end
|
78
73
|
end
|
data/lib/besepa/utils/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: besepa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- besepa.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -165,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
165
|
version: '0'
|
166
166
|
requirements: []
|
167
167
|
rubyforge_project:
|
168
|
-
rubygems_version: 2.
|
168
|
+
rubygems_version: 2.5.1
|
169
169
|
signing_key:
|
170
170
|
specification_version: 4
|
171
171
|
summary: Ruby client for besepa.com
|