class EmtApi::Stop

Attributes

id[RW]
latitude[RW]
lines[RW]
longitude[RW]
name[RW]

Public Class Methods

all() click to toggle source
# File lib/emt_api/stop.rb, line 16
def self.all
  response_data = EmtApi::Api.get_nodes_lines
  stops = []

  unless response_data.nil?
    response_data.each { |stop| stops << EmtApi::Stop.new(stop) }
  end

  stops
end
find(id) click to toggle source
# File lib/emt_api/stop.rb, line 27
def self.find(id)
  response_data = EmtApi::Api.get_nodes_lines(id)
  response_data.nil? ? nil : EmtApi::Stop.new(response_data)
end
new(stop_data = {}) click to toggle source
# File lib/emt_api/stop.rb, line 7
def initialize(stop_data = {})
  @id         = stop_data['node']
  @name       = EmtApi::Parser.parse_sentence stop_data['name']
  @lines      = stop_data['lines']
  @wifi       = (stop_data['Wifi'].to_i == 1)
  @latitude   = stop_data['latitude']
  @longitude  = stop_data['longitude']
end

Public Instance Methods

wifi?() click to toggle source
# File lib/emt_api/stop.rb, line 32
def wifi?
  @wifi
end