Class: SpBus::Scrapers::Routes

Inherits:
Object
  • Object
show all
Defined in:
lib/spbus/scrapers/routes.rb

Constant Summary collapse

ALL_ROUTES_URL =
"http://200.99.150.170/PlanOperWeb/linhaselecionada.asp"
VALIDATOR_PATH =
"#contentScroll p:first-child"
VALIDATOR_REGEX =
/Foram encontrados vĂ¡rios resultados para a sua busca/i
ROUTE_PATH =
"#contentScroll ul li .labelHold"
ROUTE_NUMBER_PATH =
".linkLinha:nth-child(1)"
ROUTE_NUMBER_REGEX =
/Linha: (?<number>[a-z0-9]+[-][0-9a-z]+)/i
WAY_PATH =
".linkLinha:nth-child(2)"
WAY_MATCHER =
/\(Ver Ida\)(?<two_way> \/ \(Ver Volta\))?/i
SPACES =
/\u00A0|\t|\n|\r/

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#routesObject (readonly)

Returns the value of attribute routes.



16
17
18
# File 'lib/spbus/scrapers/routes.rb', line 16

def routes
  @routes
end

Instance Method Details

#fetchObject



18
19
20
21
22
23
# File 'lib/spbus/scrapers/routes.rb', line 18

def fetch
  make_request
  validate_response
  build_routes
  true
end