From 594d37bb40f3e3e0f15553383cf2a305d4d6742e Mon Sep 17 00:00:00 2001 From: mo khan Date: Mon, 9 Feb 2015 19:43:03 -0700 Subject: extract api. --- lib/fake_agent.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/fake_agent.rb b/lib/fake_agent.rb index f5ce3db..ecc9e47 100644 --- a/lib/fake_agent.rb +++ b/lib/fake_agent.rb @@ -10,8 +10,7 @@ class FakeAgent end def register - url = "#{endpoint}/agents.json" - response = Typhoeus.post(url, body: { agent: { hostname: Socket.gethostname } }) + response = Typhoeus.post(registration_url, body: { agent: { hostname: Socket.gethostname } }) json = JSON.parse(response.body) @id = json["id"] end @@ -113,10 +112,14 @@ class FakeAgent end def file_query_url(fingerprint) - "#{endpoint}/agents/#{id}/files/#{fingerprint}" + "#{endpoint}/api/agents/#{id}/files/#{fingerprint}" end def event_url - "#{endpoint}/agents/#{id}/events/" + "#{endpoint}/api/agents/#{id}/events/" + end + + def registration_url + "#{endpoint}/api/agents" end end -- cgit v1.2.3