Class: Postmates::Quote

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#timeify, #urlify

Constructor Details

#initialize(hash) ⇒ Quote

Returns a new instance of Quote.



9
10
11
12
13
14
15
16
17
# File 'lib/postmates/quote.rb', line 9

def initialize(hash)
  @id          =         hash['id']
  @fee         =         hash['fee']
  @currency    =         hash['currency']
  @duration    =         hash['duration']
  @created_at  = timeify hash['created']
  @expires_at  = timeify hash['expires']
  @dropoff_eta = timeify hash['dropoff_eta']
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#currencyObject (readonly)

Returns the value of attribute currency.



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

def currency
  @currency
end

#dropoff_etaObject (readonly)

Returns the value of attribute dropoff_eta.



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

def dropoff_eta
  @dropoff_eta
end

#durationObject (readonly)

Returns the value of attribute duration.



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

def duration
  @duration
end

#expires_atObject (readonly)

Returns the value of attribute expires_at.



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

def expires_at
  @expires_at
end

#feeObject (readonly)

Returns the value of attribute fee.



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

def fee
  @fee
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

Instance Method Details

#expired?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/postmates/quote.rb', line 19

def expired?
  Time.now.utc.to_datetime > expires_at
end