Skip to content

Instantly share code, notes, and snippets.

@vgmoose
Created June 27, 2013 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vgmoose/5876667 to your computer and use it in GitHub Desktop.
Save vgmoose/5876667 to your computer and use it in GitHub Desktop.
require 'net/http'
require 'net/https'
@toSend = '{"currency":"USD","models":[{"toolID":"","modelReference":"model.xml","materialID":"12a65a42-df49-47a9-8828-0efaf84c5509","finishID":"c9c27ce3-eee4-47e4-a896-a9010a7971fd","quantity":1,"xDimMm":24.053077028234622,"yDimMm":24.671680341529406,"zDimMm":9.59760028403155,"volumeCm3":0.27144738160643134,"surfaceCm2":7.8405772975064245}],"shipmentInfo":{"countryCode":"US","stateCode":"NH","city":"Nashua","zipCode":"03063"}}'
uri = URI.parse("https://i.materialise.com/web-api/pricing")
https = Net::HTTP.new(uri.host,uri.port)
https.use_ssl = true
req = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' =>'application/json', 'Accept' => 'json', 'APICode' => '0FE2EF5F-95E3-4552-B637-55B824E3EF35'})
req.body = "#{@toSend}"
res = https.request(req)
puts "Response #{res.code} #{res.message}: #{res.body}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment