class Deliveries::Label

Attributes

url[R]

Public Class Methods

new(raw: nil, url: nil) click to toggle source
# File lib/deliveries/label.rb, line 5
def initialize(raw: nil, url: nil)
  raise ArgumentError, 'Both raw and url cannot be nil' if raw.nil? && url.nil?

  @raw = raw
  @url = url
end

Public Instance Methods

raw() click to toggle source
# File lib/deliveries/label.rb, line 12
def raw
  if @raw
    @raw
  elsif @url
    @raw = URI.parse(@url).read.force_encoding('binary')
  end
end