Class: KVVLiveAPI::Stop
- Inherits:
-
Object
- Object
- KVVLiveAPI::Stop
- Defined in:
- lib/kvvliveapi/stop.rb
Overview
Instances of this class represent a stop operated by the KVV
Instance Attribute Summary collapse
-
#lat ⇒ Object
readonly
latitute of the location of the stop.
-
#lon ⇒ Object
readonly
longitude of the location of the stop.
-
#name ⇒ Object
readonly
Name of the stop.
-
#stop_id ⇒ Object
readonly
ID used to reference the stop.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, stop_id, lat, lon) ⇒ Stop
constructor
A new instance of Stop.
- #to_s ⇒ Object
Constructor Details
#initialize(name, stop_id, lat, lon) ⇒ Stop
Returns a new instance of Stop.
23 24 25 26 27 28 |
# File 'lib/kvvliveapi/stop.rb', line 23 def initialize(name, stop_id, lat, lon) @name = name @stop_id = stop_id @lat = lat @lon = lon end |
Instance Attribute Details
#lat ⇒ Object (readonly)
latitute of the location of the stop
18 19 20 |
# File 'lib/kvvliveapi/stop.rb', line 18 def lat @lat end |
#lon ⇒ Object (readonly)
longitude of the location of the stop
21 22 23 |
# File 'lib/kvvliveapi/stop.rb', line 21 def lon @lon end |
#name ⇒ Object (readonly)
Name of the stop
12 13 14 |
# File 'lib/kvvliveapi/stop.rb', line 12 def name @name end |
#stop_id ⇒ Object (readonly)
ID used to reference the stop
15 16 17 |
# File 'lib/kvvliveapi/stop.rb', line 15 def stop_id @stop_id end |
Class Method Details
.from_json(json) ⇒ Object
6 7 8 |
# File 'lib/kvvliveapi/stop.rb', line 6 def from_json(json) new(json['name'], json['id'], json['lat'], json['lon']) end |
Instance Method Details
#to_s ⇒ Object
30 31 32 |
# File 'lib/kvvliveapi/stop.rb', line 30 def to_s @name + '(' + @stop_id.to_s + ')' end |