I am trying to implement Adobe's Creative SDK into my Ruby on Rails app.
https://creativesdk.adobe.com/docs/web/#/articles/highresolution/index.html
I have the required access to the hi-res API.
The examples they have are for PHP and Node.js, and I am trying to write a Ruby on Rails version based on the PHP. I have it all setup, in that it's properly calling the "authenticationURL" but I'm getting an "Invalid authenticationURL response. Please check the formatting the response."
I'm new to programming at this level and basically tried to figure this out by referencing a few questions on PHP & Ruby here as well sites like http://www.phptoruby.com/.
Here is the PHP:
<!-- /getAuth -->
<?php
$apiKey = "apikey";
$apiSecret = "apisecret";
$salt = rand(0,1000);
$time = time();
$sig = sha1($apiKey . $apiSecret . $time . $salt);
$authObj = array(
"apiKey" => $apiKey,
"salt" => $salt,
"timestamp" => $time,
"encryptionMethod" => 'sha1',
"signature" => $sig
);
echo json_encode($authObj);
?>
Here is what I have at the moment (with my apikey and apisecret entered correctly):
require 'time'
require 'json'
require 'digest/sha1'
def get_auth
apiKey = 'apikey'
apiSecret = 'apisecret'
salt = "#{0 + rand(1000)}"
time = "#{Time.now.to_i}"
sig = Digest::SHA1.hexdigest('apiKey' + 'apiSecret' + 'time' + 'salt')
authObj = { :apiKey => 'apiKey',
:salt => 'salt',
:timestamp => 'time',
:encryptionMethod => 'sha1',
:signature => 'sig' }
print 'authObj'.to_json
render :fxb
end
I'm not sure if using print
is correct here? Or if my problem is a syntax issue... Or something else entirely.