summaryrefslogtreecommitdiff
path: root/lib/fake_agent.rb
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2015-02-09 19:43:03 -0700
committermo khan <mo@mokhan.ca>2015-02-09 19:43:03 -0700
commit594d37bb40f3e3e0f15553383cf2a305d4d6742e (patch)
tree6236972f334d3ad778fbd51948d9635ae1226936 /lib/fake_agent.rb
parent72a1483c8f546fae6c93dcdf91cfd47c37bc2f90 (diff)
extract api.
Diffstat (limited to 'lib/fake_agent.rb')
-rw-r--r--lib/fake_agent.rb11
1 files changed, 7 insertions, 4 deletions
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