Class: FileConvert::Client
- Inherits:
-
Google::APIClient
- Object
- Google::APIClient
- FileConvert::Client
- Defined in:
- lib/file_convert/client.rb
Constant Summary collapse
- APP_OPTIONS =
{ application_name: 'file-convert', application_version: FileConvert::Version::STRING, # Retry request **once** in case authorization failed retries: 1 }
Instance Attribute Summary collapse
-
#drive ⇒ Object
readonly
Returns the value of attribute drive.
Instance Method Summary collapse
-
#initialize ⇒ FileConvert::Client
constructor
Inherits from Google::APIClient Basically wraps authentiation for simple configuration.
Constructor Details
#initialize ⇒ FileConvert::Client
Inherits from Google::APIClient Basically wraps authentiation for simple configuration
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/file_convert/client.rb', line 20 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' = APP_OPTIONS.merge(authorization: ( gaccount['email'], gaccount['auth_url'], key )) super().tap do |client| client..fetch_access_token! @drive = client.discovered_api 'drive', 'v2' end end |
Instance Attribute Details
#drive ⇒ Object (readonly)
Returns the value of attribute drive.
13 14 15 |
# File 'lib/file_convert/client.rb', line 13 def drive @drive end |