Class: Vantage::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/vantage/client.rb

Instance Method Summary collapse

Instance Method Details

#check(data = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/vantage/client.rb', line 3

def check(data={})
  endpoint = Vantage::Config.endpoint(data['point'])
  
  req = Net::HTTP::Post.new(endpoint.to_s.gsub("#{endpoint.user}:#{endpoint.password}@",""))
  req.body = OkJson.encode(data["checks"])
  req.basic_auth endpoint.user, endpoint.password

  Net::HTTP.start(endpoint.host, endpoint.port) { |http| http.request(req) }.body
end