Module: Google::Maps::FleetEngine

Defined in:
lib/google/maps/fleet_engine.rb,
lib/google/maps/fleet_engine/version.rb

Constant Summary collapse

VERSION =
"1.0.1"

Class Method Summary collapse

Class Method Details

.trip_service(version: :v1, transport: :grpc, &block) ⇒ ::Object

Create a new client object for TripService.

By default, this returns an instance of Google::Maps::FleetEngine::V1::TripService::Client for a gRPC client for version V1 of the API. However, you can specify a different API version by passing it in the version parameter. If the TripService service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

About TripService

Trip management service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/google/maps/fleet_engine.rb', line 52

def self.trip_service version: :v1, transport: :grpc, &block
  require "google/maps/fleet_engine/#{version.to_s.downcase}"

  package_name = Google::Maps::FleetEngine
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Maps::FleetEngine.const_get(package_name).const_get(:TripService)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.vehicle_service(version: :v1, transport: :grpc, &block) ⇒ ::Object

Create a new client object for VehicleService.

By default, this returns an instance of Google::Maps::FleetEngine::V1::VehicleService::Client for a gRPC client for version V1 of the API. However, you can specify a different API version by passing it in the version parameter. If the VehicleService service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

About VehicleService

Vehicle management service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v1)

    The API version to connect to. Optional. Defaults to :v1.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



86
87
88
89
90
91
92
93
94
95
96
# File 'lib/google/maps/fleet_engine.rb', line 86

def self.vehicle_service version: :v1, transport: :grpc, &block
  require "google/maps/fleet_engine/#{version.to_s.downcase}"

  package_name = Google::Maps::FleetEngine
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Maps::FleetEngine.const_get(package_name).const_get(:VehicleService)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end