Class: Postmates::Quote
- Inherits:
-
Object
- Object
- Postmates::Quote
- Includes:
- Utils
- Defined in:
- lib/postmates/quote.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#dropoff_eta ⇒ Object
readonly
Returns the value of attribute dropoff_eta.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#expires_at ⇒ Object
readonly
Returns the value of attribute expires_at.
-
#fee ⇒ Object
readonly
Returns the value of attribute fee.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #expired? ⇒ Boolean
-
#initialize(hash) ⇒ Quote
constructor
A new instance of Quote.
Methods included from Utils
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_at ⇒ Object (readonly)
Returns the value of attribute created_at.
6 7 8 |
# File 'lib/postmates/quote.rb', line 6 def created_at @created_at end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
6 7 8 |
# File 'lib/postmates/quote.rb', line 6 def currency @currency end |
#dropoff_eta ⇒ Object (readonly)
Returns the value of attribute dropoff_eta.
6 7 8 |
# File 'lib/postmates/quote.rb', line 6 def dropoff_eta @dropoff_eta end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
6 7 8 |
# File 'lib/postmates/quote.rb', line 6 def duration @duration end |
#expires_at ⇒ Object (readonly)
Returns the value of attribute expires_at.
6 7 8 |
# File 'lib/postmates/quote.rb', line 6 def expires_at @expires_at end |
#fee ⇒ Object (readonly)
Returns the value of attribute fee.
6 7 8 |
# File 'lib/postmates/quote.rb', line 6 def fee @fee end |
#id ⇒ Object (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
19 20 21 |
# File 'lib/postmates/quote.rb', line 19 def expired? Time.now.utc.to_datetime > expires_at end |