Sha256: 5dd17f4f686502692fbe862a65b01f0467cff52e3d78141937d74390864dd96d

Contents?: true

Size: 461 Bytes

Versions: 1

Compression:

Stored size: 461 Bytes

Contents

class Smartsend::Label
  attr_accessor :tracking_code, :url, :pdf

  def self.find_by_tracking_code(tracking_code, account: nil)
    response = Smartsend::Client.new(account).get("shipments/tracking/#{tracking_code}/labels")

    if response.success?
      label = new
      label.tracking_code = tracking_code
      label.url = response.dig('data', 'pdf', 'link')
      label.pdf = response.dig('data', 'pdf', 'base_64_encoded')
      label
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smartsend-ruby-0.5.1 lib/smartsend/label.rb