Skip to content

Instantly share code, notes, and snippets.

@jlebrech
Created March 8, 2012 10:51
Show Gist options
  • Save jlebrech/2000383 to your computer and use it in GitHub Desktop.
Save jlebrech/2000383 to your computer and use it in GitHub Desktop.
Switching base URI
class Managementdb
include HTTParty
def self.login(game_name)
case game_name
when "game1"
self.base_uri = "http://game1"
when "game2"
self.base_uri = "http://game2"
when "game3"
self.base_uri = "http://game3"
end
response = self.get("/login")
if response.success?
@authToken = response["authToken"]
else
# this just raises the net/http response that was raised
raise response.response
end
end
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment