Created
March 11, 2016 17:33
-
-
Save sean3z/7077c1d3e1f03ff8c54c to your computer and use it in GitHub Desktop.
why do I suck
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rest-client' | |
class Reports | |
def initialize(host, args={}) | |
@host = host | |
@username = args[:username] || 'exampleuser' | |
@password = args[:password] || 'examplepass' | |
@foreman_host = args[:foreman_host] || 'http://foreman.example.com' | |
end | |
def all_reports | |
JSON.parse(request('/api/path/1').get) | |
end | |
def last_report | |
JSON.parse(request('/api/path/2').get) | |
end | |
def request(path) | |
return RestClient::Resource.new({:url => @foreman_host.concat(path), :username => 'exampleuser', :password => 'examplepass'}) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment