ratis 3.6.2 → 3.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 898c66080a4b9249a614ab9e01ad56d2cf3d4390
4
- data.tar.gz: 70aa9e067227c5cc6ab15e82a9d8db4d93b8474b
3
+ metadata.gz: 53e9e63662690f7ab5c3028d71042f6f6dcd6f8e
4
+ data.tar.gz: 23c0844ed0a8fcad49bb2ed75254511cf4bbb4a2
5
5
  SHA512:
6
- metadata.gz: 94282be3776f0b20d04c0e16d119d38c595dd0a3e7a61141ad4e8af494d3cc924836129032121334501629c31c1dd3e33237d25ba13407097708b7353c0661ba
7
- data.tar.gz: f6f2b0751ba054218ff1fa5b51ee1a53fa6b42c26d94d4cf57c629ff74de8880706db0f41df28471d95a8268972386b7b6bffef523b2a8e90d84d3e7960d58fd
6
+ metadata.gz: 252fc9a54e7287b8df0bff15922d908d77f0bbcd6e5b4b7b3180f20ba34c945afa3f06a26ea6e6e08406b50e796306c2fd63df1e737400ab844ec1bbbf084da0
7
+ data.tar.gz: 6dc82b860fcefeab7ecb80e3a349119795c790bac348920baa33709d0a5836c942e210bc515f81bc5a0b66e717c5badc761cbb39683a706242f106f4f0835782
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ 3.6.3
2
+ - Wrap parts of Plantrip response with Hashie, coerce values appropriately
3
+
1
4
  3.6.2
2
5
  - Added support for Itintrace api
3
6
  - Plantrip now support setting a Tid, to use with Itintrace
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ratis (3.6.1)
4
+ ratis (3.6.2)
5
5
  hashie (~> 3.3.1)
6
6
  nesty (~> 1.0.2)
7
7
  savon (< 2.0)
@@ -10,9 +10,16 @@ module Ratis
10
10
  @legs = response.body.to_array(:itintrace_response, :legs, :leg).map { |l| Hashie::Mash.new l }
11
11
 
12
12
  @legs.each do |leg|
13
+ leg.distance = leg.distance.to_f
14
+
13
15
  leg.points = leg.to_array(:points, :point).collect do |point|
14
16
  point.split(',').map(&:to_f)
15
17
  end
18
+
19
+ leg.stops = leg.to_array(:stops, :stop).collect do |stop|
20
+ stop.point = stop.point.split(',').map(&:to_f)
21
+ stop
22
+ end
16
23
  end
17
24
  end
18
25
 
@@ -12,7 +12,7 @@ module Ratis
12
12
  @regular_fare = response[:regularfare].to_f
13
13
  @transit_time = response[:transittime].to_i
14
14
  @trace_info = response[:traceinfo]
15
- @legs = response.to_array :legs, :leg
15
+ @legs = response.to_array(:legs, :leg).map { |l| Hashie::Mash.new l }
16
16
  end
17
17
 
18
18
  end
@@ -2,6 +2,15 @@ module Ratis
2
2
 
3
3
  class Plantrip
4
4
 
5
+ class Input < Hashie::Mash
6
+ include Hashie::Extensions::Coercion
7
+
8
+ coerce_key :originlat, Float
9
+ coerce_key :originlong, Float
10
+ coerce_key :destinationlat, Float
11
+ coerce_key :destinationlong, Float
12
+ end
13
+
5
14
  attr_accessor :success, :itineraries, :walkable, :walkadjust, :input, :tid
6
15
 
7
16
  def initialize(response)
@@ -9,7 +18,7 @@ module Ratis
9
18
 
10
19
  @walkable = response.body[:walkable]
11
20
  @walkadjust = response.body[:walkadjust]
12
- @input = response.body[:plantrip_response][:input]
21
+ @input = Input.new response.body[:plantrip_response][:input]
13
22
 
14
23
  @itineraries = response.to_array(:plantrip_response, :itin).map do |itinerary|
15
24
  Itinerary.new(itinerary)
@@ -5,7 +5,7 @@ module Ratis
5
5
  def version
6
6
  @version ||= begin
7
7
 
8
- string = '3.6.2'
8
+ string = '3.6.3'
9
9
 
10
10
  def string.parts
11
11
  split('.').map { |p| p.to_i }
@@ -56,7 +56,7 @@ describe Ratis::Plantrip do
56
56
  expect(plantrip.walkable).to eq(nil)
57
57
  expect(plantrip.walkadjust).to eq(nil)
58
58
 
59
- input = {
59
+ input = Ratis::Plantrip::Input.new({
60
60
  :originlat => "33.452082",
61
61
  :originlong => "-112.074374",
62
62
  :originlandmarkid => "0",
@@ -82,7 +82,7 @@ describe Ratis::Plantrip do
82
82
  :walkincrease => "N",
83
83
  :allows2s => "N",
84
84
  :xmode => "BCFKLRSTX"
85
- }
85
+ })
86
86
 
87
87
  HashDiff.diff(plantrip.input, input).should eql []
88
88
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ratis
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.2
4
+ version: 3.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Velocity Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-28 00:00:00.000000000 Z
11
+ date: 2014-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nesty