Class: SFBATransitAPI::Agency

Inherits:
Object
  • Object
show all
Defined in:
lib/sfba_transit_api/agency.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#has_directionObject

Returns the value of attribute has_direction.



3
4
5
# File 'lib/sfba_transit_api/agency.rb', line 3

def has_direction
  @has_direction
end

#modeObject

Returns the value of attribute mode.



3
4
5
# File 'lib/sfba_transit_api/agency.rb', line 3

def mode
  @mode
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/sfba_transit_api/agency.rb', line 3

def name
  @name
end

#routesObject

Returns the value of attribute routes.



3
4
5
# File 'lib/sfba_transit_api/agency.rb', line 3

def routes
  @routes
end

Class Method Details

.parse(node) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/sfba_transit_api/agency.rb', line 17

def self.parse(node)
  node.xpath("//Agency").map do |agency_node|
    agency = new

    agency.name = agency_node["Name"]
    agency.has_direction = agency_node["HasDirection"]
    agency.mode = agency_node["Mode"]
    agency.routes = Route.parse(agency_node, agency)

    agency
  end
end

Instance Method Details

#to_sObject



5
6
7
# File 'lib/sfba_transit_api/agency.rb', line 5

def to_s
  "#<SFBATransitAPI::Agency:#{object_id} @name=\"#{name}\", @has_direction=#{has_direction}, @mode=\"#{mode}\", routes.count=#{routes.count}>"
end