summaryrefslogtreecommitdiff
path: root/app/views/api
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 /app/views/api
parent72a1483c8f546fae6c93dcdf91cfd47c37bc2f90 (diff)
extract api.
Diffstat (limited to 'app/views/api')
-rw-r--r--app/views/api/agents/create.json.jbuilder1
-rw-r--r--app/views/api/agents/files/index.json.jbuilder4
-rw-r--r--app/views/api/agents/files/show.json.jbuilder6
-rw-r--r--app/views/api/agents/index.json.jbuilder4
4 files changed, 15 insertions, 0 deletions
diff --git a/app/views/api/agents/create.json.jbuilder b/app/views/api/agents/create.json.jbuilder
new file mode 100644
index 0000000..f156cb0
--- /dev/null
+++ b/app/views/api/agents/create.json.jbuilder
@@ -0,0 +1 @@
+json.extract! @agent, :id, :hostname, :created_at, :updated_at
diff --git a/app/views/api/agents/files/index.json.jbuilder b/app/views/api/agents/files/index.json.jbuilder
new file mode 100644
index 0000000..6551a44
--- /dev/null
+++ b/app/views/api/agents/files/index.json.jbuilder
@@ -0,0 +1,4 @@
+json.array!(@files) do |file|
+ json.extract! agent, :fingerprint, :state
+ json.url agent_file_url([agent, file], format: :json)
+end
diff --git a/app/views/api/agents/files/show.json.jbuilder b/app/views/api/agents/files/show.json.jbuilder
new file mode 100644
index 0000000..8c6f501
--- /dev/null
+++ b/app/views/api/agents/files/show.json.jbuilder
@@ -0,0 +1,6 @@
+if @file
+ json.extract! @file, :fingerprint, :state
+else
+ json.fingerprint @fingerprint
+ json.state "unknown"
+end
diff --git a/app/views/api/agents/index.json.jbuilder b/app/views/api/agents/index.json.jbuilder
new file mode 100644
index 0000000..65f6f60
--- /dev/null
+++ b/app/views/api/agents/index.json.jbuilder
@@ -0,0 +1,4 @@
+json.array!(@agents) do |agent|
+ json.extract! agent, :id, :hostname
+ json.url agent_url(agent, format: :json)
+end