Giter Site home page Giter Site logo

hellosign-ruby-sdk's People

Contributors

angelafield avatar asolberg avatar barelyknown avatar bhspitmonkey avatar cobraextreme avatar cselmer avatar desmondw avatar emilong avatar freddyrangel avatar gkop avatar hellofaxsteve avatar johnnycupcakes avatar jon-eckstein avatar jtmarmon avatar jtreminio-dropbox avatar jyoung488 avatar manuelmeurer avatar maxime-d avatar michaelnlindsay avatar nolman avatar ppicazo avatar radhack avatar reedloden avatar renderf0x avatar sergio-amount avatar sikandartariq1 avatar skiva avatar torbjon avatar tyrbo avatar volodymyr-mykhailyk 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

Watchers

 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

hellosign-ruby-sdk's Issues

Unclaimed Draft methods doesn't default type

Embedded Unclaimed Draft endpoints need to default to type: request_signature if it's not included but this causes an error that says signers aren't included

workaround is to include type: request_signature

HelloSign.get_signature_requests does not work as expected

HelloSign.get_signature_requests is supposed to take an array of signature_ids and return the status of those. But the actual behavior is that it returns the status of all documents in my hellosign account.

For eg: Following code fails since I do not have '42383e7327eda33f4b8b91217cbe95408cc1285f' in my account. This is from example in the documentation. But if I use HelloSign.get_signature_requests it returns all data in my account.

pry(main)> signature_request = HelloSign.get_signature_request :signature_request_id => '42383e7327eda33f4b8b91217cbe95408cc1285f'
HelloSign::Error::NotFound: Server responded with code 404
Request URI: https://api.hellosign.com/v3/signature_request/42383e7327eda33f4b8b91217cbe95408cc1285f

Feature request: add "file_url" parameter

The "file_url" appears to be a parameter on the base API, but when used in place of "files" in the Ruby SDK, returns the following error:

{"error":{"error_msg":"Error when transferring file: ","error_name":"bad_request"}}):

It does this for both client.create_embedded_unclaimed_draft and for client.create_embedded_signature_request.

Thanks!

Problem creating unclaimed drafts

If I try to create an Unclaimed Draft I get the error:

Message: {"error":{"error_msg":"Cannot specify form_fields_per_document unless you also specify signers","error_name":"bad_request"}}

Even though I am supplying the signers parameter. Code below.

my_name = "My Name"
my_email = "[email protected]"
files = ["your_file.pdf"]

# The following will fail
# Error message: "Cannot specify form_fields_per_document unless you also specify signers"
unclaimed_draft = HelloSign.create_unclaimed_draft(
    :test_mode => 1,
    :type => 'send_document',
    :files => files,
    :form_fields_per_document  => "[[{\"name\":\"\",\"type\":\"date_signed\",\"signer\":0,\"x\":224,\"y\":108,\"width\":105,\"height\":16,\"required\":true,\"api_id\":\"e1c525_9\"}]]",
    :signers => [
        {
            :email_address => my_email,
            :name => my_name,
            :order => 0,
        }
    ]
)

Moreover, if I use the same syntax to create a new signature request, rather than an unclaimed_draft it works.

# This works
signature_request = HelloSign.send_signature_request(
    :test_mode => 1,
    :files => files,
    :form_fields_per_document  => "[[{\"name\":\"\",\"type\":\"date_signed\",\"signer\":0,\"x\":224,\"y\":108,\"width\":105,\"height\":16,\"required\":true,\"api_id\":\"e1c525_9\"}]]",
    :signers => [
        {
            :email_address => my_email,
            :name => my_name,
            :order => 0,
        }
    ]
)

Query not returning sorted results

I am using the ruby gem for hellosign and trying to search through the signature requests. I can't, no matter what parameters I give, sort through and find one by title.

Set test_mode on the client

Hi, Our team had recently run into an issue where we updated some templates unintentionally in production, while we were developing a new feature locally - in development mode.

Looking over the code, I would expect to be able to configure the client to run in test mode during the initial client setup / configuration and have that apply for all relevant api calls. I would expect this code to live on the configuration object here: https://github.com/HelloFax/hellosign-ruby-sdk/blob/v3/lib/hello_sign/configuration.rb#L60-L75, but I do not see it.

Perhaps there is a technique to fake this sort of test_mode operation by specifying a non verified client id?

Does anyone have a good workaround pattern to set test_mode on a per client basis? If not, would this be a worthwhile feature to add?

I'd really like to be able to do this:

HelloSign.configure do |config|
  config.api_key = ENV['HELLOSIGN_API_KEY']
  config.test_mode = true
end

Thanks!

Update API App

Hi,

I found issue on updating API App
https://github.com/HelloFax/hellosign-ruby-sdk/blob/e97b07995d5e1c59e0d771cdebf17ff8b73493a9/lib/hello_sign/api/api_app.rb#L100

The trace :

HelloSign::Error::MethodNotAllowed: Server responded with code 405
Request URI: https://api.hellosign.com/v3/api_app/838b002f8814bb2febe3175d565931bc
Message: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>405 Method Not Allowed</title>
</head><body>
<h1>Method Not Allowed</h1>
<p>The requested method PUT is not allowed for the URL /v3/api_app/838b002f8814bb2febe3175d565931bc.</p>
</body></html>
from /Users/maxime/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/hellosign-ruby-sdk-3.2.11/lib/hello_sign/client.rb:179:in `validate'

I follow the documentation https://www.hellosign.com/api/reference#ApiApp and I can see using a POST to update resource.

Add Editable Merge Fields support

When updating the SDKs to include editable merge fields, please also update the SDK git repos README examples (if necessary) and the following in the API docs:

  • "Send with Template" endpoint example
  • "Send Embedded Signature Request with Template" endpoint example
  • Templates Walkthrough
  • Signature Request Walkthrough -> Using Templates

Unable to set signers in create_embedded_unclaimed_draft

When I don't use 'request_signature' type in create_embedded_unclaimed_draft, I get error that signer name is not set. I think you recently started supporting signer_names in 'send_document' type, but in SDK, inside create_embedded_unclaimed_draft method, prepare_signers method is called only for request_signature but not in other case leading to this error

Client.get_embedded_sign_url ignores test_mode

Perhaps a noob user error. I am trying to follow the quick start example using my trial account and display embedded signature iframe on my web page following this guide:

https://app.hellosign.com/api/documentation#QuickStart

I successfully pass steps 1 and 2, but step 3 returns

Request URI: https://api.hellosign.com/v3/embedded/sign_url/29a1dde12cc9a390219992f12408292a32aadfc1
Message: {"error":{"error_msg":"Signature not found","error_name":"bad_request"}}

When I check the API console in my account, it seems that the client.get_embedded_sign_url seems to execute against the live, not test environment of my account. I've tried to add test_mode=1 to the client.get_embedded_sign_url call to no avail.

Your help would be greatly appreciated as it would allow me to continue evaluation without switching to the paid account.

EDIT #1:
I also tried the non-embedded example using client.get_signature_request: it worked perfectly. Unfortunately, it is the embedded flow that I am very interested in.

EDIT #2:
I just tried the curl example for getting the embedded URL: same result. I also tried to add -F 'test_mode=1' with no results. Therefore, the issue is most likely with the API endpoint itself.

OAuth Authorization from new users is not Returning a Response

client = HelloSign::Client.new :api_key => 'SIGN_IN_AND_CREATE_API_KEY_FIRST', :client_id => 'cc91c61d00f8bb2ece1428035716b', :client_secret => '1d14434088507ffa390e6f5528465'
client.oauth_create_account :email_address => '[email protected]'

Should return a similar response:

{
	"account": {
		"account_id": "b4680b45053c7601ca1eee3b126eca6b2b0a0219",
		"email_address": "[email protected]",
		"callback_url": null,
		"role_code": null
	},
	"oauth_data": {
		"access_token": "NWNiOTMxOGFkOGVjMDhhNTAxZN2NkNjgxMjMwOWJiYTEzZTBmZGUzMjMThhMzYyMzc=",
		"token_type": "Bearer",
		"refresh_token": "hNTI2MTFmM2VmZDQxZTZjOWRmZmFjZmVmMGMyNGFjMzI2MGI5YzgzNmE3",
		"expires_in": 86400    // in seconds
	}
}

Confirmed to only return the email address returned in the response shows the app owner's email address NOT the newly created OAuth account as expected.

Ability to set timeout

Skimming the source code, I couldn't find a way to set a timeout on any HelloSign requests. It would be handy to have a little more control over the request when using the HelloSign wrapper.

The ability to set a timeout on each request would probably be optimal, but something as simple as this would go a long way:

client = HelloSign::Client.new(api_key: 'myapikey', read_timeout: 10) # Set timeout in seconds

Add additional content type filtering in parse method

Our parse method in client.rb only checks for application/pdf and treats everything else as json. We should add logic to make sure that

a) text/html responses don't hit the json parser
b) zip files are properly handled

It might look something like this ( from Issue #20 ):

def parse(response)
  if response['content-type'] == 'application/pdf'
    response.body
  elsif response.body.strip.empty?
    {}
  elsif response['content-type'] == 'application/json'
    MultiJson.load response.body.strip
  else
      response.body
  end
end

Bug: Error creation crashing in Client#prepare_files

I'm getting a crash when passing an invalid path for the files parameter in create_embedded_signature_request:

ArgumentError: wrong number of arguments (given 1, expected 2..3)
from /Users/danieldehaas/.rvm/gems/ruby-2.4.4@duco/gems/hellosign-ruby-sdk-3.7.7/lib/hello_sign/error.rb:30:in `initialize'

The problem seems to be in these two places:

The Error initializer expects 2 to 3 arguments but is only getting 1.

Thanks!

No recipients specified

There seems to be the bug of the latest version.

This is my ruby codes:

response =
 HelloSign.create_embedded_signature_request_with_template(
    :test_mode => 1,
    :client_id => 'e83be85a783e79d3093269486aa98540',
    :template_id => 'f674cfb4a0053a792adcae3bc5f7e0375630b91d',
    :subject => 'Embedded signature request',
    :message => 'Fill this in.',
    :signers => [
        {
            :email_address => '[email protected]',
            :name => 'Jack',
            :role => 'subject'
        }
    ]
)

I keep getting the following error:

Request URI: https://api.hellosign.com/v3/signature_request/create_embedded_with_template
Message: {"error":{"error_msg":"No recipients specified","error_name":"bad_request"}}

The Signers hash build on 3.6 seems to be breaking

We're using the create_embedded_signature_request_with_template without issue in version 3.5.4. However, when we tried bumping up to v3.6, we noticed that sending in this:

 signers: [{
    name: "John Doe",
    email_address: "[email protected]",
    role: "Applicant",
    order: 0
  }]

was being turned into a request in which our signers key was a Hash and not a URL. E.g.

 "signers[Applicant]": {
      "email_address": "jdoe@mail.com",
      "name": "John Doe",
      "order": "0"
    },

It feels like this should be an Array, correct?

Why is 'pry' required?

I'm getting the following error on trying to startup my rails server:

/Users/alexey/.rvm/gems/ruby-2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require': cannot load such file -- pry (LoadError)

Looking through your code, it looks like you use Pry for debugging (and maybe documentation) - pry is required in lib/hello_sign/resource/resource_array.rb but as far as I can tell is not used there directly.

Please either include pry explicitly in your Gemfile or remove the dependency.

Unclaimed Draft methods do not support new custom field format

custom_fields do not currently take an array. You have to use the deprecated format (passing in a hash) for it to work.

Fails:

options = {
  :test_mode=>true,
  :template_id=>"my-template-id",
  :signers=>[
    { :email_address=>"[email protected]",
      :name=>"fasdfa asdfasdf",
      :role=>"signer_1"
    }
  ],
  :requester_email_address=>"[email protected]",
  :is_for_embedded_signing=>true,
  :custom_fields=>[{ name: "Business Name", value: "My Biz"}]
}

client.create_embedded_unclaimed_draft_with_template(options)

HelloSign::Error::BadRequest: Server responded with code 400
Request URI: https://api.hellosign.com/v3/unclaimed_draft/create_embedded_with_template
Message: {"error":{"error_msg":"Invalid custom field","error_name":"bad_request"}}

Works:

options = {
  :test_mode=>true,
  :template_id=>"my-template-id",
  :signers=>[
    { :email_address=>"[email protected]",
      :name=>"fasdfa asdfasdf",
      :role=>"signer_1"
    }
  ],
  :requester_email_address=>"[email protected]",
  :is_for_embedded_signing=>true,
  :custom_fields=>{"Business Name"=>"My Biz"}
}

client.create_embedded_unclaimed_draft_with_template(options)

My current workaround is to manually convert the array to hash for this specific call so you guys might have to do something like this in HelloSign::Client#prepare_custom_fields or handle it on the server.

 custom_fields.reduce({}) { |h, ele| h[ele[:name]] = ele[:value]; h }

Feature Request: Add Utility Method for Webhook Event Hash Verification

The verification of a given event hash through HMAC could be added to this SDK as a nice utility method.

def trusted_event?(event_data)
    calculated_digest = OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new('sha256'), HelloSign.api_key, (event_data[:event_time] + event_data[:event_type]))
    return calculated_digest == event_data[:event_hash]
end

Request: Parsable errors

Right now errors are fairly useless except as a development tool. It's formatted as a big unparsable string you can't really do anything with.

It would be ideal if errors could be parsed, like getting the response body, the request uri, and the status code.

Zip::Error when downloading SignatureRequest documents by calling signature_request_files

Hi there,

My team updated the hellosign-ruby-sdk gem in our bundle from 3.6.4 to 3.7.1 and started experiencing the following error each time a signature_request_all_signed callback was received:

Zip::Error Zip end of central directory signature not found

When checking out the files that are downloaded, what we get is a corrupted .zip file, causing the error above.

It is unclear to me whether there is anything we need to change to get this working again between these two versions, but it's consistent in all of our environments. We have downgraded the gem to 3.6.4 for now.

Add support for Decline to Sign

The following changes have been made to the API:

  • There is a new parameter allow_decline for declining to sign signature requests
  • There is a new API status_code for declined requests
  • There is a new API variable is_declined on SignatureRequest objects
  • There is a new API variable decline_reason on Signature objects

Client ID does not exist

We are using ROR to integrate with you guys, and it keeps on saying we are using the erroring:
App yourClientId does not exist
although i'm copying the exact one from the admin

I have followed this tutorial:
http://blog.hellosign.com/getting-started-with-hellosign-embedded-signing-with-ruby-on-rails-2/

and I'm using ngrok (that's why I have set up the app with ngrok)

Here is my code:
client = HelloSign::Client.new :api_key => 'API KEY'
client.create_embedded_signature_request(
:test_mode => 1,
:client_id => 'CLIENT ID',
:subject => 'Embedded signature request',
:message => 'Fill this in.',
:signers => [
{
:email_address => params[:email],
:name => params[:name]
}
],
files: [uploaded_file]
)

Thanks!

Consider renaming the gem

Unfortunately hellosign-ruby-sdk is not really a good gem name, hellosign or hello_sign would be much better. ๐Ÿ˜„

Currently one needs to add gem 'hellosign-ruby-sdk', require: 'hello_sign' to the Gemfile, since Bundler tries to load lib/GEM_NAME.rb and can't find lib/hellosign-ruby-sdk.rb. If the gem was named hello_sign, lib/hello_sign.rb would be loaded automatically.

An alternative to changing the gem name would be adding a lib/hellosign-ruby-sdk.rb file that requires lib/hello_sign.rb.

Unexpected error for exceeded_rate

I'm getting responses with status 429 when rate limit is exceeded, which isn't in ERRORS in HelloSign::Client, and thusly raises HelloSign::Error::UnknownError.

The documentation here https://app.hellosign.com/api/reference#WarningsAndErrors suggests this should return 403 and raise HelloSign::Error::Forbidden.

I'm wondering if this is intentional, or if ERRORS and documentation just haven't been updated to match the actual api responses.

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.