Class: GoogleMapsAPI::DistanceMatrix::Response
- Inherits:
-
Object
- Object
- GoogleMapsAPI::DistanceMatrix::Response
- Defined in:
- lib/google_maps_api/distance_matrix/response.rb
Instance Attribute Summary collapse
-
#destination_addresses ⇒ Object
readonly
Returns the value of attribute destination_addresses.
-
#json_response ⇒ Object
readonly
Returns the value of attribute json_response.
-
#origin_addresses ⇒ Object
readonly
Returns the value of attribute origin_addresses.
-
#rows ⇒ Object
readonly
Returns the value of attribute rows.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(status, origin_addresses, destination_addresses, rows, json_response) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(status, origin_addresses, destination_addresses, rows, json_response) ⇒ Response
Returns a new instance of Response.
6 7 8 9 10 11 12 |
# File 'lib/google_maps_api/distance_matrix/response.rb', line 6 def initialize(status, origin_addresses, destination_addresses, rows, json_response) @status = status @origin_addresses = origin_addresses @destination_addresses = destination_addresses @rows = rows @json_response = json_response end |
Instance Attribute Details
#destination_addresses ⇒ Object (readonly)
Returns the value of attribute destination_addresses.
4 5 6 |
# File 'lib/google_maps_api/distance_matrix/response.rb', line 4 def destination_addresses @destination_addresses end |
#json_response ⇒ Object (readonly)
Returns the value of attribute json_response.
4 5 6 |
# File 'lib/google_maps_api/distance_matrix/response.rb', line 4 def json_response @json_response end |
#origin_addresses ⇒ Object (readonly)
Returns the value of attribute origin_addresses.
4 5 6 |
# File 'lib/google_maps_api/distance_matrix/response.rb', line 4 def origin_addresses @origin_addresses end |
#rows ⇒ Object (readonly)
Returns the value of attribute rows.
4 5 6 |
# File 'lib/google_maps_api/distance_matrix/response.rb', line 4 def rows @rows end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
4 5 6 |
# File 'lib/google_maps_api/distance_matrix/response.rb', line 4 def status @status end |
Class Method Details
.from_json(json) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/google_maps_api/distance_matrix/response.rb', line 14 def self.from_json(json) parsed_json = parse_json(json) rows = build_rows(parsed_json) self.new( parsed_json['status'], parsed_json['origin_addresses'], parsed_json['destination_addresses'], rows, json ) end |