lib/google/cloud/monitoring/dashboard.rb in google-cloud-monitoring-1.5.0 vs lib/google/cloud/monitoring/dashboard.rb in google-cloud-monitoring-1.6.0

- old
+ new

@@ -53,27 +53,31 @@ # 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 DashboardsService 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 DashboardsService # # Manages Stackdriver dashboards. A dashboard is an arrangement of data display # widgets in a specific layout. # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v1`. + # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`. # @return [::Object] A client object for the specified version. # - def self.dashboards_service version: :v1, &block + def self.dashboards_service version: :v1, transport: :grpc, &block require "google/cloud/monitoring/dashboard/#{version.to_s.downcase}" package_name = Google::Cloud::Monitoring::Dashboard .constants .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") } .first service_module = Google::Cloud::Monitoring::Dashboard.const_get(package_name).const_get(:DashboardsService) + service_module = service_module.const_get(:Rest) if transport == :rest service_module.const_get(:Client).new(&block) end ## # Configure the google-cloud-monitoring-dashboard library.