Module: ConvertApi
- Defined in:
- lib/convert_api.rb,
lib/convert_api/task.rb,
lib/convert_api/client.rb,
lib/convert_api/errors.rb,
lib/convert_api/result.rb,
lib/convert_api/version.rb,
lib/convert_api/upload_io.rb,
lib/convert_api/file_param.rb,
lib/convert_api/result_file.rb,
lib/convert_api/configuration.rb,
lib/convert_api/format_detector.rb
Defined Under Namespace
Modules: FileParam
Classes: Client, ClientError, Configuration, ConnectionFailed, Error, FileNameError, FormatDetector, FormatError, Result, ResultFile, SecretError, Task, TimeoutError, UploadIO
Constant Summary
collapse
- URI_REGEXP =
URI::regexp(%w(http https))
- DEFAULT_URL_FORMAT =
'url'
- USE_THREADS =
true
- VERSION =
'1.1.2'
Class Method Summary
collapse
Class Method Details
.client ⇒ Object
36
37
38
|
# File 'lib/convert_api.rb', line 36
def client
Thread.current[:convert_api_client] ||= Client.new
end
|
.config ⇒ Object
24
25
26
|
# File 'lib/convert_api.rb', line 24
def config
@config ||= Configuration.new
end
|
20
21
22
|
# File 'lib/convert_api.rb', line 20
def configure
yield(config)
end
|
.convert(to_format, params, options = { }) ⇒ Object
28
29
30
|
# File 'lib/convert_api.rb', line 28
def convert(to_format, params, options = { })
Task.new(options[:from_format], to_format, params, :conversion_timeout => options[:conversion_timeout]).run
end
|
.user ⇒ Object
32
33
34
|
# File 'lib/convert_api.rb', line 32
def user
client.get('user')
end
|