Class: Gcloud::Search::APIClient

Inherits:
Object
  • Object
show all
Defined in:
lib/gcloud/search/api_client.rb

Overview

Temporary substitute for Google::APIClient. Once the Search API is discoverable, initialization of this class in Connection should be replaced with the Google API Client.

Defined Under Namespace

Classes: DiscoveredApi, IndexResourcePath, ResourcePath

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_options) ⇒ APIClient

Creates a new APIClient instance.



30
31
32
33
# File 'lib/gcloud/search/api_client.rb', line 30

def initialize _options
  @connection = Faraday.new request: {
    params_encoder: Faraday::FlatParamsEncoder }
end

Instance Attribute Details

#authorizationObject

:nodoc:



26
27
28
# File 'lib/gcloud/search/api_client.rb', line 26

def authorization
  @authorization
end

#connectionObject

:nodoc:



26
27
28
# File 'lib/gcloud/search/api_client.rb', line 26

def connection
  @connection
end

Instance Method Details

#discovered_api(name, version) ⇒ Object



35
36
37
# File 'lib/gcloud/search/api_client.rb', line 35

def discovered_api name, version
  DiscoveredApi.new name, version
end

#execute(options) ⇒ Object



39
40
41
42
43
# File 'lib/gcloud/search/api_client.rb', line 39

def execute options
  api_method = options[:api_method]
  uri = generate_search_uri api_method[:uri], options
  run api_method[:method], uri, options
end

#inspectObject



45
46
47
# File 'lib/gcloud/search/api_client.rb', line 45

def inspect
  "#{self.class}(#{@project})"
end