Class: Afterpay::ShippingCourier
- Inherits:
-
Object
- Object
- Afterpay::ShippingCourier
- Defined in:
- lib/afterpay/shipping_courier.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#priority ⇒ Object
Returns the value of attribute priority.
-
#shipped_at ⇒ Object
Returns the value of attribute shipped_at.
-
#tracking ⇒ Object
Returns the value of attribute tracking.
Class Method Summary collapse
-
.from_response(response) ⇒ Object
Builds ShippingCourier from response.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ ShippingCourier
constructor
A new instance of ShippingCourier.
Constructor Details
#initialize(attributes = {}) ⇒ ShippingCourier
Returns a new instance of ShippingCourier.
7 8 9 10 11 12 |
# File 'lib/afterpay/shipping_courier.rb', line 7 def initialize(attributes = {}) @shipped_at = attributes[:shipped_at] || "" @name = attributes[:name] || "" @tracking = attributes[:tracking] || "" @priority = attributes[:priority] || "" end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/afterpay/shipping_courier.rb', line 5 def name @name end |
#priority ⇒ Object
Returns the value of attribute priority.
5 6 7 |
# File 'lib/afterpay/shipping_courier.rb', line 5 def priority @priority end |
#shipped_at ⇒ Object
Returns the value of attribute shipped_at.
5 6 7 |
# File 'lib/afterpay/shipping_courier.rb', line 5 def shipped_at @shipped_at end |
#tracking ⇒ Object
Returns the value of attribute tracking.
5 6 7 |
# File 'lib/afterpay/shipping_courier.rb', line 5 def tracking @tracking end |
Class Method Details
.from_response(response) ⇒ Object
Builds ShippingCourier from response
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/afterpay/shipping_courier.rb', line 15 def self.from_response(response) return nil if response.nil? new( shipped_at: response[:shippedAt], name: response[:name], tracking: response[:tracking], priority: response[:priority], error: Error.new(response) ) end |