Class: Google::Ads::GoogleAds::ServiceLookup

Inherits:
Object
  • Object
show all
Defined in:
lib/google/ads/google_ads/service_lookup.rb

Instance Method Summary collapse

Constructor Details

#initialize(lookup_util, logger, config, credentials_or_channel, endpoint, deprecator) ⇒ ServiceLookup

Returns a new instance of ServiceLookup.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/google/ads/google_ads/service_lookup.rb', line 8

def initialize(
  lookup_util,
  logger,
  config,
  credentials_or_channel,
  endpoint,
  deprecator
)
  @lookup_util = lookup_util
  @logger = logger
  @config = config
  @credentials_or_channel = credentials_or_channel
  @endpoint = endpoint
  @deprecator = deprecator
end

Instance Method Details

#callObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/google/ads/google_ads/service_lookup.rb', line 24

def call
  if logger
    logging_interceptor = GoogleAds::Interceptors::LoggingInterceptor.new(logger)
  end
  error_interceptor = GoogleAds::Interceptors::ErrorInterceptor.new

  version_alternates = {}
  Factories::VERSIONS.each do |v|
    version_alternates[v] = factory_at_version(v, error_interceptor, logging_interceptor)
  end

  highest_factory = factory_at_version(
    Factories::HIGHEST_VERSION,
    error_interceptor,
    logging_interceptor,
  )

  VersionAlternate.new(highest_factory, version_alternates)
end