Class: Translink::Page

Inherits:
Object
  • Object
show all
Defined in:
lib/translink/page.rb

Direct Known Subclasses

Route, Timetable, Trip

Defined Under Namespace

Classes: Route, Timetable, Trip, UnexpectedParserError

Constant Summary collapse

USER_AGENT =
"Mozilla/5.0 (Translink/#{VERSION} Ruby/#{RUBY_VERSION} (https://github.com/tatey/translink))"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Page

Returns a new instance of Page.



10
11
12
13
# File 'lib/translink/page.rb', line 10

def initialize url
  @agent = Mechanize.new.tap { |mechanize| mechanize.user_agent = USER_AGENT }
  @url   = URI.parse url
end

Instance Attribute Details

#agentObject

Returns the value of attribute agent.



8
9
10
# File 'lib/translink/page.rb', line 8

def agent
  @agent
end

#pageObject

Returns the value of attribute page.



8
9
10
# File 'lib/translink/page.rb', line 8

def page
  @page
end

#urlObject

Returns the value of attribute url.



8
9
10
# File 'lib/translink/page.rb', line 8

def url
  @url
end