Class: GoogleMapsPlatform::DirectionsViaWaypoint
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- GoogleMapsPlatform::DirectionsViaWaypoint
- Defined in:
- lib/google_maps_platform/models/directions_via_waypoint.rb
Overview
DirectionsViaWaypoint Model.
Instance Attribute Summary collapse
-
#location ⇒ LatLngLiteral
An object describing a specific location with Latitude and Longitude in decimal degrees.
-
#step_index ⇒ Integer
The index of the step containing the waypoint.
-
#step_interpolation ⇒ Float
The position of the waypoint along the step’s polyline, expressed as a ratio from 0 to 1.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(location: SKIP, step_index: SKIP, step_interpolation: SKIP, additional_properties: nil) ⇒ DirectionsViaWaypoint
constructor
A new instance of DirectionsViaWaypoint.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(location: SKIP, step_index: SKIP, step_interpolation: SKIP, additional_properties: nil) ⇒ DirectionsViaWaypoint
Returns a new instance of DirectionsViaWaypoint.
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/google_maps_platform/models/directions_via_waypoint.rb', line 49 def initialize(location: SKIP, step_index: SKIP, step_interpolation: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @location = location unless location == SKIP @step_index = step_index unless step_index == SKIP @step_interpolation = step_interpolation unless step_interpolation == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#location ⇒ LatLngLiteral
An object describing a specific location with Latitude and Longitude in decimal degrees.
15 16 17 |
# File 'lib/google_maps_platform/models/directions_via_waypoint.rb', line 15 def location @location end |
#step_index ⇒ Integer
The index of the step containing the waypoint.
19 20 21 |
# File 'lib/google_maps_platform/models/directions_via_waypoint.rb', line 19 def step_index @step_index end |
#step_interpolation ⇒ Float
The position of the waypoint along the step’s polyline, expressed as a ratio from 0 to 1.
24 25 26 |
# File 'lib/google_maps_platform/models/directions_via_waypoint.rb', line 24 def step_interpolation @step_interpolation end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/google_maps_platform/models/directions_via_waypoint.rb', line 61 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. location = LatLngLiteral.from_hash(hash['location']) if hash['location'] step_index = hash.key?('step_index') ? hash['step_index'] : SKIP step_interpolation = hash.key?('step_interpolation') ? hash['step_interpolation'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. DirectionsViaWaypoint.new(location: location, step_index: step_index, step_interpolation: step_interpolation, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
27 28 29 30 31 32 33 |
# File 'lib/google_maps_platform/models/directions_via_waypoint.rb', line 27 def self.names @_hash = {} if @_hash.nil? @_hash['location'] = 'location' @_hash['step_index'] = 'step_index' @_hash['step_interpolation'] = 'step_interpolation' @_hash end |
.nullables ⇒ Object
An array for nullable fields
45 46 47 |
# File 'lib/google_maps_platform/models/directions_via_waypoint.rb', line 45 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
36 37 38 39 40 41 42 |
# File 'lib/google_maps_platform/models/directions_via_waypoint.rb', line 36 def self.optionals %w[ location step_index step_interpolation ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
92 93 94 95 96 97 |
# File 'lib/google_maps_platform/models/directions_via_waypoint.rb', line 92 def inspect class_name = self.class.name.split('::').last "<#{class_name} location: #{@location.inspect}, step_index: #{@step_index.inspect},"\ " step_interpolation: #{@step_interpolation.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
85 86 87 88 89 |
# File 'lib/google_maps_platform/models/directions_via_waypoint.rb', line 85 def to_s class_name = self.class.name.split('::').last "<#{class_name} location: #{@location}, step_index: #{@step_index}, step_interpolation:"\ " #{@step_interpolation}, additional_properties: #{@additional_properties}>" end |