Skip to content

Instantly share code, notes, and snippets.

@WietseWind
Created June 24, 2016 08:10
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 WietseWind/7d481207ec057aed3fd25b5948684efd to your computer and use it in GitHub Desktop.
Save WietseWind/7d481207ec057aed3fd25b5948684efd to your computer and use it in GitHub Desktop.
Posting data from Ruby to nodum, saving in a static txt file
{% do api.IO_staticFile("ruby/post.txt").set(param.post|print_r) %}
Array
(
[name] => Wietse
[type] => person
[description] => Founder @ nodum.io
[include_email] => true
)
require "net/http"
require 'net/https'
require "uri"
uri = URI.parse("https://my-demo-project.nodum.io/ruby")
data = {
:name => 'Wietse',
:type => 'person',
:description => 'Founder @ nodum.io',
:include_email => true
}
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
res = Net::HTTP.post_form(uri,data)
res.code
res.body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment