examples/api-samples/samples/sample21.rb in groupdocs-1.5.0 vs examples/api-samples/samples/sample21.rb in groupdocs-1.5.1
- old
+ new
@@ -14,11 +14,11 @@
set :file, params[:file]
begin
# check required variables
- raise "Please enter all required parameters" if settings.client_id.empty? or settings.private_key.empty? or settings.email.empty? or settings.name.empty? or settings.lastName.empty? or settings.file.nil?
+ raise 'Please enter all required parameters' if settings.client_id.empty? or settings.private_key.empty? or settings.email.empty? or settings.name.empty? or settings.lastName.empty? or settings.file.nil?
# construct path
filepath = "#{Dir.tmpdir}/#{params[:file][:filename]}"
# open file
File.open(filepath, 'wb') { |f| f.write(params[:file][:tempfile].read) }
@@ -26,11 +26,11 @@
file = GroupDocs::Storage::File.upload!(filepath, {}, client_id: settings.client_id, private_key: settings.private_key)
# create envelope using user id and entered by user name
envelope = GroupDocs::Signature::Envelope.new
envelope.name = params[:file][:filename]
- envelope.email_subject = "Sing this!"
+ envelope.email_subject = 'Sing this!'
envelope.create!({}, client_id: settings.client_id, private_key: settings.private_key)
# Add uploaded document to envelope
envelope.add_document!(file.to_document, {}, {client_id: settings.client_id, private_key: settings.private_key})
@@ -40,11 +40,11 @@
# Create new recipient
recipient = GroupDocs::Signature::Recipient.new
recipient.email = settings.email
recipient.first_name = settings.name
recipient.last_name = settings.lastName
- recipient.role_id = roles.detect { |role| role.name == "Signer" }.id
+ recipient.role_id = roles.detect { |role| role.name == 'Signer' }.id
# Add recipient to envelope
add = envelope.add_recipient!(recipient, {client_id: settings.client_id, private_key: settings.private_key})
# get recipient id
@@ -59,7 +59,7 @@
rescue Exception => e
err = e.message
end
# set variables for template
- haml :sample21, :locals => { :userId => settings.client_id, :privateKey => settings.private_key, :email => settings.email, :name => settings.name, :lastName => settings.lastName, :iframe => iframe, :err => err }
+ haml :sample21, :locals => {:userId => settings.client_id, :privateKey => settings.private_key, :email => settings.email, :name => settings.name, :lastName => settings.lastName, :iframe => iframe, :err => err}
end