Class: Smartsend::Label
- Inherits:
-
Object
- Object
- Smartsend::Label
- Defined in:
- lib/smartsend/label.rb
Instance Attribute Summary collapse
-
#pdf ⇒ Object
Returns the value of attribute pdf.
-
#tracking_code ⇒ Object
Returns the value of attribute tracking_code.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Attribute Details
#pdf ⇒ Object
Returns the value of attribute pdf.
2 3 4 |
# File 'lib/smartsend/label.rb', line 2 def pdf @pdf end |
#tracking_code ⇒ Object
Returns the value of attribute tracking_code.
2 3 4 |
# File 'lib/smartsend/label.rb', line 2 def tracking_code @tracking_code end |
#url ⇒ Object
Returns the value of attribute url.
2 3 4 |
# File 'lib/smartsend/label.rb', line 2 def url @url end |
Class Method Details
.find_by_tracking_code(tracking_code, account: nil) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/smartsend/label.rb', line 4 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 |