Class: GmapsDirections::Route

Inherits:
Object
  • Object
show all
Defined in:
lib/gmaps_directions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gmaps_route_hash, status) ⇒ Route

Returns a new instance of Route.



73
74
75
76
77
78
79
80
81
82
83
# File 'lib/gmaps_directions.rb', line 73

def initialize(gmaps_route_hash, status)
  @duration           = gmaps_route_hash["legs"].first["duration"]["value"]
  @formatted_duration = gmaps_route_hash["legs"].first["duration"]["text"]
  @distance           = gmaps_route_hash["legs"].first["distance"]["value"]
  @formatted_distance = gmaps_route_hash["legs"].first["distance"]["text"]
  @start_address      = gmaps_route_hash["legs"].first["start_address"]
  @end_address        = gmaps_route_hash["legs"].first["end_address"]
  @start_location     = gmaps_route_hash["legs"].first["start_location"]
  @end_location       = gmaps_route_hash["legs"].first["end_location"]
  @status             = status
end

Instance Attribute Details

#distanceObject (readonly)

Returns the value of attribute distance.



69
70
71
# File 'lib/gmaps_directions.rb', line 69

def distance
  @distance
end

#durationObject (readonly)

Returns the value of attribute duration.



69
70
71
# File 'lib/gmaps_directions.rb', line 69

def duration
  @duration
end

#end_addressObject (readonly)

Returns the value of attribute end_address.



69
70
71
# File 'lib/gmaps_directions.rb', line 69

def end_address
  @end_address
end

#end_locationObject (readonly)

Returns the value of attribute end_location.



69
70
71
# File 'lib/gmaps_directions.rb', line 69

def end_location
  @end_location
end

#formatted_distanceObject (readonly)

Returns the value of attribute formatted_distance.



69
70
71
# File 'lib/gmaps_directions.rb', line 69

def formatted_distance
  @formatted_distance
end

#formatted_durationObject (readonly)

Returns the value of attribute formatted_duration.



69
70
71
# File 'lib/gmaps_directions.rb', line 69

def formatted_duration
  @formatted_duration
end

#start_addressObject (readonly)

Returns the value of attribute start_address.



69
70
71
# File 'lib/gmaps_directions.rb', line 69

def start_address
  @start_address
end

#start_locationObject (readonly)

Returns the value of attribute start_location.



69
70
71
# File 'lib/gmaps_directions.rb', line 69

def start_location
  @start_location
end

#statusObject (readonly)

Returns the value of attribute status.



69
70
71
# File 'lib/gmaps_directions.rb', line 69

def status
  @status
end