transport-opendata 0.8.2 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/checkpoint.rb +23 -22
- data/lib/connection.rb +24 -24
- data/lib/coordinate.rb +14 -14
- data/lib/duration.rb +23 -23
- data/lib/error.rb +12 -12
- data/lib/journey.rb +27 -26
- data/lib/prognosis.rb +18 -18
- data/lib/section.rb +15 -15
- data/lib/service.rb +13 -13
- data/lib/station.rb +20 -0
- data/lib/stop.rb +21 -20
- data/lib/timetable.rb +55 -50
- data/lib/transport-opendata.rb +4 -4
- data/lib/transport_factory.rb +36 -41
- metadata +4 -4
- data/lib/location.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 477321930cf1cd7bb8a640345b83c9cd01ef910e
|
4
|
+
data.tar.gz: e0b0a35fcd22b4948a1b3d076e59f997252f3fb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb3314474a91b5104a96fb44a43bd25dce790b277d81b9976e558d5e2392c39e4654997cad6dc45528838bf6a91e261866006d9337a790745a94f0d556950d87
|
7
|
+
data.tar.gz: b206b3794dcd8f6326ded9f6cfae6ea05334b0d1a61d2733e034b5998d31fb1ae692d28ecb9c73b5022c678f0d0dd098ce451486134a35d6dff4fa82094bd5c5
|
data/lib/checkpoint.rb
CHANGED
@@ -1,22 +1,23 @@
|
|
1
|
-
#
|
2
|
-
# Checkpoint
|
3
|
-
#
|
4
|
-
|
5
|
-
require_relative '
|
6
|
-
require_relative 'prognosis'
|
7
|
-
|
8
|
-
module Transport
|
9
|
-
class Checkpoint
|
10
|
-
attr_reader :station, :arrival, :departure, :platform, :prognosis
|
11
|
-
|
12
|
-
def initialize(checkpoint)
|
13
|
-
return unless checkpoint
|
14
|
-
|
15
|
-
@station =
|
16
|
-
@arrival = DateTime.parse(checkpoint['arrival']) if checkpoint['arrival']
|
17
|
-
@departure = DateTime.parse(checkpoint['departure']) if checkpoint['departure']
|
18
|
-
@
|
19
|
-
@
|
20
|
-
|
21
|
-
|
22
|
-
end
|
1
|
+
#
|
2
|
+
# Checkpoint
|
3
|
+
#
|
4
|
+
|
5
|
+
require_relative 'station'
|
6
|
+
require_relative 'prognosis'
|
7
|
+
|
8
|
+
module Transport
|
9
|
+
class Checkpoint
|
10
|
+
attr_reader :station, :arrival, :departure, :platform, :prognosis
|
11
|
+
|
12
|
+
def initialize(checkpoint)
|
13
|
+
return unless checkpoint
|
14
|
+
|
15
|
+
@station = Station.new checkpoint['station']
|
16
|
+
@arrival = DateTime.parse(checkpoint['arrival']) if checkpoint['arrival']
|
17
|
+
@departure = DateTime.parse(checkpoint['departure']) if checkpoint['departure']
|
18
|
+
@delay = checkpoint['delay'].to_i if checkpoint['delay']
|
19
|
+
@platform = checkpoint['platform']
|
20
|
+
@prognosis = Prognosis.new checkpoint['prognosis']
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/connection.rb
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
#
|
2
|
-
# Connection
|
3
|
-
#
|
4
|
-
|
5
|
-
require_relative 'checkpoint'
|
6
|
-
require_relative 'service'
|
7
|
-
require_relative 'section'
|
8
|
-
require_relative 'duration'
|
9
|
-
|
10
|
-
module Transport
|
11
|
-
class Connection
|
12
|
-
attr_reader :from, :to, :duration, :service, :products, :capacity1st, :capacity2nd, :sections
|
13
|
-
|
14
|
-
def initialize(connection)
|
15
|
-
@from = Checkpoint.new connection['from']
|
16
|
-
@to = Checkpoint.new connection['to']
|
17
|
-
@duration = Duration.new connection['duration']
|
18
|
-
@service = Service.new connection['service']
|
19
|
-
@products = connection['products']
|
20
|
-
@capacity1st = connection['capacity1st']
|
21
|
-
@capacity2nd = connection['capacity2nd']
|
22
|
-
@sections = connection['sections'].map { |section| Section .new section }
|
23
|
-
end
|
24
|
-
end
|
1
|
+
#
|
2
|
+
# Connection
|
3
|
+
#
|
4
|
+
|
5
|
+
require_relative 'checkpoint'
|
6
|
+
require_relative 'service'
|
7
|
+
require_relative 'section'
|
8
|
+
require_relative 'duration'
|
9
|
+
|
10
|
+
module Transport
|
11
|
+
class Connection
|
12
|
+
attr_reader :from, :to, :duration, :service, :products, :capacity1st, :capacity2nd, :sections
|
13
|
+
|
14
|
+
def initialize(connection)
|
15
|
+
@from = Checkpoint.new connection['from']
|
16
|
+
@to = Checkpoint.new connection['to']
|
17
|
+
@duration = Duration.new connection['duration']
|
18
|
+
@service = Service.new connection['service']
|
19
|
+
@products = connection['products']
|
20
|
+
@capacity1st = connection['capacity1st']
|
21
|
+
@capacity2nd = connection['capacity2nd']
|
22
|
+
@sections = connection['sections'].map { |section| Section .new section }
|
23
|
+
end
|
24
|
+
end
|
25
25
|
end
|
data/lib/coordinate.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
#
|
2
|
-
# Coordinate
|
3
|
-
#
|
4
|
-
|
5
|
-
module Transport
|
6
|
-
class Coordinate
|
7
|
-
attr_reader :type, :x, :y
|
8
|
-
|
9
|
-
def initialize(coordinate)
|
10
|
-
@type = coordinate['type'].to_sym
|
11
|
-
@x = coordinate['x']
|
12
|
-
@y = coordinate['y']
|
13
|
-
end
|
14
|
-
end
|
1
|
+
#
|
2
|
+
# Coordinate
|
3
|
+
#
|
4
|
+
|
5
|
+
module Transport
|
6
|
+
class Coordinate
|
7
|
+
attr_reader :type, :x, :y
|
8
|
+
|
9
|
+
def initialize(coordinate)
|
10
|
+
@type = coordinate['type'].to_sym
|
11
|
+
@x = coordinate['x']
|
12
|
+
@y = coordinate['y']
|
13
|
+
end
|
14
|
+
end
|
15
15
|
end
|
data/lib/duration.rb
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
#
|
2
|
-
# Duration
|
3
|
-
#
|
4
|
-
|
5
|
-
module Transport
|
6
|
-
class Duration
|
7
|
-
attr_reader :seconds, :minutes, :hours, :days
|
8
|
-
|
9
|
-
def initialize(duration)
|
10
|
-
@days, @hours, @minutes, @seconds = duration.split(/d|:/)
|
11
|
-
@seconds = @seconds.to_i
|
12
|
-
@minutes = @minutes.to_i
|
13
|
-
@hours = @hours.to_i
|
14
|
-
@days = @days.to_i
|
15
|
-
end
|
16
|
-
|
17
|
-
def to_s
|
18
|
-
result = ""
|
19
|
-
result += "#{@days}d" if @days > 0
|
20
|
-
result += "#{@hours}h" if @hours > 0 || @days > 0
|
21
|
-
result += "#{@minutes}m"
|
22
|
-
end
|
23
|
-
end
|
1
|
+
#
|
2
|
+
# Duration
|
3
|
+
#
|
4
|
+
|
5
|
+
module Transport
|
6
|
+
class Duration
|
7
|
+
attr_reader :seconds, :minutes, :hours, :days
|
8
|
+
|
9
|
+
def initialize(duration)
|
10
|
+
@days, @hours, @minutes, @seconds = duration.split(/d|:/)
|
11
|
+
@seconds = @seconds.to_i
|
12
|
+
@minutes = @minutes.to_i
|
13
|
+
@hours = @hours.to_i
|
14
|
+
@days = @days.to_i
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_s
|
18
|
+
result = ""
|
19
|
+
result += "#{@days}d" if @days > 0
|
20
|
+
result += "#{@hours}h" if @hours > 0 || @days > 0
|
21
|
+
result += "#{@minutes}m"
|
22
|
+
end
|
23
|
+
end
|
24
24
|
end
|
data/lib/error.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
#
|
2
|
-
# Error
|
3
|
-
#
|
4
|
-
|
5
|
-
module Transport
|
6
|
-
class Error
|
7
|
-
attr_reader :message
|
8
|
-
|
9
|
-
def initialize(error)
|
10
|
-
@message = error['message']
|
11
|
-
end
|
12
|
-
end
|
1
|
+
#
|
2
|
+
# Error
|
3
|
+
#
|
4
|
+
|
5
|
+
module Transport
|
6
|
+
class Error
|
7
|
+
attr_reader :message
|
8
|
+
|
9
|
+
def initialize(error)
|
10
|
+
@message = error['message']
|
11
|
+
end
|
12
|
+
end
|
13
13
|
end
|
data/lib/journey.rb
CHANGED
@@ -1,26 +1,27 @@
|
|
1
|
-
#
|
2
|
-
# Journey
|
3
|
-
#
|
4
|
-
|
5
|
-
require_relative '
|
6
|
-
|
7
|
-
module Transport
|
8
|
-
class Journey
|
9
|
-
attr_reader :stop, :name, :category, :categoryCode, :number, :operator, :to, :passList, :capacity1st, :capacity2nd
|
10
|
-
|
11
|
-
def initialize(journey)
|
12
|
-
return unless journey
|
13
|
-
|
14
|
-
@stop =
|
15
|
-
@name = journey['name']
|
16
|
-
@category = journey['category']
|
17
|
-
@
|
18
|
-
@
|
19
|
-
@
|
20
|
-
@
|
21
|
-
@
|
22
|
-
@
|
23
|
-
@
|
24
|
-
|
25
|
-
|
26
|
-
end
|
1
|
+
#
|
2
|
+
# Journey
|
3
|
+
#
|
4
|
+
|
5
|
+
require_relative 'stop'
|
6
|
+
|
7
|
+
module Transport
|
8
|
+
class Journey
|
9
|
+
attr_reader :stop, :name, :category, :categoryCode, :number, :operator, :to, :passList, :capacity1st, :capacity2nd
|
10
|
+
|
11
|
+
def initialize(journey)
|
12
|
+
return unless journey
|
13
|
+
|
14
|
+
@stop = Stop.new journey['stop']
|
15
|
+
@name = journey['name']
|
16
|
+
@category = journey['category']
|
17
|
+
@subcategory = journey['subcategory']
|
18
|
+
@categoryCode = journey['categoryCode']
|
19
|
+
@number = journey['number'].to_i
|
20
|
+
@operator = journey['operator']
|
21
|
+
@to = journey['to']
|
22
|
+
@passList = journey['passList'].map { |checkpoint| Checkpoint.new checkpoint }
|
23
|
+
@capacity1st = journey['capacity1st']
|
24
|
+
@capacity2nd = journey['capacity2nd']
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/prognosis.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
#
|
2
|
-
# Prognosis
|
3
|
-
#
|
4
|
-
|
5
|
-
module Transport
|
6
|
-
class Prognosis
|
7
|
-
attr_reader :platform, :departure, :arrival, :capacity1st, :capacity2nd
|
8
|
-
|
9
|
-
def initialize(prognosis)
|
10
|
-
return unless prognosis
|
11
|
-
|
12
|
-
@platform = prognosis['platform']
|
13
|
-
@departure = DateTime.parse prognosis['departure'] if prognosis['departure']
|
14
|
-
@arrival = DateTime.parse prognosis['arrival'] if prognosis['arrival']
|
15
|
-
@capacity1st = prognosis['capacity1st']
|
16
|
-
@capacity2nd = prognosis['capacity2nd']
|
17
|
-
end
|
18
|
-
end
|
1
|
+
#
|
2
|
+
# Prognosis
|
3
|
+
#
|
4
|
+
|
5
|
+
module Transport
|
6
|
+
class Prognosis
|
7
|
+
attr_reader :platform, :departure, :arrival, :capacity1st, :capacity2nd
|
8
|
+
|
9
|
+
def initialize(prognosis)
|
10
|
+
return unless prognosis
|
11
|
+
|
12
|
+
@platform = prognosis['platform']
|
13
|
+
@departure = DateTime.parse prognosis['departure'] if prognosis['departure']
|
14
|
+
@arrival = DateTime.parse prognosis['arrival'] if prognosis['arrival']
|
15
|
+
@capacity1st = prognosis['capacity1st']
|
16
|
+
@capacity2nd = prognosis['capacity2nd']
|
17
|
+
end
|
18
|
+
end
|
19
19
|
end
|
data/lib/section.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
#
|
2
|
-
# Section
|
3
|
-
#
|
4
|
-
|
5
|
-
module Transport
|
6
|
-
class Section
|
7
|
-
attr_reader :journey, :walk, :departure, :arrival
|
8
|
-
|
9
|
-
def initialize(section)
|
10
|
-
@journey = Journey.new section['journey']
|
11
|
-
@walk = section['walk']
|
12
|
-
@departure = Checkpoint.new section['departure']
|
13
|
-
@arrival = Checkpoint.new section['arrival']
|
14
|
-
end
|
15
|
-
end
|
1
|
+
#
|
2
|
+
# Section
|
3
|
+
#
|
4
|
+
|
5
|
+
module Transport
|
6
|
+
class Section
|
7
|
+
attr_reader :journey, :walk, :departure, :arrival
|
8
|
+
|
9
|
+
def initialize(section)
|
10
|
+
@journey = Journey.new section['journey']
|
11
|
+
@walk = section['walk']
|
12
|
+
@departure = Checkpoint.new section['departure']
|
13
|
+
@arrival = Checkpoint.new section['arrival']
|
14
|
+
end
|
15
|
+
end
|
16
16
|
end
|
data/lib/service.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
#
|
2
|
-
# Service
|
3
|
-
#
|
4
|
-
|
5
|
-
module Transport
|
6
|
-
class Service
|
7
|
-
attr_reader :regular, :irregular
|
8
|
-
|
9
|
-
def initialize(service)
|
10
|
-
@regular = service['regular']
|
11
|
-
@irregular = service['irregular']
|
12
|
-
end
|
13
|
-
end
|
1
|
+
#
|
2
|
+
# Service
|
3
|
+
#
|
4
|
+
|
5
|
+
module Transport
|
6
|
+
class Service
|
7
|
+
attr_reader :regular, :irregular
|
8
|
+
|
9
|
+
def initialize(service)
|
10
|
+
@regular = service['regular']
|
11
|
+
@irregular = service['irregular']
|
12
|
+
end
|
13
|
+
end
|
14
14
|
end
|
data/lib/station.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#
|
2
|
+
# Station
|
3
|
+
#
|
4
|
+
|
5
|
+
require_relative 'coordinate'
|
6
|
+
|
7
|
+
module Transport
|
8
|
+
class Station
|
9
|
+
attr_reader :id, :type, :name, :score, :coordinate, :distance
|
10
|
+
|
11
|
+
def initialize(station)
|
12
|
+
@id = station['id']
|
13
|
+
@name = station['name']
|
14
|
+
@score = station['score']
|
15
|
+
@coordinate = Coordinate.new station['coordinate']
|
16
|
+
@distance = station['distance']
|
17
|
+
@type = station['type']
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/stop.rb
CHANGED
@@ -1,20 +1,21 @@
|
|
1
|
-
#
|
2
|
-
# Stop
|
3
|
-
#
|
4
|
-
|
5
|
-
module Transport
|
6
|
-
class Stop
|
7
|
-
attr_reader :station, :
|
8
|
-
|
9
|
-
def initialize(stop)
|
10
|
-
return unless stop
|
11
|
-
|
12
|
-
@station =
|
13
|
-
@
|
14
|
-
@
|
15
|
-
@
|
16
|
-
@
|
17
|
-
@
|
18
|
-
|
19
|
-
|
20
|
-
end
|
1
|
+
#
|
2
|
+
# Stop
|
3
|
+
#
|
4
|
+
|
5
|
+
module Transport
|
6
|
+
class Stop
|
7
|
+
attr_reader :station, :arrival, :departure, :delay, :realtimeAvailability
|
8
|
+
|
9
|
+
def initialize(stop)
|
10
|
+
return unless stop
|
11
|
+
|
12
|
+
@station = Station.new stop['station']
|
13
|
+
@arrival = DateTime.parse stop['arrival'] if stop['arrival']
|
14
|
+
@departure = DateTime.parse stop['departure'] if stop['departure']
|
15
|
+
@delay = stop['delay'].to_i if stop['delay']
|
16
|
+
@platform = stop['platform'] if stop['platform']
|
17
|
+
@prognosis = Prognosis.new stop['prognosis']
|
18
|
+
@realtimeAvailability = stop['realtimeAvailability']
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/timetable.rb
CHANGED
@@ -1,50 +1,55 @@
|
|
1
|
-
#
|
2
|
-
# Locations
|
3
|
-
#
|
4
|
-
|
5
|
-
require 'httparty'
|
6
|
-
require_relative 'transport_factory'
|
7
|
-
|
8
|
-
module Transport
|
9
|
-
class Timetable
|
10
|
-
include HTTParty
|
11
|
-
|
12
|
-
attr_accessor :parse
|
13
|
-
|
14
|
-
base_uri 'transport.opendata.ch'
|
15
|
-
|
16
|
-
# default_params :output => 'json'
|
17
|
-
|
18
|
-
def initialize
|
19
|
-
@version = 'v1'
|
20
|
-
@parse = true
|
21
|
-
@options = { query: { } }
|
22
|
-
end
|
23
|
-
|
24
|
-
def search_station station_partial
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
def search_connection from, to
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
def board_for station
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
1
|
+
#
|
2
|
+
# Locations
|
3
|
+
#
|
4
|
+
|
5
|
+
require 'httparty'
|
6
|
+
require_relative 'transport_factory'
|
7
|
+
|
8
|
+
module Transport
|
9
|
+
class Timetable
|
10
|
+
include HTTParty
|
11
|
+
|
12
|
+
attr_accessor :parse
|
13
|
+
|
14
|
+
base_uri 'transport.opendata.ch'
|
15
|
+
|
16
|
+
# default_params :output => 'json'
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
@version = 'v1'
|
20
|
+
@parse = true
|
21
|
+
@options = { query: { } }
|
22
|
+
end
|
23
|
+
|
24
|
+
def search_station station_partial
|
25
|
+
request 'locations', query: { query: station_partial }
|
26
|
+
end
|
27
|
+
|
28
|
+
def search_connection from, to
|
29
|
+
request 'connections', query: { from: from, to: to}
|
30
|
+
end
|
31
|
+
|
32
|
+
def board_for station, limit=15
|
33
|
+
request 'stationboard', query: { station: station, limit: limit}
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
private
|
38
|
+
def restful_url page
|
39
|
+
"/#{@version}/#{page}"
|
40
|
+
end
|
41
|
+
|
42
|
+
def request resource, options
|
43
|
+
parse_filter(self.class.get(restful_url(resource), @options.merge(options)), resource)
|
44
|
+
end
|
45
|
+
|
46
|
+
def parse_filter unparsed_result, resource
|
47
|
+
if @parse
|
48
|
+
TransportFactory::create(unparsed_result, resource)
|
49
|
+
else
|
50
|
+
unparsed_result
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
data/lib/transport-opendata.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
#
|
2
|
-
# Transport Opendata
|
3
|
-
#
|
4
|
-
|
1
|
+
#
|
2
|
+
# Transport Opendata
|
3
|
+
#
|
4
|
+
|
5
5
|
require_relative 'timetable'
|
data/lib/transport_factory.rb
CHANGED
@@ -1,41 +1,36 @@
|
|
1
|
-
#
|
2
|
-
# Transport Factory
|
3
|
-
#
|
4
|
-
|
5
|
-
require 'httparty'
|
6
|
-
require_relative '
|
7
|
-
require_relative 'connection'
|
8
|
-
require_relative 'journey'
|
9
|
-
require_relative 'error'
|
10
|
-
|
11
|
-
module Transport
|
12
|
-
class TransportFactory
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
1
|
+
#
|
2
|
+
# Transport Factory
|
3
|
+
#
|
4
|
+
|
5
|
+
require 'httparty'
|
6
|
+
require_relative 'station'
|
7
|
+
require_relative 'connection'
|
8
|
+
require_relative 'journey'
|
9
|
+
require_relative 'error'
|
10
|
+
|
11
|
+
module Transport
|
12
|
+
class TransportFactory
|
13
|
+
def self.create(json, resource)
|
14
|
+
if json['errors']
|
15
|
+
return Error.new json
|
16
|
+
else
|
17
|
+
case resource
|
18
|
+
when 'locations'
|
19
|
+
return json['stations'].map do |station|
|
20
|
+
Station.new station
|
21
|
+
end
|
22
|
+
when 'connections'
|
23
|
+
return json[resource].map do |connection|
|
24
|
+
Connection.new connection
|
25
|
+
end
|
26
|
+
when 'stationboard'
|
27
|
+
return json[resource].map do |journey|
|
28
|
+
Journey.new journey
|
29
|
+
end
|
30
|
+
else
|
31
|
+
raise ArgumentError.new('Unknown Resource: ', resource)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transport-opendata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Bruderer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -36,10 +36,10 @@ files:
|
|
36
36
|
- lib/duration.rb
|
37
37
|
- lib/error.rb
|
38
38
|
- lib/journey.rb
|
39
|
-
- lib/location.rb
|
40
39
|
- lib/prognosis.rb
|
41
40
|
- lib/section.rb
|
42
41
|
- lib/service.rb
|
42
|
+
- lib/station.rb
|
43
43
|
- lib/stop.rb
|
44
44
|
- lib/timetable.rb
|
45
45
|
- lib/transport-opendata.rb
|
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
66
|
rubyforge_project:
|
67
|
-
rubygems_version: 2.
|
67
|
+
rubygems_version: 2.6.10
|
68
68
|
signing_key:
|
69
69
|
specification_version: 4
|
70
70
|
summary: Swiss Public Transport API
|
data/lib/location.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Locations
|
3
|
-
#
|
4
|
-
|
5
|
-
require_relative 'coordinate'
|
6
|
-
|
7
|
-
module Transport
|
8
|
-
class Location
|
9
|
-
attr_reader :id, :type, :name, :score, :coordinate, :distance
|
10
|
-
|
11
|
-
def initialize(location)
|
12
|
-
@id = location['id']
|
13
|
-
@type = location['type']
|
14
|
-
@name = location['name']
|
15
|
-
@score = location['score']
|
16
|
-
@coordinate = Coordinate.new location['coordinate']
|
17
|
-
@distance = location['distance']
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|