Sha256: 85ef637eef874a95a5d522346228d6f62677b705ab46120cd30f02d20dbb9366

Contents?: true

Size: 495 Bytes

Versions: 4

Compression:

Stored size: 495 Bytes

Contents

require 'net/http'

module NimbleNodes
  
  class Server
    
    def self.post(path,args)    
      url = URI.parse(url_to(path))
      request = Net::HTTP::Post.new(url.path)
      request.set_form_data({:token => ENV['NN_TOKEN'], :json => args.to_json })
      response = Net::HTTP.start(url.host, url.port) {|http| http.request(request)}
    end
    
    def self.url_to(path)
      'http://' + ENV['NN_SERVER_DOMAIN'] + path
      # 'http://nimblenodes.com' + path
    end
    
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nimble_nodes-0.1.3 lib/nimble_nodes/server.rb
nimble_nodes-0.1.2 lib/nimble_nodes/server.rb
nimble_nodes-0.1.1 lib/nimble_nodes/server.rb
nimble_nodes-0.1.0 lib/nimble_nodes/server.rb