sapoci 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sapoci/item.rb +15 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 553cb3599fb64e68ced3a9a151ca91c2e9ab27d3a8e0e070fcac952da54678c5
|
4
|
+
data.tar.gz: ec979e67665aef6f011842486544b1f31aba19290adb02ec658e84f0b282a5ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d578ae5120f30234132178ffb15f8bc2071371ee84c3e5e536eb3797c69d5f9d6058a2274ad51a09dc80f9aab1b5be66c5702d7f6320d2b3d303d1895223292e
|
7
|
+
data.tar.gz: 283200ef21c82abab10c52da87e7972a4134208e13b02cc0df3e85adf5c7eceee597676f5468d52ee480dd346dffc3623027770e79ed2ec75b19dae78a56298c
|
data/lib/sapoci/item.rb
CHANGED
@@ -73,11 +73,19 @@ module SAPOCI
|
|
73
73
|
@index = index
|
74
74
|
end
|
75
75
|
|
76
|
+
def decimal(s)
|
77
|
+
if RUBY_VERSION >= '2.5'
|
78
|
+
BigDecimal(s)
|
79
|
+
else
|
80
|
+
BigDecimal.new(s)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
76
84
|
def quantity
|
77
85
|
if defined?(@quantity)
|
78
|
-
|
86
|
+
decimal("0#{@quantity.to_s.strip.gsub(/,/,'.')}")
|
79
87
|
else
|
80
|
-
|
88
|
+
decimal("0.0")
|
81
89
|
end
|
82
90
|
end
|
83
91
|
|
@@ -91,9 +99,9 @@ module SAPOCI
|
|
91
99
|
|
92
100
|
def price
|
93
101
|
if defined?(@price)
|
94
|
-
|
102
|
+
decimal("0#{@price.to_s.strip.gsub(/,/,'.')}")
|
95
103
|
else
|
96
|
-
|
104
|
+
decimal("0.0")
|
97
105
|
end
|
98
106
|
end
|
99
107
|
|
@@ -107,7 +115,7 @@ module SAPOCI
|
|
107
115
|
|
108
116
|
def priceunit
|
109
117
|
if defined?(@priceunit)
|
110
|
-
|
118
|
+
decimal("0#{@priceunit.to_s.strip.gsub(/,/,'.')}").nonzero? || 1
|
111
119
|
else
|
112
120
|
1
|
113
121
|
end
|
@@ -143,9 +151,9 @@ module SAPOCI
|
|
143
151
|
|
144
152
|
def tax_rate
|
145
153
|
if defined?(@tax_rate)
|
146
|
-
|
154
|
+
decimal("0#{@tax_rate.to_s.strip.gsub(/,/,'.')}")
|
147
155
|
else
|
148
|
-
|
156
|
+
decimal("0.0")
|
149
157
|
end
|
150
158
|
end
|
151
159
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sapoci
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oliver Eilhard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|