From c8af13c629623f52bba6a984da7e8d300e971080 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 12 Feb 2024 07:01:21 -0800 Subject: [PATCH] Version 1.0.2.rc12-v1.1.0-1.0.2 release --- .rspec | 2 + .rubocop.yml | 148 +++ .swagger-codegen-ignore | 44 + .swagger-codegen/VERSION | 1 + CHANGELOG.md | 34 + Gemfile | 7 + LICENSE | 21 - README.md | 132 +- Rakefile | 8 + docusign_webforms.gemspec | 48 + lib/docusign_webforms.rb | 64 + .../api/form_instance_management_api.rb | 272 +++++ .../api/form_management_api.rb | 192 +++ lib/docusign_webforms/client/api_client.rb | 600 ++++++++++ lib/docusign_webforms/client/api_error.rb | 37 + lib/docusign_webforms/client/auth/oauth.rb | 1061 +++++++++++++++++ lib/docusign_webforms/configuration.rb | 203 ++++ lib/docusign_webforms/models/account_id.rb | 175 +++ lib/docusign_webforms/models/assertion_id.rb | 175 +++ .../models/authentication_instant.rb | 175 +++ .../models/authentication_method.rb | 175 +++ lib/docusign_webforms/models/brand_id.rb | 175 +++ .../models/client_user_id.rb | 175 +++ lib/docusign_webforms/models/component_key.rb | 174 +++ lib/docusign_webforms/models/count.rb | 175 +++ .../models/create_instance_request_body.rb | 264 ++++ .../models/created_date_time.rb | 175 +++ lib/docusign_webforms/models/date_time.rb | 174 +++ lib/docusign_webforms/models/envelope_id.rb | 175 +++ .../models/expiration_date_time.rb | 175 +++ .../models/expiration_offset.rb | 175 +++ lib/docusign_webforms/models/form_sort_by.rb | 175 +++ lib/docusign_webforms/models/form_url.rb | 175 +++ lib/docusign_webforms/models/guid.rb | 174 +++ lib/docusign_webforms/models/http_error.rb | 195 +++ lib/docusign_webforms/models/http_success.rb | 184 +++ lib/docusign_webforms/models/instance_id.rb | 175 +++ .../models/instance_source.rb | 31 + .../models/instance_status.rb | 31 + .../models/instance_token.rb | 175 +++ .../models/is_private_access.rb | 175 +++ lib/docusign_webforms/models/is_published.rb | 175 +++ lib/docusign_webforms/models/is_standalone.rb | 175 +++ .../models/last_modified_date_time.rb | 175 +++ lib/docusign_webforms/models/return_url.rb | 175 +++ lib/docusign_webforms/models/search_text.rb | 175 +++ .../models/security_domain.rb | 175 +++ lib/docusign_webforms/models/source.rb | 31 + .../models/start_position.rb | 175 +++ lib/docusign_webforms/models/tags.rb | 175 +++ .../models/template_properties.rb | 217 ++++ .../models/token_expiration_date_time.rb | 175 +++ .../models/update_instance_request_body.rb | 184 +++ lib/docusign_webforms/models/user_filter.rb | 30 + lib/docusign_webforms/models/user_id.rb | 175 +++ lib/docusign_webforms/models/web_form.rb | 268 +++++ .../models/web_form_adm_type.rb | 39 + .../models/web_form_component.rb | 248 ++++ .../models/web_form_component_type.rb | 34 + .../models/web_form_components_map.rb | 175 +++ .../models/web_form_content.rb | 217 ++++ lib/docusign_webforms/models/web_form_id.rb | 175 +++ .../models/web_form_instance.rb | 295 +++++ .../models/web_form_instance_envelopes.rb | 183 +++ .../models/web_form_instance_list.rb | 187 +++ .../models/web_form_instance_metadata.rb | 237 ++++ .../models/web_form_metadata.rb | 377 ++++++ lib/docusign_webforms/models/web_form_name.rb | 175 +++ .../models/web_form_properties.rb | 193 +++ .../models/web_form_published_names.rb | 175 +++ .../models/web_form_source.rb | 29 + .../models/web_form_state.rb | 29 + .../models/web_form_summary.rb | 250 ++++ .../models/web_form_summary_list.rb | 247 ++++ .../models/web_form_user_info.rb | 209 ++++ .../models/web_form_values.rb | 175 +++ .../models/web_form_version_id.rb | 175 +++ lib/docusign_webforms/version.rb | 14 + runLinter.sh | 1 + tests/Gemfile | 5 + tests/spec/unit_tests_using_jwt_spec.rb | 38 + 81 files changed, 13241 insertions(+), 22 deletions(-) create mode 100644 .rspec create mode 100644 .rubocop.yml create mode 100644 .swagger-codegen-ignore create mode 100644 .swagger-codegen/VERSION create mode 100644 CHANGELOG.md create mode 100644 Gemfile delete mode 100644 LICENSE create mode 100644 Rakefile create mode 100644 docusign_webforms.gemspec create mode 100644 lib/docusign_webforms.rb create mode 100644 lib/docusign_webforms/api/form_instance_management_api.rb create mode 100644 lib/docusign_webforms/api/form_management_api.rb create mode 100644 lib/docusign_webforms/client/api_client.rb create mode 100644 lib/docusign_webforms/client/api_error.rb create mode 100644 lib/docusign_webforms/client/auth/oauth.rb create mode 100644 lib/docusign_webforms/configuration.rb create mode 100644 lib/docusign_webforms/models/account_id.rb create mode 100644 lib/docusign_webforms/models/assertion_id.rb create mode 100644 lib/docusign_webforms/models/authentication_instant.rb create mode 100644 lib/docusign_webforms/models/authentication_method.rb create mode 100644 lib/docusign_webforms/models/brand_id.rb create mode 100644 lib/docusign_webforms/models/client_user_id.rb create mode 100644 lib/docusign_webforms/models/component_key.rb create mode 100644 lib/docusign_webforms/models/count.rb create mode 100644 lib/docusign_webforms/models/create_instance_request_body.rb create mode 100644 lib/docusign_webforms/models/created_date_time.rb create mode 100644 lib/docusign_webforms/models/date_time.rb create mode 100644 lib/docusign_webforms/models/envelope_id.rb create mode 100644 lib/docusign_webforms/models/expiration_date_time.rb create mode 100644 lib/docusign_webforms/models/expiration_offset.rb create mode 100644 lib/docusign_webforms/models/form_sort_by.rb create mode 100644 lib/docusign_webforms/models/form_url.rb create mode 100644 lib/docusign_webforms/models/guid.rb create mode 100644 lib/docusign_webforms/models/http_error.rb create mode 100644 lib/docusign_webforms/models/http_success.rb create mode 100644 lib/docusign_webforms/models/instance_id.rb create mode 100644 lib/docusign_webforms/models/instance_source.rb create mode 100644 lib/docusign_webforms/models/instance_status.rb create mode 100644 lib/docusign_webforms/models/instance_token.rb create mode 100644 lib/docusign_webforms/models/is_private_access.rb create mode 100644 lib/docusign_webforms/models/is_published.rb create mode 100644 lib/docusign_webforms/models/is_standalone.rb create mode 100644 lib/docusign_webforms/models/last_modified_date_time.rb create mode 100644 lib/docusign_webforms/models/return_url.rb create mode 100644 lib/docusign_webforms/models/search_text.rb create mode 100644 lib/docusign_webforms/models/security_domain.rb create mode 100644 lib/docusign_webforms/models/source.rb create mode 100644 lib/docusign_webforms/models/start_position.rb create mode 100644 lib/docusign_webforms/models/tags.rb create mode 100644 lib/docusign_webforms/models/template_properties.rb create mode 100644 lib/docusign_webforms/models/token_expiration_date_time.rb create mode 100644 lib/docusign_webforms/models/update_instance_request_body.rb create mode 100644 lib/docusign_webforms/models/user_filter.rb create mode 100644 lib/docusign_webforms/models/user_id.rb create mode 100644 lib/docusign_webforms/models/web_form.rb create mode 100644 lib/docusign_webforms/models/web_form_adm_type.rb create mode 100644 lib/docusign_webforms/models/web_form_component.rb create mode 100644 lib/docusign_webforms/models/web_form_component_type.rb create mode 100644 lib/docusign_webforms/models/web_form_components_map.rb create mode 100644 lib/docusign_webforms/models/web_form_content.rb create mode 100644 lib/docusign_webforms/models/web_form_id.rb create mode 100644 lib/docusign_webforms/models/web_form_instance.rb create mode 100644 lib/docusign_webforms/models/web_form_instance_envelopes.rb create mode 100644 lib/docusign_webforms/models/web_form_instance_list.rb create mode 100644 lib/docusign_webforms/models/web_form_instance_metadata.rb create mode 100644 lib/docusign_webforms/models/web_form_metadata.rb create mode 100644 lib/docusign_webforms/models/web_form_name.rb create mode 100644 lib/docusign_webforms/models/web_form_properties.rb create mode 100644 lib/docusign_webforms/models/web_form_published_names.rb create mode 100644 lib/docusign_webforms/models/web_form_source.rb create mode 100644 lib/docusign_webforms/models/web_form_state.rb create mode 100644 lib/docusign_webforms/models/web_form_summary.rb create mode 100644 lib/docusign_webforms/models/web_form_summary_list.rb create mode 100644 lib/docusign_webforms/models/web_form_user_info.rb create mode 100644 lib/docusign_webforms/models/web_form_values.rb create mode 100644 lib/docusign_webforms/models/web_form_version_id.rb create mode 100644 lib/docusign_webforms/version.rb create mode 100644 runLinter.sh create mode 100644 tests/Gemfile create mode 100644 tests/spec/unit_tests_using_jwt_spec.rb diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..83e16f8 --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--color +--require spec_helper diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..b3ec02a --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,148 @@ +# This file is based on https://github.com/rails/rails/blob/master/.rubocop.yml (MIT license) +# Automatically generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen) +AllCops: + TargetRubyVersion: 2.6 + # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop + # to ignore them, so only the ones explicitly set in this file are enabled. + DisabledByDefault: true + Exclude: + - '**/templates/**/*' + - '**/vendor/**/*' + - 'actionpack/lib/action_dispatch/journey/parser.rb' + +# Prefer &&/|| over and/or. +Style/AndOr: + Enabled: true + +# Align `when` with `case`. +Layout/CaseIndentation: + Enabled: true + +# Align comments with method definitions. +Layout/CommentIndentation: + Enabled: true + +Layout/ElseAlignment: + Enabled: true + +Layout/EmptyLineAfterMagicComment: + Enabled: true + +# In a regular class definition, no empty lines around the body. +Layout/EmptyLinesAroundClassBody: + Enabled: true + +# In a regular method definition, no empty lines around the body. +Layout/EmptyLinesAroundMethodBody: + Enabled: true + +# In a regular module definition, no empty lines around the body. +Layout/EmptyLinesAroundModuleBody: + Enabled: true + +Layout/FirstParameterIndentation: + Enabled: true + +# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }. +Style/HashSyntax: + Enabled: false + +# Method definitions after `private` or `protected` isolated calls need one +# extra level of indentation. +Layout/IndentationConsistency: + Enabled: true + EnforcedStyle: indented_internal_methods + +# Two spaces, no tabs (for indentation). +Layout/IndentationWidth: + Enabled: true + +Layout/LeadingCommentSpace: + Enabled: true + +Layout/SpaceAfterColon: + Enabled: true + +Layout/SpaceAfterComma: + Enabled: true + +Layout/SpaceAroundEqualsInParameterDefault: + Enabled: true + +Layout/SpaceAroundKeyword: + Enabled: true + +Layout/SpaceAroundOperators: + Enabled: true + +Layout/SpaceBeforeComma: + Enabled: true + +Layout/SpaceBeforeFirstArg: + Enabled: true + +Style/DefWithParentheses: + Enabled: true + +# Defining a method with parameters needs parentheses. +Style/MethodDefParentheses: + Enabled: true + +Style/FrozenStringLiteralComment: + Enabled: false + EnforcedStyle: always + +# Use `foo {}` not `foo{}`. +Layout/SpaceBeforeBlockBraces: + Enabled: true + +# Use `foo { bar }` not `foo {bar}`. +Layout/SpaceInsideBlockBraces: + Enabled: true + +# Use `{ a: 1 }` not `{a:1}`. +Layout/SpaceInsideHashLiteralBraces: + Enabled: true + +Layout/SpaceInsideParens: + Enabled: true + +# Check quotes usage according to lint rule below. +#Style/StringLiterals: +# Enabled: true +# EnforcedStyle: single_quotes + +# Detect hard tabs, no hard tabs. +Layout/IndentationStyle: + Enabled: true + +# Blank lines should not have any spaces. +Layout/TrailingEmptyLines: + Enabled: true + +# No trailing whitespace. +Layout/TrailingWhitespace: + Enabled: false + +# Use quotes for string literals when they are enough. +Style/RedundantPercentQ: + Enabled: true + +# Align `end` with the matching keyword or starting expression except for +# assignments, where it should be aligned with the LHS. +Lint/EndAlignment: + Enabled: true + EnforcedStyleAlignWith: variable + AutoCorrect: true + +# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg. +Lint/RequireParentheses: + Enabled: true + +Style/RedundantReturn: + Enabled: true + AllowMultipleReturnValues: true + +Style/Semicolon: + Enabled: true + AllowAsExpressionSeparator: true diff --git a/.swagger-codegen-ignore b/.swagger-codegen-ignore new file mode 100644 index 0000000..1df37eb --- /dev/null +++ b/.swagger-codegen-ignore @@ -0,0 +1,44 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md + + +# Swagger and Git files +.swagger-codegen-ignore +git_push.sh +.gitignore +CHANGELOG.md + + +# Project files +LICENSE +.travis.yml +Gemfile +Gemfile.lock +Rakefile + +# Specific src and test files +.rspec +docs/ +spec/ +tests/ \ No newline at end of file diff --git a/.swagger-codegen/VERSION b/.swagger-codegen/VERSION new file mode 100644 index 0000000..19244e8 --- /dev/null +++ b/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.4.21 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..2720f99 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,34 @@ +## [v1.0.2.rc12] - WebForms API v1.1.0-1.0.2 - 2024-02-09 +### Breaking Changes + +- **`baseUrl` Defaulting to DEMO URL:** + - The `baseUrl` now defaults to the DEMO URL if not provided. Please update your configurations accordingly. + +### Other Changes + +- Updated the SDK release version +## [v1.0.2.rc11] - WebForms API v1.1.0-1.0.2 - 2024-02-08 +### Changed +- Added support for version v1.1.0-1.0.2 of the DocuSign WebForms API. +- Updated the SDK release version. + +## [v1.0.1.rc9] - WebForms API v1.1.0-1.0.1 - 2024-02-05 +### Changed +- Added support for version v1.1.0-1.0.1 of the DocuSign WebForms API. +- Updated the SDK release version. + +## [v1.0.0.rc05] - WebForms API v1.1.0-1.0.0 - 2023-12-26 +### Changed +- Added support for version v1.1.0-1.0.0 of the DocuSign WebForms API. +- Updated the SDK release version. + +## [v1.0.0.rc04] - WebForms API v1.1.0-1.0.0 - 2023-12-18 +### Changed +- Added support for version v1.1.0-1.0.0 of the DocuSign WebForms API. +- Updated the SDK release version. + +## [v1.0.0.rc02] - WebForms API 1.1.0-1.0.0 - 2023-12-14 +### Changed +- Added support for version 1.1.0-1.0.0 of the DocuSign WebForms API. +- Updated the SDK release version. + diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..f58bec0 --- /dev/null +++ b/Gemfile @@ -0,0 +1,7 @@ +source 'https://rubygems.org' + +gemspec + +group :development, :test do + gem 'rake', '~> 12.3.3' +end diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 71a5961..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2024 DocuSign Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md index ccf1db0..6d06e64 100644 --- a/README.md +++ b/README.md @@ -1 +1,131 @@ -# docusign-webforms-ruby-client \ No newline at end of file +# docusign_webforms + +DocuSign_WebForms - the Ruby gem for the Web Forms API version 1.1 + +The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: + +- API version: 1.1.0 +- Package version: 1.0.2.rc12 +- Build package: io.swagger.codegen.languages.RubyClientCodegen +For more information, please visit [https://developers.docusign.com/](https://developers.docusign.com/) + +## Installation + +### Build a gem + +To build the Ruby code into a gem: + +```shell +gem build docusign_webforms.gemspec +``` + +Then either install the gem locally: + +```shell +gem install ./docusign_webforms-1.0.2.rc12.gem +``` +(for development, run `gem install --dev ./docusign_webforms-1.0.2.rc12.gem` to install the development dependencies) + +or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/). + +Finally add this to the Gemfile: + + gem 'docusign_webforms', '~> 1.0.2.rc12' + +### Install from Git + +If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile: + + gem 'docusign_webforms', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git' + +### Include the Ruby code directly + +Include the Ruby code directly using `-I` as follows: + +```shell +ruby -Ilib script.rb +``` + +## Getting Started + +Please follow the [installation](#installation) procedure and then run the following code: +```ruby +# Load the gem +require 'docusign_webforms' + +# Setup authorization +DocuSign_WebForms.configure do |config| + # Configure OAuth2 access token for authorization: docusignAccessCode + config.access_token = 'YOUR ACCESS TOKEN' +end + +api_instance = DocuSign_WebForms::FormInstanceManagementApi.new + +account_id = 'account_id_example' # String | Account identifier in which the web form resides + +form_id = 'form_id_example' # String | Unique identifier for a web form entity that is consistent for it's lifetime + +create_instance_body = DocuSign_WebForms::CreateInstanceRequestBody.new # CreateInstanceRequestBody | Request body containing properties that will be used to create instance. + + +begin + #Creates an instance of the web form + result = api_instance.create_instance(account_id, form_id, create_instance_body) + p result +rescue DocuSign_WebForms::ApiError => e + puts "Exception when calling FormInstanceManagementApi->create_instance: #{e}" +end + +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://www.docusign.net/webforms/v1.1* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*DocuSign_WebForms::FormInstanceManagementApi* | [**create_instance**](docs/FormInstanceManagementApi.md#create_instance) | **POST** /accounts/{account_id}/forms/{form_id}/instances | Creates an instance of the web form +*DocuSign_WebForms::FormInstanceManagementApi* | [**get_instance**](docs/FormInstanceManagementApi.md#get_instance) | **GET** /accounts/{account_id}/forms/{form_id}/instances/{instance_id} | Get form instance +*DocuSign_WebForms::FormInstanceManagementApi* | [**list_instances**](docs/FormInstanceManagementApi.md#list_instances) | **GET** /accounts/{account_id}/forms/{form_id}/instances | List instances +*DocuSign_WebForms::FormInstanceManagementApi* | [**refresh_token**](docs/FormInstanceManagementApi.md#refresh_token) | **POST** /accounts/{account_id}/forms/{form_id}/instances/{instance_id}/refresh | Refreshes the instance token +*DocuSign_WebForms::FormManagementApi* | [**get_form**](docs/FormManagementApi.md#get_form) | **GET** /accounts/{account_id}/forms/{form_id} | Get Form +*DocuSign_WebForms::FormManagementApi* | [**list_forms**](docs/FormManagementApi.md#list_forms) | **GET** /accounts/{account_id}/forms | List Forms + + +## Documentation for Models + + - [DocuSign_WebForms::CreateInstanceRequestBody](docs/CreateInstanceRequestBody.md) + - [DocuSign_WebForms::HttpError](docs/HttpError.md) + - [DocuSign_WebForms::HttpSuccess](docs/HttpSuccess.md) + - [DocuSign_WebForms::InstanceSource](docs/InstanceSource.md) + - [DocuSign_WebForms::InstanceStatus](docs/InstanceStatus.md) + - [DocuSign_WebForms::TemplateProperties](docs/TemplateProperties.md) + - [DocuSign_WebForms::WebForm](docs/WebForm.md) + - [DocuSign_WebForms::WebFormComponentType](docs/WebFormComponentType.md) + - [DocuSign_WebForms::WebFormContent](docs/WebFormContent.md) + - [DocuSign_WebForms::WebFormInstance](docs/WebFormInstance.md) + - [DocuSign_WebForms::WebFormInstanceEnvelopes](docs/WebFormInstanceEnvelopes.md) + - [DocuSign_WebForms::WebFormInstanceList](docs/WebFormInstanceList.md) + - [DocuSign_WebForms::WebFormInstanceMetadata](docs/WebFormInstanceMetadata.md) + - [DocuSign_WebForms::WebFormMetadata](docs/WebFormMetadata.md) + - [DocuSign_WebForms::WebFormProperties](docs/WebFormProperties.md) + - [DocuSign_WebForms::WebFormSource](docs/WebFormSource.md) + - [DocuSign_WebForms::WebFormState](docs/WebFormState.md) + - [DocuSign_WebForms::WebFormSummary](docs/WebFormSummary.md) + - [DocuSign_WebForms::WebFormSummaryList](docs/WebFormSummaryList.md) + - [DocuSign_WebForms::WebFormUserInfo](docs/WebFormUserInfo.md) + - [DocuSign_WebForms::WebFormValues](docs/WebFormValues.md) + + +## Documentation for Authorization + + +### docusignAccessCode + +- **Type**: OAuth +- **Flow**: accessCode +- **Authorization URL**: https://account.docusign.com/oauth/auth +- **Scopes**: N/A + diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..d52c3e3 --- /dev/null +++ b/Rakefile @@ -0,0 +1,8 @@ +begin + require 'rspec/core/rake_task' + + RSpec::Core::RakeTask.new(:spec) + task default: :spec +rescue LoadError + # no rspec available +end diff --git a/docusign_webforms.gemspec b/docusign_webforms.gemspec new file mode 100644 index 0000000..d4ab3fd --- /dev/null +++ b/docusign_webforms.gemspec @@ -0,0 +1,48 @@ +# -*- encoding: utf-8 -*- + +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +$:.push File.expand_path("../lib", __FILE__) +require "docusign_webforms/version" + +Gem::Specification.new do |s| + s.name = "docusign_webforms" + s.version = DocuSign_WebForms::VERSION + s.platform = Gem::Platform::RUBY + s.authors = ["DocuSign"] + s.email = ["devcenter@docusign.com"] + s.homepage = "https://github.com/docusign/docusign-webforms-ruby-client" + s.summary = "Web Forms API version 1.1 Ruby Gem" + s.description = "The DocuSign package makes integrating DocuSign into your apps and websites a super fast and painless process. The library is open sourced on GitHub, look for the docusign-webforms-ruby-client repository." + s.license = "MIT" + s.required_ruby_version = ">= 1.9" + + s.add_runtime_dependency 'jwt', '~> 2.2', '>= 2.2.1' + s.add_runtime_dependency 'addressable', '~> 2.7', '>= 2.7.0' + s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' + s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0' + + s.add_development_dependency 'rspec-mocks', '~> 3.8', '>= 3.8.0' + s.add_development_dependency 'rspec-expectations', '~> 3.8', '>= 3.8.0' + s.add_development_dependency 'rspec', '~> 3.4', '>= 3.4.0' + s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1' + s.add_development_dependency 'webmock', '~> 1.24', '>= 1.24.3' + s.add_development_dependency 'autotest', '~> 4.4', '>= 4.4.6' + s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2' + s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16' + s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.11' + + s.files = `find *`.split("\n").uniq.sort.select{|f| !f.empty? } + s.test_files = `find spec/*`.split("\n") + s.executables = [] + s.require_paths = ["lib"] +end \ No newline at end of file diff --git a/lib/docusign_webforms.rb b/lib/docusign_webforms.rb new file mode 100644 index 0000000..17e887f --- /dev/null +++ b/lib/docusign_webforms.rb @@ -0,0 +1,64 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +# Common files +require 'docusign_webforms/client/api_client' +require 'docusign_webforms/client/api_error' +require 'docusign_webforms/version' +require 'docusign_webforms/configuration' + +# Client Files +require 'docusign_webforms/client/auth/oauth' + +# Models +require 'docusign_webforms/models/create_instance_request_body' +require 'docusign_webforms/models/http_error' +require 'docusign_webforms/models/http_success' +require 'docusign_webforms/models/instance_source' +require 'docusign_webforms/models/instance_status' +require 'docusign_webforms/models/template_properties' +require 'docusign_webforms/models/web_form' +require 'docusign_webforms/models/web_form_component_type' +require 'docusign_webforms/models/web_form_content' +require 'docusign_webforms/models/web_form_instance' +require 'docusign_webforms/models/web_form_instance_envelopes' +require 'docusign_webforms/models/web_form_instance_list' +require 'docusign_webforms/models/web_form_instance_metadata' +require 'docusign_webforms/models/web_form_metadata' +require 'docusign_webforms/models/web_form_properties' +require 'docusign_webforms/models/web_form_source' +require 'docusign_webforms/models/web_form_state' +require 'docusign_webforms/models/web_form_summary' +require 'docusign_webforms/models/web_form_summary_list' +require 'docusign_webforms/models/web_form_user_info' +require 'docusign_webforms/models/web_form_values' + +# APIs +require 'docusign_webforms/api/form_instance_management_api' +require 'docusign_webforms/api/form_management_api' + +module DocuSign_WebForms + class << self + # Customize default settings for the SDK using block. + # DocuSign_WebForms.configure do |config| + # config.username = "xxx" + # config.password = "xxx" + # end + # If no block given, return the default Configuration object. + def configure + if block_given? + yield(Configuration.default) + else + Configuration.default + end + end + end +end \ No newline at end of file diff --git a/lib/docusign_webforms/api/form_instance_management_api.rb b/lib/docusign_webforms/api/form_instance_management_api.rb new file mode 100644 index 0000000..72a83b1 --- /dev/null +++ b/lib/docusign_webforms/api/form_instance_management_api.rb @@ -0,0 +1,272 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require "uri" + +module DocuSign_WebForms + + class ListInstancesOptions + # A unique identifier for a user that should originate from client's system. This value can be anything your backend system would use to track individual form instances. Examples include employee IDs, email addresses, surrogate key values, etc. + attr_accessor :client_user_id + + def self.default + @@default ||= ListInstancesOptions.new + end + end + + + class FormInstanceManagementApi + attr_accessor :api_client + + def initialize(api_client = FormInstanceManagementApi.default) + @api_client = api_client + end + + # Creates an instance of the web form + # Creates an instance of the web form. + # @param account_id Account identifier in which the web form resides + # @param form_id Unique identifier for a web form entity that is consistent for it's lifetime + # @param create_instance_body Request body containing properties that will be used to create instance. + # @return [WebFormInstance] + def create_instance(account_id, form_id, create_instance_body) + data, _status_code, _headers = create_instance_with_http_info(account_id, form_id, create_instance_body) + return data + end + + # Creates an instance of the web form + # Creates an instance of the web form. + # @param account_id Account identifier in which the web form resides + # @param form_id Unique identifier for a web form entity that is consistent for it's lifetime + # @param create_instance_body Request body containing properties that will be used to create instance. + # @return [Array<(WebFormInstance, Fixnum, Hash)>] WebFormInstance data, response status code and response headers + def create_instance_with_http_info(account_id, form_id, create_instance_body) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: FormInstanceManagementApi.create_instance ..." + end + # verify the required parameter 'account_id' is set + fail ArgumentError, "Missing the required parameter 'account_id' when calling FormInstanceManagementApi.create_instance" if account_id.nil? + # verify the required parameter 'form_id' is set + fail ArgumentError, "Missing the required parameter 'form_id' when calling FormInstanceManagementApi.create_instance" if form_id.nil? + # verify the required parameter 'create_instance_body' is set + fail ArgumentError, "Missing the required parameter 'create_instance_body' when calling FormInstanceManagementApi.create_instance" if create_instance_body.nil? + # resource path + local_var_path = "/accounts/{account_id}/forms/{form_id}/instances".sub('{format}','json').sub('{' + 'account_id' + '}', account_id.to_s).sub('{' + 'form_id' + '}', form_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = @api_client.object_to_http_body(create_instance_body) + auth_names = [] + data, status_code, headers = @api_client.call_api(:POST, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'WebFormInstance') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FormInstanceManagementApi#create_instance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get form instance + # Retrieves instance information filter by instance id + # @param account_id Account identifier in which the web form resides + # @param form_id Unique identifier for a web form entity that is consistent for it's lifetime + # @param instance_id Unique identifier for a Web Form Instance that is consistent until its expiration + # @return [WebFormInstance] + def get_instance(account_id, form_id, instance_id) + data, _status_code, _headers = get_instance_with_http_info(account_id, form_id, instance_id) + return data + end + + # Get form instance + # Retrieves instance information filter by instance id + # @param account_id Account identifier in which the web form resides + # @param form_id Unique identifier for a web form entity that is consistent for it's lifetime + # @param instance_id Unique identifier for a Web Form Instance that is consistent until its expiration + # @return [Array<(WebFormInstance, Fixnum, Hash)>] WebFormInstance data, response status code and response headers + def get_instance_with_http_info(account_id, form_id, instance_id) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: FormInstanceManagementApi.get_instance ..." + end + # verify the required parameter 'account_id' is set + fail ArgumentError, "Missing the required parameter 'account_id' when calling FormInstanceManagementApi.get_instance" if account_id.nil? + # verify the required parameter 'form_id' is set + fail ArgumentError, "Missing the required parameter 'form_id' when calling FormInstanceManagementApi.get_instance" if form_id.nil? + # verify the required parameter 'instance_id' is set + fail ArgumentError, "Missing the required parameter 'instance_id' when calling FormInstanceManagementApi.get_instance" if instance_id.nil? + # resource path + local_var_path = "/accounts/{account_id}/forms/{form_id}/instances/{instance_id}".sub('{format}','json').sub('{' + 'account_id' + '}', account_id.to_s).sub('{' + 'form_id' + '}', form_id.to_s).sub('{' + 'instance_id' + '}', instance_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = [] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'WebFormInstance') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FormInstanceManagementApi#get_instance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List instances + # List all the instances of a web form in an account. When filtered by clientUserId, it will return instances having same clientUserId + # @param account_id Account identifier in which the web form resides + # @param form_id Unique identifier for a web form that is consistent for it's lifetime + # @param DocuSign_WebForms::ListInstancesOptions Options for modifying the behavior of the function. + # @return [WebFormInstanceList] + def list_instances(account_id, form_id, options = DocuSign_WebForms::ListInstancesOptions.default) + data, _status_code, _headers = list_instances_with_http_info(account_id, form_id, options) + return data + end + + # List instances + # List all the instances of a web form in an account. When filtered by clientUserId, it will return instances having same clientUserId + # @param account_id Account identifier in which the web form resides + # @param form_id Unique identifier for a web form that is consistent for it's lifetime + # @param DocuSign_WebForms::ListInstancesOptions Options for modifying the behavior of the function. + # @return [Array<(WebFormInstanceList, Fixnum, Hash)>] WebFormInstanceList data, response status code and response headers + def list_instances_with_http_info(account_id, form_id, options = DocuSign_WebForms::ListInstancesOptions.default) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: FormInstanceManagementApi.list_instances ..." + end + # verify the required parameter 'account_id' is set + fail ArgumentError, "Missing the required parameter 'account_id' when calling FormInstanceManagementApi.list_instances" if account_id.nil? + # verify the required parameter 'form_id' is set + fail ArgumentError, "Missing the required parameter 'form_id' when calling FormInstanceManagementApi.list_instances" if form_id.nil? + if !options.client_user_id.nil? && options.client_user_id.to_s.length > 100 + fail ArgumentError, 'invalid value for "options[:"client_user_id"]" when calling FormInstanceManagementApi.list_instances, the character length must be smaller than or equal to 100.' + end + + # resource path + local_var_path = "/accounts/{account_id}/forms/{form_id}/instances".sub('{format}','json').sub('{' + 'account_id' + '}', account_id.to_s).sub('{' + 'form_id' + '}', form_id.to_s) + + # query parameters + query_params = {} + query_params[:'client_user_id'] = options.client_user_id if !options.client_user_id.nil? + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = [] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'WebFormInstanceList') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FormInstanceManagementApi#list_instances\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Refreshes the instance token + # Generates new instance token for the existing Web Form Instance. + # @param account_id Account identifier in which the web form resides + # @param form_id Unique identifier for a web form entity that is consistent for it's lifetime + # @param instance_id Unique identifier for a Web Form Instance that is consistent until its expiration + # @return [WebFormInstance] + def refresh_token(account_id, form_id, instance_id) + data, _status_code, _headers = refresh_token_with_http_info(account_id, form_id, instance_id) + return data + end + + # Refreshes the instance token + # Generates new instance token for the existing Web Form Instance. + # @param account_id Account identifier in which the web form resides + # @param form_id Unique identifier for a web form entity that is consistent for it's lifetime + # @param instance_id Unique identifier for a Web Form Instance that is consistent until its expiration + # @return [Array<(WebFormInstance, Fixnum, Hash)>] WebFormInstance data, response status code and response headers + def refresh_token_with_http_info(account_id, form_id, instance_id) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: FormInstanceManagementApi.refresh_token ..." + end + # verify the required parameter 'account_id' is set + fail ArgumentError, "Missing the required parameter 'account_id' when calling FormInstanceManagementApi.refresh_token" if account_id.nil? + # verify the required parameter 'form_id' is set + fail ArgumentError, "Missing the required parameter 'form_id' when calling FormInstanceManagementApi.refresh_token" if form_id.nil? + # verify the required parameter 'instance_id' is set + fail ArgumentError, "Missing the required parameter 'instance_id' when calling FormInstanceManagementApi.refresh_token" if instance_id.nil? + # resource path + local_var_path = "/accounts/{account_id}/forms/{form_id}/instances/{instance_id}/refresh".sub('{format}','json').sub('{' + 'account_id' + '}', account_id.to_s).sub('{' + 'form_id' + '}', form_id.to_s).sub('{' + 'instance_id' + '}', instance_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = [] + data, status_code, headers = @api_client.call_api(:POST, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'WebFormInstance') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FormInstanceManagementApi#refresh_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end \ No newline at end of file diff --git a/lib/docusign_webforms/api/form_management_api.rb b/lib/docusign_webforms/api/form_management_api.rb new file mode 100644 index 0000000..addadbf --- /dev/null +++ b/lib/docusign_webforms/api/form_management_api.rb @@ -0,0 +1,192 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require "uri" + +module DocuSign_WebForms + + class GetFormOptions + # The state of the web form configuration + attr_accessor :state + + def self.default + @@default ||= GetFormOptions.new + end + end + + class ListFormsOptions + # Filter which forms are returned + attr_accessor :user_filter + + # Is the form a standalone form + attr_accessor :is_standalone + + # Has the form been published + attr_accessor :is_published + + # Sort result set in mentioned sort property:order. Default is lastModifiedDateTime:desc. Default sort is descending if not mentioned. + attr_accessor :sort_by + + # Search through form names + attr_accessor :search + + # Starting position for desired page of results. + attr_accessor :start_position + + # Number of results to return per page. + attr_accessor :count + + def self.default + @@default ||= ListFormsOptions.new + end + end + + + class FormManagementApi + attr_accessor :api_client + + def initialize(api_client = FormManagementApi.default) + @api_client = api_client + end + + # Get Form + # Retrieves form information filter by form id and state. The `state` parameter is optional and can accept value from `draft, active`. + # @param account_id Account identifier in which the web form resides + # @param form_id Unique identifier for a web form that is consistent for it's lifetime + # @param DocuSign_WebForms::GetFormOptions Options for modifying the behavior of the function. + # @return [WebForm] + def get_form(account_id, form_id, options = DocuSign_WebForms::GetFormOptions.default) + data, _status_code, _headers = get_form_with_http_info(account_id, form_id, options) + return data + end + + # Get Form + # Retrieves form information filter by form id and state. The `state` parameter is optional and can accept value from `draft, active`. + # @param account_id Account identifier in which the web form resides + # @param form_id Unique identifier for a web form that is consistent for it's lifetime + # @param DocuSign_WebForms::GetFormOptions Options for modifying the behavior of the function. + # @return [Array<(WebForm, Fixnum, Hash)>] WebForm data, response status code and response headers + def get_form_with_http_info(account_id, form_id, options = DocuSign_WebForms::GetFormOptions.default) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: FormManagementApi.get_form ..." + end + # verify the required parameter 'account_id' is set + fail ArgumentError, "Missing the required parameter 'account_id' when calling FormManagementApi.get_form" if account_id.nil? + # verify the required parameter 'form_id' is set + fail ArgumentError, "Missing the required parameter 'form_id' when calling FormManagementApi.get_form" if form_id.nil? + if options.state && !['active', 'draft'].include?(options.state) + fail ArgumentError, 'invalid value for "state", must be one of active, draft' + end + if !options.state.nil? && options.state.to_s.length > 15 + fail ArgumentError, 'invalid value for "options[:"state"]" when calling FormManagementApi.get_form, the character length must be smaller than or equal to 15.' + end + + # resource path + local_var_path = "/accounts/{account_id}/forms/{form_id}".sub('{format}','json').sub('{' + 'account_id' + '}', account_id.to_s).sub('{' + 'form_id' + '}', form_id.to_s) + + # query parameters + query_params = {} + query_params[:'state'] = options.state if !options.state.nil? + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = [] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'WebForm') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FormManagementApi#get_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List Forms + # List all the forms for the active user that can be in an active or draft state + # @param account_id Account identifier in which the webform resides + # @param DocuSign_WebForms::ListFormsOptions Options for modifying the behavior of the function. + # @return [WebFormSummaryList] + def list_forms(account_id, options = DocuSign_WebForms::ListFormsOptions.default) + data, _status_code, _headers = list_forms_with_http_info(account_id, options) + return data + end + + # List Forms + # List all the forms for the active user that can be in an active or draft state + # @param account_id Account identifier in which the webform resides + # @param DocuSign_WebForms::ListFormsOptions Options for modifying the behavior of the function. + # @return [Array<(WebFormSummaryList, Fixnum, Hash)>] WebFormSummaryList data, response status code and response headers + def list_forms_with_http_info(account_id, options = DocuSign_WebForms::ListFormsOptions.default) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: FormManagementApi.list_forms ..." + end + # verify the required parameter 'account_id' is set + fail ArgumentError, "Missing the required parameter 'account_id' when calling FormManagementApi.list_forms" if account_id.nil? + if options.user_filter && !['owned_by_me', 'all'].include?(options.user_filter) + fail ArgumentError, 'invalid value for "user_filter", must be one of owned_by_me, all' + end + if !options.sort_by.nil? && options.sort_by.to_s.length > 50 + fail ArgumentError, 'invalid value for "options[:"sort_by"]" when calling FormManagementApi.list_forms, the character length must be smaller than or equal to 50.' + end + + # resource path + local_var_path = "/accounts/{account_id}/forms".sub('{format}','json').sub('{' + 'account_id' + '}', account_id.to_s) + + # query parameters + query_params = {} + query_params[:'user_filter'] = options.user_filter if !options.user_filter.nil? + query_params[:'is_standalone'] = options.is_standalone if !options.is_standalone.nil? + query_params[:'is_published'] = options.is_published if !options.is_published.nil? + query_params[:'sort_by'] = options.sort_by if !options.sort_by.nil? + query_params[:'search'] = options.search if !options.search.nil? + query_params[:'start_position'] = options.start_position if !options.start_position.nil? + query_params[:'count'] = options.count if !options.count.nil? + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = [] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'WebFormSummaryList') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FormManagementApi#list_forms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end \ No newline at end of file diff --git a/lib/docusign_webforms/client/api_client.rb b/lib/docusign_webforms/client/api_client.rb new file mode 100644 index 0000000..68bff40 --- /dev/null +++ b/lib/docusign_webforms/client/api_client.rb @@ -0,0 +1,600 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' +require 'json' +require 'logger' +require 'tempfile' +require 'typhoeus' +require 'uri' +require 'jwt' +require 'addressable/uri' + +module DocuSign_WebForms + class ApiClient + # The Configuration object holding settings to be used in the API client. + attr_accessor :config + + # Defines the headers to be used in HTTP requests of all API calls by default. + # + # @return [Hash] + attr_accessor :default_headers + + attr_accessor :base_path + attr_accessor :oauth_base_path + + # Initializes the ApiClient + # @option config [Configuration] Configuration for initializing the object, default to Configuration.default + def initialize(config = Configuration.default) + @config = config + @user_agent = "Swagger-Codegen/1.1.0/1.0.2.rc12/ruby-#{RUBY_VERSION}p#{RUBY_PATCHLEVEL}" + @default_headers = { + 'Content-Type' => "application/json", + 'User-Agent' => @user_agent + } + end + + def self.default + @@default ||= ApiClient.new + end + + # Call an API with given options. + # + # @return [Array<(Object, Fixnum, Hash)>] an array of 3 elements: + # the data deserialized from response body (could be nil), response status code and response headers. + def call_api(http_method, path, opts = {}) + request = build_request(http_method, path, opts) + response = request.run + + if @config.debugging + @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" + end + + unless response.success? + if response.timed_out? + fail ApiError.new('Connection timed out') + elsif response.code == 0 + # Errors from libcurl will be made visible here + fail ApiError.new(:code => 0, + :message => response.return_message) + else + fail ApiError.new(:code => response.code, + :response_headers => response.headers, + :response_body => response.body), + response.status_message + end + end + + if opts[:return_type] + data = deserialize(response, opts[:return_type]) + else + data = nil + end + return data, response.code, response.headers + end + + # Builds the HTTP request + # + # @param [String] http_method HTTP method/verb (e.g. POST) + # @param [String] path URL path (e.g. /account/new) + # @option opts [Hash] :header_params Header parameters + # @option opts [Hash] :query_params Query parameters + # @option opts [Hash] :form_params Query parameters + # @option opts [Object] :body HTTP body (JSON/XML) + # @return [Typhoeus::Request] A Typhoeus Request + def build_request(http_method, path, opts = {}) + url = build_request_url(path, opts) + http_method = http_method.to_sym.downcase + + header_params = @default_headers.merge(opts[:header_params] || {}) + + # Add SDK default header + header_params.store("X-DocuSign-SDK", "Ruby") + + query_params = opts[:query_params] || {} + form_params = opts[:form_params] || {} + + update_params_for_auth! header_params, query_params, opts[:auth_names] + + # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false) + _verify_ssl_host = @config.verify_ssl_host ? 2 : 0 + + req_opts = { + :method => http_method, + :headers => header_params, + :params => query_params, + :params_encoding => @config.params_encoding, + :timeout => @config.timeout, + :ssl_verifypeer => @config.verify_ssl, + :ssl_verifyhost => _verify_ssl_host, + :sslcert => @config.cert_file, + :sslkey => @config.key_file, + :verbose => @config.debugging + } + + # set custom cert, if provided + req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert + + if [:post, :patch, :put, :delete].include?(http_method) + req_body = build_request_body(header_params, form_params, opts[:body]) + req_opts.update :body => req_body + if @config.debugging + @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" + end + end + + Typhoeus::Request.new(url, req_opts) + end + + # Check if the given MIME is a JSON MIME. + # JSON MIME examples: + # application/json + # application/json; charset=UTF8 + # APPLICATION/JSON + # */* + # @param [String] mime MIME + # @return [Boolean] True if the MIME is application/json + def json_mime?(mime) + (mime == "*/*") || !(mime =~ /\Aapplication\/json(;.*)?\z/i).nil? + end + + # Deserialize the response to the given return type. + # + # @param [Response] response HTTP response + # @param [String] return_type some examples: "User", "Array[User]", "Hash[String,Integer]" + def deserialize(response, return_type) + body = response.body + return nil if body.nil? || body.empty? + + # return response body directly for String return type + return body if return_type == 'String' + + # handle file downloading - save response body into a tmp file and return the File instance + return download_file(response) if return_type == 'File' + + # ensuring a default content type + content_type = response.headers['Content-Type'] || 'application/json' + + fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) + + begin + data = JSON.parse("[#{body}]", :symbolize_names => true)[0] + rescue JSON::ParserError => e + if %w(String Date DateTime).include?(return_type) + data = body + else + raise e + end + end + + convert_to_type data, return_type + end + + # Convert data to the given return type. + # @param [Object] data Data to be converted + # @param [String] return_type Return type + # @return [Mixed] Data in a particular type + def convert_to_type(data, return_type) + return nil if data.nil? + case return_type + when 'String' + data.to_s + when 'Integer' + data.to_i + when 'Float' + data.to_f + when 'BOOLEAN' + data == true + when 'DateTime' + # parse date time (expecting ISO 8601 format) + DateTime.parse data + when 'Date' + # parse date time (expecting ISO 8601 format) + Date.parse data + when 'Object' + # generic object (usually a Hash), return directly + data + when /\AArray<(.+)>\z/ + # e.g. Array + sub_type = $1 + data.map {|item| convert_to_type(item, sub_type) } + when /\AHash\\z/ + # e.g. Hash + sub_type = $1 + {}.tap do |hash| + data.each {|k, v| hash[k] = convert_to_type(v, sub_type) } + end + else + # models, e.g. Pet + DocuSign_WebForms.const_get(return_type).new.tap do |model| + model.build_from_hash data + end + end + end + + # Save response body into a file in (the defined) temporary folder, using the filename + # from the "Content-Disposition" header if provided, otherwise a random filename. + # + # @see Configuration#temp_folder_path + # @return [Tempfile] the file downloaded + def download_file(response) + content_disposition = response.headers['Content-Disposition'] + if content_disposition and content_disposition =~ /filename=/i + filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] + prefix = sanitize_filename(filename) + else + prefix = 'download-' + end + prefix = prefix + '-' unless prefix.end_with?('-') + + tempfile = nil + encoding = response.body.encoding + Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) do |file| + file.write(response.body) + tempfile = file + end + @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ + "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ + "will be deleted automatically with GC. It's also recommended to delete the temp file "\ + "explicitly with `tempfile.delete`" + tempfile + end + + # Sanitize filename by removing path. + # e.g. ../../sun.gif becomes sun.gif + # + # @param [String] filename the filename to be sanitized + # @return [String] the sanitized filename + def sanitize_filename(filename) + filename.gsub(/.*[\/\\]/, '') + end + + def build_request_url(path, opts) + # Add leading and trailing slashes to path + path = "/#{path}".gsub(/\/+/, '/') + return Addressable::URI.encode("https://" + self.get_oauth_base_path + path) if opts[:oauth] + Addressable::URI.encode(@config.base_url + path) + end + + # Builds the HTTP request body + # + # @param [Hash] header_params Header parameters + # @param [Hash] form_params Query parameters + # @param [Object] body HTTP body (JSON/XML) + # @return [String] HTTP body data in the form of string + def build_request_body(header_params, form_params, body) + # http form + if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || + header_params['Content-Type'] == 'multipart/form-data' + data = {} + form_params.each do |key, value| + case value + when File, Array, nil + # let typhoeus handle File, Array and nil parameters + data[key] = value + else + if header_params['Content-Type'] == 'multipart/form-data' + header_params['Content-Disposition'] = 'form-data; name=file; filename=' + key + data = value + else + data[key] = value.to_s + end + end + end + elsif body + data = body.is_a?(String) ? body : body.to_json + else + data = nil + end + data + end + + # Update hearder and query params based on authentication settings. + # + # @param [Hash] header_params Header parameters + # @param [Hash] query_params Query parameters + # @param [String] auth_names Authentication scheme name + def update_params_for_auth!(header_params, query_params, auth_names) + Array(auth_names).each do |auth_name| + auth_setting = @config.auth_settings[auth_name] + next unless auth_setting + case auth_setting[:in] + when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] + when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] + else fail ArgumentError, 'Authentication token must be in `query` of `header`' + end + end + end + + # Sets user agent in HTTP header + # + # @param [String] user_agent User agent (e.g. swagger-codegen/ruby/1.0.0) + def user_agent=(user_agent) + @user_agent = user_agent + @default_headers['User-Agent'] = @user_agent + end + + # Return Accept header based on an array of accepts provided. + # @param [Array] accepts array for Accept + # @return [String] the Accept header (e.g. application/json) + def select_header_accept(accepts) + return nil if accepts.nil? || accepts.empty? + # use JSON when present, otherwise use all of the provided + json_accept = accepts.find { |s| json_mime?(s) } + return json_accept || accepts.join(',') + end + + # Return Content-Type header based on an array of content types provided. + # @param [Array] content_types array for Content-Type + # @return [String] the Content-Type header (e.g. application/json) + def select_header_content_type(content_types) + # use application/json by default + return 'application/json' if content_types.nil? || content_types.empty? + # use JSON when present, otherwise use the first one + json_content_type = content_types.find { |s| json_mime?(s) } + return json_content_type || content_types.first + end + + # Convert object (array, hash, object, etc) to JSON string. + # @param [Object] model object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_http_body(model) + return model if model.nil? || model.is_a?(String) + local_body = nil + if model.is_a?(Array) + local_body = model.map{|m| object_to_hash(m) } + else + local_body = object_to_hash(model) + end + local_body.to_json + end + + # Convert object(non-array) to hash. + # @param [Object] obj object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_hash(obj) + if obj.respond_to?(:to_hash) + obj.to_hash + else + obj + end + end + + # Build parameter value according to the given collection format. + # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi + def build_collection_param(param, collection_format) + case collection_format + when :csv + param.join(',') + when :ssv + param.join(' ') + when :tsv + param.join("\t") + when :pipes + param.join('|') + when :multi + # return the array directly as typhoeus will handle it as expected + param + else + fail "unknown collection format: #{collection_format.inspect}" + end + end + + # Helper method to set base_path + # @param [String] base_path + def set_base_path(base_path) + self.base_path = base_path + end + + # Helper method to set oauth base path + # @param [String] oauth_base_path if passed nil it will determined from base_path + def set_oauth_base_path(oauth_base_path=nil) + if oauth_base_path + raise ArgumentError.new('OAuth base path should only include domain name (without https://)') if oauth_base_path.include? "//" + self.oauth_base_path = oauth_base_path + return + end + + # did we need this check as we can determine it from base path + #raise ArgumentError.new('oAuthBasePath cannot be empty') unless oauth_base_path + + # Derive OAuth Base Path if not given + if self.base_path.nil? or self.base_path.start_with?("https://demo") or self.base_path.start_with?("http://demo") or self.base_path.start_with?("https://apps-d") or self.base_path.start_with?("http://apps-d") + self.oauth_base_path = OAuth::DEMO_OAUTH_BASE_PATH + elsif self.base_path.start_with?("https://stage") or self.base_path.start_with?("http://stage") or self.base_path.start_with?("https://apps-s") or self.base_path.start_with?("http://apps-s") + self.oauth_base_path = OAuth::STAGE_OAUTH_BASE_PATH + else + self.oauth_base_path = OAuth::PRODUCTION_OAUTH_BASE_PATH + end + end + + # Helper method to get oauth base path + def get_oauth_base_path + if !self.oauth_base_path + self.set_oauth_base_path() + end + + self.oauth_base_path + end + + # Helper method to configure the OAuth accessCode/implicit flow parameters + # @param [String] client_id DocuSign OAuth Client Id(AKA Integrator Key) + # @param scopes The list of requested scopes. Client applications may be scoped to a limited set of system access. + # @param [String] redirect_uri This determines where to deliver the response containing the authorization code + # @param [String] response_type Determines the response type of the authorization request, NOTE: these response types are mutually exclusive for a client application. A public/native client application may only request a response type + # of "token". A private/trusted client application may only request a response type of "code". + # @param [String] state Allows for arbitrary state that may be useful to your application. The value in this parameter + # will be round-tripped along with the response so you can make sure it didn't change. + # @return [String] + def get_authorization_uri(client_id, scopes, redirect_uri, response_type, state=nil) + self.oauth_base_path ||= self.get_oauth_base_path + + scopes = scopes.join(' ') if scopes.kind_of?(Array) + scopes = OAuth::SCOPE_SIGNATURE if scopes.empty? + + uri = "https://%{base_path}/oauth/auth?response_type=%{response_type}&scope=%{scopes}&client_id=%{client_id}&redirect_uri=%{redirect_uri}" + uri += "&state=%{state}" if state + uri % {base_path: self.oauth_base_path, response_type:response_type, scopes: scopes, client_id: client_id, redirect_uri: redirect_uri, state: state} + end + + # Request JWT User Token + # @param [String] client_id DocuSign OAuth Client Id(AKA Integrator Key) + # @param [String] user_id DocuSign user Id to be impersonated + # @param [String] private_key_or_filename the RSA private key + # @param [Number] expires_in number of seconds remaining before the JWT assertion is considered as invalid + # @param scopes The list of requested scopes. Client applications may be scoped to a limited set of system access. + # @return [OAuth::OAuthToken] + def request_jwt_user_token(client_id, user_id, private_key_or_filename, expires_in = 3600,scopes=OAuth::SCOPE_SIGNATURE) + raise ArgumentError.new('client_id cannot be empty') if client_id.empty? + raise ArgumentError.new('user_id cannot be empty') if user_id.empty? + raise ArgumentError.new('private_key_or_filename cannot be empty') if private_key_or_filename.empty? + + scopes = scopes.join(' ') if scopes.kind_of?(Array) + scopes = OAuth::SCOPE_SIGNATURE if scopes.empty? + expires_in = 3600 if expires_in > 3600 + now = Time.now.to_i + claim = { + "iss" => client_id, + "sub" => user_id, + "aud" => self.get_oauth_base_path, + "iat" => now, + "exp" => now + expires_in, + "scope"=> scopes + } + + private_key = if private_key_or_filename.include?("-----BEGIN RSA PRIVATE KEY-----") + private_key_or_filename + else + File.read(private_key_or_filename) + end + + private_key_bytes = OpenSSL::PKey::RSA.new private_key + token = JWT.encode claim, private_key_bytes, 'RS256' + params = { + :header_params => {"Content-Type" => "application/x-www-form-urlencoded"}, + :form_params => { + "assertion" => token, + "grant_type" => OAuth::GRANT_TYPE_JWT + }, + :return_type => 'OAuth::OAuthToken', + :oauth => true + } + data, status_code, headers = self.call_api("POST", "/oauth/token", params) + + + raise ApiError.new('Some error accrued during process') if data.nil? + + self.set_default_header('Authorization', data.token_type + ' ' + data.access_token) + data + end + + # Request JWT User Token + # @param [String] client_id DocuSign OAuth Client Id(AKA Integrator Key) + # @param [String] private_key_or_filename the RSA private key + # @param [Number] expires_in number of seconds remaining before the JWT assertion is considered as invalid + # @param scopes The list of requested scopes. Client applications may be scoped to a limited set of system access. + # @return [OAuth::OAuthToken] + def request_jwt_application_token(client_id, private_key_or_filename, expires_in = 3600,scopes=OAuth::SCOPE_SIGNATURE) + raise ArgumentError.new('client_id cannot be empty') if client_id.empty? + raise ArgumentError.new('private_key_or_filename cannot be empty') if private_key_or_filename.empty? + + scopes = scopes.join(' ') if scopes.kind_of?(Array) + scopes = OAuth::SCOPE_SIGNATURE if scopes.empty? + expires_in = 3600 if expires_in > 3600 + now = Time.now.to_i + claim = { + "iss" => client_id, + "aud" => self.get_oauth_base_path, + "iat" => now, + "exp" => now + expires_in, + "scope"=> scopes + } + + private_key = if private_key_or_filename.include?("-----BEGIN RSA PRIVATE KEY-----") + private_key_or_filename + else + File.read(private_key_or_filename) + end + + private_key_bytes = OpenSSL::PKey::RSA.new private_key + token = JWT.encode claim, private_key_bytes, 'RS256' + params = { + :header_params => {"Content-Type" => "application/x-www-form-urlencoded"}, + :form_params => { + "assertion" => token, + "grant_type" => OAuth::GRANT_TYPE_JWT + }, + :return_type => 'OAuth::OAuthToken', + :oauth => true + } + data, status_code, headers = self.call_api("POST", "/oauth/token", params) + + raise ApiError.new('Some error accrued during process') if data.nil? + + self.set_default_header('Authorization', data.token_type + ' ' + data.access_token) + data + end + + # Get User Info method takes the accessToken to retrieve User Account Data. + # @param [String] access_token + # @return [OAuth::UserInfo] + def get_user_info(access_token) + raise ArgumentError.new('Cannot find a valid access token. Cannot find a valid access token.') if access_token.empty? + + params = { + :header_params => {"Authorization" => 'Bearer ' + access_token}, + :return_type => 'OAuth::UserInfo', + :oauth => true + } + data, status_code, headers = self.call_api("GET", '/oauth/userinfo', params) + data + end + + # GenerateAccessToken will exchange the authorization code for an access token and refresh tokens. + # @param [String] client_id DocuSign OAuth Client Id(AKA Integrator Key) + # @param [String] client_secret The secret key you generated when you set up the integration in DocuSign Admin console. + # @param [String] code The authorization code + def generate_access_token(client_id, client_secret, code) + raise ArgumentError.new('client_id cannot be empty') if client_id.empty? + raise ArgumentError.new('client_secret cannot be empty') if client_secret.empty? + raise ArgumentError.new('code cannot be empty') if code.empty? + + authcode = "Basic " + Base64.strict_encode64("#{client_id}:#{client_secret}") + params = { + :header_params => { + "Authorization" => authcode, + "Content-Type" => "application/x-www-form-urlencoded" + }, + :form_params => { + "grant_type" => 'authorization_code', + "code" => code, + }, + :return_type => 'OAuth::OAuthToken', + :oauth => true + } + + token, status_code, headers = self.call_api("POST", '/oauth/token', params) + + if status_code == 200 + self.default_headers.store('Authorization', "#{token.token_type} #{token.access_token}") + + token + end + end + + # Helper method to add default header params + # @param [String] header_name + # @param [String] header_value + def set_default_header(header_name, header_value) + @default_headers[header_name] = header_value + end + end +end \ No newline at end of file diff --git a/lib/docusign_webforms/client/api_error.rb b/lib/docusign_webforms/client/api_error.rb new file mode 100644 index 0000000..4c79521 --- /dev/null +++ b/lib/docusign_webforms/client/api_error.rb @@ -0,0 +1,37 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +module DocuSign_WebForms + class ApiError < StandardError + attr_reader :code, :response_headers, :response_body + + # Usage examples: + # ApiError.new + # ApiError.new("message") + # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") + # ApiError.new(:code => 404, :message => "Not Found") + def initialize(arg = nil) + if arg.is_a? Hash + if arg.key?(:message) || arg.key?('message') + super(arg[:message] || arg['message']) + else + super arg + end + + arg.each do |k, v| + instance_variable_set "@#{k}", v + end + else + super arg + end + end + end +end diff --git a/lib/docusign_webforms/client/auth/oauth.rb b/lib/docusign_webforms/client/auth/oauth.rb new file mode 100644 index 0000000..477ed7f --- /dev/null +++ b/lib/docusign_webforms/client/auth/oauth.rb @@ -0,0 +1,1061 @@ +require 'date' + +module DocuSign_WebForms + class OAuth + # create and send envelopes, and obtain links for starting signing sessions. + SCOPE_SIGNATURE = "signature" + # obtain a refresh token with an extended lifetime. + SCOPE_EXTENDED = "extended" + # obtain access to the user’s account when the user is not present. + SCOPE_IMPERSONATION = "impersonation" + + # OAuth Base path constants + # Demo server base path + DEMO_OAUTH_BASE_PATH = "account-d.docusign.com" + # Production server base path + PRODUCTION_OAUTH_BASE_PATH = "account.docusign.com" + # Stage server base path + STAGE_OAUTH_BASE_PATH = "account-s.docusign.com" + # JWT Grant Type + GRANT_TYPE_JWT = "urn:ietf:params:oauth:grant-type:jwt-bearer" + + # Contains account Information. + class Account + # The account ID. + attr_accessor :account_id + + # The name of the current account. + attr_accessor :account_name + + # either account is default or no. + attr_accessor :is_default + + # Reserved: TBD + attr_accessor :base_uri + + # Reserved: TBD + attr_accessor :organization + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_id' => :'account_id', + :'account_name' => :'account_name', + :'is_default' => :'is_default', + :'base_uri' => :'base_uri', + :'organization' => :'organization', + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'account_id' => :'String', + :'account_name' => :'String', + :'is_default' => :'String', + :'base_uri' => :'String', + :'organization' => :'Organization' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.has_key?(:'account_name') + self.account_name = attributes[:'account_name'] + end + + if attributes.has_key?(:'is_default') + self.is_default = attributes[:'is_default'] + end + + if attributes.has_key?(:'base_uri') + self.base_uri = attributes[:'base_uri'] + end + + if attributes.has_key?(:'organization') + self.organization = attributes['organization'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + account_id == o.account_id && + account_name == o.account_name && + is_default == o.is_default && + base_uri == o.base_uri && + organization == o.organization + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [account_id, account_name, is_default, base_uri, organization].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + #there is bug with ruby while searching for constraint which is under 2 modules + temp_model = DocuSign_WebForms.const_get('OAuth').const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map{ |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + + class Link + # Link rel + attr_accessor :rel + + # Link href + attr_accessor :href + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'rel' => :'rel', + :'href' => :'href' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'rel' => :'String', + :'href' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'rel') + self.rel = attributes[:'rel'] + end + + if attributes.has_key?(:'href') + self.href = attributes[:'href'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + rel == o.rel && + href == o.href + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [rel, href].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map{ |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + + class OAuthToken + # The account ID. + attr_accessor :access_token + + # + attr_accessor :data + + # + attr_accessor :expires_in + + # Reserved: TBD + attr_accessor :refresh_token + + # Reserved: TBD + attr_accessor :scope + + # Reserved: TBD + attr_accessor :token_type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'access_token' => :'access_token', + :'data' => :'data', + :'expires_in' => :'expires_in', + :'refresh_token' => :'refresh_token', + :'scope' => :'scope', + :'token_type' => :'token_type' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'access_token' => :'String', + :'expires_in' => :'String', + :'refresh_token' => :'String', + :'scope' => :'String', + :'data' => :'Array', + :'token_type' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'accessToken') + self.access_token = attributes[:'accessToken'] + end + + if attributes.has_key?(:'scope') + self.scope = attributes[:'scope'] + end + + if attributes.has_key?(:'refreshToken') + self.refresh_token = attributes[:'refreshToken'] + end + + if attributes.has_key?(:'expiresIn') + self.expires_in = attributes[:'expiresIn'] + end + + if attributes.has_key?(:'tokenType') + self.token_type = attributes[:'tokenType'] + end + + if attributes.has_key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + access_token == o.access_token && + data == o.data && + expires_in == o.expires_in && + refresh_token == o.refresh_token && + token_type == o.token_type && + scope == o.scope + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [expires_in, data, access_token, refresh_token, scope, token_type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map{ |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + + class Organization + # The account ID. + attr_accessor :organization_id + + # The name of the current account. + attr_accessor :links + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'organization_id' => :'organization_id', + :'links' => :'links' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'organization_id' => :'String', + :'links' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'organizationId') + self.organization_id = attributes[:'organizationId'] + end + + if attributes.has_key?(:'links') + if (value = attributes[:'links']).is_a?(Array) + self.links = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + links == o.links && + organization_id == o.organization_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [links, organization_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map{ |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + + class UserInfo + # + attr_accessor :sub + + # + attr_accessor :email + + attr_accessor :error_details + + # + attr_accessor :accounts + + # + attr_accessor :name + + # + attr_accessor :given_name + + # + attr_accessor :family_name + + # + attr_accessor :created + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'sub' => :'sub', + :'email' => :'email', + :'error_details' => :'error_details', + :'accounts' => :'accounts', + :'name' => :'name', + :'given_name' => :'given_name', + :'family_name' => :'family_name', + :'created' => :'created' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'sub' => :'String', + :'email' => :'String', + :'error_details' => :'ErrorDetails', + :'accounts' => :'Array', + :'name' => :'String', + :'given_name' => :'String', + :'family_name' => :'String', + :'created' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'sub') + self.sub = attributes[:'sub'] + end + + if attributes.has_key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.has_key?(:'errorDetails') + self.error_details = attributes[:'errorDetails'] + end + + if attributes.has_key?(:'accounts') + if (value = attributes[:'accounts']).is_a?(Array) + self.accounts = value + end + end + + if attributes.has_key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.has_key?(:'givenName') + self.given_name = attributes[:'givenName'] + end + + if attributes.has_key?(:'familyName') + self.family_name = attributes[:'familyName'] + end + + if attributes.has_key?(:'created') + self.created = attributes[:'created'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + sub == o.sub && + email == o.email && + error_details == o.error_details && + accounts == o.accounts && + name == o.name && + family_name == o.family_name && + given_name == o.given_name && + created == o.created + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [sub, email, error_details, accounts, name, family_name, given_name, created].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map{ |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + end +end \ No newline at end of file diff --git a/lib/docusign_webforms/configuration.rb b/lib/docusign_webforms/configuration.rb new file mode 100644 index 0000000..6adaf35 --- /dev/null +++ b/lib/docusign_webforms/configuration.rb @@ -0,0 +1,203 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'uri' +require 'addressable/uri' + +module DocuSign_WebForms + class Configuration + # Defines url scheme + attr_accessor :scheme + + # Defines url host + attr_accessor :host + + # Defines url base path + attr_accessor :base_path + + # Defines API keys used with API Key authentications. + # + # @return [Hash] key: parameter name, value: parameter value (API key) + # + # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) + # config.api_key['api_key'] = 'xxx' + attr_accessor :api_key + + # Defines API key prefixes used with API Key authentications. + # + # @return [Hash] key: parameter name, value: API key prefix + # + # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) + # config.api_key_prefix['api_key'] = 'Token' + attr_accessor :api_key_prefix + + # Defines the username used with HTTP basic authentication. + # + # @return [String] + attr_accessor :username + + # Defines the password used with HTTP basic authentication. + # + # @return [String] + attr_accessor :password + + # Defines the access token (Bearer) used with OAuth2. + attr_accessor :access_token + + # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response + # details will be logged with `logger.debug` (see the `logger` attribute). + # Default to false. + # + # @return [true, false] + attr_accessor :debugging + + # Defines the logger used for debugging. + # Default to `Rails.logger` (when in Rails) or logging to STDOUT. + # + # @return [#debug] + attr_accessor :logger + + # Defines the temporary folder to store downloaded files + # (for API endpoints that have file response). + # Default to use `Tempfile`. + # + # @return [String] + attr_accessor :temp_folder_path + + # The time limit for HTTP request in seconds. + # Default to 0 (never times out). + attr_accessor :timeout + + ### TLS/SSL setting + # Set this to false to skip verifying SSL certificate when calling API from https server. + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl + + ### TLS/SSL setting + # Set this to false to skip verifying SSL host name + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl_host + + ### TLS/SSL setting + # Set this to customize the certificate file to verify the peer. + # + # @return [String] the path to the certificate file + # + # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code: + # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145 + attr_accessor :ssl_ca_cert + + ### TLS/SSL setting + # Client certificate file (for client certificate) + attr_accessor :cert_file + + ### TLS/SSL setting + # Client private key file (for client certificate) + attr_accessor :key_file + + # Set this to customize parameters encoding of array parameter with multi collectionFormat. + # Default to nil. + # + # @see The params_encoding option of Ethon. Related source code: + # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 + attr_accessor :params_encoding + + attr_accessor :inject_format + + attr_accessor :force_ending_format + + def initialize + @scheme = 'https' + @host = 'apps-d.docusign.com/api' + @base_path = '/webforms/v1.1' + @api_key = {} + @api_key_prefix = {} + @timeout = 0 + @verify_ssl = true + @verify_ssl_host = true + @params_encoding = nil + @cert_file = nil + @key_file = nil + @debugging = false + @inject_format = false + @force_ending_format = false + @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) + + yield(self) if block_given? + end + + # The default Configuration object. + def self.default + @@default ||= Configuration.new + end + + def configure + yield(self) if block_given? + end + + def scheme=(scheme) + # remove :// from scheme + @scheme = scheme.sub(/:\/\//, '') + end + + def host=(host) + # remove http(s):// and anything after a slash + @host = host.sub(/https?:\/\//, '').split('/').first + end + + def base_path=(base_path) + # Add leading and trailing slashes to base_path + @base_path = "/#{base_path}".gsub(/\/+/, '/') + @base_path = '' if @base_path == '/' + end + + def base_url + url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') + Addressable::URI.encode(url) + end + + # Gets API key (with prefix if set). + # @param [String] param_name the parameter name of API key auth + def api_key_with_prefix(param_name) + if @api_key_prefix[param_name] + "#{@api_key_prefix[param_name]} #{@api_key[param_name]}" + else + @api_key[param_name] + end + end + + # Gets Basic Auth token string + def basic_auth_token + 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") + end + + # Returns Auth Settings hash for api client. + def auth_settings + { + 'docusignAccessCode' => + { + type: 'oauth2', + in: 'header', + key: 'Authorization', + value: "Bearer #{access_token}" + }, + } + end + end +end \ No newline at end of file diff --git a/lib/docusign_webforms/models/account_id.rb b/lib/docusign_webforms/models/account_id.rb new file mode 100644 index 0000000..1e04b50 --- /dev/null +++ b/lib/docusign_webforms/models/account_id.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Account identifier in which the webform resides + class AccountId + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/assertion_id.rb b/lib/docusign_webforms/models/assertion_id.rb new file mode 100644 index 0000000..e319827 --- /dev/null +++ b/lib/docusign_webforms/models/assertion_id.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # A unique identifier of the authentication event executed by the client application. + class AssertionId + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/authentication_instant.rb b/lib/docusign_webforms/models/authentication_instant.rb new file mode 100644 index 0000000..3d9a7b6 --- /dev/null +++ b/lib/docusign_webforms/models/authentication_instant.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # A sender-generated value that indicates the date and time that the signer was authenticated. + class AuthenticationInstant + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/authentication_method.rb b/lib/docusign_webforms/models/authentication_method.rb new file mode 100644 index 0000000..6a2ca34 --- /dev/null +++ b/lib/docusign_webforms/models/authentication_method.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # A value that most closely matches the technique your application used to authenticate the recipient / signer. + class AuthenticationMethod + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/brand_id.rb b/lib/docusign_webforms/models/brand_id.rb new file mode 100644 index 0000000..09681c8 --- /dev/null +++ b/lib/docusign_webforms/models/brand_id.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Brand Id for web form + class BrandId + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/client_user_id.rb b/lib/docusign_webforms/models/client_user_id.rb new file mode 100644 index 0000000..638a29e --- /dev/null +++ b/lib/docusign_webforms/models/client_user_id.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # A unique identifier for a user that should originate from client's system. This value can be anything your backend system would use to track individual form instances. Examples include employee IDs, email addresses, surrogate key values, etc. + class ClientUserId + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/component_key.rb b/lib/docusign_webforms/models/component_key.rb new file mode 100644 index 0000000..4025d2b --- /dev/null +++ b/lib/docusign_webforms/models/component_key.rb @@ -0,0 +1,174 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + class ComponentKey + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/count.rb b/lib/docusign_webforms/models/count.rb new file mode 100644 index 0000000..689e023 --- /dev/null +++ b/lib/docusign_webforms/models/count.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Number of results to return per page. + class Count + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/create_instance_request_body.rb b/lib/docusign_webforms/models/create_instance_request_body.rb new file mode 100644 index 0000000..926a163 --- /dev/null +++ b/lib/docusign_webforms/models/create_instance_request_body.rb @@ -0,0 +1,264 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Request body containing properties that will be used to create instance. + class CreateInstanceRequestBody + attr_accessor :form_values + + attr_accessor :client_user_id + + attr_accessor :authentication_instant + + attr_accessor :authentication_method + + attr_accessor :assertion_id + + attr_accessor :security_domain + + attr_accessor :return_url + + attr_accessor :expiration_offset + + # List of tags provided by the user with each request. This field is optional. + attr_accessor :tags + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'form_values' => :'formValues', + :'client_user_id' => :'clientUserId', + :'authentication_instant' => :'authenticationInstant', + :'authentication_method' => :'authenticationMethod', + :'assertion_id' => :'assertionId', + :'security_domain' => :'securityDomain', + :'return_url' => :'returnUrl', + :'expiration_offset' => :'expirationOffset', + :'tags' => :'tags' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'form_values' => :'WebFormValues', + :'client_user_id' => :'String', + :'authentication_instant' => :'DateTime', + :'authentication_method' => :'String', + :'assertion_id' => :'String', + :'security_domain' => :'String', + :'return_url' => :'String', + :'expiration_offset' => :'Integer', + :'tags' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + + if attributes.has_key?(:'formValues') + self.form_values = attributes[:'formValues'] + end + + if attributes.has_key?(:'clientUserId') + self.client_user_id = attributes[:'clientUserId'] + end + + if attributes.has_key?(:'authenticationInstant') + self.authentication_instant = attributes[:'authenticationInstant'] + end + + if attributes.has_key?(:'authenticationMethod') + self.authentication_method = attributes[:'authenticationMethod'] + end + + if attributes.has_key?(:'assertionId') + self.assertion_id = attributes[:'assertionId'] + end + + if attributes.has_key?(:'securityDomain') + self.security_domain = attributes[:'securityDomain'] + end + + if attributes.has_key?(:'returnUrl') + self.return_url = attributes[:'returnUrl'] + end + + if attributes.has_key?(:'expirationOffset') + self.expiration_offset = attributes[:'expirationOffset'] + end + + if attributes.has_key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @client_user_id.nil? + invalid_properties.push('invalid value for "client_user_id", client_user_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @client_user_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + form_values == o.form_values && + client_user_id == o.client_user_id && + authentication_instant == o.authentication_instant && + authentication_method == o.authentication_method && + assertion_id == o.assertion_id && + security_domain == o.security_domain && + return_url == o.return_url && + expiration_offset == o.expiration_offset && + tags == o.tags + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [form_values, client_user_id, authentication_instant, authentication_method, assertion_id, security_domain, return_url, expiration_offset, tags].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/created_date_time.rb b/lib/docusign_webforms/models/created_date_time.rb new file mode 100644 index 0000000..7b4734a --- /dev/null +++ b/lib/docusign_webforms/models/created_date_time.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # The dateTime when the webform instance is created. + class CreatedDateTime + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/date_time.rb b/lib/docusign_webforms/models/date_time.rb new file mode 100644 index 0000000..51e95a1 --- /dev/null +++ b/lib/docusign_webforms/models/date_time.rb @@ -0,0 +1,174 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + class DateTime + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/envelope_id.rb b/lib/docusign_webforms/models/envelope_id.rb new file mode 100644 index 0000000..174baf9 --- /dev/null +++ b/lib/docusign_webforms/models/envelope_id.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Envelope Id + class EnvelopeId + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/expiration_date_time.rb b/lib/docusign_webforms/models/expiration_date_time.rb new file mode 100644 index 0000000..5c822e7 --- /dev/null +++ b/lib/docusign_webforms/models/expiration_date_time.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # The datetime after which the webform instance is inaccessible. + class ExpirationDateTime + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/expiration_offset.rb b/lib/docusign_webforms/models/expiration_offset.rb new file mode 100644 index 0000000..893b755 --- /dev/null +++ b/lib/docusign_webforms/models/expiration_offset.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Specify the number of hours after which the form instance expires. For example, if the form expiration is set to 5 days, you should specify 120. The default value is 720 hours (30 days). + class ExpirationOffset + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/form_sort_by.rb b/lib/docusign_webforms/models/form_sort_by.rb new file mode 100644 index 0000000..dcc7fc6 --- /dev/null +++ b/lib/docusign_webforms/models/form_sort_by.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Sort result set in mentioned sort property:order. Default is lastModifiedDateTime:desc. Default sort is descending if not mentioned. + class FormSortBy + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/form_url.rb b/lib/docusign_webforms/models/form_url.rb new file mode 100644 index 0000000..3736d4c --- /dev/null +++ b/lib/docusign_webforms/models/form_url.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # The instance url which can be rendered by the user + class FormUrl + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/guid.rb b/lib/docusign_webforms/models/guid.rb new file mode 100644 index 0000000..c61c968 --- /dev/null +++ b/lib/docusign_webforms/models/guid.rb @@ -0,0 +1,174 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + class Guid + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/http_error.rb b/lib/docusign_webforms/models/http_error.rb new file mode 100644 index 0000000..dfa78ce --- /dev/null +++ b/lib/docusign_webforms/models/http_error.rb @@ -0,0 +1,195 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # An error occurred while processing a request. Source - https://www.baeldung.com/rest-api-error-handling-best-practices + class HttpError + # A granular, human and computer readable code indicating more deeply what error occurred. + attr_accessor :error_code + + # A human-readable description of the error, meant for developers to store for their review. + attr_accessor :message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'error_code' => :'errorCode', + :'message' => :'message' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'error_code' => :'String', + :'message' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + + if attributes.has_key?(:'errorCode') + self.error_code = attributes[:'errorCode'] + end + + if attributes.has_key?(:'message') + self.message = attributes[:'message'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + error_code == o.error_code && + message == o.message + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [error_code, message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/http_success.rb b/lib/docusign_webforms/models/http_success.rb new file mode 100644 index 0000000..45dd8c5 --- /dev/null +++ b/lib/docusign_webforms/models/http_success.rb @@ -0,0 +1,184 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # A simple response indicating success when no extra data is needed + class HttpSuccess + attr_accessor :status + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'status' => :'status' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'status' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + + if attributes.has_key?(:'status') + self.status = attributes[:'status'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + status == o.status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/instance_id.rb b/lib/docusign_webforms/models/instance_id.rb new file mode 100644 index 0000000..5a55226 --- /dev/null +++ b/lib/docusign_webforms/models/instance_id.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Unique identifier for a webform instance that is consistent until its expiration + class InstanceId + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/instance_source.rb b/lib/docusign_webforms/models/instance_source.rb new file mode 100644 index 0000000..bcaa104 --- /dev/null +++ b/lib/docusign_webforms/models/instance_source.rb @@ -0,0 +1,31 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + class InstanceSource + + PUBLIC_URL = 'PUBLIC_URL'.freeze + API_EMBEDDED = 'API_EMBEDDED'.freeze + API_REMOTE = 'API_REMOTE'.freeze + UI_REMOTE = 'UI_REMOTE'.freeze + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + constantValues = InstanceSource.constants.select { |c| InstanceSource::const_get(c) == value } + raise "Invalid ENUM value #{value} for class #InstanceSource" if constantValues.empty? + value + end + end +end diff --git a/lib/docusign_webforms/models/instance_status.rb b/lib/docusign_webforms/models/instance_status.rb new file mode 100644 index 0000000..af9a54c --- /dev/null +++ b/lib/docusign_webforms/models/instance_status.rb @@ -0,0 +1,31 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + class InstanceStatus + + INITIATED = 'INITIATED'.freeze + SUBMITTED = 'SUBMITTED'.freeze + EXPIRED = 'EXPIRED'.freeze + FAILED = 'FAILED'.freeze + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + constantValues = InstanceStatus.constants.select { |c| InstanceStatus::const_get(c) == value } + raise "Invalid ENUM value #{value} for class #InstanceStatus" if constantValues.empty? + value + end + end +end diff --git a/lib/docusign_webforms/models/instance_token.rb b/lib/docusign_webforms/models/instance_token.rb new file mode 100644 index 0000000..9279545 --- /dev/null +++ b/lib/docusign_webforms/models/instance_token.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Unique token associated with an instance that is required to render the form instance. This token is valid for 5 minutes after which it needs to be refreshed using refreshToken api + class InstanceToken + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/is_private_access.rb b/lib/docusign_webforms/models/is_private_access.rb new file mode 100644 index 0000000..aeb54de --- /dev/null +++ b/lib/docusign_webforms/models/is_private_access.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # When a form is private, the Player will not be accessible via its URL unless a valid instance token is provided + class IsPrivateAccess + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/is_published.rb b/lib/docusign_webforms/models/is_published.rb new file mode 100644 index 0000000..439d880 --- /dev/null +++ b/lib/docusign_webforms/models/is_published.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Has the form been published + class IsPublished + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/is_standalone.rb b/lib/docusign_webforms/models/is_standalone.rb new file mode 100644 index 0000000..9a82521 --- /dev/null +++ b/lib/docusign_webforms/models/is_standalone.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Is the form a standalone form + class IsStandalone + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/last_modified_date_time.rb b/lib/docusign_webforms/models/last_modified_date_time.rb new file mode 100644 index 0000000..77ce6e9 --- /dev/null +++ b/lib/docusign_webforms/models/last_modified_date_time.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # The dateTime when the Web Form Instance is last modified. + class LastModifiedDateTime + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/return_url.rb b/lib/docusign_webforms/models/return_url.rb new file mode 100644 index 0000000..431b75c --- /dev/null +++ b/lib/docusign_webforms/models/return_url.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # The url to which the user is redirected after the signing is completed + class ReturnUrl + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/search_text.rb b/lib/docusign_webforms/models/search_text.rb new file mode 100644 index 0000000..432c123 --- /dev/null +++ b/lib/docusign_webforms/models/search_text.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Search through form names + class SearchText + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/security_domain.rb b/lib/docusign_webforms/models/security_domain.rb new file mode 100644 index 0000000..34b7779 --- /dev/null +++ b/lib/docusign_webforms/models/security_domain.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # The domain in which the user authenticated. + class SecurityDomain + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/source.rb b/lib/docusign_webforms/models/source.rb new file mode 100644 index 0000000..634f2e6 --- /dev/null +++ b/lib/docusign_webforms/models/source.rb @@ -0,0 +1,31 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + class Source + + PUBLIC_URL = 'PUBLIC_URL'.freeze + API_EMBEDDED = 'API_EMBEDDED'.freeze + API_REMOTE = 'API_REMOTE'.freeze + UI_REMOTE = 'UI_REMOTE'.freeze + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + constantValues = Source.constants.select { |c| Source::const_get(c) == value } + raise "Invalid ENUM value #{value} for class #Source" if constantValues.empty? + value + end + end +end diff --git a/lib/docusign_webforms/models/start_position.rb b/lib/docusign_webforms/models/start_position.rb new file mode 100644 index 0000000..867df4e --- /dev/null +++ b/lib/docusign_webforms/models/start_position.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Starting position for desired page of results. + class StartPosition + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/tags.rb b/lib/docusign_webforms/models/tags.rb new file mode 100644 index 0000000..aa3ee7a --- /dev/null +++ b/lib/docusign_webforms/models/tags.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # List of tags provided by the user with each request. This field is optional. + class Tags + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/template_properties.rb b/lib/docusign_webforms/models/template_properties.rb new file mode 100644 index 0000000..b175b87 --- /dev/null +++ b/lib/docusign_webforms/models/template_properties.rb @@ -0,0 +1,217 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Information about a DocuSign template that will be used to seed a web form. + class TemplateProperties + # Template identifier for original Template that is used by the DocuSign Template API. + attr_accessor :original_template_id + + # Template identifier for cloned Template that is used by the DocuSign Template API. + attr_accessor :cloned_template_id + + # Track the time of assignment of Template information to the Form. + attr_accessor :imported_date_time + + # Track mapped recipients on Template. + attr_accessor :recipient_ids + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'original_template_id' => :'originalTemplateId', + :'cloned_template_id' => :'clonedTemplateId', + :'imported_date_time' => :'importedDateTime', + :'recipient_ids' => :'recipientIds' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'original_template_id' => :'String', + :'cloned_template_id' => :'String', + :'imported_date_time' => :'DateTime', + :'recipient_ids' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + + if attributes.has_key?(:'originalTemplateId') + self.original_template_id = attributes[:'originalTemplateId'] + end + + if attributes.has_key?(:'clonedTemplateId') + self.cloned_template_id = attributes[:'clonedTemplateId'] + end + + if attributes.has_key?(:'importedDateTime') + self.imported_date_time = attributes[:'importedDateTime'] + end + + if attributes.has_key?(:'recipientIds') + if (value = attributes[:'recipientIds']).is_a?(Array) + self.recipient_ids = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + original_template_id == o.original_template_id && + cloned_template_id == o.cloned_template_id && + imported_date_time == o.imported_date_time && + recipient_ids == o.recipient_ids + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [original_template_id, cloned_template_id, imported_date_time, recipient_ids].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/token_expiration_date_time.rb b/lib/docusign_webforms/models/token_expiration_date_time.rb new file mode 100644 index 0000000..890cc07 --- /dev/null +++ b/lib/docusign_webforms/models/token_expiration_date_time.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # The datetime after which the token is expired and form instance is inaccessible. + class TokenExpirationDateTime + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/update_instance_request_body.rb b/lib/docusign_webforms/models/update_instance_request_body.rb new file mode 100644 index 0000000..92b3c8b --- /dev/null +++ b/lib/docusign_webforms/models/update_instance_request_body.rb @@ -0,0 +1,184 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Request body containing properties that needs to be updated. + class UpdateInstanceRequestBody + attr_accessor :form_values + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'form_values' => :'formValues' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'form_values' => :'WebFormValues' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + + if attributes.has_key?(:'formValues') + self.form_values = attributes[:'formValues'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + form_values == o.form_values + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [form_values].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/user_filter.rb b/lib/docusign_webforms/models/user_filter.rb new file mode 100644 index 0000000..84ef3ce --- /dev/null +++ b/lib/docusign_webforms/models/user_filter.rb @@ -0,0 +1,30 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + class UserFilter + + OWNED_BY_ME = 'owned_by_me'.freeze + SHARED_WITH_ME = 'shared_with_me'.freeze + ALL = 'all'.freeze + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + constantValues = UserFilter.constants.select { |c| UserFilter::const_get(c) == value } + raise "Invalid ENUM value #{value} for class #UserFilter" if constantValues.empty? + value + end + end +end diff --git a/lib/docusign_webforms/models/user_id.rb b/lib/docusign_webforms/models/user_id.rb new file mode 100644 index 0000000..0719ca9 --- /dev/null +++ b/lib/docusign_webforms/models/user_id.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # DocuSign user identifier + class UserId + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/web_form.rb b/lib/docusign_webforms/models/web_form.rb new file mode 100644 index 0000000..49d3594 --- /dev/null +++ b/lib/docusign_webforms/models/web_form.rb @@ -0,0 +1,268 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # An object that fully describes an instance of a form + class WebForm + attr_accessor :id + + attr_accessor :account_id + + # Has the form been published + attr_accessor :is_published + + # Is the form currently enabled and available for data collection + attr_accessor :is_enabled + + # Does the form have draft changes that need to be published? + attr_accessor :has_draft_changes + + attr_accessor :form_state + + attr_accessor :form_properties + + attr_accessor :form_metadata + + attr_accessor :version_id + + attr_accessor :form_content + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'account_id' => :'accountId', + :'is_published' => :'isPublished', + :'is_enabled' => :'isEnabled', + :'has_draft_changes' => :'hasDraftChanges', + :'form_state' => :'formState', + :'form_properties' => :'formProperties', + :'form_metadata' => :'formMetadata', + :'version_id' => :'versionId', + :'form_content' => :'formContent' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'account_id' => :'String', + :'is_published' => :'BOOLEAN', + :'is_enabled' => :'BOOLEAN', + :'has_draft_changes' => :'BOOLEAN', + :'form_state' => :'WebFormState', + :'form_properties' => :'WebFormProperties', + :'form_metadata' => :'WebFormMetadata', + :'version_id' => :'Integer', + :'form_content' => :'WebFormContent' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'accountId') + self.account_id = attributes[:'accountId'] + end + + if attributes.has_key?(:'isPublished') + self.is_published = attributes[:'isPublished'] + end + + if attributes.has_key?(:'isEnabled') + self.is_enabled = attributes[:'isEnabled'] + end + + if attributes.has_key?(:'hasDraftChanges') + self.has_draft_changes = attributes[:'hasDraftChanges'] + end + + if attributes.has_key?(:'formState') + self.form_state = attributes[:'formState'] + end + + if attributes.has_key?(:'formProperties') + self.form_properties = attributes[:'formProperties'] + end + + if attributes.has_key?(:'formMetadata') + self.form_metadata = attributes[:'formMetadata'] + end + + if attributes.has_key?(:'versionId') + self.version_id = attributes[:'versionId'] + end + + if attributes.has_key?(:'formContent') + self.form_content = attributes[:'formContent'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + account_id == o.account_id && + is_published == o.is_published && + is_enabled == o.is_enabled && + has_draft_changes == o.has_draft_changes && + form_state == o.form_state && + form_properties == o.form_properties && + form_metadata == o.form_metadata && + version_id == o.version_id && + form_content == o.form_content + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [id, account_id, is_published, is_enabled, has_draft_changes, form_state, form_properties, form_metadata, version_id, form_content].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/web_form_adm_type.rb b/lib/docusign_webforms/models/web_form_adm_type.rb new file mode 100644 index 0000000..9796ce1 --- /dev/null +++ b/lib/docusign_webforms/models/web_form_adm_type.rb @@ -0,0 +1,39 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + class WebFormAdmType + + STRING = 'String'.freeze + BOOLEAN = 'Boolean'.freeze + DOUBLE = 'Double'.freeze + DATE_TIME = 'DateTime'.freeze + ARRAY_OF_STRING = 'ArrayOfString'.freeze + CHECKBOX_GROUP = 'CheckboxGroup'.freeze + DATE = 'Date'.freeze + EMAIL = 'Email'.freeze + NUMBER = 'Number'.freeze + RADIO_BUTTON_GROUP = 'RadioButtonGroup'.freeze + SELECT = 'Select'.freeze + TEXT_BOX = 'TextBox'.freeze + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + constantValues = WebFormAdmType.constants.select { |c| WebFormAdmType::const_get(c) == value } + raise "Invalid ENUM value #{value} for class #WebFormAdmType" if constantValues.empty? + value + end + end +end diff --git a/lib/docusign_webforms/models/web_form_component.rb b/lib/docusign_webforms/models/web_form_component.rb new file mode 100644 index 0000000..e3f2339 --- /dev/null +++ b/lib/docusign_webforms/models/web_form_component.rb @@ -0,0 +1,248 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Each component type contains additional properties + class WebFormComponent + attr_accessor :component_key + + # The type of component this object represents + attr_accessor :component_type + + # Name value that is used for mapping components to external sources + attr_accessor :component_name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'component_key' => :'componentKey', + :'component_type' => :'componentType', + :'component_name' => :'componentName' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'component_key' => :'String', + :'component_type' => :'String', + :'component_name' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + + if attributes.has_key?(:'componentKey') + self.component_key = attributes[:'componentKey'] + end + + if attributes.has_key?(:'componentType') + self.component_type = attributes[:'componentType'] + end + + if attributes.has_key?(:'componentName') + self.component_name = attributes[:'componentName'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @component_key.nil? + invalid_properties.push('invalid value for "component_key", component_key cannot be nil.') + end + + if @component_type.nil? + invalid_properties.push('invalid value for "component_type", component_type cannot be nil.') + end + + if @component_type.to_s.length > 100 + invalid_properties.push('invalid value for "component_type", the character length must be smaller than or equal to 100.') + end + + if !@component_name.nil? && @component_name.to_s.length > 100 + invalid_properties.push('invalid value for "component_name", the character length must be smaller than or equal to 100.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @component_key.nil? + return false if @component_type.nil? + return false if @component_type.to_s.length > 100 + return false if !@component_name.nil? && @component_name.to_s.length > 100 + true + end + + # Custom attribute writer method with validation + # @param [Object] component_type Value to be assigned + def component_type=(component_type) + if component_type.nil? + fail ArgumentError, 'component_type cannot be nil' + end + + if component_type.to_s.length > 100 + fail ArgumentError, 'invalid value for "component_type", the character length must be smaller than or equal to 100.' + end + + @component_type = component_type + end + + # Custom attribute writer method with validation + # @param [Object] component_name Value to be assigned + def component_name=(component_name) + if !component_name.nil? && component_name.to_s.length > 100 + fail ArgumentError, 'invalid value for "component_name", the character length must be smaller than or equal to 100.' + end + + @component_name = component_name + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + component_key == o.component_key && + component_type == o.component_type && + component_name == o.component_name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [component_key, component_type, component_name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/web_form_component_type.rb b/lib/docusign_webforms/models/web_form_component_type.rb new file mode 100644 index 0000000..e520164 --- /dev/null +++ b/lib/docusign_webforms/models/web_form_component_type.rb @@ -0,0 +1,34 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + class WebFormComponentType + + CHECKBOX_GROUP = 'CheckboxGroup'.freeze + DATE = 'Date'.freeze + EMAIL = 'Email'.freeze + NUMBER = 'Number'.freeze + RADIO_BUTTON_GROUP = 'RadioButtonGroup'.freeze + SELECT = 'Select'.freeze + TEXT_BOX = 'TextBox'.freeze + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + constantValues = WebFormComponentType.constants.select { |c| WebFormComponentType::const_get(c) == value } + raise "Invalid ENUM value #{value} for class #WebFormComponentType" if constantValues.empty? + value + end + end +end diff --git a/lib/docusign_webforms/models/web_form_components_map.rb b/lib/docusign_webforms/models/web_form_components_map.rb new file mode 100644 index 0000000..130a0a4 --- /dev/null +++ b/lib/docusign_webforms/models/web_form_components_map.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # The components map for the web form + class WebFormComponentsMap + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/web_form_content.rb b/lib/docusign_webforms/models/web_form_content.rb new file mode 100644 index 0000000..14d835e --- /dev/null +++ b/lib/docusign_webforms/models/web_form_content.rb @@ -0,0 +1,217 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Container for the components map used during configuration and data collection + class WebFormContent + # Key/value dictionary of components that represent the form + attr_accessor :components + + attr_accessor :is_standalone + + attr_accessor :brand_id + + # Optional template information that will be used to seed the form. + attr_accessor :templates + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'components' => :'components', + :'is_standalone' => :'isStandalone', + :'brand_id' => :'brandId', + :'templates' => :'templates' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'components' => :'Hash>', + :'is_standalone' => :'BOOLEAN', + :'brand_id' => :'String', + :'templates' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + + if attributes.has_key?(:'components') + if (value = attributes[:'components']).is_a?(Hash) + self.components = value + end + end + + if attributes.has_key?(:'isStandalone') + self.is_standalone = attributes[:'isStandalone'] + end + + if attributes.has_key?(:'brandId') + self.brand_id = attributes[:'brandId'] + end + + if attributes.has_key?(:'templates') + if (value = attributes[:'templates']).is_a?(Array) + self.templates = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + components == o.components && + is_standalone == o.is_standalone && + brand_id == o.brand_id && + templates == o.templates + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [components, is_standalone, brand_id, templates].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/web_form_id.rb b/lib/docusign_webforms/models/web_form_id.rb new file mode 100644 index 0000000..dab20bb --- /dev/null +++ b/lib/docusign_webforms/models/web_form_id.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Unique identifier for a webform entity that is consistent for it's lifetime + class WebFormId + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/web_form_instance.rb b/lib/docusign_webforms/models/web_form_instance.rb new file mode 100644 index 0000000..9f9d033 --- /dev/null +++ b/lib/docusign_webforms/models/web_form_instance.rb @@ -0,0 +1,295 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # An object that contains the Web Form Instance required to render it and its metadata such as created by, created time + class WebFormInstance + attr_accessor :form_url + + attr_accessor :instance_token + + attr_accessor :token_expiration_date_time + + attr_accessor :id + + # Web form from which the instance is created + attr_accessor :form_id + + attr_accessor :account_id + + attr_accessor :client_user_id + + # List of tags provided by the user with each request. This field is optional. + attr_accessor :tags + + attr_accessor :status + + # The associated envelope that is created when the instance is submitted + attr_accessor :envelopes + + attr_accessor :instance_metadata + + attr_accessor :form_values + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'form_url' => :'formUrl', + :'instance_token' => :'instanceToken', + :'token_expiration_date_time' => :'tokenExpirationDateTime', + :'id' => :'id', + :'form_id' => :'formId', + :'account_id' => :'accountId', + :'client_user_id' => :'clientUserId', + :'tags' => :'tags', + :'status' => :'status', + :'envelopes' => :'envelopes', + :'instance_metadata' => :'instanceMetadata', + :'form_values' => :'formValues' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'form_url' => :'String', + :'instance_token' => :'String', + :'token_expiration_date_time' => :'DateTime', + :'id' => :'String', + :'form_id' => :'String', + :'account_id' => :'String', + :'client_user_id' => :'String', + :'tags' => :'Array', + :'status' => :'InstanceStatus', + :'envelopes' => :'Array', + :'instance_metadata' => :'WebFormInstanceMetadata', + :'form_values' => :'WebFormValues' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + + if attributes.has_key?(:'formUrl') + self.form_url = attributes[:'formUrl'] + end + + if attributes.has_key?(:'instanceToken') + self.instance_token = attributes[:'instanceToken'] + end + + if attributes.has_key?(:'tokenExpirationDateTime') + self.token_expiration_date_time = attributes[:'tokenExpirationDateTime'] + end + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'formId') + self.form_id = attributes[:'formId'] + end + + if attributes.has_key?(:'accountId') + self.account_id = attributes[:'accountId'] + end + + if attributes.has_key?(:'clientUserId') + self.client_user_id = attributes[:'clientUserId'] + end + + if attributes.has_key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.has_key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.has_key?(:'envelopes') + if (value = attributes[:'envelopes']).is_a?(Array) + self.envelopes = value + end + end + + if attributes.has_key?(:'instanceMetadata') + self.instance_metadata = attributes[:'instanceMetadata'] + end + + if attributes.has_key?(:'formValues') + self.form_values = attributes[:'formValues'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + form_url == o.form_url && + instance_token == o.instance_token && + token_expiration_date_time == o.token_expiration_date_time && + id == o.id && + form_id == o.form_id && + account_id == o.account_id && + client_user_id == o.client_user_id && + tags == o.tags && + status == o.status && + envelopes == o.envelopes && + instance_metadata == o.instance_metadata && + form_values == o.form_values + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [form_url, instance_token, token_expiration_date_time, id, form_id, account_id, client_user_id, tags, status, envelopes, instance_metadata, form_values].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/web_form_instance_envelopes.rb b/lib/docusign_webforms/models/web_form_instance_envelopes.rb new file mode 100644 index 0000000..37713f7 --- /dev/null +++ b/lib/docusign_webforms/models/web_form_instance_envelopes.rb @@ -0,0 +1,183 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + class WebFormInstanceEnvelopes + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/web_form_instance_list.rb b/lib/docusign_webforms/models/web_form_instance_list.rb new file mode 100644 index 0000000..912a97b --- /dev/null +++ b/lib/docusign_webforms/models/web_form_instance_list.rb @@ -0,0 +1,187 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # A list of web form instance items. + class WebFormInstanceList + # Array of web form instance items. + attr_accessor :items + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'items' => :'items' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'items' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + + if attributes.has_key?(:'items') + if (value = attributes[:'items']).is_a?(Array) + self.items = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + items == o.items + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [items].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/web_form_instance_metadata.rb b/lib/docusign_webforms/models/web_form_instance_metadata.rb new file mode 100644 index 0000000..5233bb9 --- /dev/null +++ b/lib/docusign_webforms/models/web_form_instance_metadata.rb @@ -0,0 +1,237 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Web Form Instance metadata containing information like created by, created time, etc. + class WebFormInstanceMetadata + attr_accessor :expiration_date_time + + attr_accessor :created_date_time + + # The user that created the Web Form Instance + attr_accessor :created_by + + attr_accessor :last_modified_date_time + + # The user that last modified the Web Form Instance + attr_accessor :last_modified_by + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'expiration_date_time' => :'expirationDateTime', + :'created_date_time' => :'createdDateTime', + :'created_by' => :'createdBy', + :'last_modified_date_time' => :'lastModifiedDateTime', + :'last_modified_by' => :'lastModifiedBy' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'expiration_date_time' => :'DateTime', + :'created_date_time' => :'DateTime', + :'created_by' => :'WebFormUserInfo', + :'last_modified_date_time' => :'String', + :'last_modified_by' => :'WebFormUserInfo' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + + if attributes.has_key?(:'expirationDateTime') + self.expiration_date_time = attributes[:'expirationDateTime'] + end + + if attributes.has_key?(:'createdDateTime') + self.created_date_time = attributes[:'createdDateTime'] + end + + if attributes.has_key?(:'createdBy') + self.created_by = attributes[:'createdBy'] + end + + if attributes.has_key?(:'lastModifiedDateTime') + self.last_modified_date_time = attributes[:'lastModifiedDateTime'] + end + + if attributes.has_key?(:'lastModifiedBy') + self.last_modified_by = attributes[:'lastModifiedBy'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @expiration_date_time.nil? + invalid_properties.push('invalid value for "expiration_date_time", expiration_date_time cannot be nil.') + end + + if @created_date_time.nil? + invalid_properties.push('invalid value for "created_date_time", created_date_time cannot be nil.') + end + + if @created_by.nil? + invalid_properties.push('invalid value for "created_by", created_by cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @expiration_date_time.nil? + return false if @created_date_time.nil? + return false if @created_by.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + expiration_date_time == o.expiration_date_time && + created_date_time == o.created_date_time && + created_by == o.created_by && + last_modified_date_time == o.last_modified_date_time && + last_modified_by == o.last_modified_by + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [expiration_date_time, created_date_time, created_by, last_modified_date_time, last_modified_by].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/web_form_metadata.rb b/lib/docusign_webforms/models/web_form_metadata.rb new file mode 100644 index 0000000..db68bd9 --- /dev/null +++ b/lib/docusign_webforms/models/web_form_metadata.rb @@ -0,0 +1,377 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Form metadata + class WebFormMetadata + # The source from which the webform is created. Accepted values are [upload, templates, blank] + attr_accessor :source + + # The user that created the form or has been transferred ownership + attr_accessor :owner + + # The user that has added their consent to the form for sending actions + attr_accessor :sender + + # Track the user that last modified anything related to the form + attr_accessor :last_modified_by + + # Track the user that last modified the form content + attr_accessor :form_content_modified_by + + # Track the user that last modified the form properties + attr_accessor :form_properties_modified_by + + # Track the user that last published a draft version to active + attr_accessor :last_published_by + + # Track the user that last unpublished an active version + attr_accessor :last_enabled_by + + # Track the user that last unpublished an active version + attr_accessor :last_disabled_by + + # The last time the web form was archived + attr_accessor :archived_date_time + + # Track the time the web form was created + attr_accessor :created_date_time + + # The last time anything was modified on the form + attr_accessor :last_modified_date_time + + # Track the last time web form content changed. + attr_accessor :form_content_modified_date_time + + # Track the last time the form properties changed. + attr_accessor :form_properties_modified_date_time + + # Track the last time a draft version was published to active + attr_accessor :last_published_date_time + + # Track the last time the form was enabled + attr_accessor :last_enabled_date_time + + # Track the last time the form was disabled + attr_accessor :last_disabled_date_time + + # Track the last time a user added their consent for the form. + attr_accessor :last_sender_consent_date_time + + # The public friendly slug that is used to access the form from the player + attr_accessor :published_slug + + # A dictionary containing the mapping of component names to their respective component types for all the published components. + attr_accessor :published_component_names + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'source' => :'source', + :'owner' => :'owner', + :'sender' => :'sender', + :'last_modified_by' => :'lastModifiedBy', + :'form_content_modified_by' => :'formContentModifiedBy', + :'form_properties_modified_by' => :'formPropertiesModifiedBy', + :'last_published_by' => :'lastPublishedBy', + :'last_enabled_by' => :'lastEnabledBy', + :'last_disabled_by' => :'lastDisabledBy', + :'archived_date_time' => :'archivedDateTime', + :'created_date_time' => :'createdDateTime', + :'last_modified_date_time' => :'lastModifiedDateTime', + :'form_content_modified_date_time' => :'formContentModifiedDateTime', + :'form_properties_modified_date_time' => :'formPropertiesModifiedDateTime', + :'last_published_date_time' => :'lastPublishedDateTime', + :'last_enabled_date_time' => :'lastEnabledDateTime', + :'last_disabled_date_time' => :'lastDisabledDateTime', + :'last_sender_consent_date_time' => :'lastSenderConsentDateTime', + :'published_slug' => :'publishedSlug', + :'published_component_names' => :'publishedComponentNames' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'source' => :'WebFormSource', + :'owner' => :'WebFormUserInfo', + :'sender' => :'WebFormUserInfo', + :'last_modified_by' => :'WebFormUserInfo', + :'form_content_modified_by' => :'WebFormUserInfo', + :'form_properties_modified_by' => :'WebFormUserInfo', + :'last_published_by' => :'WebFormUserInfo', + :'last_enabled_by' => :'WebFormUserInfo', + :'last_disabled_by' => :'WebFormUserInfo', + :'archived_date_time' => :'DateTime', + :'created_date_time' => :'DateTime', + :'last_modified_date_time' => :'DateTime', + :'form_content_modified_date_time' => :'DateTime', + :'form_properties_modified_date_time' => :'DateTime', + :'last_published_date_time' => :'DateTime', + :'last_enabled_date_time' => :'DateTime', + :'last_disabled_date_time' => :'DateTime', + :'last_sender_consent_date_time' => :'DateTime', + :'published_slug' => :'String', + :'published_component_names' => :'Hash' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + + if attributes.has_key?(:'source') + self.source = attributes[:'source'] + end + + if attributes.has_key?(:'owner') + self.owner = attributes[:'owner'] + end + + if attributes.has_key?(:'sender') + self.sender = attributes[:'sender'] + end + + if attributes.has_key?(:'lastModifiedBy') + self.last_modified_by = attributes[:'lastModifiedBy'] + end + + if attributes.has_key?(:'formContentModifiedBy') + self.form_content_modified_by = attributes[:'formContentModifiedBy'] + end + + if attributes.has_key?(:'formPropertiesModifiedBy') + self.form_properties_modified_by = attributes[:'formPropertiesModifiedBy'] + end + + if attributes.has_key?(:'lastPublishedBy') + self.last_published_by = attributes[:'lastPublishedBy'] + end + + if attributes.has_key?(:'lastEnabledBy') + self.last_enabled_by = attributes[:'lastEnabledBy'] + end + + if attributes.has_key?(:'lastDisabledBy') + self.last_disabled_by = attributes[:'lastDisabledBy'] + end + + if attributes.has_key?(:'archivedDateTime') + self.archived_date_time = attributes[:'archivedDateTime'] + end + + if attributes.has_key?(:'createdDateTime') + self.created_date_time = attributes[:'createdDateTime'] + end + + if attributes.has_key?(:'lastModifiedDateTime') + self.last_modified_date_time = attributes[:'lastModifiedDateTime'] + end + + if attributes.has_key?(:'formContentModifiedDateTime') + self.form_content_modified_date_time = attributes[:'formContentModifiedDateTime'] + end + + if attributes.has_key?(:'formPropertiesModifiedDateTime') + self.form_properties_modified_date_time = attributes[:'formPropertiesModifiedDateTime'] + end + + if attributes.has_key?(:'lastPublishedDateTime') + self.last_published_date_time = attributes[:'lastPublishedDateTime'] + end + + if attributes.has_key?(:'lastEnabledDateTime') + self.last_enabled_date_time = attributes[:'lastEnabledDateTime'] + end + + if attributes.has_key?(:'lastDisabledDateTime') + self.last_disabled_date_time = attributes[:'lastDisabledDateTime'] + end + + if attributes.has_key?(:'lastSenderConsentDateTime') + self.last_sender_consent_date_time = attributes[:'lastSenderConsentDateTime'] + end + + if attributes.has_key?(:'publishedSlug') + self.published_slug = attributes[:'publishedSlug'] + end + + if attributes.has_key?(:'publishedComponentNames') + if (value = attributes[:'publishedComponentNames']).is_a?(Hash) + self.published_component_names = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + source == o.source && + owner == o.owner && + sender == o.sender && + last_modified_by == o.last_modified_by && + form_content_modified_by == o.form_content_modified_by && + form_properties_modified_by == o.form_properties_modified_by && + last_published_by == o.last_published_by && + last_enabled_by == o.last_enabled_by && + last_disabled_by == o.last_disabled_by && + archived_date_time == o.archived_date_time && + created_date_time == o.created_date_time && + last_modified_date_time == o.last_modified_date_time && + form_content_modified_date_time == o.form_content_modified_date_time && + form_properties_modified_date_time == o.form_properties_modified_date_time && + last_published_date_time == o.last_published_date_time && + last_enabled_date_time == o.last_enabled_date_time && + last_disabled_date_time == o.last_disabled_date_time && + last_sender_consent_date_time == o.last_sender_consent_date_time && + published_slug == o.published_slug && + published_component_names == o.published_component_names + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [source, owner, sender, last_modified_by, form_content_modified_by, form_properties_modified_by, last_published_by, last_enabled_by, last_disabled_by, archived_date_time, created_date_time, last_modified_date_time, form_content_modified_date_time, form_properties_modified_date_time, last_published_date_time, last_enabled_date_time, last_disabled_date_time, last_sender_consent_date_time, published_slug, published_component_names].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/web_form_name.rb b/lib/docusign_webforms/models/web_form_name.rb new file mode 100644 index 0000000..b89329c --- /dev/null +++ b/lib/docusign_webforms/models/web_form_name.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # User friendly Form name. This can be set via UI and/or API. + class WebFormName + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/web_form_properties.rb b/lib/docusign_webforms/models/web_form_properties.rb new file mode 100644 index 0000000..7cbe2cf --- /dev/null +++ b/lib/docusign_webforms/models/web_form_properties.rb @@ -0,0 +1,193 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # General information about the web form that is consistent across versions + class WebFormProperties + attr_accessor :name + + attr_accessor :is_private_access + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'is_private_access' => :'isPrivateAccess' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'name' => :'String', + :'is_private_access' => :'BOOLEAN' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + + if attributes.has_key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.has_key?(:'isPrivateAccess') + self.is_private_access = attributes[:'isPrivateAccess'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + is_private_access == o.is_private_access + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [name, is_private_access].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/web_form_published_names.rb b/lib/docusign_webforms/models/web_form_published_names.rb new file mode 100644 index 0000000..0955a87 --- /dev/null +++ b/lib/docusign_webforms/models/web_form_published_names.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # A collection of the published component name and its corresponding type + class WebFormPublishedNames + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/web_form_source.rb b/lib/docusign_webforms/models/web_form_source.rb new file mode 100644 index 0000000..564bbd2 --- /dev/null +++ b/lib/docusign_webforms/models/web_form_source.rb @@ -0,0 +1,29 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + class WebFormSource + + TEMPLATES = 'templates'.freeze + BLANK = 'blank'.freeze + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + constantValues = WebFormSource.constants.select { |c| WebFormSource::const_get(c) == value } + raise "Invalid ENUM value #{value} for class #WebFormSource" if constantValues.empty? + value + end + end +end diff --git a/lib/docusign_webforms/models/web_form_state.rb b/lib/docusign_webforms/models/web_form_state.rb new file mode 100644 index 0000000..2996e11 --- /dev/null +++ b/lib/docusign_webforms/models/web_form_state.rb @@ -0,0 +1,29 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + class WebFormState + + ACTIVE = 'active'.freeze + DRAFT = 'draft'.freeze + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + constantValues = WebFormState.constants.select { |c| WebFormState::const_get(c) == value } + raise "Invalid ENUM value #{value} for class #WebFormState" if constantValues.empty? + value + end + end +end diff --git a/lib/docusign_webforms/models/web_form_summary.rb b/lib/docusign_webforms/models/web_form_summary.rb new file mode 100644 index 0000000..45c25b3 --- /dev/null +++ b/lib/docusign_webforms/models/web_form_summary.rb @@ -0,0 +1,250 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # An object that summarizes an instance of a form that can be used to display a listing + class WebFormSummary + attr_accessor :id + + attr_accessor :account_id + + # Has the form been published + attr_accessor :is_published + + # Is the form currently enabled and available for data collection + attr_accessor :is_enabled + + # Does the form have draft changes that need to be published? + attr_accessor :has_draft_changes + + attr_accessor :form_state + + attr_accessor :form_properties + + attr_accessor :form_metadata + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'account_id' => :'accountId', + :'is_published' => :'isPublished', + :'is_enabled' => :'isEnabled', + :'has_draft_changes' => :'hasDraftChanges', + :'form_state' => :'formState', + :'form_properties' => :'formProperties', + :'form_metadata' => :'formMetadata' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'account_id' => :'String', + :'is_published' => :'BOOLEAN', + :'is_enabled' => :'BOOLEAN', + :'has_draft_changes' => :'BOOLEAN', + :'form_state' => :'WebFormState', + :'form_properties' => :'WebFormProperties', + :'form_metadata' => :'WebFormMetadata' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'accountId') + self.account_id = attributes[:'accountId'] + end + + if attributes.has_key?(:'isPublished') + self.is_published = attributes[:'isPublished'] + end + + if attributes.has_key?(:'isEnabled') + self.is_enabled = attributes[:'isEnabled'] + end + + if attributes.has_key?(:'hasDraftChanges') + self.has_draft_changes = attributes[:'hasDraftChanges'] + end + + if attributes.has_key?(:'formState') + self.form_state = attributes[:'formState'] + end + + if attributes.has_key?(:'formProperties') + self.form_properties = attributes[:'formProperties'] + end + + if attributes.has_key?(:'formMetadata') + self.form_metadata = attributes[:'formMetadata'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + account_id == o.account_id && + is_published == o.is_published && + is_enabled == o.is_enabled && + has_draft_changes == o.has_draft_changes && + form_state == o.form_state && + form_properties == o.form_properties && + form_metadata == o.form_metadata + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [id, account_id, is_published, is_enabled, has_draft_changes, form_state, form_properties, form_metadata].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/web_form_summary_list.rb b/lib/docusign_webforms/models/web_form_summary_list.rb new file mode 100644 index 0000000..f31ffac --- /dev/null +++ b/lib/docusign_webforms/models/web_form_summary_list.rb @@ -0,0 +1,247 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # A list of web form summary items. + class WebFormSummaryList + # Array of web form items with each containing summary. + attr_accessor :items + + # Result set size for current page + attr_accessor :result_set_size + + # Total result set size + attr_accessor :total_set_size + + # Starting position of fields returned for the current page + attr_accessor :start_position + + # Ending position of fields returned for the current page + attr_accessor :end_position + + # Url for the next page of results + attr_accessor :next_url + + # Url for the previous page of results + attr_accessor :previous_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'items' => :'items', + :'result_set_size' => :'resultSetSize', + :'total_set_size' => :'totalSetSize', + :'start_position' => :'startPosition', + :'end_position' => :'endPosition', + :'next_url' => :'nextUrl', + :'previous_url' => :'previousUrl' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'items' => :'Array', + :'result_set_size' => :'Float', + :'total_set_size' => :'Float', + :'start_position' => :'Float', + :'end_position' => :'Float', + :'next_url' => :'String', + :'previous_url' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + + if attributes.has_key?(:'items') + if (value = attributes[:'items']).is_a?(Array) + self.items = value + end + end + + if attributes.has_key?(:'resultSetSize') + self.result_set_size = attributes[:'resultSetSize'] + end + + if attributes.has_key?(:'totalSetSize') + self.total_set_size = attributes[:'totalSetSize'] + end + + if attributes.has_key?(:'startPosition') + self.start_position = attributes[:'startPosition'] + end + + if attributes.has_key?(:'endPosition') + self.end_position = attributes[:'endPosition'] + end + + if attributes.has_key?(:'nextUrl') + self.next_url = attributes[:'nextUrl'] + end + + if attributes.has_key?(:'previousUrl') + self.previous_url = attributes[:'previousUrl'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + items == o.items && + result_set_size == o.result_set_size && + total_set_size == o.total_set_size && + start_position == o.start_position && + end_position == o.end_position && + next_url == o.next_url && + previous_url == o.previous_url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [items, result_set_size, total_set_size, start_position, end_position, next_url, previous_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/web_form_user_info.rb b/lib/docusign_webforms/models/web_form_user_info.rb new file mode 100644 index 0000000..6e64c46 --- /dev/null +++ b/lib/docusign_webforms/models/web_form_user_info.rb @@ -0,0 +1,209 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Information about a DocuSign system user. The user exists within the account associated with the form. + class WebFormUserInfo + attr_accessor :user_id + + # Name of the user that can be displayed in the user interface. + attr_accessor :user_name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'user_id' => :'userId', + :'user_name' => :'userName' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'user_id' => :'String', + :'user_name' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + + if attributes.has_key?(:'userId') + self.user_id = attributes[:'userId'] + end + + if attributes.has_key?(:'userName') + self.user_name = attributes[:'userName'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@user_name.nil? && @user_name.to_s.length > 150 + invalid_properties.push('invalid value for "user_name", the character length must be smaller than or equal to 150.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@user_name.nil? && @user_name.to_s.length > 150 + true + end + + # Custom attribute writer method with validation + # @param [Object] user_name Value to be assigned + def user_name=(user_name) + if !user_name.nil? && user_name.to_s.length > 150 + fail ArgumentError, 'invalid value for "user_name", the character length must be smaller than or equal to 150.' + end + + @user_name = user_name + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user_id == o.user_id && + user_name == o.user_name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [user_id, user_name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/web_form_values.rb b/lib/docusign_webforms/models/web_form_values.rb new file mode 100644 index 0000000..92ac406 --- /dev/null +++ b/lib/docusign_webforms/models/web_form_values.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Key-value pairs (where key is the component name and value is the form value) used to create a form instance. For key of type TextBox, Email, Date, Select and RadioButtonGroup the value is of string type. For key of type Number, the value is of number type. For key of type of CheckboxGroup, the value is of type array of string. + class WebFormValues + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/models/web_form_version_id.rb b/lib/docusign_webforms/models/web_form_version_id.rb new file mode 100644 index 0000000..2d4eded --- /dev/null +++ b/lib/docusign_webforms/models/web_form_version_id.rb @@ -0,0 +1,175 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module DocuSign_WebForms + # Identifier for the current version of the web form that is published + class WebFormVersionId + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = DocuSign_WebForms.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/lib/docusign_webforms/version.rb b/lib/docusign_webforms/version.rb new file mode 100644 index 0000000..8875ccc --- /dev/null +++ b/lib/docusign_webforms/version.rb @@ -0,0 +1,14 @@ +=begin +#Web Forms API version 1.1 + +#The Web Forms API facilitates generating semantic HTML forms around everyday contracts. + +OpenAPI spec version: 1.1.0 +Contact: devcenter@docusign.com +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +module DocuSign_WebForms + VERSION = '1.0.2.rc12' +end diff --git a/runLinter.sh b/runLinter.sh new file mode 100644 index 0000000..d4e11f9 --- /dev/null +++ b/runLinter.sh @@ -0,0 +1 @@ +./vendor/bundle/ruby/2.6.0/bin/rubocop -a \ No newline at end of file diff --git a/tests/Gemfile b/tests/Gemfile new file mode 100644 index 0000000..d811f56 --- /dev/null +++ b/tests/Gemfile @@ -0,0 +1,5 @@ +source 'https://rubygems.org' + +gem 'rspec' + +gem 'docusign_webforms', path: '../' diff --git a/tests/spec/unit_tests_using_jwt_spec.rb b/tests/spec/unit_tests_using_jwt_spec.rb new file mode 100644 index 0000000..7f10668 --- /dev/null +++ b/tests/spec/unit_tests_using_jwt_spec.rb @@ -0,0 +1,38 @@ +require 'docusign_webforms' +require 'base64' +require 'uri' +RSpec.describe DocuSign_WebForms::FormManagementApi do + def login + begin + if $api_client.nil? + configuration = DocuSign_WebForms::Configuration.new + configuration.host = "https://demo.services.docusign.net/webforms/v1.1" + + $api_client = DocuSign_WebForms::ApiClient.new(configuration) + end + + $api_client.set_default_header("Authorization", "Bearer" + " " + "") + return nil + end + end + + def create_api_client + if $api_client.nil? + self.login() + end + + return $api_client + end + + describe '#listForms' do + it 'list forms' do + begin + api_client = create_api_client() + form_management_api = DocuSign_WebForms::FormManagementApi.new(api_client) + puts form_management_api.list_forms("3c9c0391-01ac-4a98-8fab-adb9d0e548d2") + rescue => e + puts "An error occurred: #{e}" + end + end + end +end