Class: AxiomusApi::Label
- Inherits:
-
Object
- Object
- AxiomusApi::Label
- Defined in:
- lib/axiomus_api/label.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#b_time ⇒ Object
Returns the value of attribute b_time.
-
#city ⇒ Object
Returns the value of attribute city.
-
#client_name ⇒ Object
Returns the value of attribute client_name.
-
#date ⇒ Object
Returns the value of attribute date.
-
#dispatch_number ⇒ Object
Returns the value of attribute dispatch_number.
-
#e_time ⇒ Object
Returns the value of attribute e_time.
-
#order_id ⇒ Object
Returns the value of attribute order_id.
-
#place ⇒ Object
Returns the value of attribute place.
-
#places ⇒ Object
Returns the value of attribute places.
-
#type ⇒ Object
Returns the value of attribute type.
-
#weight ⇒ Object
Returns the value of attribute weight.
Class Method Summary collapse
Instance Method Summary collapse
- #barcode_base64(height = 70) ⇒ Object
- #barcode_raw(height = 70) ⇒ Object
- #delivery_time ⇒ Object
- #dispatch_number_formatted ⇒ Object
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
17 18 19 |
# File 'lib/axiomus_api/label.rb', line 17 def address @address end |
#b_time ⇒ Object
Returns the value of attribute b_time.
13 14 15 |
# File 'lib/axiomus_api/label.rb', line 13 def b_time @b_time end |
#city ⇒ Object
Returns the value of attribute city.
19 20 21 |
# File 'lib/axiomus_api/label.rb', line 19 def city @city end |
#client_name ⇒ Object
Returns the value of attribute client_name.
10 11 12 |
# File 'lib/axiomus_api/label.rb', line 10 def client_name @client_name end |
#date ⇒ Object
Returns the value of attribute date.
12 13 14 |
# File 'lib/axiomus_api/label.rb', line 12 def date @date end |
#dispatch_number ⇒ Object
Returns the value of attribute dispatch_number.
8 9 10 |
# File 'lib/axiomus_api/label.rb', line 8 def dispatch_number @dispatch_number end |
#e_time ⇒ Object
Returns the value of attribute e_time.
14 15 16 |
# File 'lib/axiomus_api/label.rb', line 14 def e_time @e_time end |
#order_id ⇒ Object
Returns the value of attribute order_id.
9 10 11 |
# File 'lib/axiomus_api/label.rb', line 9 def order_id @order_id end |
#place ⇒ Object
Returns the value of attribute place.
15 16 17 |
# File 'lib/axiomus_api/label.rb', line 15 def place @place end |
#places ⇒ Object
Returns the value of attribute places.
16 17 18 |
# File 'lib/axiomus_api/label.rb', line 16 def places @places end |
#type ⇒ Object
Returns the value of attribute type.
18 19 20 |
# File 'lib/axiomus_api/label.rb', line 18 def type @type end |
#weight ⇒ Object
Returns the value of attribute weight.
11 12 13 |
# File 'lib/axiomus_api/label.rb', line 11 def weight @weight end |
Class Method Details
.render(labels, template = nil) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/axiomus_api/label.rb', line 44 def self.render(labels, template = nil) renderer = ERB.new(template || default_template) labels = labels.is_a?(Array) ? labels : [labels] @labels = labels.select{|l| l.is_a?(AxiomusApi::Label)} renderer.result(binding) end |
Instance Method Details
#barcode_base64(height = 70) ⇒ Object
39 40 41 42 |
# File 'lib/axiomus_api/label.rb', line 39 def (height = 70) s = (height) "data:image/png;base64,#{s}" end |
#barcode_raw(height = 70) ⇒ Object
33 34 35 36 37 |
# File 'lib/axiomus_api/label.rb', line 33 def (height = 70) = Barby::Code39.new("#{dispatch_number}+#{place}") .wide_width = 3 Base64.encode64(.to_png(height: height, margin: 0)) end |
#delivery_time ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/axiomus_api/label.rb', line 25 def delivery_time if b_time.nil? || e_time.nil? nil else "#{b_time}-#{e_time}" end end |
#dispatch_number_formatted ⇒ Object
21 22 23 |
# File 'lib/axiomus_api/label.rb', line 21 def dispatch_number_formatted dispatch_number.to_s.gsub(/(....)$/, '`\1') end |