odata 0.5.3 → 0.5.4
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/odata/properties/binary.rb +6 -0
- data/lib/odata/properties/date_time.rb +6 -0
- data/lib/odata/properties/decimal.rb +6 -0
- data/lib/odata/properties/float.rb +6 -0
- data/lib/odata/properties/guid.rb +6 -0
- data/lib/odata/property.rb +7 -1
- data/lib/odata/version.rb +1 -1
- data/spec/odata/properties/binary_spec.rb +2 -0
- data/spec/odata/properties/date_time_spec.rb +2 -0
- data/spec/odata/properties/decimal_spec.rb +2 -0
- data/spec/odata/properties/float_spec.rb +2 -0
- data/spec/odata/properties/guid_spec.rb +2 -0
- data/spec/odata/property_spec.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea9d74baca2cbdc590e6d5b595749ed585944358
|
4
|
+
data.tar.gz: 18a9982c53ceae0b27ebcd33b1fa481ea4ac4143
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b7480aa1cb5e374d1a12bffe66be01d55731e1df62e39884f5b15f5e129717740965392e1bf71c87c3f844f46d8f84c2bf1d96e1a987bfbd71e1d9bd6194f45
|
7
|
+
data.tar.gz: 00f30d2802f4a90d953aa9a46cbbbdc8d79e5ecea3bf0267180da280766da8f722f932875b1f446d466fcd9dfc8d7fff4a4d1ab1cfa6a64c31f1c2332297a0e2
|
data/lib/odata/property.rb
CHANGED
@@ -48,7 +48,13 @@ module OData
|
|
48
48
|
# Value to be used in XML.
|
49
49
|
# @return [String]
|
50
50
|
def xml_value
|
51
|
-
|
51
|
+
value
|
52
|
+
end
|
53
|
+
|
54
|
+
# Value to be used in URLs.
|
55
|
+
# @return [String]
|
56
|
+
def url_value
|
57
|
+
value
|
52
58
|
end
|
53
59
|
|
54
60
|
# Returns the XML representation of the property to the supplied XML
|
data/lib/odata/version.rb
CHANGED
@@ -7,6 +7,8 @@ describe OData::Properties::DateTime do
|
|
7
7
|
it { expect(subject.type).to eq('Edm.DateTime') }
|
8
8
|
it { expect(subject.value).to eq(DateTime.parse('2000-01-01T16:00:00.000')) }
|
9
9
|
|
10
|
+
it { expect(subject.url_value).to eq("datetime'2000-01-01T16:00:00+00:00'")}
|
11
|
+
|
10
12
|
it { expect {subject.value = 'bad'}.to raise_error(ArgumentError) }
|
11
13
|
|
12
14
|
it { expect(lambda {
|
@@ -6,6 +6,8 @@ describe OData::Properties::Decimal do
|
|
6
6
|
it { expect(subject.type).to eq('Edm.Decimal') }
|
7
7
|
it { expect(subject.value).to eq(BigDecimal('678.90325')) }
|
8
8
|
|
9
|
+
it { expect(subject.url_value).to eq('678.90325M') }
|
10
|
+
|
9
11
|
it { expect { subject.value = BigDecimal((7.9 * (10**28)), 2) + 1 }.to raise_error(ArgumentError) }
|
10
12
|
it { expect { subject.value = BigDecimal((-7.9 * (10**28)), 2) - 1 }.to raise_error(ArgumentError) }
|
11
13
|
it { expect { subject.value = BigDecimal((3.4 * (10**-28)), 2) * 3.14151 + 5 }.to raise_error(ArgumentError) }
|
@@ -27,6 +27,8 @@ describe OData::Properties::Float do
|
|
27
27
|
it { expect(subject.type).to eq('Edm.Single') }
|
28
28
|
it { expect(subject.value).to eq(678.90325) }
|
29
29
|
|
30
|
+
it { expect(subject.url_value).to eq('678.90325F') }
|
31
|
+
|
30
32
|
it { expect { subject.value = (3.4 * (10**38) * 2) }.to raise_error(ArgumentError) }
|
31
33
|
it { expect { subject.value = (-3.4 * (10**38) * 2) }.to raise_error(ArgumentError) }
|
32
34
|
|
data/spec/odata/property_spec.rb
CHANGED
@@ -11,6 +11,12 @@ describe OData::Property do
|
|
11
11
|
it { expect(subject).to respond_to(:value) }
|
12
12
|
it { expect(subject.value).to eq('1') }
|
13
13
|
|
14
|
+
it { expect(subject).to respond_to(:xml_value) }
|
15
|
+
it { expect(subject.xml_value).to eq('1') }
|
16
|
+
|
17
|
+
it { expect(subject).to respond_to(:url_value) }
|
18
|
+
it { expect(subject.url_value).to eq('1') }
|
19
|
+
|
14
20
|
it { expect(subject).to respond_to(:type) }
|
15
21
|
it { expect(lambda {subject.type}).to raise_error(NotImplementedError) }
|
16
22
|
|