Class: GoogleDrive::ApiClientFetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/google_drive/api_client_fetcher.rb

Defined Under Namespace

Classes: Response

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ApiClientFetcher

Returns a new instance of ApiClientFetcher.



31
32
33
34
35
36
37
# File 'lib/google_drive/api_client_fetcher.rb', line 31

def initialize(client)
  @client = client
  # Sets virtually infinite default timeout because some operations (e.g., uploading
  # a large files/spreadsheets) can take very long.
  @client.connection.options[:timeout] ||= 100000000
  @drive = @client.discovered_api("drive", "v2")
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



39
40
41
# File 'lib/google_drive/api_client_fetcher.rb', line 39

def client
  @client
end

#driveObject (readonly)

Returns the value of attribute drive.



39
40
41
# File 'lib/google_drive/api_client_fetcher.rb', line 39

def drive
  @drive
end

Instance Method Details

#request_raw(method, url, data, extra_header, auth) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/google_drive/api_client_fetcher.rb', line 41

def request_raw(method, url, data, extra_header, auth)
  client_response = @client.execute(
      :http_method => method,
      :uri => url,
      :body => data,
      :headers => extra_header)
  return Response.new(client_response)
end