add DEBUG_JSON env
parent
43d123f956
commit
8a45d727af
|
@ -12,3 +12,9 @@ GET http://localhost:4567/api/1/preview/:label.pdf
|
||||||
POST http://localhost:4567/api/1/print/:label
|
POST http://localhost:4567/api/1/print/:label
|
||||||
|
|
||||||
where :label is a `spejstore` label.id or item.short_id
|
where :label is a `spejstore` label.id or item.short_id
|
||||||
|
|
||||||
|
to test without spejstore running locally, pass:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
DEBUG_JSON='{"short_id":"abcdef","name":"Some long test item","owner":"testowner"}' bundle exec ruby main.rb
|
||||||
|
```
|
||||||
|
|
4
main.rb
4
main.rb
|
@ -41,7 +41,11 @@ BACKEND_URL = 'https://inventory.hackerspace.pl/api/1/'
|
||||||
CODE_PREFIX = "https://inventory.hackerspace.pl/"
|
CODE_PREFIX = "https://inventory.hackerspace.pl/"
|
||||||
|
|
||||||
def api(uri)
|
def api(uri)
|
||||||
|
if ENV["DEBUG_JSON"]
|
||||||
|
JSON.parse(ENV["DEBUG_JSON"])
|
||||||
|
else
|
||||||
Excon.get(BACKEND_URL + uri + "/").json!
|
Excon.get(BACKEND_URL + uri + "/").json!
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_identicode(data, id, extent)
|
def render_identicode(data, id, extent)
|
||||||
|
|
Loading…
Reference in New Issue