oeffi 0.0.2 → 0.0.3
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/oeffi/locations.rb +9 -0
- data/lib/oeffi/version.rb +1 -1
- data/spec/location_spec.rb +14 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e32f11bfa40cbcfe0d2921c912d83bde602064b
|
4
|
+
data.tar.gz: 289024b98b846ce03cb3f75ab51434113edacef9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e664ab6eff4acd3c1ff76d7eb5528c764adf7dceef7ab8a65aa106914b332af1fbf8f1778842d58abaf714137adb449085c219fb8fa9199c594b45e52d86dc0f
|
7
|
+
data.tar.gz: 8b3df35dc7257bf8495bf101ad297ac1aa2d0137611f0bfbf75f99f9291b0e280ff30cb169a6a7154f78164dd2f5d9dd240dc67d1ecf40cef969b0a8bdd6c15e
|
data/lib/oeffi/locations.rb
CHANGED
@@ -2,6 +2,7 @@ java_import "de.schildbach.pte.dto.Location"
|
|
2
2
|
|
3
3
|
module Locations
|
4
4
|
class Location
|
5
|
+
attr_accessor :id, :type, :name, :lat, :lon
|
5
6
|
STATION = 0
|
6
7
|
ADDRESS = 1
|
7
8
|
POI = 2
|
@@ -14,5 +15,13 @@ module Locations
|
|
14
15
|
@lat = javaStation.lat.to_f / 1000000
|
15
16
|
@lng = javaStation.lon.to_f / 1000000
|
16
17
|
end
|
18
|
+
|
19
|
+
def as_json
|
20
|
+
hash = {}
|
21
|
+
[:id, :type, :name, :lat, :lon].each do |sym|
|
22
|
+
hash[sym] = self.send sym
|
23
|
+
end
|
24
|
+
return hash
|
25
|
+
end
|
17
26
|
end
|
18
27
|
end
|
data/lib/oeffi/version.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "java"
|
2
|
+
require "lib/oeffi"
|
3
|
+
|
4
|
+
describe Location do
|
5
|
+
it "should present it's values as a hash" do
|
6
|
+
jLocation = Java::DeSchildbachPteDto::Location.new Java::DeSchildbachPteDto::LocationType::STATION, 13000
|
7
|
+
location = Locations::Location.new jLocation
|
8
|
+
|
9
|
+
result = location.as_json
|
10
|
+
result.should be_a Hash
|
11
|
+
|
12
|
+
result[:id].should equal 13000
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oeffi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Kraft
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/vendor/org.json.jar
|
89
89
|
- lib/vendor/public-enabler.jar
|
90
90
|
- oeffi.gemspec
|
91
|
+
- spec/location_spec.rb
|
91
92
|
- spec/oeffi_spec.rb
|
92
93
|
- spec/spec_helper.rb
|
93
94
|
homepage: https://github.com/floriank/oeffi
|
@@ -115,5 +116,6 @@ signing_key:
|
|
115
116
|
specification_version: 4
|
116
117
|
summary: Oeffi for JRuby
|
117
118
|
test_files:
|
119
|
+
- spec/location_spec.rb
|
118
120
|
- spec/oeffi_spec.rb
|
119
121
|
- spec/spec_helper.rb
|