pikesley/ultron

View on GitHub
lib/ultron/connection.rb

Summary

Maintainability
A
0 mins
Test Coverage
Dotenv.load
Dotenv.load "#{ENV['HOME']}/.ultronrc"

module Ultron
  class Connection
    def self.perform url
      c         = Curl::Easy.new("%s" % url)
      c.headers = {
          'Accept'     => 'application/json',
          'User-agent' => 'Ultron v%s: https://rubygems.org/gems/ultron' % Ultron::VERSION
      }

      c.perform
      JSON.parse c.body_str
    end
  end
end