odata 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea7ec77343b1356c209a7d839ff2622f8689d3ac
4
- data.tar.gz: e30192e3b42bcfb44ad603a67e850fe1ba78b450
3
+ metadata.gz: ea9d74baca2cbdc590e6d5b595749ed585944358
4
+ data.tar.gz: 18a9982c53ceae0b27ebcd33b1fa481ea4ac4143
5
5
  SHA512:
6
- metadata.gz: e0b19371dc53a765266f87f692b5b2205f24da8cee4887b3af5743171f84f63ef8070188434e97727393df9a5045cd6c6927436ddfa92920f1ed75772824888a
7
- data.tar.gz: c8ecae4b80e97b4c8c6c3aeaf6a042df929c5b58bfda0a8361fb2caa72ea86ce6f3508a3c360d3663d631df570a6ebeaddb1a1f62880665eb95d345c809daa4f
6
+ metadata.gz: 2b7480aa1cb5e374d1a12bffe66be01d55731e1df62e39884f5b15f5e129717740965392e1bf71c87c3f844f46d8f84c2bf1d96e1a987bfbd71e1d9bd6194f45
7
+ data.tar.gz: 00f30d2802f4a90d953aa9a46cbbbdc8d79e5ecea3bf0267180da280766da8f722f932875b1f446d466fcd9dfc8d7fff4a4d1ab1cfa6a64c31f1c2332297a0e2
@@ -24,6 +24,12 @@ module OData
24
24
  'Edm.Binary'
25
25
  end
26
26
 
27
+ # Value to be used in URLs.
28
+ # @return [String]
29
+ def url_value
30
+ "binary'#{value}'"
31
+ end
32
+
27
33
  private
28
34
 
29
35
  def parse_value(value)
@@ -28,6 +28,12 @@ module OData
28
28
  'Edm.DateTime'
29
29
  end
30
30
 
31
+ # Value to be used in URLs.
32
+ # @return [String]
33
+ def url_value
34
+ "datetime'#{value}'"
35
+ end
36
+
31
37
  private
32
38
 
33
39
  def validate(value)
@@ -24,6 +24,12 @@ module OData
24
24
  'Edm.Decimal'
25
25
  end
26
26
 
27
+ # Value to be used in URLs.
28
+ # @return [String]
29
+ def url_value
30
+ "#{value.to_f}M"
31
+ end
32
+
27
33
  private
28
34
 
29
35
  def validate(value)
@@ -47,6 +47,12 @@ module OData
47
47
  'Edm.Single'
48
48
  end
49
49
 
50
+ # Value to be used in URLs.
51
+ # @return [String]
52
+ def url_value
53
+ "#{value}F"
54
+ end
55
+
50
56
  private
51
57
 
52
58
  def min_value
@@ -6,6 +6,12 @@ module OData
6
6
  def type
7
7
  'Edm.Guid'
8
8
  end
9
+
10
+ # Value to be used in URLs.
11
+ # @return [String]
12
+ def url_value
13
+ "guid'#{value}'"
14
+ end
9
15
  end
10
16
  end
11
17
  end
@@ -48,7 +48,13 @@ module OData
48
48
  # Value to be used in XML.
49
49
  # @return [String]
50
50
  def xml_value
51
- @value
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
@@ -1,3 +1,3 @@
1
1
  module OData
2
- VERSION = '0.5.3'
2
+ VERSION = '0.5.4'
3
3
  end
@@ -8,6 +8,8 @@ describe OData::Properties::Binary do
8
8
 
9
9
  it { expect {subject.value = 'bad'}.to raise_error(ArgumentError) }
10
10
 
11
+ it { expect(subject.url_value).to eq("binary'1'") }
12
+
11
13
  describe 'setting to 0' do
12
14
  it { expect(lambda {
13
15
  subject.value = 0
@@ -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
 
@@ -12,4 +12,6 @@ describe OData::Properties::Guid do
12
12
  subject.value = guid2
13
13
  subject.value
14
14
  }.call).to eq(guid2) }
15
+
16
+ it { expect(subject.url_value).to eq("guid'#{guid}'") }
15
17
  end
@@ -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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: odata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Thompson