labelary 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1a162c74bb9e9c778da52f11edd04dfe37bf7f94
4
- data.tar.gz: a4798e56be3ae88fdf34eead27e627621cf6a6d0
2
+ SHA256:
3
+ metadata.gz: bfb976fe9132ddc1eda91ea59e492fae1a1cb1e5bdb248ef5774283a16a71297
4
+ data.tar.gz: d134dbbf2459083fc595c77b0c1e83098137721cd49664139d6517b1617bef39
5
5
  SHA512:
6
- metadata.gz: 84eeaeeac3ef9b38c9591d961e46d5c703b81b437f9c5f64fe6e24fe80b885ee6c58fef643733350bf70961705c29961a3d0903bfd72a463bc6765ccba9772aa
7
- data.tar.gz: 5543b9ac8bfc95c5673c86754a9259161782097658b134a3adf6b0da92e7d42a30068f0154b11094a0f916e69dd4fd27c935a3537cabfbf3c7a2c612ad7ca805
6
+ metadata.gz: 6d672c17592334da9b00dfc46e8e9517201a832685f44f0d19a17a03905eb2fb968740c463c7c833e0e8436ad84d9361b7f05925d35cb97a1e2da39de261d235
7
+ data.tar.gz: 8f9188b15884b2937de8de875538cac97696ebb876cc78dc290b319f501a53d307d252615228f9d15e9e1f59a2bf7e34ed75781cfd2947f83345bd550666905f
data/README.md CHANGED
@@ -87,6 +87,8 @@ You also need to configure fonts.
87
87
  Labelary::Label.render zpl: '^XA^A@,,,E:TT0003M_.FNT^FDHello World^FS^XZ', font: File.read('./swiss-721-font/77849_002.ZSU')
88
88
  ```
89
89
 
90
+ There is also a helper method, `Labelary.font` to grab your configured font string.
91
+
90
92
  ### ZPL Encoding Images
91
93
 
92
94
  Pass in an image (or an IO object) and it's mime type and you'll get back a ZPL encoded version.
@@ -7,3 +7,9 @@ require 'labelary/image'
7
7
  require 'labelary/client'
8
8
  require 'labelary/configuration'
9
9
  require 'labelary/version'
10
+
11
+ module Labelary
12
+ def self.font
13
+ Labelary.configuration.font
14
+ end
15
+ end
@@ -31,7 +31,7 @@ module Labelary
31
31
  @height = nil
32
32
  @index = 0
33
33
  @content_type = 'image/png'
34
- @font = nil
34
+ @font = ''
35
35
  end
36
36
 
37
37
  end
@@ -20,11 +20,15 @@ module Labelary
20
20
 
21
21
  # http://labelary.com/service.html
22
22
  def render
23
- payload = @font.present? ? @font.to_s + @zpl : @zpl
23
+ payload = font_string + @zpl
24
24
  response = Labelary::Client.connection.post "/v1/printers/#{@dpmm}dpmm/labels/#{@width}x#{@height}/#{@index}/", payload, { Accept: @content_type }
25
25
  return response.body
26
26
  end
27
27
 
28
+ def font_string
29
+ @font.present? ? @font.to_s : ''
30
+ end
31
+
28
32
  private
29
33
 
30
34
  def config
@@ -1,3 +1,3 @@
1
1
  module Labelary
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: labelary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Coleman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-14 00:00:00.000000000 Z
11
+ date: 2018-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  version: '0'
122
122
  requirements: []
123
123
  rubyforge_project:
124
- rubygems_version: 2.5.1
124
+ rubygems_version: 2.7.6
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: Ruby Gem to interact with the Labelary.com ZPL Web Service