Class: SeametrixRuby::Responses::RouteResult
- Inherits:
-
Object
- Object
- SeametrixRuby::Responses::RouteResult
- Defined in:
- lib/seametrix_ruby/responses/route_result.rb
Instance Attribute Summary collapse
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#result_code ⇒ Object
Returns the value of attribute result_code.
-
#result_text ⇒ Object
Returns the value of attribute result_text.
-
#seca_distance ⇒ Object
Returns the value of attribute seca_distance.
-
#total_distance ⇒ Object
Returns the value of attribute total_distance.
-
#waypoints ⇒ Object
Returns the value of attribute waypoints.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ RouteResult
constructor
A new instance of RouteResult.
Constructor Details
#initialize(attributes = {}) ⇒ RouteResult
Returns a new instance of RouteResult.
15 16 17 18 19 20 21 22 |
# File 'lib/seametrix_ruby/responses/route_result.rb', line 15 def initialize(attributes = {}) @result_code = attributes[:result_code] @result_text = attributes[:result_text] @total_distance = attributes[:total_distance].to_f @seca_distance = attributes[:seca_distance].to_f = attributes[:metadata] self.waypoints = attributes[:waypoints] || [] end |
Instance Attribute Details
#metadata ⇒ Object
Returns the value of attribute metadata.
8 9 10 |
# File 'lib/seametrix_ruby/responses/route_result.rb', line 8 def end |
#result_code ⇒ Object
Returns the value of attribute result_code.
8 9 10 |
# File 'lib/seametrix_ruby/responses/route_result.rb', line 8 def result_code @result_code end |
#result_text ⇒ Object
Returns the value of attribute result_text.
8 9 10 |
# File 'lib/seametrix_ruby/responses/route_result.rb', line 8 def result_text @result_text end |
#seca_distance ⇒ Object
Returns the value of attribute seca_distance.
8 9 10 |
# File 'lib/seametrix_ruby/responses/route_result.rb', line 8 def seca_distance @seca_distance end |
#total_distance ⇒ Object
Returns the value of attribute total_distance.
8 9 10 |
# File 'lib/seametrix_ruby/responses/route_result.rb', line 8 def total_distance @total_distance end |
#waypoints ⇒ Object
Returns the value of attribute waypoints.
13 14 15 |
# File 'lib/seametrix_ruby/responses/route_result.rb', line 13 def waypoints @waypoints end |
Class Method Details
.from_json(json_string) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/seametrix_ruby/responses/route_result.rb', line 24 def self.from_json(json_string) json = MultiJson.load(json_string) new(result_code: json['resultCode'], result_text: json['resultText'], total_distance: json['totalDistance'].to_f, seca_distance: json['secaDistance'].to_f, metadata: json['metadata'], waypoints: json['waypoints']) end |