Class: GoogleMapsPlatform::Type1

Inherits:
Object
  • Object
show all
Defined in:
lib/google_maps_platform/models/type1.rb

Overview

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.

Constant Summary collapse

TYPE1 =
[
  # TODO: Write general description for BUS
  BUS = 'BUS'.freeze,

  # TODO: Write general description for CABLE_CAR
  CABLE_CAR = 'CABLE_CAR'.freeze,

  # TODO: Write general description for COMMUTER_TRAIN
  COMMUTER_TRAIN = 'COMMUTER_TRAIN'.freeze,

  # TODO: Write general description for FERRY
  FERRY = 'FERRY'.freeze,

  # TODO: Write general description for FUNICULAR
  FUNICULAR = 'FUNICULAR'.freeze,

  # TODO: Write general description for GONDOLA_LIFT
  GONDOLA_LIFT = 'GONDOLA_LIFT'.freeze,

  # TODO: Write general description for HEAVY_RAIL
  HEAVY_RAIL = 'HEAVY_RAIL'.freeze,

  # TODO: Write general description for HIGH_SPEED_TRAIN
  HIGH_SPEED_TRAIN = 'HIGH_SPEED_TRAIN'.freeze,

  # TODO: Write general description for INTERCITY_BUS
  INTERCITY_BUS = 'INTERCITY_BUS'.freeze,

  # TODO: Write general description for LONG_DISTANCE_TRAIN
  LONG_DISTANCE_TRAIN = 'LONG_DISTANCE_TRAIN'.freeze,

  # TODO: Write general description for METRO_RAIL
  METRO_RAIL = 'METRO_RAIL'.freeze,

  # TODO: Write general description for MONORAIL
  MONORAIL = 'MONORAIL'.freeze,

  # TODO: Write general description for OTHER
  OTHER = 'OTHER'.freeze,

  # TODO: Write general description for RAIL
  RAIL = 'RAIL'.freeze,

  # TODO: Write general description for SHARE_TAXI
  SHARE_TAXI = 'SHARE_TAXI'.freeze,

  # TODO: Write general description for SUBWAY
  SUBWAY = 'SUBWAY'.freeze,

  # TODO: Write general description for TRAM
  TRAM = 'TRAM'.freeze,

  # TODO: Write general description for TROLLEYBUS
  TROLLEYBUS = 'TROLLEYBUS'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = BUS) ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/google_maps_platform/models/type1.rb', line 83

def self.from_value(value, default_value = BUS)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'bus' then BUS
  when 'cable_car' then CABLE_CAR
  when 'commuter_train' then COMMUTER_TRAIN
  when 'ferry' then FERRY
  when 'funicular' then FUNICULAR
  when 'gondola_lift' then GONDOLA_LIFT
  when 'heavy_rail' then HEAVY_RAIL
  when 'high_speed_train' then HIGH_SPEED_TRAIN
  when 'intercity_bus' then INTERCITY_BUS
  when 'long_distance_train' then LONG_DISTANCE_TRAIN
  when 'metro_rail' then METRO_RAIL
  when 'monorail' then MONORAIL
  when 'other' then OTHER
  when 'rail' then RAIL
  when 'share_taxi' then SHARE_TAXI
  when 'subway' then SUBWAY
  when 'tram' then TRAM
  when 'trolleybus' then TROLLEYBUS
  else
    default_value
  end
end

.validate(value) ⇒ Object



77
78
79
80
81
# File 'lib/google_maps_platform/models/type1.rb', line 77

def self.validate(value)
  return false if value.nil?

  TYPE1.include?(value)
end