Skip to content

Instantly share code, notes, and snippets.

@ntrepid8
Created May 23, 2014 14:09
Show Gist options
  • Save ntrepid8/2df548c5de9ba8e1ade1 to your computer and use it in GitHub Desktop.
Save ntrepid8/2df548c5de9ba8e1ade1 to your computer and use it in GitHub Desktop.
require 'Unirest'
require 'json'
puts "testing"
begin
url = "http://stage.maasive.net/v2.4/5379f153b2c4271b06d88351/plays/"
parameters = {
:user_score=>5,
:alien_score=>1,
:match_length=>"01:00:15",
:country=>"USA",
:mobile_brand=>"Samsung",
:mobile_version=>"Galaxy S5"}
response = Unirest.post(
url,
headers:{
"Accept" => "application/json",
"Content-Type" => "application/json"
},
parameters:JSON.dump(parameters))
data = response.body
log_content_response = "CODE: #{response.code} / BODY: #{response.body}"
rescue Exception => e
log_content_response = "Problems sending POST: #{e}"
end
puts log_content_response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment