Coder Social home page Coder Social logo

Comments (1)

jondkinney avatar jondkinney commented on June 2, 2024

Hi there,

Looks like you're not setting your account_id in the configure block which is breaking the request.

If you want to do it dynamically, you'd have to do it like this:

require 'bundler'

Bundler.require

DocusignRest.configure do |config|
  config.username       = '[email protected]'
  config.password       = '********'
  config.integrator_key = 'RFXX-5e8080a0-88d3-4c41-94b6-**********'
  config.endpoint       = 'https://demo.docusign.net/restapi'
  config.api_version    = 'v2'
end

acct_client = DocusignRest::Client.new
puts acct_client.get_account_id

DocusignRest.configure do |config|
  config.account_id = acct_client.get_account_id
end

client = DocusignRest::Client.new

response = client.create_envelope_from_document(
  email: {
    subject: 'Sign me please',
    body: 'This is the email body from docusign.'
  },
  # If embedded is set to true in the signers array below, emails don't go out
  # and you can embed the signature page in an iFrame by using the
  # get_recipient_view method
  signers: [
    {
      embedded: true,
      name: 'Test Guy',
      email: '[email protected]',
      role_name: 'Issuer',
      sign_here_tabs: [
      {
        anchor_string: 'sign_here_1',
        anchor_x_offset: '140',
        anchor_y_offset: '8'
      }
      ]
    },
  ],
  files: [
    { path: '/Users/mhawash/src/rpace/sandbox/docu_sign/test.pdf', name: 'test.pdf' },
  ],
  status: 'sent'
)

puts response

I tested this locally with my credentials and the test.pdf file from this repo and it worked.

However, personally I just embed the account_id directly in the first configure block. The query to get the account ID I believe is just to allow you to retrieve it initially. Of course, you can do it dynamically as I show above if you really want to...

from docusign_rest.

Related Issues (20)

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.