Class: FileConvert::Client

Inherits:
Google::APIClient
  • Object
show all
Defined in:
lib/file_convert/client.rb

Constant Summary collapse

APP_OPTIONS =
{
  application_name: 'file-convert',
  application_version: FileConvert::Version::STRING
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFileConvert::Client

Inherits from Google::APIClient Basically wraps authentiation for simple configuration



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/file_convert/client.rb', line 17

def initialize
  gaccount = FileConvert.config['google_service_account']
  gaccount['auth_url'] ||= 'https://www.googleapis.com/auth/drive'

  key = load_key gaccount['pkcs12_file_path'], 'notasecret'
  asserter = get_asserter gaccount['email'], gaccount['auth_url'], key

  super(APP_OPTIONS).tap do |client|
    client.authorization = asserter.authorize
    @drive = client.discovered_api('drive', 'v2')
  end
end

Instance Attribute Details

#driveObject (readonly)

Returns the value of attribute drive.



10
11
12
# File 'lib/file_convert/client.rb', line 10

def drive
  @drive
end