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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ebfa7758ce02a657b74981eb50987b84cf586e9f
4
- data.tar.gz: 3c437c70d5ba5562c2443f51744038b864036f41
3
+ metadata.gz: 2e32f11bfa40cbcfe0d2921c912d83bde602064b
4
+ data.tar.gz: 289024b98b846ce03cb3f75ab51434113edacef9
5
5
  SHA512:
6
- metadata.gz: 16c8580f2cc8dfcb1f63e76c7f85d397515be83e2a07258d4a07a9282805ef7ff2c4e6bb157d0228318e11f6358ff4997eebde3335e73560e2014603aacc9873
7
- data.tar.gz: a78126929df3905fbfcae5e072f8893229f05ecb6e43171998b69f68ea70db43d9b2b95b382ec27a01c79296b172ca542e0fc6d51e4b0398e7bdffa0bf76ddba
6
+ metadata.gz: e664ab6eff4acd3c1ff76d7eb5528c764adf7dceef7ab8a65aa106914b332af1fbf8f1778842d58abaf714137adb449085c219fb8fa9199c594b45e52d86dc0f
7
+ data.tar.gz: 8b3df35dc7257bf8495bf101ad297ac1aa2d0137611f0bfbf75f99f9291b0e280ff30cb169a6a7154f78164dd2f5d9dd240dc67d1ecf40cef969b0a8bdd6c15e
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Oeffi
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -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.2
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