Class: Bing::Route::Itinerary
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#coordinates ⇒ Object
readonly
Returns the value of attribute coordinates.
-
#distance ⇒ Object
readonly
Returns the value of attribute distance.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#instruction ⇒ Object
readonly
Returns the value of attribute instruction.
-
#travel_mode ⇒ Object
readonly
Returns the value of attribute travel_mode.
Instance Method Summary collapse
-
#initialize(resource) ⇒ Itinerary
constructor
A new instance of Itinerary.
Constructor Details
#initialize(resource) ⇒ Itinerary
Returns a new instance of Itinerary.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/bing/route/itinerary.rb', line 10 def initialize resource raise Bing::ItineraryResourceMissing if resource.blank? @distance = resource['travelDistance'] @duration = resource['travelDuration'] @travel_mode = resource['travelMode'] if instructions = resource['instruction'] then @action = instructions['maneuverType'] @instruction = instructions['text'] end if resource['maneuverPoint'] && resource['maneuverPoint']['coordinates'] then @coordinates = resource['maneuverPoint']['coordinates'] end end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
3 4 5 |
# File 'lib/bing/route/itinerary.rb', line 3 def action @action end |
#coordinates ⇒ Object (readonly)
Returns the value of attribute coordinates.
4 5 6 |
# File 'lib/bing/route/itinerary.rb', line 4 def coordinates @coordinates end |
#distance ⇒ Object (readonly)
Returns the value of attribute distance.
5 6 7 |
# File 'lib/bing/route/itinerary.rb', line 5 def distance @distance end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
6 7 8 |
# File 'lib/bing/route/itinerary.rb', line 6 def duration @duration end |
#instruction ⇒ Object (readonly)
Returns the value of attribute instruction.
7 8 9 |
# File 'lib/bing/route/itinerary.rb', line 7 def instruction @instruction end |
#travel_mode ⇒ Object (readonly)
Returns the value of attribute travel_mode.
8 9 10 |
# File 'lib/bing/route/itinerary.rb', line 8 def travel_mode @travel_mode end |