Class: GoogleMapsPlatform::DirectionsTransitVehicle
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- GoogleMapsPlatform::DirectionsTransitVehicle
- Defined in:
- lib/google_maps_platform/models/directions_transit_vehicle.rb
Overview
DirectionsTransitVehicle Model.
Instance Attribute Summary collapse
-
#icon ⇒ String
Contains the URL for an icon associated with this vehicle type.
-
#local_icon ⇒ String
Contains the URL for the icon associated with this vehicle type, based on the local transport signage.
-
#name ⇒ String
The name of this vehicle, capitalized.
-
#type ⇒ Type1
The type of vehicle used.
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(name:, type:, icon: SKIP, local_icon: SKIP, additional_properties: nil) ⇒ DirectionsTransitVehicle
constructor
A new instance of DirectionsTransitVehicle.
-
#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(name:, type:, icon: SKIP, local_icon: SKIP, additional_properties: nil) ⇒ DirectionsTransitVehicle
Returns a new instance of DirectionsTransitVehicle.
74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/google_maps_platform/models/directions_transit_vehicle.rb', line 74 def initialize(name:, type:, icon: SKIP, local_icon: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @icon = icon unless icon == SKIP @local_icon = local_icon unless local_icon == SKIP @name = name @type = type @additional_properties = additional_properties end |
Instance Attribute Details
#icon ⇒ String
Contains the URL for an icon associated with this vehicle type.
14 15 16 |
# File 'lib/google_maps_platform/models/directions_transit_vehicle.rb', line 14 def icon @icon end |
#local_icon ⇒ String
Contains the URL for the icon associated with this vehicle type, based on the local transport signage.
19 20 21 |
# File 'lib/google_maps_platform/models/directions_transit_vehicle.rb', line 19 def local_icon @local_icon end |
#name ⇒ String
The name of this vehicle, capitalized.
23 24 25 |
# File 'lib/google_maps_platform/models/directions_transit_vehicle.rb', line 23 def name @name end |
#type ⇒ Type1
The type of vehicle used.
-
BUS- Bus. -
CABLE_CAR- A vehicle that operates on a cable, usually on the ground.
Aerial cable cars may be of the type GONDOLA_LIFT.
-
COMMUTER_TRAIN- Commuter rail. -
FERRY- Ferry. -
FUNICULAR- A vehicle that is pulled up a steep incline by a cable. A
Funicular typically consists of two cars, with each car acting as a counterweight for the other.
-
GONDOLA_LIFT- An aerial cable car. -
HEAVY_RAIL- Heavy rail. -
HIGH_SPEED_TRAIN- High speed train. -
INTERCITY_BUS- Intercity bus. -
LONG_DISTANCE_TRAIN- Long distance train. -
METRO_RAIL- Light rail transit. -
MONORAIL- Monorail. -
OTHER- All other vehicles will return this type. -
RAIL- Rail. -
SHARE_TAXI- Share taxi is a kind of bus with the ability to drop off
and pick up passengers anywhere on its route.
-
SUBWAY- Underground light rail. -
TRAM- Above ground light rail. -
TROLLEYBUS- Trolleybus.
49 50 51 |
# File 'lib/google_maps_platform/models/directions_transit_vehicle.rb', line 49 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/google_maps_platform/models/directions_transit_vehicle.rb', line 87 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : nil type = hash.key?('type') ? hash['type'] : nil icon = hash.key?('icon') ? hash['icon'] : SKIP local_icon = hash.key?('local_icon') ? hash['local_icon'] : 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. DirectionsTransitVehicle.new(name: name, type: type, icon: icon, local_icon: local_icon, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
52 53 54 55 56 57 58 59 |
# File 'lib/google_maps_platform/models/directions_transit_vehicle.rb', line 52 def self.names @_hash = {} if @_hash.nil? @_hash['icon'] = 'icon' @_hash['local_icon'] = 'local_icon' @_hash['name'] = 'name' @_hash['type'] = 'type' @_hash end |
.nullables ⇒ Object
An array for nullable fields
70 71 72 |
# File 'lib/google_maps_platform/models/directions_transit_vehicle.rb', line 70 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
62 63 64 65 66 67 |
# File 'lib/google_maps_platform/models/directions_transit_vehicle.rb', line 62 def self.optionals %w[ icon local_icon ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
119 120 121 122 123 124 |
# File 'lib/google_maps_platform/models/directions_transit_vehicle.rb', line 119 def inspect class_name = self.class.name.split('::').last "<#{class_name} icon: #{@icon.inspect}, local_icon: #{@local_icon.inspect}, name:"\ " #{@name.inspect}, type: #{@type.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
112 113 114 115 116 |
# File 'lib/google_maps_platform/models/directions_transit_vehicle.rb', line 112 def to_s class_name = self.class.name.split('::').last "<#{class_name} icon: #{@icon}, local_icon: #{@local_icon}, name: #{@name}, type: #{@type},"\ " additional_properties: #{@additional_properties}>" end |