Class: Uber::Estimate
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#message ⇒ Object
Returns the value of attribute message.
-
#pickup_estimate ⇒ Object
Returns the value of attribute pickup_estimate.
-
#price ⇒ Object
Returns the value of attribute price.
-
#trip ⇒ Object
Returns the value of attribute trip.
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Uber::Base
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
4 5 6 |
# File 'lib/uber/models/estimate.rb', line 4 def code @code end |
#errors ⇒ Object
Returns the value of attribute errors.
4 5 6 |
# File 'lib/uber/models/estimate.rb', line 4 def errors @errors end |
#message ⇒ Object
Returns the value of attribute message.
4 5 6 |
# File 'lib/uber/models/estimate.rb', line 4 def end |
#pickup_estimate ⇒ Object
Returns the value of attribute pickup_estimate.
4 5 6 |
# File 'lib/uber/models/estimate.rb', line 4 def pickup_estimate @pickup_estimate end |
#price ⇒ Object
Returns the value of attribute price.
4 5 6 |
# File 'lib/uber/models/estimate.rb', line 4 def price @price end |
#trip ⇒ Object
Returns the value of attribute trip.
4 5 6 |
# File 'lib/uber/models/estimate.rb', line 4 def trip @trip end |
Instance Method Details
#errors? ⇒ Boolean
18 19 20 21 22 |
# File 'lib/uber/models/estimate.rb', line 18 def errors? multi_errors = @errors && @errors.size >= 1 single_error = @code && !@code.empty? && && !.empty? multi_errors || single_error end |
#humanized_estimate ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/uber/models/estimate.rb', line 24 def humanized_estimate unless pickup_estimate.nil? if pickup_estimate.to_i == 1 "#{pickup_estimate} minute" else "#{pickup_estimate} minutes" end end end |