main.rb: rename base URLs
parent
546a4f026b
commit
9a7c2271e7
|
@ -37,11 +37,11 @@ module Excon
|
|||
end
|
||||
end
|
||||
|
||||
BACKEND_URL = ENV['BACKEND_URL'] || 'https://inventory.waw.hackerspace.pl/api/1/'
|
||||
CODE_PREFIX = ENV['CODE_PREFIX'] || 'HTTP://I/'
|
||||
SPEJSTORE_BASE_URL = ENV['SPEJSTORE_BASE_URL'] || 'https://inventory.waw.hackerspace.pl/api/1/'
|
||||
QR_BASE_URL = ENV['QR_BASE_URL'] || 'HTTP://I/'
|
||||
|
||||
def api(uri)
|
||||
Excon.get(BACKEND_URL + uri + "/").json!
|
||||
Excon.get(SPEJSTORE_BASE_URL + uri + "/").json!
|
||||
end
|
||||
|
||||
def render_identicode(data, id, extent)
|
||||
|
@ -76,11 +76,12 @@ def render_label(item_or_label_id, size: DYMO_LABEL_SIZE)
|
|||
|
||||
pdf = Prawn::Document.new(page_size: size.map { |x| mm2pt(x) },
|
||||
margin: [2, 2, 2, 6].map { |x| mm2pt(x) }) do
|
||||
base_dir = File.dirname(__FILE__)
|
||||
font_families.update("DejaVuSans" => {
|
||||
normal: "fonts/DejaVuSans.ttf",
|
||||
italic: "fonts/DejaVuSans-Oblique.ttf",
|
||||
bold: "fonts/DejaVuSans-Bold.ttf",
|
||||
bold_italic: "fonts/DejaVuSans-BoldOblique.ttf"
|
||||
normal: base_dir + "/fonts/DejaVuSans.ttf",
|
||||
italic: base_dir + "/fonts/DejaVuSans-Oblique.ttf",
|
||||
bold: base_dir + "/fonts/DejaVuSans-Bold.ttf",
|
||||
bold_italic: base_dir + "/fonts/DejaVuSans-BoldOblique.ttf"
|
||||
})
|
||||
|
||||
font 'DejaVuSans'
|
||||
|
@ -90,7 +91,7 @@ def render_label(item_or_label_id, size: DYMO_LABEL_SIZE)
|
|||
|
||||
# Right side
|
||||
bounding_box([bounds.right - qr_size, bounds.top], width: qr_size) do
|
||||
print_qr_code CODE_PREFIX + item['short_id'], stroke: false,
|
||||
print_qr_code QR_BASE_URL + item['short_id'], stroke: false,
|
||||
foreground_color: '000000',
|
||||
extent: bounds.width, margin: 0, pos: bounds.top_left
|
||||
|
||||
|
|
Loading…
Reference in New Issue