rconomic 0.2.0 → 0.2.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.
@@ -87,7 +87,7 @@ module Economic
|
|
87
87
|
data['DebtorCountry'] = debtor_country unless debtor_country.blank?
|
88
88
|
data['Date'] = date.iso8601 unless date.blank?
|
89
89
|
data['TermOfPaymentHandle'] = { 'Id' => term_of_payment_handle[:id] } unless term_of_payment_handle.blank?
|
90
|
-
data['DueDate'] = due_date.
|
90
|
+
data['DueDate'] = (due_date.blank? ? nil : due_date.iso8601)
|
91
91
|
data['CurrencyHandle'] = { 'Code' => currency_handle[:code] } unless currency_handle.blank?
|
92
92
|
data['ExchangeRate'] = exchange_rate
|
93
93
|
data['IsVatIncluded'] = is_vat_included
|
@@ -29,6 +29,8 @@ module Economic
|
|
29
29
|
entity.update_properties(properties)
|
30
30
|
entity.partial = false
|
31
31
|
|
32
|
+
self.append(entity)
|
33
|
+
|
32
34
|
entity
|
33
35
|
end
|
34
36
|
|
@@ -57,10 +59,11 @@ module Economic
|
|
57
59
|
entity_hash
|
58
60
|
end
|
59
61
|
|
60
|
-
#
|
61
|
-
def
|
62
|
-
items << item
|
62
|
+
# Adds item to proxy unless item already exists in the proxy
|
63
|
+
def append(item)
|
64
|
+
items << item unless items.include?(item)
|
63
65
|
end
|
66
|
+
alias :<< :append
|
64
67
|
|
65
68
|
def each
|
66
69
|
items.each { |i| yield i }
|
@@ -70,5 +73,10 @@ module Economic
|
|
70
73
|
items.empty?
|
71
74
|
end
|
72
75
|
|
76
|
+
# Returns the number of entities in proxy
|
77
|
+
def size
|
78
|
+
items.size
|
79
|
+
end
|
80
|
+
|
73
81
|
end
|
74
82
|
end
|
data/lib/rconomic/version.rb
CHANGED
@@ -15,6 +15,15 @@ describe Economic::CurrentInvoiceLineProxy do
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
describe ".append" do
|
19
|
+
it "ignores duplicated lines" do
|
20
|
+
line = Economic::CurrentInvoiceLine.new
|
21
|
+
subject.append(line)
|
22
|
+
subject.append(line)
|
23
|
+
subject.items.should == [line]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
18
27
|
describe ".build" do
|
19
28
|
it "instantiates a new CurrentInvoiceLine" do
|
20
29
|
subject.build.should be_instance_of(Economic::CurrentInvoiceLine)
|
@@ -28,6 +37,11 @@ describe Economic::CurrentInvoiceLineProxy do
|
|
28
37
|
subject.build.should_not be_partial
|
29
38
|
end
|
30
39
|
|
40
|
+
it "adds the built line to proxy items" do
|
41
|
+
line = subject.build
|
42
|
+
subject.items.should == [line]
|
43
|
+
end
|
44
|
+
|
31
45
|
context "when owner is a CurrentInvoice" do
|
32
46
|
subject { invoice.lines }
|
33
47
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rconomic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jakob Skjerning
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-08-
|
18
|
+
date: 2011-08-12 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: savon
|