Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Labelary.configure do |config|
config.index = 0 # optional, for picking a label when multiple are present in the ZPL (usually 0)
config.content_type = 'image/png' # or 'application/pdf', specifies the content type of the returned label
config.url = 'http://api.labelary.com' # optional (for self hosted)
config.api_key = 'api_key' # optional (for Labelary Business Saas, requires url to be set for the Paid API endpoint)
end
```

Expand Down
1 change: 1 addition & 0 deletions lib/labelary/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def connection
@connection ||= Faraday.new(url: config.url) do |faraday|
faraday.request :multipart
faraday.response :json, content_type: /\bjson$/
faraday.headers['X-API-Key'] = config.api_key if config.api_key

faraday.adapter config.http_adapter
end
Expand Down
2 changes: 2 additions & 0 deletions lib/labelary/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def self.configure
class Configuration
attr_accessor *[
:url,
:api_key,
:http_adapter,
:dpmm,
:width,
Expand All @@ -26,6 +27,7 @@ class Configuration
def initialize
@url = 'http://api.labelary.com'
@http_adapter = Faraday.default_adapter
@api_key = nil
@dpmm = nil
@width = nil
@height = nil
Expand Down