Class: Afterpay::ShippingCourier

Inherits:
Object
  • Object
show all
Defined in:
lib/afterpay/shipping_courier.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/afterpay/shipping_courier.rb', line 5

def name
  @name
end

#priorityObject

Returns the value of attribute priority.



5
6
7
# File 'lib/afterpay/shipping_courier.rb', line 5

def priority
  @priority
end

#shipped_atObject

Returns the value of attribute shipped_at.



5
6
7
# File 'lib/afterpay/shipping_courier.rb', line 5

def shipped_at
  @shipped_at
end

#trackingObject

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