Class: Postmates::Delivery

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/postmates/delivery.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#timeify, #urlify

Constructor Details

#initialize(hash) ⇒ Delivery

Returns a new instance of Delivery.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/postmates/delivery.rb', line 11

def initialize(hash)
  @id          =         hash['id']
  @status      =         hash['status']
  @complete    =         hash['complete']
  @quote_id    =         hash['quote_id']
  @fee         =         hash['fee']
  @currency    =         hash['currency']
  @manifest    =         hash['manifest']
  @pickup      =         hash['pickup']
  @dropoff     =         hash['dropoff']
  @courier     =         hash['courier']
  @image_url   =  urlify hash['image_href']
  @created_at  = timeify hash['created']
  @updated_at  = timeify hash['updated']
  @pickup_eta  = timeify hash['pickup_eta']
  @dropoff_eta = timeify hash['dropoff_eta']
end

Instance Attribute Details

#completeObject (readonly)

Returns the value of attribute complete.



6
7
8
# File 'lib/postmates/delivery.rb', line 6

def complete
  @complete
end

#courierObject (readonly)

Returns the value of attribute courier.



6
7
8
# File 'lib/postmates/delivery.rb', line 6

def courier
  @courier
end

#created_atObject (readonly)

Returns the value of attribute created_at.



6
7
8
# File 'lib/postmates/delivery.rb', line 6

def created_at
  @created_at
end

#currencyObject (readonly)

Returns the value of attribute currency.



6
7
8
# File 'lib/postmates/delivery.rb', line 6

def currency
  @currency
end

#dropoffObject (readonly)

Returns the value of attribute dropoff.



6
7
8
# File 'lib/postmates/delivery.rb', line 6

def dropoff
  @dropoff
end

#dropoff_deadlineObject (readonly)

Returns the value of attribute dropoff_deadline.



6
7
8
# File 'lib/postmates/delivery.rb', line 6

def dropoff_deadline
  @dropoff_deadline
end

#dropoff_etaObject (readonly)

Returns the value of attribute dropoff_eta.



6
7
8
# File 'lib/postmates/delivery.rb', line 6

def dropoff_eta
  @dropoff_eta
end

#feeObject (readonly)

Returns the value of attribute fee.



6
7
8
# File 'lib/postmates/delivery.rb', line 6

def fee
  @fee
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/postmates/delivery.rb', line 6

def id
  @id
end

#image_urlObject (readonly)

Returns the value of attribute image_url.



6
7
8
# File 'lib/postmates/delivery.rb', line 6

def image_url
  @image_url
end

#manifestObject (readonly)

Returns the value of attribute manifest.



6
7
8
# File 'lib/postmates/delivery.rb', line 6

def manifest
  @manifest
end

#pickupObject (readonly)

Returns the value of attribute pickup.



6
7
8
# File 'lib/postmates/delivery.rb', line 6

def pickup
  @pickup
end

#pickup_etaObject (readonly)

Returns the value of attribute pickup_eta.



6
7
8
# File 'lib/postmates/delivery.rb', line 6

def pickup_eta
  @pickup_eta
end

#quote_idObject (readonly)

Returns the value of attribute quote_id.



6
7
8
# File 'lib/postmates/delivery.rb', line 6

def quote_id
  @quote_id
end

#statusObject (readonly)

Returns the value of attribute status.



6
7
8
# File 'lib/postmates/delivery.rb', line 6

def status
  @status
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



6
7
8
# File 'lib/postmates/delivery.rb', line 6

def updated_at
  @updated_at
end

Instance Method Details

#delivered?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/postmates/delivery.rb', line 29

def delivered?
  status == 'delivered'
end