Class: Hobos::Api

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

Instance Method Summary collapse

Constructor Details

#initializeApi

Returns a new instance of Api.



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

def initialize
  @browser = Browser.new.browser
end

Instance Method Details

#hobo(uid) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/hobos.rb', line 9

def hobo uid
  begin
    clean_name(@browser.get("http://www.e-hobo.com/hoboes/#{uid}").at('span').children.last.to_s)
  rescue
    "{ 'error': { 'message': 'bad UID' } }"
  end
end