blob: f4d12e4820dc84018f535a890d56409e7000a17b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
module TomTom
class Matrix
class RequestJSONSerializer
def self.dump(hash)
hash[:origins].map! do |point|
point_to_f(point)
end
hash[:destinations].map! do |point|
point_to_f(point)
end
JSON.dump(hash)
end
private
def self.point_to_f(point)
point[:point][:latitude] = point[:point][:latitude].to_f
point[:point][:longitude] = point[:point][:longitude].to_f
point
end
end
end
end
|