Class: Translink::Page
- Inherits:
-
Object
- Object
- Translink::Page
- Defined in:
- lib/translink/page.rb
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
-
#agent ⇒ Object
Returns the value of attribute agent.
-
#page ⇒ Object
Returns the value of attribute page.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url) ⇒ Page
constructor
A new instance of Page.
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
#agent ⇒ Object
Returns the value of attribute agent.
8 9 10 |
# File 'lib/translink/page.rb', line 8 def agent @agent end |
#page ⇒ Object
Returns the value of attribute page.
8 9 10 |
# File 'lib/translink/page.rb', line 8 def page @page end |
#url ⇒ Object
Returns the value of attribute url.
8 9 10 |
# File 'lib/translink/page.rb', line 8 def url @url end |