27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/easy_pdf_cloud.rb', line 27
def initialize(options)
@options = options
@host = options['host'] || 'https://www.easypdfcloud.com'
@api_host = options['api_host'] || "https://api.easypdfcloud.com"
@version = options['version'] || "v1"
@api_url = "#{@api_host}/#{@version}"
@workflow_url = "#{@api_url}/workflows"
@client_id = options['client_id']
@client_secret = options['client_secret']
@access_token = options['access_token']
@refresh_token = options['refresh_token']
client_options = {
:site => @host,
:authorize_url => '/oauth2/authorize',
:token_url => '/oauth2/token'
}
@client = OAuth2::Client.new(@client_id, @client_secret, client_options)
@access_token = OAuth2::AccessToken.from_hash(@client, {:access_token => @access_token, :refresh_token => @refresh_token})
end
|