Skip to content

Commit

Permalink
Merge pull request #49 from routific/routific/add-polylines
Browse files Browse the repository at this point in the history
Routific/add polylines
  • Loading branch information
rogertsui0923 authored Nov 29, 2019
2 parents 2a0250c + a219772 commit 3d0d4e8
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Routific Ruby Gem

[![Build Status](https://travis-ci.org/routific/routific-gem.svg?branch=master)](https://travis-ci.org/routific/routific-gem)

This Ruby Gem assists users to easily access the [Routific API][1], which is a practical and scalable solution to the Vehicle Routing Problem.
This Ruby Gem assists users to easily access the [Routific API][1], which is a practical and scalable solution to the Vehicle Routing Problem and Traveling Salesman Problem.

[1]: https://routific.com/developers

Expand Down Expand Up @@ -60,11 +60,16 @@ routific.set_vehicle("vehicle_1", {
"shift_end" => "12:00",
})

routific.set_options({
"polylines" => true
})

route = routific.get_route()


puts route.status # => "success"
puts route.total_travel_time # => 29
puts route.polylines["vehicle_1"] # => s`i}|AbxswiFnn@gdBvG?vVf@jC?nZRb[f@j\z@nZRnZRj\f@nZz

vehicle_routes = route.vehicle_routes

Expand Down
2 changes: 1 addition & 1 deletion lib/routific/options.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module RoutificApi
# This class represents a set of options for the request
class Options
VALID_PARAMS = %w{ traffic min_visits_per_vehicle balance min_vehicles shortest_distance squash_durations max_vehicle_overtime max_visit_lateness }
VALID_PARAMS = %w{ traffic min_visits_per_vehicle balance min_vehicles shortest_distance squash_durations max_vehicle_overtime max_visit_lateness polylines }

attr_reader *VALID_PARAMS

Expand Down
3 changes: 2 additions & 1 deletion lib/routific/route.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ class Route
:total_working_time, :total_travel_time,
:total_break_time, :total_idle_time,
:total_visit_lateness, :num_late_visits,
:vehicle_overtime, :total_vehicle_overtime
:vehicle_overtime, :total_vehicle_overtime,
:polylines,
]

attr_reader *FIELDS
Expand Down
6 changes: 3 additions & 3 deletions routific.gemspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Gem::Specification.new do |s|
s.name = 'routific'
s.version = '1.7.2'
s.date = '2017-09-25'
s.add_runtime_dependency('rest-client', '~> 1.7')
s.version = '1.7.3'
s.date = '2019-11-26'
s.add_runtime_dependency('rest-client', '~> 2.0.1')
s.add_runtime_dependency('json', '~> 1.8')
s.add_development_dependency('rspec', '~> 3.0')
s.add_development_dependency('faker', '>= 1.6.2')
Expand Down
2 changes: 1 addition & 1 deletion spec/routific_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def set_visit_and_vehicle(routific)
expect(job.id).to be_instance_of(String)
expect(job.input).to be_instance_of(Hash)
expect(job.status).to eq('pending')
sleep 1
sleep 10
expect(job.fetch).to eq('finished')
expect(job.route).to be_instance_of(RoutificApi::Route)
end
Expand Down

0 comments on commit 3d0d4e8

Please sign in to comment.