lib/ads_common/api.rb
def service(name, version = nil)
      name = name.to_sym
      version = (version.nil?) ? api_config.default_version : version.to_sym
      environment = @config.read('service.environment')

      # Check if the combination is available.
      validate_service_request(environment, version, name)

      # Try to re-use the service for this version if it was requested before.
      wrapper = if @wrappers.include?(version) && @wrappers[version][name]
        @wrappers[version][name]
      else
        @wrappers[version] ||= {}
        @wrappers[version][name] = prepare_wrapper(version, name)
      end
      return wrapper
    end
# Obtain an API service, given a version and its name.
#
# Args:
# - name: name for the intended service
# - version: intended API version.
#
# Returns:
# - the service wrapper for the intended service.
#
Obtain an API service, given a version and its name.
Args:
name: name for the intended service
version: intended API version.

the service wrapper for the intended service.
Obtain an API service given a version and its name . Args : name : name for the intended service version : intended API version . the service wrapper for the intended service .
def service(name, version = nil)
      name = name.to_sym
      version = (version.nil?) ? api_config.default_version : version.to_sym
      environment = @config.read('service.environment')
      validate_service_request(environment, version, name)
      wrapper = if @wrappers.include?(version) && @wrappers[version][name]
        @wrappers[version][name]
      else
        @wrappers[version] ||= {}
        @wrappers[version][name] = prepare_wrapper(version, name)
      end
      return wrapper
    end
def service ( name , version = nil ) name = name . to_sym version = ( version . nil? ) ? api_config . default_version : version . to_sym environment = @config . read ( 'service.environment' ) validate_service_request ( environment , version , name ) wrapper = if @wrappers . include? ( version ) && @wrappers [ version ] [ name ] @wrappers [ version ] [ name ] else @wrappers [ version ] ||= { } @wrappers [ version ] [ name ] = prepare_wrapper ( version , name ) end return wrapper end
Obtain an API service, given a version and its name.
Obtain an API service given a version and its name .
# Check if the combination is available. # Try to re-use the service for this version if it was requested before.
name
version