Giter Site home page Giter Site logo

docusign / docusign-esign-ruby-client Goto Github PK

View Code? Open in Web Editor NEW
66.0 21.0 62.0 3.67 MB

The Official DocuSign Ruby Library used to interact with the eSign REST API. Send, sign, and approve documents using this client.

License: MIT License

Ruby 99.98% Shell 0.02%

docusign-esign-ruby-client's Introduction

The Official DocuSign eSignature Ruby Client SDK

[![RubyGems version][rubygems-image]][rubygems-url] [![RubyGems downloads][downloads-image]][downloads-url] [![Build status][travis-image]][travis-url]

Requirements

Compatibility

  • Ruby 1.9+

Installation

This SDK is provided as open source, which enables you to customize its functionality to suit your particular use case. To do so, download or clone the repository. If the SDK’s given functionality meets your integration needs, or if you’re working through our code examples from the DocuSign Developer Center, you merely need to install it by following the instructions below.

Installation via your application's Gemfile:

  1. In your application's Gemfile, add:
    gem 'docusign_esign'
  2. Open your preferred console.
  3. In your project directory, execute the installer by typing: bundle install

Manual installation:

  1. Open your preferred console.
  2. In the console, type: gem install docusign_esign

Dependencies

This client has the following external dependencies:

  • Jwt>=1.5.2
  • Json>=2.1.0
  • Typhoeus>=1.0.1

Code examples

You can find on our GitHub a self-executing package of code examples for the eSignature C# SDK, called a Launcher, that demonstrates common use cases. You can also download a version preconfigured for your DocuSign developer account from Quickstart. These examples can use either the Authorization Code Grant or JSON Web Token (JWT) authentication workflows.

OAuth implementations

For details regarding which type of OAuth grant will work best for your DocuSign integration, see Choose OAuth Type in the DocuSign Developer Center.

For security purposes, DocuSign recommends using the Authorization Code Grant flow.

Support

Log issues against this client through GitHub. We also have an active developer community on Stack Overflow.

License

The DocuSign eSignature Ruby Client SDK is licensed under the MIT License.

Additional resources

docusign-esign-ruby-client's People

Contributors

asif-docusign avatar cameronloewen avatar dbbrahmbhatt avatar diegous avatar eleanorharris avatar ergin008 avatar garg-mudit avatar gsnavin avatar gurgelrenan avatar harsharahul avatar hobbyprojects avatar inbargazit avatar karissarjacobsen avatar kenharris avatar larryklugerds avatar mattkingds avatar mmallis87 avatar rajrele avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docusign-esign-ruby-client's Issues

Authenticating docusign via Rails API (Omniauth + Devise) + JS Frontend

I'm trying to create an authentication flow using Auth Code Grant where I've added necessary omniauth strategy for Docusign to create /auth/docusign routes in Rails API only application.

Here are the steps followed
I'm issuing a request to the route from VueJS client.
window.open("http://localhost:4000/auth/docusign", "targetWindow", "width=350,height=250")

After user enters credentials and on successful login I'm calling the callback:

class SessionsController < Devise::SessionsController
  def docusign
    internal_destroy
    @success = false
    userinfo = request.env['omniauth.auth']
    request_info = request.env['omniauth.params'] 
    if userinfo
      info = userinfo.info
      cred = userinfo.credentials
      user = User.find_by(email: info['email']) || User.find_by(id: session[:user_id])
      if user
        organization = user.organization
        organization.organization_providers.where(provider_name: 'Docusign').destroy_all
        OrganizationProvider.create(email: info['email'], token_expires_at: Time.at(cred['expires_at']), token_expires_at: Time.now, provider_name: 'Docusign', organization_id: organization.id, token: cred.token)
        @success = true
      end 
    end 
    render 'sessions/docusign'      
  end
end

I'd like to pass some params (which I'm accessing in the callback as request.env['omniauth.params']) for executing some backend tasks in the method.
When I try window.open("http://localhost:4000/auth/docusign?email='"+email+"'", "targetWindow", "width=350,height=250")

It says that the url doesn't match with any redirect urls

I have also tried passing in redirect_to('/auth/docusign', query: query) but on doing so, it doesn't open in a browser due to CORS.

I'm also trying to set it in session cookie, but since it's an API only server, I'm still working towards setting up cookie store.

Question
Which is the best way to achieve this? To pass some params in the callback and retrieve it.

Then the execution flow continues on the Rails server and the window serves a page with an appropriate response as per authentication status. However during this time, the client window which started the request is not aware of the authentication outcome.

Question
How can I communicate to the VueJS client that the authentication process is completed?

Question
Am I doing the above flow correctly or are there any better ways to achieve the same?

Thanks in advance

Client doesn't properly handle ScaleValue attribute

This occurs with DocuSign_eSign::SignHere and DocuSign_eSign::InitialHere models.

Current behavior:

=> DocuSign_eSign::SignHere.new.build_from_hash(scaleValue: 0.5).scale_value
nil

Temporary Fix:

module FixSwaggerTypes
  def self.included(base)
    base.class_eval do
      class << self
        alias _swagger_types swagger_types
        def swagger_types
          _swagger_types.merge(
            scale_value: :Float
          )
        end
      end
    end
  end
end

class DocuSign_eSign::SignHere
  include FixSwaggerTypes
end

class DocuSign_eSign::InitialHere
  include FixSwaggerTypes
end

Unable to set 'expires_in' for token

When I generate my token:

 api_client.request_jwt_user_token(
      ENV["DOCUSIGN_JWT_INTEGRATION_KEY"],
      ENV["DOCUSIGN_IMPERSONATED_USER_GUID"],
      ENV["DOCUSIGN_RSA_PRIVATE_KEY"],
      60,
      "signature impersonation"
    )

It doesn't matter what the 4th arg is. The code always sets it to 3600.

Also, for what it's worth, the syntax of the example here https://developers.docusign.com/docs/esign-rest-api/sdk-tools/ruby/auth/ (token = api_client.request_jwt_user_token(Rails.configuration.jwt_integration_key, Rails.configuration.impersonated_user_guid, rsa_pk, expires_in=3600, "signature impersonation")) does not need the expires_in=.

No Error response on void envelope request

Request:
ETHON: performed EASY effective_url=https://demo.docusign.net/restapi/v2.1/accounts/xxxxxx/envelopes/9316039f-7e71-483f-ae3b-d1613970505c response_code=0 return_code=ok total_time=0.000605

Response:
#<DocuSign_eSign::ApiError: No error>

Body:
#<DocuSign_eSign::Envelope:0x000055c0aa572f40 @status="voided", @voided_reason="Test">

Code:

def void_envelope(options = {})
  retry_count ||= 0
  envelope = DocuSign_eSign::Envelope.new
  envelope.status = 'voided'
  envelope.voided_reason = 'Test'
  envelope_api.update(account_id, options[:envelope_id], envelope)
rescue DocuSign_eSign::ApiError => e
  Rails.logger.info "exception #{e.inspect}"
  raise if retry_count > 0
  retry_count += 1
  retry
end

API Dashboard:

API logs

Skipping envelope_api definition code as it is standard instance method of DocuSign_eSign::EnvelopesApi
I don't see any logs on DocuSign API Dashboard page.
Same request works on retry.
Same request works fine always with V2 version and no gem setup.

I am not sure how to debug this further without proper error details. Please help. Thanks.

Further sdk development question

Thank you for providing this sdk. We were just about to start writing our own when we found this.

I had some ideas for contributing back to this repo. Is that someone you would welcome, or do you plan to simply regenerate using swagger as the api gets updated?

Tabfield with spaces

Hello. I am sending a text tab field for a last name that is multiple words separated by space. In the envelope after creation the form data is showing me that only the 2nd word of the 3 I have sent is parsed out. My network traces confirm that the name is intact when it leaves my server.

Is there some special way we're supposed to deal with those kind of values?

Why is the gem bigger than rails ?

I am currently investigating memory usage on my rails app. I ran a check (bundle exec derailed bundle:mem) to see memory at load time, and discovered that docusign was 46Mb which is a lot (rails is 34Mb and most gems are between 1 and 3 Mb).

Have you investigated why ?

List documents api always returning first document

I am fetching documents for a template templates_api.list_documents(account_id, template_id) which I plan to iterate and fetch document preview images to show by templates_api.get_document_page_image(account_id, document_id, (page_id, template_id).

However I'm getting only the first document as response to list_documents api.
Tried it with templates with pdf files with multiple pages.

gem 'docusign_esign', '~> 3.3.0'

Fail to resend envelopes to recipient using update_recipient method.

Hi there,

We tried to resend envelope to recipients but got DocuSign_eSign::ApiError (Bad Request) in the response using DocuSign ruby client.

I tried to check DocuSign API dashboard but couldn't locate the error. Is this a bug? We tested this code weeks ago and it was working fine back then.

def update_recipients(envelope_id, recipients)
      options = DocuSign_eSign::UpdateRecipientsOptions.new
      options.resend_envelope = true
      envelope_api.update_recipients(DOCUSIGN_ACCOUNT_ID, envelope_id, recipients, options)
[2021-06-09T23:55:35.001909 #1778] DEBUG -- : ETHON: performed EASY effective_url=https://account-d.docusign.com/oauth/token response_code=200 return_code=ok total_time=0.240809
D, [2021-06-09T23:55:35.224072 #1778] DEBUG -- : ETHON: performed EASY effective_url=https://demo.docusign.net/restapi/v2.1/accounts/13114371/envelopes/bbb8dc41-b4a5-4ad6-84b6-da5a1f4befa6/recipients response_code=200 return_code=ok total_time=0.220226
D, [2021-06-09T23:55:35.499727 #1778] DEBUG -- : ETHON: performed EASY effective_url=https://account-d.docusign.com/oauth/token response_code=200 return_code=ok total_time=0.270668
D, [2021-06-09T23:55:35.729664 #1778] DEBUG -- : ETHON: performed EASY effective_url=https://demo.docusign.net/restapi/v2.1/accounts/13114371/envelopes/bbb8dc41-b4a5-4ad6-84b6-da5a1f4befa6/recipients?resend_envelope=true response_code=400 return_code=ok total_time=0.228156
Traceback (most recent call last):
        5: from (irb):11
        4: from app/commands/disputes/abstract_command.rb:14:in `call'
        3: from app/commands/disputes/resend_wsud_form.rb:9:in `call'
        2: from app/services/docusign_service.rb:51:in `update_recipients'
        1: from app/services/docusign_service/client.rb:33:in `update_recipients'
DocuSign_eSign::ApiError (Bad Request)

Support for DocuSign API 2.1

We would like to take advantage of some of the new filtering capabilities available in version 2.1 of the API. When are you guys planning on getting the API updates into the gem?

Failed sending data to the peer on create_envelope endpoint

We recently switched to V2.1 API and are using this gem. We are seeing "Failed sending data to the peer" intermittently for create_envelope api. Same request works on second/third attempt.

ETHON: performed EASY effective_url=https://demo.docusign.net/restapi/v2.1/accounts/xxxxx/envelopes response_code=0 return_code=send_error total_time=0.000478

Same request works fine all the time if we fallback to Api version V2 and no gem. So my understanding is that something is causing this issue in new setup, either API V2.1 or docusign_esign gem.

Has anyone seen this issue? Any pointers will be appreciated.
Thanks.

Bad request

Hi,

While trying to login using the sample code on the readme I am getting an error:

ETHON: Libcurl initialized
ETHON: performed EASY effective_url=https://account-d.docusign.com/oauth/token  response_code=400 return_code=ok total_time=0.436539
DocuSign_eSign::ApiError: Bad Request
from /home/dev/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/docusign_esign-1.0.0/lib/docusign_esign/api_client.rb:66:in `call_api'
from /home/dev/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/docusign_esign-1.0.0/lib/docusign_esign/api_client.rb:410:in `configure_jwt_authorization_flow'

Any ideas why I am getting this?

Thanks,
Ben

Authenticate multiple users with their docusign account within your application

One use case that I'm working on currently is to allow users to authenticate their docusign account within our application.
I'm following the authentication code grant.

For that to work, I'm setting few config variables in application.rb for example client_id, client_secret etc.
The callback that takes place through to /oauth/auth uses these values set in config in the request url for authentication.

For authentication to take place for various users, do we need to capture their client_id, client_secret in a form and then needs to be overridden in Docusign client?
Or am I using a wrong strategy here?

Client doesn't properly handle Dropdown

I'm getting this error while loading a template that contains listTabs:

#<NoMethodError: undefined method build_from_hash' for []:Array>`

image

Context of the lib/docusign_esign/models/tabs.rb:430:

=> # def _deserialize(type, value)
=> type
"Array"
=> value
{:listItems=>[{:text=>"Sample TEXT", :value=>"SAMPLE VALUE", :selected=>"false"}, {:text=>"Other (Please specify)", :value=>"Other (Please specify)", :selected=>"false"}, {:text=>"Select", :value=>"Select", :selected=>"true"}], :value=>"Select", :width=>153, :shared=>"false", :required=>"false", :locked=>"false", :requireAll=>"false", :tabLabel=>"business_structure", :font=>"lucidaconsole", :bold=>"false", :italic=>"false", :underline=>"false", :fontColor=>"black", :fontSize=>"size10", :documentId=>"XXXXXX", :recipientId=>"XXXXXXXX", :pageNumber=>"3", :xPosition=>"42", :yPosition=>"360", :tabId=>"XXXXXXX", :templateLocked=>"false", :templateRequired=>"false"}
=> DocuSign_eSign::VERSION
"1.0.2"

envelope_api update_document not working as expected

Hi there,

I'm trying to add a new document to my envelope using update_document, however I'm unsure of what to pass in for the document_file_bytes. The documentation is quite vague. I've tried just passing in the bytes, I've tried passing in base 64 encoded bytes and I've tried passing in a DocuSign_eSign::Document.

All of these return the same error The request contained at least one invalid parameter. A filename was not found in the Content-Disposition header ('filename=\\\"filename.ext\\\"\"}

Passing in the bytes doesn't give me an option to set the content-disposition header anywhere. I would've expected to have to pass in a DocuSign_eSign::Document at this point rather as it gives the option to attach the filename etc..

For now I've resolved this by using update_documents and just passing in one document. However I'd like to use update_document as I expect it's probably a less expensive call.

json gem dependency is out of date.

The gemspec for this client has:
s.add_runtime_dependency 'json', '~> 1.8', '>= 1.8.3'
Running the stock swagger code gen today creates:
s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'.

We have another code gen library we are trying use alongside this one, and the above discrepancy is making that impossible.

Version 1.8.3 of the json gem is from 2015. I am not certain what the changes are from then until today. I am not finding a changelog that would tell us.

endpoint /oauth/user_info return 302

when I call /oauth/user_info, receive 302, but the content doesn't help

Connection #0 to host account-d.docusign.com left intact
ETHON: performed EASY effective_url=https://account-d.docusign.com/oauth/token response_code=200 return_code=ok total_time=1.405751
HTTP response body ~BEGIN~
{"access_token":[filtered],"token_type":"Application","expires_in":28800}
~END~

Found bundle for host account-d.docusign.com: 0x7f7a9ce69790 [can pipeline]
Re-using existing connection! (#0) with host account-d.docusign.com
Connected to account-d.docusign.com (64.207.216.101) port 443 (#0)
�����GET /restapi/oauth/ HTTP/1.1
Host: account-d.docusign.com
Accept: */*
User-Agent: Swagger-Codegen/3.0.0/ruby
Content-Type: application/json
Authorization: Application [filtered]
X-DocuSign-SDK: Ruby

���HHTTP/1.1 302 Found
Cache-Control: no-cache
Pragma: no-cache
Content-Type: text/html; charset=utf-8
Expires: -1
Location: https://account-d.docusign.com/
Server: Microsoft-IIS/8.5
X-AspNetMvc-Version: 5.2
X-DocuSign-TraceToken: f74e9a5e-8cf0-49a2-9277-8a65c31c6f2c
Content-Security-Policy-Report-Only: script-src  'unsafe-eval' 'self'; report-uri /client-errors/csp/report
Content-Security-Policy: script-src 'unsafe-inline' 'unsafe-eval' 'self';style-src 'unsafe-inline' 'self';img-src data: https://docucdn-a.akamaihd.net 'self' https://*.docusign.com https://*.docusign.net https://www.docusign.com.au https://www.docusign.co.uk https://www.docusign.ca;font-src 'self' https://* data:;connect-src 'self' data:;object-src 'none';media-src 'none';frame-src https://docusign.sjv.io https://*.docusign.com; report-uri /client-errors/csp/enforce
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block; report=/client-errors/xss
X-DocuSign-Node: SE2DFE2
Date: Mon, 02 Dec 2019 21:27:49 GMT
Content-Length: 148
Strict-Transport-Security: max-age=15768000

Connection #0 to host account-d.docusign.com left intact
ETHON: performed EASY effective_url=https://account-d.docusign.com/restapi/oauth/ response_code=302 return_code=ok total_time=0.29105
HTTP response body ~BEGIN~
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="https://account-d.docusign.com/">here</a>.</h2>
</body></html>

~END~

Completed 500 Internal Server Error in 1876ms (ActiveRecord: 6.1ms)


Found excluded from capture: Not configured to send/capture in environment 'development'
  
DocuSign_eSign::ApiError (Found):
  
lib/authorization/docusign.rb:25:in `account_info'
app/graphql/mutations/dashboard/negotiation/notify_buyer_proposal.rb:16:in `resolve'
app/controllers/graphql_controller.rb:10:in `execute'

updateDocument methods missing the document as part of payload body

According to the API documentation we need to pass the document in the body of the request. However, the method does not allow us to provide the document definition.

On the other side, the update_documents method allow us to provide the envelope definition and the documents definition by consequence.

The request made by the first method includes a nil body and for the second one, the body is populated with the envelope definition.

I don't think this is the correct behavior but if it is, how can I upload a document first and then attach it to the envelope?

Edit: Fix links

(NoMethodError) Couldn't do view_request.role_name (our legacy js code does it though)

I'm trying to emulate some js code written by a previous dev.

// js code
let viewRequest = new docusign.RecipientViewRequest();
viewRequest.returnUrl = "https://acme.org/admin";
viewRequest.authenticationMethod = "none";
viewRequest.email = "[email protected]";
viewRequest.userName =  "John Doe";
viewRequest.roleName = "CEO";
viewRequest.clientUserId = USER_ID;
# ruby code
view_request = DocuSign_eSign::RecipientViewRequest.new
view_request.return_url = "https://acme.org/admin"
view_request.authentication_method = 'none'
view_request.email = "[email protected]"
view_request.user_name = "John Doe"
view_request.role_name = "CEO" # Why npm package supports this but gem doesnt
view_request.client_user_id = USER_ID

I get NoMethodError (undefined method `role_name=' for #<DocuSign_eSign::RecipientViewRequest:0x000000011c8ce278
How was the js developer able to set the role_name, and I cannot?

Ruby documentation comments formatting

The documentation comments in the code are in the markdown format but are generated on a single line, which makes it unreadable and unparsable using markdown or rubydoc.info.

One example is the #create_envelope method (rubydoc).

The documentation comments are the only source of documentation that I found for the ruby client, and this issue makes it really hard to work with.

List API points to Get

I was looking at listing all the templates available in my account and noticed that it's missing, but I found:

# Gets a list of templates for a specified account.
    # Retrieves the definition of the specified template.
    # @param account_id The external account number (int) or account ID Guid.
    # @param template_id The ID of the template being accessed.
    # @param DocuSign_eSign::GetOptions Options for modifying the behavior of the function.
    # @return [EnvelopeTemplate]
    def get(account_id, template_id, options = DocuSign_eSign::GetOptions.default)
      data, _status_code, _headers = get_with_http_info(account_id, template_id, options)
      return data
    end

But the description and the actual function doesn't match.

jwt version requirement

Is 2.0.0 minimum required version of jwt gem? It breaks project with existing gems. For example:

Bundler could not find compatible versions for gem "jwt":
  In Gemfile:
    docusign_esign was resolved to 0.0.1, which depends on
      jwt (>= 2.0.0, ~> 2.0)

    omniauth-slack was resolved to 2.3.0, which depends on
      omniauth-oauth2 (~> 1.4) was resolved to 1.4.0, which depends on
        oauth2 (~> 1.0) was resolved to 1.1.0, which depends on
          jwt (< 1.5.2, ~> 1.0)

Can you set jwt 1.5 as minimum? jwt-2.0.0 released 22 days ago and of course most of gems still require older versions of jwt.

Question about authentication in version 3

Hi,

How is authentication supposed to work now? I was on the 1.0.2 gem and this code was working:

namespace :auth do
  desc 'Check if auth token is expired'
  task check_token: :environment do
    @refresh_token = true
    @access_token_file = ENV['ACCESS_TOKEN_FILE']
    if File.exist? @access_token_file
      json_web_token = YAML.load(File.read(@access_token_file))
      expires_at = json_web_token[:expires_at]
      if expires_at >= Time.now - 300
        puts 'Loading JSON Web Token from file'
        @api_client = json_web_token[:access_token]
        @refresh_token = false
      end
    end
  end

  desc 'Load Dotenv config and generate token'
  task get_token: :check_token do
    integration_key = ENV['INTEGRATION_KEY']
    private_key = ENV['RSA_PRIVATE_KEY_FILE']
    api_username = ENV['API_USERNAME']
    api_endpoint = ENV['API_ENDPOINT']
    auth_server = ENV['AUTH_SERVER_URL']
    @account_id = ENV['ACCOUNT_ID']
    if @refresh_token == true
      puts 'Generating new access token'
      configuration = DocuSign_eSign::Configuration.new
      configuration.host = api_endpoint
      @api_client = DocuSign_eSign::ApiClient.new configuration
      @api_client.configure_jwt_authorization_flow(private_key, auth_server, integration_key, api_username, 3600)
      json_web_token = Hash.autonew
      json_web_token[:access_token] = @api_client
      json_web_token[:expires_at ] = Time.now + 3600
      File.open(@access_token_file, 'w') { |file| file.write(json_web_token.to_yaml) }
    end
  end

But now it seems the configure_jwt_authorization_flow method has been replaced by request_jwt_user_token? But the method seems different and I don't understand what input it's expecting for scope. Can I get an example to work of off please.

Getting contract details fails with the official W-9 template

I used the W-9 template from template library: https://support.docusign.com/knowledgemarket/Template-Library-W-9 to send a contract.

Now when I am trying to get the envelope I am getting the following exception:
*** NoMethodError Exception: undefined method 'build_from_hash' for []:Array

This is the top of the stack trace:

[  0] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/models/tabs.rb:502:in `_deserialize'",
    [  1] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/models/tabs.rb:454:in `block (2 levels) in build_from_hash'",
    [  2] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/models/tabs.rb:454:in `map'",
    [  3] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/models/tabs.rb:454:in `block in build_from_hash'",
    [  4] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/models/tabs.rb:449:in `each_pair'",
    [  5] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/models/tabs.rb:449:in `build_from_hash'",
    [  6] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/models/signer.rb:999:in `_deserialize'",
    [  7] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/models/signer.rb:954:in `block in build_from_hash'",
    [  8] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/models/signer.rb:946:in `each_pair'",
    [  9] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/models/signer.rb:946:in `build_from_hash'",
    [ 10] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/models/recipients.rb:267:in `_deserialize'",
    [ 11] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/models/recipients.rb:219:in `block (2 levels) in build_from_hash'",
    [ 12] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/models/recipients.rb:219:in `map'",
    [ 13] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/models/recipients.rb:219:in `block in build_from_hash'",
    [ 14] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/models/recipients.rb:214:in `each_pair'",
    [ 15] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/models/recipients.rb:214:in `build_from_hash'",
    [ 16] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/models/envelope.rb:878:in `_deserialize'",
    [ 17] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/models/envelope.rb:833:in `block in build_from_hash'",
    [ 18] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/models/envelope.rb:825:in `each_pair'",
    [ 19] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/models/envelope.rb:825:in `build_from_hash'",
    [ 20] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/client/api_client.rb:217:in `block in convert_to_type'",
    [ 21] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/client/api_client.rb:216:in `tap'",
    [ 22] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/client/api_client.rb:216:in `convert_to_type'",
    [ 23] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/client/api_client.rb:177:in `deserialize'",
    [ 24] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/client/api_client.rb:76:in `call_api'",
    [ 25] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/api/envelopes_api.rb:3229:in `get_envelope_with_http_info'",
    [ 26] "/home/toptal/staging.toptal.net/shared/bundle/ruby/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/api/envelopes_api.rb:3192:in `get_envelope'",

In debugger it looks like this (seems like it is the drop-down list of states that is causing trouble):

[497, 506] in /home/mmrazik/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/models/tabs.rb
   497:             hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
   498:           end
   499:         end
   500:       else # model
   501:         debugger
=> 502:         temp_model = DocuSign_eSign.const_get(type).new
   503:         temp_model.build_from_hash(value)
   504:       end
   505:     end
   506: 
(byebug) type
"Array"
(byebug) next

[498, 507] in /home/mmrazik/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/docusign_esign-3.2.1/lib/docusign_esign/models/tabs.rb
   498:           end
   499:         end
   500:       else # model
   501:         debugger
   502:         temp_model = DocuSign_eSign.const_get(type).new
=> 503:         temp_model.build_from_hash(value)
   504:       end
   505:     end
   506: 
   507:     # Returns the string representation of the object
(byebug) temp_model
[]
(byebug) value
{:listItems=>[{:text=>"AL", :value=>"AL", :selected=>"false"}, {:text=>"AK", :value=>"AK", :selected=>"false"}, {:text=>"AZ", :value=>"AZ", :selected=>"false"}, {:text=>"AR", :value=>"AR", :selected=>"false"}, {:text=>"CA", :value=>"CA", :selected=>"false"}, {:text=>"CO", :value=>"CO", :selected=>"false"}, {:text=>"CT", :value=>"CT", :selected=>"false"}, {:text=>"DE", :value=>"DE", :selected=>"false"}, {:text=>"FL", :value=>"FL", :selected=>"false"}, {:text=>"GA", :value=>"GA", :selected=>"false"}, {:text=>"HI", :value=>"HI", :selected=>"false"}, {:text=>"ID", :value=>"ID", :selected=>"false"}, {:text=>"IL", :value=>"IL", :selected=>"false"}, {:text=>"IN", :value=>"IN", :selected=>"false"}, {:text=>"IA", :value=>"IA", :selected=>"false"}, {:text=>"KS", :value=>"KS", :selected=>"false"}, {:text=>"KY", :value=>"KY", :selected=>"false"}, {:text=>"LA", :value=>"LA", :selected=>"false"}, {:text=>"ME", :value=>"ME", :selected=>"false"}, {:text=>"MD", :value=>"MD", :selected=>"false"}, {:text=>"MA", :value=>"MA", :selected=>"false"}, {:text=>"MI", :value=>"MI", :selected=>"false"}, {:text=>"MN", :value=>"MN", :selected=>"false"}, {:text=>"MS", :value=>"MS", :selected=>"false"}, {:text=>"MO", :value=>"MO", :selected=>"false"}, {:text=>"MT", :value=>"MT", :selected=>"false"}, {:text=>"NE", :value=>"NE", :selected=>"false"}, {:text=>"NV", :value=>"NV", :selected=>"false"}, {:text=>"NH", :value=>"NH", :selected=>"false"}, {:text=>"NJ", :value=>"NJ", :selected=>"false"}, {:text=>"NM", :value=>"NM", :selected=>"false"}, {:text=>"NY", :value=>"NY", :selected=>"false"}, {:text=>"NC", :value=>"NC", :selected=>"false"}, {:text=>"ND", :value=>"ND", :selected=>"false"}, {:text=>"OH", :value=>"OH", :selected=>"false"}, {:text=>"OK", :value=>"OK", :selected=>"false"}, {:text=>"OR", :value=>"OR", :selected=>"false"}, {:text=>"PA", :value=>"PA", :selected=>"false"}, {:text=>"RI", :value=>"RI", :selected=>"false"}, {:text=>"SC", :value=>"SC", :selected=>"false"}, {:text=>"SD", :value=>"SD", :selected=>"false"}, {:text=>"TN", :value=>"TN", :selected=>"false"}, {:text=>"TX", :value=>"TX", :selected=>"false"}, {:text=>"UT", :value=>"UT", :selected=>"false"}, {:text=>"VT", :value=>"VT", :selected=>"false"}, {:text=>"VA", :value=>"VA", :selected=>"false"}, {:text=>"WA", :value=>"WA", :selected=>"false"}, {:text=>"WV", :value=>"WV", :selected=>"false"}, {:text=>"WI", :value=>"WI", :selected=>"false"}, {:text=>"WY", :value=>"WY", :selected=>"false"}], :value=>"", :shared=>"false", :requireInitialOnSharedChange=>"false", :required=>"true", :locked=>"false", :requireAll=>"false", :tabLabel=>"W9 State", :font=>"arial", :fontColor=>"black", :fontSize=>"size9", :localePolicy=>{}, :documentId=>"1", :recipientId=>"1", :pageNumber=>"1", :xPosition=>"240", :yPosition=>"237", :width=>"78", :height=>"9", :tabId=>"290b1cbe-5e20-461f-8fbc-fbf41c52decd", :templateRequired=>"false", :tabType=>"list"}
(byebug) temp_model.build_from_hash(value)
*** NoMethodError Exception: undefined method `build_from_hash' for []:Array

DocuSign_eSign::ApiError (Bad Request)

I'm new to using Docusign and am trying to use this to connect to my sandbox account where I've set up the API integrator keys and generated the RSA keys and saved it on a file on my local computer (docusign.pem)

I'm following the instructions for login in the read me but I just constantly run into DocuSign_eSign::ApiError (Bad Request) error.

I've read online that user consent is required first, but not much else is given.

Is there a step I need to perform before? I've tried manually triggering getting an access token by doing:

require "net/http"
integration_and_secret = Base64.encode64("#{integration_key};#{secret}")
uri = URI.parse("https://account-d.docusign.com/oauth/token")

http = Net::HTTP.new(uri.host, uri.port)

http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(uri.request_uri)
request['Authorization'] = "Basic #{integration_and_secret}"
request.body = "grant_type=authorization_code&code=***code***"
response = http.request(request)

I simply get Errno::ECONNRESET: Connection reset by peer by doing this.

Any help on this would be greatly appreciated!

JSON version of version 2.0

In PR #14 the JSON version is bumped to 2.1, however, in the latest release of this gem (2.0.0) we see JSON 1.8. Is there an issue with regards to using json 2.1? We'd rather use a more recent version of json.

Create envelope with documents for certain formats failing.

I tried to create envelope using docusign_rest gem, it is failing only for certain MIME types files such as (CSV,png...), but working fine for few things like (JPEG,PDF...)

Version used : docusign_rest (0.4.4)

File params:
{"file1"=>#<UploadIO:0x00007feac1ec3930 
 @content_type="text/csv",
 @original_filename="local.path",
 @local_path="local.path",
 @io=#<StringIO:0x00007feac1ed1cd8 
 @base_uri=#<URI::HTTPS https://s3.amazonaws.com/xxx_Sample_CSV%20%282%29%20%281%29.csv?AWSAccessKeyId=xxxxx&Expires=xxx&Signature=xxxxxx>,
 @meta={"x-amz-id-2"=>"xx/xxx+xxx=",
   "x-amz-request-id"=>"xx",
   "date"=>"Thu, 03 Oct 2019 13:13:19 GMT",
   "last-modified"=>"Thu, 03 Oct 2019 13:12:27 GMT",
   "etag"=>"\"xx\"",
   "x-amz-storage-class"=>"REDUCED_REDUNDANCY",
   "x-amz-server-side-encryption"=>"AES256",
   "accept-ranges"=>"bytes",
   "content-type"=>"text/csv",
   "content-length"=>"63",
   "server"=>"AmazonS3"},
 @metas={"x-amz-id-2"=>["xxx/xxx+xx="],
   "x-amz-request-id"=>["xxxx"],
   "date"=>["Thu, 03 Oct 2019 13:13:19 GMT"],
   "last-modified"=>["Thu, 03 Oct 2019 13:12:27 GMT"],
   "etag"=>["\"xx\""],
   "x-amz-storage-class"=>["REDUCED_REDUNDANCY"],
   "x-amz-server-side-encryption"=>["AES256"],
   "accept-ranges"=>["bytes"],
   "content-type"=>["text/csv"],
   "content-length"=>["63"],
   "server"=>["AmazonS3"]},
 @status=["200", "OK"]>,
 @opts={"Content-Disposition"=>"file; documentid=1"}>}

Getting the below Error

{"errorCode"=>"UNABLE_TO_CONVERT_DOCUMENT", "message"=>"System was unable to convert this document to a PDF. Unable to convert Document(local.path) to a PDF. Error: UserId:xxxxxxxxxxxx IPAddress:xxx.xxx.xxxx Source:ApiRESTv2:FileType path is ineligible for conversion."}

ListStatus not accepting envelope_ids

This appears to be covered by this issue in the related c# client: issue 196. I want to confirm that if an update gets pushed out for that codebase it will be pulled into the ruby client.

To reiterate the issue I have code that is trying to make a call to list_status to only pull in envelope_ids that I care about hover I receive an error message indicating that a date range is required or envelope ids or transaction ids need to be specified. Here is my code in context:

# api_client is an authenticated instance of DocuSign_eSign::ApiClient
envelope_api = DocuSign_eSign::EnvelopesApi.new(api_client)
request = DocuSign_eSign::EnvelopeIdsRequest.new
request.envelope_ids = envelope_ids # envelope_ids is an array of envelope id strings
response = envelope_api.list_status(login_account.account_id, request)

I'm working around the issue by issuing a request with the from_date specified by I want to get status information about specific envelopes to limit the number of calls I need to make.

As a side note it would be great if you could configure your code generate to use more standard ruby conventions, for example, the namespace DocuSign_eSign is a strange combination of camelcase and underscores.

URI.escape obsolete warning on Ruby 2.7+

An annoying warning is raised by URI.encode (which is an alias of URI.escape) on Ruby 2.7+

docusign_esign-3.0.0/lib/docusign_esign/client/api_client.rb:262: warning: URI.escape is obsolete

Here is an article explaining why. TL;DR it's been obsolete for 10 years now but since Ruby 2.7, the warning is now displayed even when not running in verbose mode.
It's pretty annoying as it can quickly ruin one's logs.

As suggested per the stdlib doc, we could use CGI.escape instead.

This method is obsolete and should not be used. Instead, use CGI.escape, URI.encode_www_form or URI.encode_www_form_component depending on your specific use case.

ListStatus not accepting envelope_ids (regression)

This was referenced in closed issue: #15

I am on version 3.11.0 of the gem, and the issue seems identical to the one claimed to be 'fixed'.

Namely, if I call list_status with only envelope_ids as so:

envelope_api = DocuSign_eSign::EnvelopesApi.new(api_client)
request = DocuSign_eSign::EnvelopeIdsRequest.new
request.envelope_ids = envelope_ids # envelope_ids is an array of envelope id strings
response = envelope_api.list_status(login_account.account_id, request)

I get the error:

The request contained at least one invalid parameter. Query parameter 'from_date' must be set to a valid DateTime, or 'envelope_ids' or 'transaction_ids' must be specified.

If I add in the from_date, I don't get the error, but the envelope_ids are ignored.

Note that have essentially the same problem with the list_status_changes method as well.

Can models require dependant models by themselves?

Hello there!

I was working on boot time improvements in our application and I noticed that loading the DocuSign gem is taking a significant amount of time there (~300ms, when Rails takes ~100ms). I also realized we are using only a few models from all the variety the gem provides. However, when I required only these models that we mention in our code, our test suit that is based on recorded responses from the API started to fail with NameError on missing constants. Some models (like Envelope) consist of objects of different model types. To safely require the minimal subset of models that works for my application I need to know the internal structure of each one.

Is it possible for you to update each model (or the generator that creates them) to explicitly require dependent models, so I can require only one or 2 files from the gem and be sure my application doesn't break on missing constant?

Thanks!

Can't find template

Issue

Can't find template on create

Following the quick examples to prototype. https://github.com/docusign/qs-ruby/blob/master/app/controllers/embedded_signing_controller.rb

Set up a sandbox, account, generated an access_token, entered my account_id from the top right, created a template with the file name specified, as a solution to why it wasn't working...file_name = 'World_Wide_Corp_lorem.pdf' # The document to be signed. Tried creating a folder called data.

Screen Shot 2020-07-07 at 11 32 56 AM

Get the error below

No such file or directory @ rb_sysopen - data/test_pdf excluded from capture: DSN not set

Errno::ENOENT (No such file or directory @ rb_sysopen - data/test_pdf):

I'm stuck.

Setting client_user_id still triggers email

In Bash and Js code, setting the clientUserId prevents
an email going out to the signers.

When using this ruby gem however, the clientUserId property
doesn't have that intended effect.

Connect x.509 certificates or HMAC?

I've been using this gem for integrating my app with DocuSign, thanks for the great work.

However, DocuSign has recently send a message that certificates must be upgraded soon to Connect x.509 or HMAC. See https://developers.docusign.com/esign-rest-api/guides/connect-hmac

Would you be able to tell me if these changes apply to using this gem? Do I need to update any certificates?

thanks again for supplying this gem and thanks in advance for any tips.

Best regards,
-- Ronnie

`ConnectApi` incorrect default initialization

Local gem version: 3.0.4

When trying to initialize a ConnectApi instance I get this error:

> DocuSign_eSign::ConnectApi.new
NoMethodError: undefined method `default' for DocuSign_eSign::ConnectApi:Class
from docusign_esign-3.4.0/lib/docusign_esign/api/connect_api.rb:78:in `initialize'

This is the code that is causing the issue (still present)

class ConnectApi
  attr_accessor :api_client

  def initialize(api_client = ConnectApi.default)
    @api_client = api_client
  end

  #...
end

The problem is there isn't any ConnectApi.default method. Instead, what I believe goes here is ApiClient.default.

Allow passing in JWT

This line:

https://github.com/docusign/docusign-ruby-client/blob/c69e4785115a2ed4eb716f9af216454f93ae8971/lib/docusign_esign/api_client.rb#L386

Wants you to pass in a path to the RSA secret as a file on disk. We would prefer to pass in the JWT ourselves, or barring that an instance of OpenSSL::PKey::RSA so that we can source our private key from somewhere other than a file on disk.

PR #5 would probably be sufficient for us, for now, but also somewhat less ideal. If we can pass in an instance of OpenSSL::PKey::RSA or the JWT, then allows many options, such as HSM or other key-in-hardware solutions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.