From aeb9f6b5efb02e293b027932e146149fa8532165 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Wed, 8 Apr 2020 17:03:33 +0200 Subject: [PATCH] Expose file size in versions metadata Close: #7 --- lib/document.rb | 1 + spec/fixtures/document.json | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib/document.rb b/lib/document.rb index 2deae54..c2f438b 100644 --- a/lib/document.rb +++ b/lib/document.rb @@ -198,6 +198,7 @@ def to_hash content_type: content_type, filename: pfile.basename.to_s, path: file_path(v,pfile.basename), + size: pfile.size, author: author, created_at: pfile.mtime, } diff --git a/spec/fixtures/document.json b/spec/fixtures/document.json index a46ba1e..9893972 100644 --- a/spec/fixtures/document.json +++ b/spec/fixtures/document.json @@ -9,12 +9,14 @@ "content_type": "application/zip; charset=binary", "filename": "arglebargle.docx", "path": "/document/app/12345/v001/arglebargle.docx", + "size": 12782, "author": "spliffy" }, "txt": { "content_type": "text/plain; charset=us-ascii", "filename": "arglebargle.txt", "path": "/document/app/12345/v001/arglebargle.txt", + "size": 19, "author": "spliffy" } }, @@ -23,12 +25,14 @@ "content_type": "application/zip; charset=binary", "filename": "arglebargle.docx", "path": "/document/app/12345/v002/arglebargle.docx", + "size": 12782, "author": "spliffy" }, "txt": { "content_type": "text/plain; charset=us-ascii", "filename": "arglebargle.txt", "path": "/document/app/12345/v002/arglebargle.txt", + "size": 19, "author": "spliffy" } }