signable
v0.3.0
可签名客户端为 Signable API 提供了一个简单的 Ruby 接口。
将此行添加到应用程序的 Gemfile 中:
gem 'signable'
然后执行:
$ bundle
或者自己安装:
$ gem install signable
Signable . configure do | config |
config . base_url = ENV . fetch ( 'SIGNABLE_BASE_URL' )
config . api_key = ENV . fetch ( 'SIGNABLE_API_KEY' )
end
Signable :: Template . find 'fingerprint'
Signable :: Document . new ( template_fingerprint : fingerprint , title : title )
文档还可能包含 merge_fields(请参阅可签名文档)
Signable :: Party . new ( id : id , name : 'name' , email : 'email' )
可以从模板中检索参与方 ID
envelope = Signable :: Envelope . new title : 'title' , redirect_url : 'https://www.autoenrolment.co.uk'
envelope . documents = documents
envelope . parties = parties
envelope . save
测试套件是 RSpec,并使用 VCR 来测试 API 调用。
VCR 盒式磁带包含在此存储库中,因此您可以运行规范而无需点击 Signable API,如下所示:
bundle exec rspec
如果您需要重新记录 Ruby 代码和 Signable API 之间的交互,您可以指定一个 API 密钥供测试使用,如下所示:
SIGNABLE_API_KEY = 'valid_signable_api_key' bundle exec rspec
如果您的 API 无效或缺失,您将看到如下错误:
Authentication failed . Either the API Key or password was blank .
笔记:
要获取有效的 Signable API 密钥,请登录您的 Signable 帐户并导航至“公司设置”→“Api 和 Webhooks”,然后单击“添加 API 密钥”以生成密钥。我们建议您在使用完该密钥后将其删除。
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)