I'm trying to make a simple http request to a local rails application running at localhost:3000. The code for my application is very much in prototype phase as I am only trying to get raw functionality before I try anything else.
The rails app simply returns JSON that looks like this before being parsed
"{\"response\":\"foo is blank\"}"
Here's the code I'm trying right now:
require 'net/http'
def get_response
return Net::HTTP.get(URI.parse("http://localhost:3000"))
end
Shoes.app(:width => 280, :height => 350) do
flow do
stack do
button "make http request and display results in an alert box" do
x = get_response
alert x
end# of button
end# of stack
end# of flow
end
I've also tried to put the method inside the Shoes.app block to no avail. When executed, this creates all the elements that it should create, but nothing happens when I click the button.
I know you're not supposed to be able to do anything practical with ruby shoes, but I'm trying anyway. Thanks for your time