sepa 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sepa/base.rb +5 -1
- data/lib/sepa/payments_initiation/contact_details.rb +4 -0
- data/lib/sepa/version.rb +1 -1
- metadata +2 -2
data/lib/sepa/base.rb
CHANGED
@@ -12,12 +12,16 @@ module Sepa
|
|
12
12
|
result
|
13
13
|
end
|
14
14
|
|
15
|
+
def empty?
|
16
|
+
false
|
17
|
+
end
|
18
|
+
|
15
19
|
def to_xml builder
|
16
20
|
self.class.attribute_defs.each do |name, meta|
|
17
21
|
item = self.send(name)
|
18
22
|
options = meta[:options] || { }
|
19
23
|
attributes = build_xml_attributes options[:attributes]
|
20
|
-
next if item == nil
|
24
|
+
next if item == nil || (item.is_a?(Sepa::Base) && item.empty?)
|
21
25
|
if meta[:type] == :string
|
22
26
|
builder.__send__(meta[:tag], item, attributes)
|
23
27
|
elsif meta[:type] == :[]
|
@@ -6,4 +6,8 @@ class Sepa::PaymentsInitiation::ContactDetails < Sepa::Base
|
|
6
6
|
attribute :fax_number , "FaxNb"
|
7
7
|
attribute :email_address, "EmailAdr"
|
8
8
|
attribute :other , "Othr"
|
9
|
+
|
10
|
+
def empty?
|
11
|
+
[name_prefix, name, phone_number, mobile_number, fax_number, email_address, other].compact == []
|
12
|
+
end
|
9
13
|
end
|
data/lib/sepa/version.rb
CHANGED
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.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-09-
|
12
|
+
date: 2013-09-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: builder
|