Class: Ratis::ItinTrace
- Inherits:
-
Object
- Object
- Ratis::ItinTrace
- Defined in:
- lib/ratis/itin_trace.rb
Instance Attribute Summary collapse
-
#legs ⇒ Object
Returns the value of attribute legs.
-
#map_extents ⇒ Object
Returns the value of attribute map_extents.
-
#success ⇒ Object
Returns the value of attribute success.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(response) ⇒ ItinTrace
constructor
A new instance of ItinTrace.
- #success? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ ItinTrace
Returns a new instance of ItinTrace.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ratis/itin_trace.rb', line 7 def initialize(response) @success = response.success? @map_extents = response.body[:itintrace_response][:mapextents].split(',').map(&:to_f).each_slice(2).to_a @legs = response.body.to_array(:itintrace_response, :legs, :leg).map { |l| Hashie::Mash.new l } @legs.each do |leg| leg.points = leg.to_array(:points, :point).collect do |point| point.split(',').map(&:to_f) end end end |
Instance Attribute Details
#legs ⇒ Object
Returns the value of attribute legs.
5 6 7 |
# File 'lib/ratis/itin_trace.rb', line 5 def legs @legs end |
#map_extents ⇒ Object
Returns the value of attribute map_extents.
5 6 7 |
# File 'lib/ratis/itin_trace.rb', line 5 def map_extents @map_extents end |
#success ⇒ Object
Returns the value of attribute success.
5 6 7 |
# File 'lib/ratis/itin_trace.rb', line 5 def success @success end |
Class Method Details
Instance Method Details
#success? ⇒ Boolean
24 25 26 |
# File 'lib/ratis/itin_trace.rb', line 24 def success? @success end |