sepa 0.0.18.1 → 0.0.18.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sepa/base.rb +9 -1
- data/lib/sepa/version.rb +1 -1
- data/spec/sepa/payments_initiation/contact_details_spec.rb +18 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab9664447c049ccc5d9bee8208adedeaf835127a
|
4
|
+
data.tar.gz: 2458d3d8e38a35ac4e06fd6d84cbb3b6b8f3fdbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c767a5457b79d39ed6d7ca038cb4ae97cefd6593ca20e999c71fca5ae7059f04fd34786e0a4b486d2816c67100ddfa04dff8457859063da0935e66aa61099419
|
7
|
+
data.tar.gz: 4415b51f8c5bd33c997218e2bd8ffee8718546117f02d75e62095ced989d1b56a1865a3c69dcc3b3a53ebd9bb69c3eb01ab1d9069c4ea285beb8214fec20b55a
|
data/lib/sepa/base.rb
CHANGED
@@ -7,6 +7,10 @@ module Sepa
|
|
7
7
|
self.string = constrain s
|
8
8
|
end
|
9
9
|
|
10
|
+
def empty?
|
11
|
+
(self.string == nil) || (self.string == '')
|
12
|
+
end
|
13
|
+
|
10
14
|
def to_s
|
11
15
|
self.string
|
12
16
|
end
|
@@ -58,12 +62,16 @@ module Sepa
|
|
58
62
|
(type_def == :string) || (type_def.is_a?(Class) && type_def < StringWithConstraint)
|
59
63
|
end
|
60
64
|
|
65
|
+
def empty_item? item
|
66
|
+
item == nil || (item.respond_to?(:empty?) && item.empty?)
|
67
|
+
end
|
68
|
+
|
61
69
|
def to_xml builder
|
62
70
|
self.class.attribute_defs.each do |name, meta|
|
63
71
|
item = self.send(name)
|
64
72
|
options = meta[:options] || { }
|
65
73
|
attributes = build_xml_attributes options[:attributes]
|
66
|
-
next if
|
74
|
+
next if empty_item? item
|
67
75
|
if string_type?(meta[:type])
|
68
76
|
builder.__send__(meta[:tag], normalize(item), attributes)
|
69
77
|
elsif meta[:type] == :[]
|
data/lib/sepa/version.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Sepa::PaymentsInitiation::ContactDetails do
|
6
|
+
it "should be empty by default" do
|
7
|
+
Sepa::PaymentsInitiation::ContactDetails.new({ }).should be_empty
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should not generate an empty 'Nm' tag" do
|
11
|
+
contact_details = Sepa::PaymentsInitiation::ContactDetails.new({ :phone_number => "12345" })
|
12
|
+
builder = Builder::XmlMarkup.new(:indent => 2)
|
13
|
+
xml = builder.Document() {
|
14
|
+
contact_details.to_xml builder
|
15
|
+
}
|
16
|
+
expect(xml).to eq "<Document>\n <PhneNb>12345</PhneNb>\n</Document>\n"
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sepa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.18.
|
4
|
+
version: 0.0.18.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Conan Dalton
|
@@ -148,6 +148,7 @@ files:
|
|
148
148
|
- spec/sepa/expected_customer_direct_debit_initiation_v02_with_remittance_information.xml
|
149
149
|
- spec/sepa/expected_customer_direct_debit_initiation_v04.xml
|
150
150
|
- spec/sepa/expected_customer_direct_debit_initiation_v04_with_org_id.xml
|
151
|
+
- spec/sepa/payments_initiation/contact_details_spec.rb
|
151
152
|
- spec/sepa/payments_initiation/financial_identification_scheme_name_1_choice_spec.rb
|
152
153
|
- spec/sepa/payments_initiation/generic_financial_identification_1_spec.rb
|
153
154
|
- spec/sepa/payments_initiation/pain00800104/customer_direct_debit_initiation_spec.rb
|
@@ -186,6 +187,7 @@ test_files:
|
|
186
187
|
- spec/sepa/expected_customer_direct_debit_initiation_v02_with_remittance_information.xml
|
187
188
|
- spec/sepa/expected_customer_direct_debit_initiation_v04.xml
|
188
189
|
- spec/sepa/expected_customer_direct_debit_initiation_v04_with_org_id.xml
|
190
|
+
- spec/sepa/payments_initiation/contact_details_spec.rb
|
189
191
|
- spec/sepa/payments_initiation/financial_identification_scheme_name_1_choice_spec.rb
|
190
192
|
- spec/sepa/payments_initiation/generic_financial_identification_1_spec.rb
|
191
193
|
- spec/sepa/payments_initiation/pain00800104/customer_direct_debit_initiation_spec.rb
|