Class: Offliberty::Helpers::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/offliberty/helpers/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(song_url) ⇒ Connection

Returns a new instance of Connection.



6
7
8
9
10
11
12
13
# File 'lib/offliberty/helpers/connection.rb', line 6

def initialize song_url
  @agent = Mechanize.new
  @agent.user_agent_alias = 'Mac Safari'
  @page = @agent.get("http://offliberty.com")
  @form = @page.forms.fetch(0)
  @form.action = "http://offliberty.com/off03.php"
  @form.track = song_url
end

Instance Attribute Details

#agentObject (readonly)

Returns the value of attribute agent.



4
5
6
# File 'lib/offliberty/helpers/connection.rb', line 4

def agent
  @agent
end

#formObject (readonly)

Returns the value of attribute form.



4
5
6
# File 'lib/offliberty/helpers/connection.rb', line 4

def form
  @form
end