Sha256: 76f95636a878e4c1f3f898b4d143ff79ce2d7f0d9d1f28c89bb2f9e9320a8e3e

Contents?: true

Size: 474 Bytes

Versions: 1

Compression:

Stored size: 474 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, debug: true).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.0 lib/smartsend/label.rb