Sha256: 7397c3766ac9d097e5a0f700e5f743ab9b49f6409fdab7572fab050e52199c8b

Contents?: true

Size: 814 Bytes

Versions: 13

Compression:

Stored size: 814 Bytes

Contents

require 'convert_api/version'
require 'convert_api/configuration'
require 'convert_api/task'
require 'convert_api/client'
require 'convert_api/errors'
require 'convert_api/result'
require 'convert_api/result_file'
require 'convert_api/upload_io'
require 'convert_api/file_param'
require 'convert_api/format_detector'

module ConvertApi
  URI_REGEXP = URI::regexp(%w(http https))
  DEFAULT_URL_FORMAT = 'url'

  module_function

  def configure
    yield(config)
  end

  def config
    @config ||= Configuration.new
  end

  def convert(to_format, params, from_format: nil, conversion_timeout: nil)
    Task.new(from_format, to_format, params, conversion_timeout: conversion_timeout).run
  end

  def user
    client.get('user')
  end

  def client
    Thread.current[:convert_api_client] ||= Client.new
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
convert_api-3.0.0 lib/convert_api.rb
convert_api-2.0.0 lib/convert_api.rb
convert_api-1.4.0 lib/convert_api.rb
convert_api-1.3.2 lib/convert_api.rb
convert_api-1.3.1 lib/convert_api.rb
convert_api-1.3.0 lib/convert_api.rb
convert_api-1.2.1 lib/convert_api.rb
convert_api-1.2.0 lib/convert_api.rb
convert_api-1.1.0 lib/convert_api.rb
convert_api-1.0.4 lib/convert_api.rb
convert_api-1.0.3 lib/convert_api.rb
convert_api-1.0.2 lib/convert_api.rb
convert_api-1.0.1 lib/convert_api.rb