Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sandbox/ruby/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ source 'https://rubygems.org'

gem 'dropbox-sign',
path: "../../sdks/ruby"

group :development, :test do
gem 'json_spec', '~> 1.1.5'
end
6 changes: 6 additions & 0 deletions sandbox/ruby/spec/.config.dist.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"BASE_URL": "https://api.hellosign.com/v3",
"API_KEY": "",
"CLIENT_ID": "",
"USE_XDEBUG": 0
}
1 change: 1 addition & 0 deletions sandbox/ruby/spec/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.config.json
133 changes: 133 additions & 0 deletions sandbox/ruby/spec/signature_request_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
require "spec_helper"
require "dropbox-sign"

# This test suite is intended solely as a stopgap while we setup automated
# internal tests from github actions.
#
# For now it requires running manually
describe "SignatureRequestSpec" do
config_custom = JSON.parse(File.read(__dir__ + "/.config.json"), :symbolize_names => false)
config_dist = JSON.parse(File.read(__dir__ + "/.config.dist.json"), :symbolize_names => false)
config_merged = config_dist.merge(config_custom)
opts = {}

if config_merged["USE_XDEBUG"]
opts[:header_params] = {"Cookie" => "XDEBUG_SESSION=xdebug"}
end

Dropbox::Sign.configure do |config|
config.username = config_merged["API_KEY"]
config.host = config_merged["BASE_URL"]
end

it "testSend" do
signature_request_api = Dropbox::Sign::SignatureRequestApi.new

data = JSON.parse(
File.read(__dir__ + "/../test_fixtures/SignatureRequestSendRequest.json"),
:symbolize_names => true,
)

send_request = Dropbox::Sign::SignatureRequestSendRequest.init(data)
send_request.files = [File.new(__dir__ + "/../test_fixtures/pdf-sample.pdf", "r")]

begin
send_response = signature_request_api.signature_request_send(send_request, opts)
rescue Dropbox::Sign::ApiError => e
puts "Exception when calling Dropbox Sign API: #{e}"
exit
end

signature_request = send_response.signature_request

expect(signature_request.custom_fields[0].api_id)
.to eq(send_request.form_fields_per_document[0].api_id)

expect(signature_request.signatures[0].signer_email_address)
.to eq(send_request.signers[0].email_address)
expect(signature_request.signatures[1].signer_email_address)
.to eq(send_request.signers[1].email_address)
expect(signature_request.signatures[2].signer_email_address)
.to eq(send_request.signers[2].email_address)

begin
get_response = signature_request_api.signature_request_get(
signature_request.signature_request_id,
opts,
)
rescue Dropbox::Sign::ApiError => e
puts "Exception when calling Dropbox Sign API: #{e}"
exit
end

expect(signature_request.signature_request_id)
.to eq(get_response.signature_request.signature_request_id)
end

it "testCreateEmbedded" do
signature_request_api = Dropbox::Sign::SignatureRequestApi.new

data = JSON.parse(
File.read(__dir__ + "/../test_fixtures/SignatureRequestCreateEmbeddedRequest.json"),
:symbolize_names => true,
)

send_request = Dropbox::Sign::SignatureRequestCreateEmbeddedRequest.init(data)
send_request.files = [File.new(__dir__ + "/../test_fixtures/pdf-sample.pdf", "r")]
send_request.client_id = config_merged["CLIENT_ID"]

begin
send_response = signature_request_api.signature_request_create_embedded(
send_request,
opts,
)
rescue Dropbox::Sign::ApiError => e
puts "Exception when calling Dropbox Sign API: #{e}"
exit
end

signature_request = send_response.signature_request

expect(signature_request.signatures[0].signer_email_address)
.to eq(send_request.signers[0].email_address)
expect(signature_request.signatures[1].signer_email_address)
.to eq(send_request.signers[1].email_address)
expect(signature_request.signatures[2].signer_email_address)
.to eq(send_request.signers[2].email_address)

embedded_api = Dropbox::Sign::EmbeddedApi.new

begin
get_response = embedded_api.embedded_sign_url(
signature_request.signatures[0].signature_id,
opts,
)

expect(get_response.embedded.sign_url).to be_truthy
rescue Dropbox::Sign::ApiError => e
puts "Exception when calling Dropbox Sign API: #{e}"
exit
end
end

it "testSendWithoutFileError" do
signature_request_api = Dropbox::Sign::SignatureRequestApi.new

data = JSON.parse(
File.read(__dir__ + "/../test_fixtures/SignatureRequestSendRequest.json"),
:symbolize_names => true,
)

send_request = Dropbox::Sign::SignatureRequestSendRequest.init(data)

begin
send_response = signature_request_api.signature_request_send(send_request, opts)

puts "Should have thrown: #{send_response}"
exit
rescue Dropbox::Sign::ApiError => e
expect(e.response_body.error.error_path)
.to eq("file")
end
end
end
111 changes: 111 additions & 0 deletions sandbox/ruby/spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
=begin
#Dropbox Sign API

#Dropbox Sign v3 API

The version of the OpenAPI document: 3.0.0
Contact: apisupport@hellosign.com
Generated by: https://openapi-generator.tech
Generator version: 7.8.0

=end

# load the gem
require 'dropbox-sign'

# The following was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to explicitly require it in any
# files.
#
# Given that it is always loaded, you are encouraged to keep this file as
# light-weight as possible. Requiring heavyweight dependencies from this file
# will add to the boot time of your test suite on EVERY test run, even for an
# individual file that may not need all of that loaded. Instead, consider making
# a separate helper file that requires the additional dependencies and performs
# the additional setup, and require it from the spec files that actually need
# it.
#
# The `.rspec` file also contains a few flags that are not defaults but that
# users commonly want.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
# assertions if you prefer.
config.expect_with :rspec do |expectations|
# This option will default to `true` in RSpec 4. It makes the `description`
# and `failure_message` of custom matchers include text for helper methods
# defined using `chain`, e.g.:
# be_bigger_than(2).and_smaller_than(4).description
# # => "be bigger than 2 and smaller than 4"
# ...rather than:
# # => "be bigger than 2"
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end

# rspec-mocks config goes here. You can use an alternate test double
# library (such as bogus or mocha) by changing the `mock_with` option here.
config.mock_with :rspec do |mocks|
# Prevents you from mocking or stubbing a method that does not exist on
# a real object. This is generally recommended, and will default to
# `true` in RSpec 4.
mocks.verify_partial_doubles = true
end

# The settings below are suggested to provide a good initial experience
# with RSpec, but feel free to customize to your heart's content.
=begin
# These two settings work together to allow you to limit a spec run
# to individual examples or groups you care about by tagging them with
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
# get run.
config.filter_run :focus
config.run_all_when_everything_filtered = true

# Allows RSpec to persist some state between runs in order to support
# the `--only-failures` and `--next-failure` CLI options. We recommend
# you configure your source control system to ignore this file.
config.example_status_persistence_file_path = "spec/examples.txt"

# Limits the available syntax to the non-monkey patched syntax that is
# recommended. For more details, see:
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
config.disable_monkey_patching!

# This setting enables warnings. It's recommended, but in some cases may
# be too noisy due to issues in dependencies.
config.warnings = true

# Many RSpec users commonly either run the entire suite or an individual
# file, and it's useful to allow more verbose output when running an
# individual spec file.
if config.files_to_run.one?
# Use the documentation formatter for detailed output,
# unless a formatter has already been configured
# (e.g. via a command-line flag).
config.default_formatter = 'doc'
end

# Print the 10 slowest examples and example groups at the
# end of the spec run, to help surface which specs are running
# particularly slow.
config.profile_examples = 10

# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = :random

# Seed global randomization in this process using the `--seed` CLI option.
# Setting this allows you to use `--seed` to deterministically reproduce
# test failures related to randomization by passing the same `--seed` value
# as the one that triggered the failure.
Kernel.srand config.seed
=end
end
2 changes: 1 addition & 1 deletion sdks/ruby/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ build/
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

vendor
vendor
2 changes: 1 addition & 1 deletion sdks/ruby/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.7.0
7.8.0
2 changes: 1 addition & 1 deletion sdks/ruby/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ script:
- bundle install --path vendor/bundle
- bundle exec rspec
- gem build dropbox-sign.gemspec
- gem install ./dropbox-sign-1.5-dev.gem
- gem install ./dropbox-sign-1.6-dev.gem
2 changes: 1 addition & 1 deletion sdks/ruby/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
dropbox-sign (1.5.pre.dev)
dropbox-sign (1.6.pre.dev)
typhoeus (~> 1.0, >= 1.0.1)

GEM
Expand Down
11 changes: 6 additions & 5 deletions sdks/ruby/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ directory that corresponds to the file you want updated.
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 3.0.0
- Package version: 1.5-dev
- Generator version: 7.7.0
- Package version: 1.6-dev
- Generator version: 7.8.0
- Build package: org.openapitools.codegen.languages.RubyClientCodegen

## Installation
Expand All @@ -47,14 +47,15 @@ gem build dropbox-sign.gemspec
Then install the gem locally:

```shell
gem install ./dropbox-sign-1.5-dev.gem
gem install ./dropbox-sign-1.6-dev.gem
```

(for development, run `gem install --dev ./dropbox-sign-1.5-dev.gem` to install the development dependencies)
(for development, run `gem install --dev ./dropbox-sign-1.6-dev.gem` to install the development dependencies)


Finally add this to the Gemfile:

gem 'dropbox-sign', '~> 1.5-dev'
gem 'dropbox-sign', '~> 1.6-dev'

### Install from Git

Expand Down
2 changes: 1 addition & 1 deletion sdks/ruby/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5-dev
1.6-dev
2 changes: 1 addition & 1 deletion sdks/ruby/dropbox-sign.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
The version of the OpenAPI document: 3.0.0
Contact: apisupport@hellosign.com
Generated by: https://openapi-generator.tech
Generator version: 7.7.0
Generator version: 7.8.0

=end

Expand Down
2 changes: 1 addition & 1 deletion sdks/ruby/lib/dropbox-sign.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: 3.0.0
Contact: apisupport@hellosign.com
Generated by: https://openapi-generator.tech
Generator version: 7.7.0
Generator version: 7.8.0

=end

Expand Down
10 changes: 5 additions & 5 deletions sdks/ruby/lib/dropbox-sign/api/account_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: 3.0.0
Contact: apisupport@hellosign.com
Generated by: https://openapi-generator.tech
Generator version: 7.7.0
Generator version: 7.8.0

=end

Expand Down Expand Up @@ -54,7 +54,7 @@ def account_create_with_http_info(account_create_request, opts = {})
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
Expand Down Expand Up @@ -163,7 +163,7 @@ def account_get_with_http_info(opts = {})
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

post_body = {}
form_params = opts[:form_params] || {}
Expand Down Expand Up @@ -257,7 +257,7 @@ def account_update_with_http_info(account_update_request, opts = {})
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
Expand Down Expand Up @@ -366,7 +366,7 @@ def account_verify_with_http_info(account_verify_request, opts = {})
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
Expand Down
Loading