Class: Onebusaway::Agency

Inherits:
Base
  • Object
show all
Defined in:
lib/onebusaway.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Base

from_xml

Instance Attribute Details

#idObject

Returns the value of attribute id.



112
113
114
# File 'lib/onebusaway.rb', line 112

def id
  @id
end

#langObject

Returns the value of attribute lang.



112
113
114
# File 'lib/onebusaway.rb', line 112

def lang
  @lang
end

#nameObject

Returns the value of attribute name.



112
113
114
# File 'lib/onebusaway.rb', line 112

def name
  @name
end

#phoneObject

Returns the value of attribute phone.



112
113
114
# File 'lib/onebusaway.rb', line 112

def phone
  @phone
end

#timezoneObject

Returns the value of attribute timezone.



112
113
114
# File 'lib/onebusaway.rb', line 112

def timezone
  @timezone
end

#urlObject

Returns the value of attribute url.



112
113
114
# File 'lib/onebusaway.rb', line 112

def url
  @url
end

Class Method Details

.parse(data) ⇒ Object



113
114
115
116
117
118
119
120
# File 'lib/onebusaway.rb', line 113

def self.parse(data)
  agency = self.new
  [:id, :name, :url, :timezone, :lang, :phone].each do |attr|
    value = data.elements[attr.to_s]
    agency.send("#{attr}=", value.text) if value
  end
  agency
end