Module: Urbanesia

Defined in:
lib/urbanesia.rb,
lib/urbanesia/agent.rb

Defined Under Namespace

Classes: Agent

Class Method Summary collapse

Class Method Details

.request(endpoint = "get/super_search", post = "", get = "") ⇒ String

Makes a request to the API.

Parameters:

  • endpoint (String) (defaults to: "get/super_search")

    API endpoint according to the API docs, eg “get/super_search”

  • post (String) (defaults to: "")

    Any required post variables, eg “year=2011”

  • get (String) (defaults to: "")

    Any required get variables, eg “what=culinary&where=jakarta&row=1&offset=1000”

Returns:

  • (String)

    response The output of a Mechanize agent.post to the API endpoint



15
16
17
18
19
20
21
# File 'lib/urbanesia.rb', line 15

def self.request( endpoint = "get/super_search", post = "", get = "" )
  
  @agent = Agent.new(@@consumer_key, @@consumer_secret, @@base_url) if @agent.nil?
  
  return @agent.request(endpoint, post, get)
  
end