Class: Citywrapper::TravelTime

Inherits:
ApiBase
  • Object
show all
Defined in:
lib/citywrapper/resources/travel_time.rb

Constant Summary

Constants inherited from ApiBase

ApiBase::JSON_HEADERS

Instance Attribute Summary

Attributes inherited from ApiBase

#config, #response

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiBase

#request

Constructor Details

#initializeTravelTime

Returns a new instance of TravelTime.



3
4
5
6
# File 'lib/citywrapper/resources/travel_time.rb', line 3

def initialize
  super
  @resource = 'traveltime'
end

Class Method Details

.between(start_coordinates: [], end_coordinates: [], time: nil, time_type: nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/citywrapper/resources/travel_time.rb', line 8

def self.between(start_coordinates: [], end_coordinates: [], time: nil, time_type: nil)
  new.request(
    params: {
      startcoord: start_coordinates.join(','),
      endcoord: end_coordinates.join(','),
      time: time ? time.to_i : nil,
      time_type: time_type
    }
  )
end