jondkinney / docusign_rest Goto Github PK
View Code? Open in Web Editor NEWA wrapper gem for the DocuSign REST API
License: MIT License
A wrapper gem for the DocuSign REST API
License: MIT License
The last time version.rb was bumped was 2/3/2014. There are commit with fixes since then.
For instance:
9661e0d
Is fix is not in the gem that is published, this when one installs it has they bug in it.
Hi,
Using the very first example (enveloppe), I keep having this:
{"errorCode"=>"INVALID_ANCHOR_TAB_STRING", "message"=>"The Anchor Tab String Format is invalid. AnchorTabString "" is either empty or is not a single word."}
Any idea?
Great work on this wrapper.
When moving from the Demo environment to Production I ran into issues because the DocuSign Endpoint is issued in the baseUrl which is part of the response from the login.
However this wrapper doesn't use the baseUrl for all subsequent requests instead opting for the static configuration endpoint.
Below is what the DocuSign support team said.
"This is most likely an issue with your baseUrl. In the demo environment all account URLs start with demo.docusign.net, however in production there are multiple sub-domains like www, na2, eu, etc.
To resolve all you need to do is parse the baseUrl value that is returned from the login call (property will be called base_uri if you are using OAuth authentication) and use that for subsequent API requests."
"It’s possible an account’s data center (ie baseUrl) can change though it’s rare. In either case best practice here is to always parse the Login API response you receive and use the user’s baseUrl that is returned in there as that will always be accurate and up to date.
"
Hey there! This gem is great!
I think there is a typo when checking the "enableWetSign" option:
https://github.com/jondkinney/docusign_rest/blob/master/lib/docusign_rest/client.rb#L782
post_hash[:enableWetSign] = options[:wet_sign] if options.has_key? :web_sign # "web_sign" instead of "wet_sign"
I believe this is supposed to be:
options.has_key? :wet_sign
The following line ( client.rb, line 411)
tab_hash[:height] = tab[:height] if tab[:width]
should be
tab_hash[:height] = tab[:height] if tab[:height]
It seems to successfully run:
Finished in 8.313475 seconds.
28 tests, 25 passed, 3 failures, 0 errors, 0 skips, 51 assertions
but at the end the rake fails:
rake aborted!
Command failed with status (1): [C:/Ruby193/bin/ruby.exe -I"lib;lib;test" -...]
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/file_utils.rb:53:in block in create_shell_runner' C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in
call'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in sh' C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in
sh'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/file_utils.rb:82:in ruby' C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in
ruby'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/testtask.rb:99:in block (2 levels) in define' C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:60:in
verbose'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/testtask.rb:98:in block in define' C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in
call'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in block in execute' C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in
each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in execute' C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in
block in invoke_with_call_chain'
C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in mon_synchronize' C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in
invoke_with_call_chain'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in invoke' C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in
invoke_task'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in block (2 levels) in top_level C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in
each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in block in top_level' C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in
standard_exception_handling'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:in top_level' C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:in
block in run'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in standard_exception_handling' C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in
run'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in <top (required)>' C:/Ruby193/bin/rake:23:in
load'
C:/Ruby193/bin/rake:23:in `
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require': cannot load such file -- helper (LoadError) from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
require'
from docusign_rest/configuration_test.rb:1:in `
I am attempting to use the gem to create a document or template, but I get this error:
{"errorCode"=>"INVALID_CONTENT_TYPE", "message"=>"Content Type specified is not supported."}
The code is here: https://gist.github.com/gmhawash/9234892
What could be the issue?
Playing on my localhost-ubuntu-ruby 2.0.0 and developer account on docusign.
After bundle exec rake docusign_rest:generate_config
and providing username,password and integrator key i got this:
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
I am lost, what i am missing?
This should allow the gem to be a bit more self-documenting. Things like needing to use label: instead of tabLabel: can be confusing.
Initially I thought I should try to make the interaction with the gem be more 'ruby-ish', but there's a downside...each of the keys we want to pass need to be implemented in the gem's code instead of allowing them to just be passed through to the API. I just ran into this specific situation where I wanted to set the width and height of a textLabel, and I had to add both width and height in the client.rb under the get_tabs method. This shouldn't be necessary.
I still want to make things easier than interacting with the API directly, for instance, setting some sane defaults for the required fields in case they're not passed. Those fields should be allowed to be overridden by user input of course.
When a document is uploaded, the user should be able to supply multiple signHereTabs. I'm not sure about what design pattern should be used here. the "signers" input can also contain an array of tabs, which can be iterated over to produce the json request. Alternatively, the Client can take in a developer crafted json string (since there are no special "/r/n" needed) and have the file locations specified separately in a second argument.
From my limited understanding of things, I think these are the things that would be good to do and generally should be done in this order:
Hi Jon,
I really appreciate all the work you've put into this gem, and you making it available for us to use.
We have a relatively simple integration (create an envelope from a template that we created on the docusign website, get it signed), and we are just starting the certification process. Part of that process says "Your system should have the ability to capture outgoing request messages and the related responses... This ability need not be active all the time, but should be easily activated..."
I see no way to do that using your gem, have you ever had a need to do that? If so can you share how you did it?
Best,
Brad Bennett
I might be reading this wrong, but client.rb marks get_account_id
as "internal" but it's referenced in the README. I wouldn't care very much except when I set up my config and try to do what I think is the simplest example from the README, I got nothing:
> client.get_account_id
=> nil
> client.account_id
=> "611155" # this isn't my actual ID but it's correct in my console
Maybe better to replace that example with one that hits the API? client.get_login_information
worked great as a smoke test for me, it was nice to see the wrapper return an HTTP response that contained my info.
bundle exec rake docusign_rest:generate_config
rake aborted!
Don't know how to build task 'docusign_rest:generate_config'
(See full trace by running task with --trace)
rake -T
rake build # Build docusign_rest-0.0.3.gem into the pkg directory
rake install # Build and install docusign_rest-0.0.3.gem into system gems
rake release # Create tag v0.0.3 and build and push docusign_rest-0.0.3.gem to Rubygems
rake test # Run tests
@madamkiwi an issue has surfaced after your July 14, 2016 commit
Please accept pull request #85 to fix this issue.
Now that the composite template methods ('create_envelope_from_composite_template' and 'get_composite_template') take an argument for files, there are errors if you don't pass files. The first error will occur in the 'create_file_ios' method because 'each_with_index' will be called on nil.
It's quite common to only use server templates and/or inline templates and not replace them with a different document. Therefore files should be optional.
I only see support for carbonCopies in the method create_envelope_from_document. Is there currently support for carbonCopies recipients in the create_envelope_from_composite_template method?
When running the test suite I'm finding the setup code calling 'create_template' is returning an API error:
{ "errorCode": "UNSPECIFIED_ERROR", "message": "The header name format is invalid." }
Wondering if anyone else has experienced this issue and how they fixed it?
As the title says, we upgraded multipart-post gem to 2.0.0 and now get an Argument Error (4 for 3) when using the create_envelope_from_document method (only one tested). Downgrading to multipart-post 1.2.0 seems to fix the issue. Has anyone else had this problem?
I always to get the error
{ "errorCode": "UNKNOWN_ENVELOPE_RECIPIENT", "message": "The recipient you have identified is not a valid recipient of the specified envelope. Envelope recipient could not be determined. 'clientUserId', 'email', or 'userName' in request and envelope may not match." }
when I call client.get_recipient_view
unless I explicitly set client_id:
to blank/nil when I'm making the call. The code sets clientUserId to the email by default and that seems to be tripping me up.
I looked into it further and I think the issue arises from the assumption that only those who set embedded: true when creating signers will call get_recipient_view
and that's not true in my case.
Hi there,
I'm working on integrating docusign into a project and we would live to use callbacks. I see some code for event notifications but there's a todo comment near it. What is the status of this code? Is it usable at all? Thanks.
Hi,
I have been tasked with adding a dynamically generated attachment to a docusign envelope and then send the document. Currently there is the add_envelope_document method, however that requires a document ID, which obviously doesn't work if you're generating the on the fly.
I took a look at the documentation (https://docs.docusign.com/esign/restapi/Envelopes/EnvelopeAttachments/create/) and found that this should work. I wrote this up, but I wanted to see if this was an addition that anybody else wants? It's basically just a different version of add_envelope_document except it takes a base64 encoded string.
This may be related to #57, but I'm getting an INVALID_CONTENT_TYPE
error when calling create_envelope_from_document
, but only when it's the first call on the client.
For example, this fails every time:
client = DocusignRest::Client.new(access_token: token)
client.create_envelope_from_document(
signers: signers,
files: [ { path: '/path/to/my.pdf', name: 'my.pdf' } ]
)
# => {"errorCode"=>"INVALID_CONTENT_TYPE", "message"=>"Content Type specified is not supported."}
But this works every time:
client = DocusignRest::Client.new(access_token: token)
# Making another call first makes this work
client.get_account_id
client.create_envelope_from_document(
signers: signers,
files: [ { path: '/path/to/my.pdf', name: 'my.pdf' } ]
)
# => {"envelopeId"=>"66367318-d662-4f2f-b44f-f1d8b4e47211", "uri"=>"/envelopes/66367318-d662-4f2f-b44f-f1d8b4e47211", "statusDateTime"=>"2017-08-02T00:25:30.9070000Z", "status"=>"created"}
I'm trying to require a wet signature for signers using create_envelope_from_document
. However, I noticed that the requireSignOnPaper
option is only applied when using a composite template (set in get_inline_signers).
I imagine we could simply add that logic to get_signers
above this line
Before I make the change was this an oversight or a true limitation of DocuSign's API? I don't have a production API key yet so the feature seems to be turned off when I test the change on the Sandbox from my forked version.
When attempting to create an envelope from a template using your example code, if I only have the signers node in the request I get this error:
{"errorCode"=>"RECIPIENTS_NOT_PROVIDED", "message"=>"No recipients were found in the request."}
If I embed the signers node inside a recipients node the client errors out on a each_with_index for nil expecting the signers node.
Please help.
Is there any option to create docusign template from url instead of path?
Hi, I signed up as a free user to integrate docusign with my rails app, but unfortunately, I couldn't get integrator_key anywhere? How can I get it?
in order to get the iframe breakout redirec to work with Internet Explorer I had to use it as follows:
render :text => utility.breakout_path(some_path), content_type: Mime::HTML
using a content_type of :html did not work on our app (Rails 3.2.8)
Is there a way to log/capture the raw HTTP requests and responses that go out and come in ? I tried installing (https://github.com/railsware/http_logger) but no luck. I'm sure this would be a commonly used feature since Docusign requires the submission of raw sample requests as part of their certification process.
In one of our DocuSign template we have two signers. For the first signer there is a text field need to be filled first.
I tried to call the DocuSign API, here is the code snippet.
client = DocusignRest::Client.new
@envelope_response = client.create_envelope_from_template(
status: 'sent',
email: {
subject: "The test email subject envelope",
body: "Envelope body content here"
},
template_id: "cf2a5306-xxxx-4ee5-xxxx-xxxxxxxxxx",
signers: [
{
embedded: false,
name: 'Sxxxx Mxxxx',
email: '[email protected]',
role_name: 'Issuer',
text_tabs: [
{
label: 'full_name',
name: 'full_name',
value: 'Another Person Name'
}
]
},
{
embedded: false,
name: 'Another Person',
email: '[email protected]',
role_name: 'Attorney',
text_tabs: [
{
label: 'Full Name',
name: 'Full Name',
value: 'John Doe'
}
]
}
]
)
But unfortunately it is not working. Please suggest what did I miss?
Hi, your API is really awesome, but I'm wondering are those three property work now? It seems that it doesn't work in my code. Thanks!
I'm trying out the gem in rails console, and am not able to get a value other than nil for @url.
client = DocusignRest::Client.new
@url = client.get_recipient_view(
envelope_id: 3c2f6852-edc2-4352-b62c-98f110dc076e",
name: "John",
email: "[email protected]",
return_url: 'http://google.com'
)
I would like to suggest that you use the embedded check in the get_inline_signers method before assigning the clientUserId attribute as you do in the get_signers method. Otherwise DocuSign doesn't send out an email to the signer.
If I set embedded: true Embedded signing URL is successfully returned by DocuSign but there is NO email link sent to the Signers email.
What should I do to do both? Embedded signing + send email link
Any thoughts on adding rate limiting to the Client?
[API Call Limits](https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#GettingStarted/API Call Limits.htm) and API Best Practices
applications are not allowed to poll for envelope status more than once every 15 minutes
:routing_order
, which I noticed is actually supported already from this particular lines of code:routing_order
works in my "developer" Docusign account.docusign_rest
gem though he/she didn't answer how he/she solved it) https://support.docusign.com/en/answers/00009385There doesn't seem to be a environment configurable way to specify the endpoint to be www.docusign.net in production? The way I do it now is instantiate the client with the endpoint specified. Is there a better way that is config/env based?
DocusignRest::Client.new(:endpoint => "https://www.docusign.net/restapi")
Hello there - I saw your note and would like to help maintaining this, so let me know what I can do to help!
How do I download a completed signed document from DocuSign?
Does this gem gives us the ability to download the document from envelop?
Is there any other way to download the documents?
If yes, how can it be achieved?
I have 2 signers on my document template that each have some custom fields, I duplicate them because there seems to be no way to have common custom fields since DocuSign asks that you specify a signer for your fields
So I add these custom fields to each signer in my envelope request, but they don't show up in the document when I go view it.
custom_fields = {
host_address: "Testing Host Address",
host_civil_status: "Host Civil Status",
host_id_number: "123HOSTID",
host_tax_number: "123HOSTTAX",
nomad_address: "Testing Nomad Address",
nomad_civil_status: "Nomad Civil Status",
nomad_id_number: "123NOMADID",
nomad_tax_number: "123NOMADTAX",
property_address: booking.listing.property.full_address,
property_deposit: (booking.deposit * booking.price).to_s,
property_description: "Property Description",
property_start_date: booking.start_date.strftime("%d/%m/%Y"),
property_end_date: booking.end_date.strftime("%d/%m/%Y"),
property_stay_length: distance_of_time_in_words(booking.start_date, booking.end_date),
property_montly_rent: booking.price.to_s,
}
@envelope = client.create_envelope_from_template(
status: 'sent',
email: {
subject: "The test email subject envelope",
body: "Envelope body content here"
},
template_id: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
signers: [
{
embedded: true,
name: booking.listing.user.name,
email: booking.listing.user.email,
role_name: 'Host',
custom_fields: custom_fields
},
{
embedded: true,
name: booking.user.name,
email: booking.user.email,
role_name: 'Nomad',
custom_fields: custom_fields
}
]
)
I'm trying to figure out how to retrieve a signed document from an envelope using the get_document_from_envelope
method, immediately after completing embedded signing.
I can successfully get a document signed (I know because I've received it through email) and successfully break out of the iframe. However, I'm trying to retrieve the signed document using the get_document_from_envelope
immediately after the signing ceremony.
My code is below. The problem I'm facing is that the document that's ultimately saved to my local drive is the unsigned version. Is there any way to get the signed version while remaining within the embedded_signing
controller action? The reason I'd like to do it within that action is that the envelopeId is then easily retrievable via the @envelope_response
object.
The only other option I can see is setting up a chron task in which I periodically get a list of envelopes in the Completed folder (I suppose through a get_list_of_envelopes
API call?), and then iterate through the resulting set of envelopeID's using get_document_from_envelope
. Seems like it would be a lot easier to do this right after each signing ceremony
def embedded_signing
# @envelope_response is created successfully from client.create_envelope_from_document
@url = client.get_recipient_view(
envelope_id: @envelope_response["envelopeId"],
name: @request.signer_name,
email: @user.email,
return_url: "http://localhost:3000/users/docusign_response"
)
client.get_document_from_envelope(
envelope_id: @envelope_response["envelopeId"],
document_id: 1,
local_save_path: "#{Rails.root.join('forms/'[email protected]_s+'.pdf')}"
)
end
def docusign_response
utility = DocusignRest::Utility.new
if params[:event] == "signing_complete"
flash[:notice] = "Thanks! Successfully signed. Please check your email for the signed form."
render :text => utility.breakout_path(root_path), content_type: :html
else
flash[:notice] = "You chose not to sign the document."
render :text => utility.breakout_path(root_path), content_type: :html
end
end
I have an app that requires me to upload to S3, but I would like to be able to submit some of these documents to Docusign for embedded signing. I can read the file from S3, but the examples in the gem are all opening a file from local storage, which doesn't necessarily exist when using S3.
Safe to assume radio groups are not implemented? Are there any plans to do so?
docusign_rest/lib/docusign_rest/client.rb
Line 357 in 24be496
I want create the envelop but get this
'{\r\n "errorCode": "INVALID_CONTENT_TYPE",\r\n "message": "Content Ty
pe specified is not supported."\r\n}' }
this is the code
var CRLF = '\r\n';
var form = new FormData();
var filename = "test.pdf";
var documentId = Date.now();
var recipientId = settings.accountID;
var json_data_options = {
header: CRLF + '--' + form.getBoundary() + CRLF + 'Content-Type: application/json' + CRLF
};
for(var key in args.signers){
args.signers[key].recipientId = recipientId;
}
var json_data = {
"status":"sent",
"emailBlurb":"Test Email Body",
"emailSubject": "Test Email Subject - EnvelopeDefFull",
"documents": [{
"name": filename,
"documentId": documentId,
"order":"1"
}],
"recipients": {
"signers" : args.signers
}
};
form.append("form-data", JSON.stringify(json_data), json_data_options);
var file_options = {
header: CRLF + '--' + form.getBoundary() + CRLF + 'Content-Type: application/pdf' + CRLF
};
form.append('file: filename="' + filename + '";documentId='+ documentId, args.file, file_options);
var options = {
method: "POST",
uri: settings.baseUrl + "/accounts/" + settings.accountID + "/envelopes",
headers: {
"X-DocuSign-Authentication": JSON.stringify({
Username: settings.username,
Password: settings.password,
IntegratorKey: settings.integrationKey
}),
"Accept": "application/json",
"Content-Type": "multipart/form-data; boundary=" + form.getBoundary()
},
form: form
};
return new Promise(function(resolve, reject){
request(options, function(error, response, body){
if (!error && response.statusCode == 200) {
resolve(JSON.parse(body));
} else {
error = {
error: error,
response: response,
body:body
};
reject(error);
}
});
});
what can be a problem?
I try add the accountID into headers but it doesn't help
The gem version is still 0.1.1. Does it need to be updated so that new Gem version flows in on bundle update?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.