├── storage
└── .keep
├── vendor
└── .keep
├── lib
├── assets
│ └── .keep
└── tasks
│ └── .keep
├── .ruby-gemset
├── .ruby-version
├── app
├── assets
│ ├── images
│ │ ├── .keep
│ │ └── favicon.png
│ ├── javascripts
│ │ ├── channels
│ │ │ └── .keep
│ │ ├── cable.js
│ │ └── application.js
│ ├── config
│ │ └── manifest.js
│ └── stylesheets
│ │ └── application.css
├── models
│ ├── concerns
│ │ └── .keep
│ └── application_record.rb
├── controllers
│ ├── concerns
│ │ └── .keep
│ ├── .DS_Store
│ ├── application_controller.rb
│ ├── clickwrap
│ │ ├── ceg004_list_clickwraps_controller.rb
│ │ ├── ceg005_clickwrap_responses_controller.rb
│ │ ├── ceg003_create_new_clickwrap_version_controller.rb
│ │ ├── ceg002_activate_clickwrap_controller.rb
│ │ ├── ceg001_create_clickwrap_controller.rb
│ │ └── ceg006_embed_clickwrap_controller.rb
│ ├── e_sign
│ │ ├── eeg003_list_envelopes_controller.rb
│ │ ├── eeg015_get_envelope_tab_data_controller.rb
│ │ ├── eeg018_get_envelope_custom_field_data_controller.rb
│ │ ├── eeg012_embedded_console_controller.rb
│ │ ├── eeg024_permission_create_controller.rb
│ │ ├── eeg038_responsive_signing_controller.rb
│ │ ├── eeg028_brands_creating_controller.rb
│ │ ├── eeg016_set_envelope_tab_data_controller.rb
│ │ ├── eeg044_focused_view_controller.rb
│ │ ├── eeg035_scheduled_sending_controller.rb
│ │ ├── eeg011_embedded_sending_controller.rb
│ │ ├── eeg004_envelope_info_controller.rb
│ │ ├── eeg019_access_code_authentication_controller.rb
│ │ ├── eeg008_create_template_controller.rb
│ │ ├── eeg033_unpauses_signature_workflow_controller.rb
│ │ ├── eeg005_envelope_recipients_controller.rb
│ │ ├── eeg017_set_template_tab_values_controller.rb
│ │ ├── eeg022_kba_authentication_controller.rb
│ │ ├── eeg002_signing_via_email_controller.rb
│ │ ├── eeg027_permissions_delete_controller.rb
│ │ ├── eeg010_send_binary_docs_controller.rb
│ │ ├── eeg031_bulk_sending_envelopes_controller.rb
│ │ ├── eeg007_envelope_get_doc_controller.rb
│ │ ├── eeg042_document_generation_controller.rb
│ │ ├── eeg026_permissions_change_single_setting_controller.rb
│ │ ├── eeg032_pauses_signature_workflow_controller.rb
│ │ └── eeg009_use_template_controller.rb
│ ├── room_api
│ │ ├── reg007_create_form_group_controller.rb
│ │ ├── reg003_export_data_from_room_controller.rb
│ │ ├── reg005_get_rooms_with_filters_controller.rb
│ │ ├── reg004_add_forms_to_room_controller.rb
│ │ ├── reg001_create_room_with_data_controller.rb
│ │ ├── reg002_create_room_with_template_controller.rb
│ │ ├── reg006_create_an_external_form_fill_session_controller.rb
│ │ ├── reg008_grant_office_access_to_form_group_controller.rb
│ │ └── reg009_assign_form_to_form_group_controller.rb
│ ├── connect
│ │ └── cneg001_validate_webhook_message_controller.rb
│ ├── admin_api
│ │ ├── aeg011_delete_user_data_from_account_controller.rb
│ │ ├── aeg006_get_user_profile_by_email_controller.rb
│ │ ├── aeg010_delete_user_data_from_organization_controller.rb
│ │ ├── aeg007_get_user_profile_by_user_id_controller.rb
│ │ ├── aeg005_audit_users_controller.rb
│ │ ├── aeg003_bulk_export_user_data_controller.rb
│ │ ├── aeg012_clone_account_controller.rb
│ │ └── aeg013_create_account_controller.rb
│ ├── monitor_api
│ │ └── meg001_get_monitoring_dataset_controller.rb
│ ├── notary
│ │ └── neg004_send_with_third_party_notary_controller.rb
│ └── eeg001_embedded_signing_controller.rb
├── views
│ ├── layouts
│ │ ├── mailer.text.erb
│ │ ├── application.html.erb
│ │ ├── mailer.html.erb
│ │ └── _foot.erb
│ ├── .DS_Store
│ ├── partials
│ │ ├── _continue_button.erb
│ │ ├── _submit_button.erb
│ │ ├── _email_will_not_be_shared.erb
│ │ ├── _email_should_differ_from_signer.erb
│ │ ├── _phone_will_not_be_shared.erb
│ │ └── _example_info.erb
│ ├── admin_api
│ │ ├── aeg004_import_user
│ │ │ ├── get.html.erb
│ │ │ └── get_status.html.erb
│ │ ├── aeg005_audit_users
│ │ │ └── get.html.erb
│ │ ├── aeg003_bulk_export_user_data
│ │ │ └── get.html.erb
│ │ ├── aeg007_get_user_profile_by_user_id
│ │ │ └── get.html.erb
│ │ ├── aeg006_get_user_profile_by_email
│ │ │ └── get.html.erb
│ │ ├── aeg010_delete_user_data_from_organization
│ │ │ └── get.html.erb
│ │ ├── aeg011_delete_user_data_from_account
│ │ │ └── get.html.erb
│ │ ├── aeg009_delete_user_product_permission_profile
│ │ │ └── get.html.erb
│ │ └── aeg013_create_account
│ │ │ └── get.html.erb
│ ├── e_sign
│ │ ├── eeg003_list_envelopes
│ │ │ └── get.html.erb
│ │ ├── eeg008_create_template
│ │ │ └── get.html.erb
│ │ ├── eeg034_use_conditional_recipients
│ │ │ └── return.html.erb
│ │ ├── eeg033_unpauses_signature_workflow
│ │ │ ├── return.html.erb
│ │ │ └── get.html.erb
│ │ ├── eeg032_pauses_signature_workflow
│ │ │ └── return.html.erb
│ │ ├── eeg004_envelope_info
│ │ │ └── get.html.erb
│ │ ├── eeg006_envelope_docs
│ │ │ └── get.html.erb
│ │ ├── eeg005_envelope_recipients
│ │ │ └── get.html.erb
│ │ ├── eeg015_get_envelope_tab_data
│ │ │ └── get.html.erb
│ │ ├── eeg018_get_envelope_custom_field_data
│ │ │ └── get.html.erb
│ │ ├── eeg024_permission_create
│ │ │ └── get.html.erb
│ │ ├── eeg039_signing_in_person
│ │ │ └── get.html.erb
│ │ ├── eeg027_permissions_delete
│ │ │ └── get.html.erb
│ │ ├── eeg026_permissions_change_single_setting
│ │ │ └── get.html.erb
│ │ ├── eeg045_delete_restore_envelope
│ │ │ ├── restore.html.erb
│ │ │ └── delete.html.erb
│ │ ├── eeg012_embedded_console
│ │ │ └── get.html.erb
│ │ ├── eeg028_brands_creating
│ │ │ └── get.html.erb
│ │ ├── eeg025_permissions_set_user_group
│ │ │ └── get.html.erb
│ │ ├── eeg022_kba_authentication
│ │ │ └── get.html.erb
│ │ ├── eeg023_idv_authentication
│ │ │ └── get.html.erb
│ │ ├── eeg044_focused_view
│ │ │ └── get.html.erb
│ │ ├── eeg016_set_envelope_tab_data
│ │ │ └── get.html.erb
│ │ └── eeg007_envelope_get_doc
│ │ │ └── get.html.erb
│ ├── monitor_api
│ │ └── meg001_get_monitoring_dataset
│ │ │ └── get.html.erb
│ ├── webforms
│ │ ├── weg001_create_instance
│ │ │ ├── get.html.erb
│ │ │ └── web_form_create.html.erb
│ │ └── weg002_create_remote_instance
│ │ │ ├── get.html.erb
│ │ │ └── web_form_create.html.erb
│ ├── clickwrap
│ │ ├── ceg004_list_clickwraps
│ │ │ └── get.html.erb
│ │ ├── ceg003_create_new_clickwrap_version
│ │ │ └── get.html.erb
│ │ ├── ceg001_create_clickwrap
│ │ │ └── get.html.erb
│ │ ├── ceg002_activate_clickwrap
│ │ │ └── get.html.erb
│ │ ├── ceg005_clickwrap_responses
│ │ │ └── get.html.erb
│ │ └── ceg006_embed_clickwrap
│ │ │ └── results.html.erb
│ ├── ds_common
│ │ ├── error.erb
│ │ ├── example_done.erb
│ │ ├── ds_return.html.erb
│ │ └── ds_must_authenticate.erb
│ ├── room_api
│ │ ├── reg006_create_an_external_form_fill_session
│ │ │ ├── results.html.erb
│ │ │ ├── get_rooms.html.erb
│ │ │ └── get_forms.html.erb
│ │ ├── return.html.erb
│ │ ├── reg001_create_room_with_data
│ │ │ └── get.html.erb
│ │ ├── reg007_create_form_group
│ │ │ └── get.html.erb
│ │ ├── reg003_export_data_from_room
│ │ │ └── get.html.erb
│ │ ├── reg008_grant_office_access_to_form_group
│ │ │ └── get.erb
│ │ ├── reg009_assign_form_to_form_group
│ │ │ └── get.erb
│ │ ├── reg002_create_room_with_template
│ │ │ └── get.html.erb
│ │ └── reg005_get_rooms_with_filters
│ │ │ └── get.html.erb
│ ├── eeg001_embedded_signing
│ │ └── get.html.erb
│ ├── connect
│ │ └── cneg001_validate_webhook_message
│ │ │ └── get.html.erb
│ └── notary
│ │ └── neg004_send_with_third_party_notary
│ │ └── get.html.erb
├── .DS_Store
├── jobs
│ └── application_job.rb
├── channels
│ └── application_cable
│ │ ├── channel.rb
│ │ └── connection.rb
├── mailers
│ └── application_mailer.rb
├── helpers
│ ├── application_helper.rb
│ └── eg024_brands_creating_helper.rb
└── services
│ ├── e_sign
│ ├── eg004_envelope_info_service.rb
│ ├── eg006_envelope_docs_service.rb
│ ├── eg018_get_envelope_custom_field_data_service.rb
│ ├── eg005_envelope_recipients_service.rb
│ ├── eg027_permissions_delete_service.rb
│ ├── eg025_permissions_set_user_group_service.rb
│ ├── eg015_get_envelope_tab_data_service.rb
│ ├── eg012_embedded_console_service.rb
│ ├── eg003_list_envelopes_service.rb
│ ├── eg028_brands_creating_service.rb
│ ├── eg033_unpauses_signature_workflow_service.rb
│ ├── get_data_service.rb
│ ├── eg045_delete_restore_envelope_service.rb
│ └── eg007_envelope_get_doc_service.rb
│ ├── connect
│ └── eg001_validate_webhook_message_service.rb
│ ├── room_api
│ ├── eg003_export_data_from_room_service.rb
│ ├── eg008_grant_office_access_to_form_group_service.rb
│ ├── eg007_create_form_group_service.rb
│ ├── eg005_get_rooms_with_filters_service.rb
│ ├── eg004_add_forms_to_room_service.rb
│ ├── eg009_assign_form_to_form_group_service.rb
│ ├── eg006_create_an_external_form_fill_session_service.rb
│ └── eg001_create_room_with_data_service.rb
│ ├── admin_api
│ ├── eg007_get_user_profile_by_user_id_service.rb
│ ├── eg001_create_user_service.rb
│ ├── eg004_import_user_service.rb
│ ├── eg006_get_user_profile_by_email_service.rb
│ ├── eg011_delete_user_data_from_account_service.rb
│ ├── eg008_update_user_product_permission_profile_service.rb
│ └── eg002_create_active_clm_esign_user_service.rb
│ └── clickwrap
│ ├── eg004_list_clickwraps_service.rb
│ └── eg005_clickwrap_responses_service.rb
├── public
├── apple-touch-icon.png
├── apple-touch-icon-precomposed.png
├── favicon.ico
├── header.png
└── robots.txt
├── quick_acg
├── .ruby-version
├── bin
│ ├── rake
│ ├── rails
│ └── setup
├── app
│ ├── assets
│ │ └── config
│ │ │ └── manifest.js
│ ├── controllers
│ │ └── ds_common_controller.rb
│ └── views
│ │ └── ds_common
│ │ └── error.erb
├── config
│ ├── boot.rb
│ ├── environment.rb
│ ├── credentials.yml.enc
│ ├── initializers
│ │ └── assets.rb
│ ├── database.yml
│ └── application.rb
├── config.ru
├── Rakefile
├── .gitattributes
├── README.md
└── .gitignore
├── .DS_Store
├── data
├── Term_Of_Service.pdf
├── Offer_Letter_Demo.docx
├── World_Wide_Corp_fields.pdf
├── World_Wide_Corp_lorem.pdf
├── World_Wide_Corp_Web_Form.pdf
├── World_Wide_Corp_fields.docx
├── World_Wide_Corp_salary.docx
├── Offer_Letter_Dynamic_Table.docx
├── World_Wide_Corp_fields_shown.docx
├── World_Wide_Corp_Battle_Plan_Trafalgar.docx
└── userData.csv
├── bin
├── rake
├── rails
├── bundle
├── yarn
├── spring
├── update
└── setup
├── test
├── run_tests.rb
├── eg001_create_clickwrap_test.rb
├── eg028_brands_creating_test.rb
└── eg002_activate_clickwrap_test.rb
├── docs
└── stripe_skip_account_form_link.png
├── config
├── spring.rb
├── environment.rb
├── initializers
│ ├── mime_types.rb
│ ├── filter_parameter_logging.rb
│ ├── application_controller_renderer.rb
│ ├── cookies_serializer.rb
│ ├── backtrace_silencers.rb
│ ├── wrap_parameters.rb
│ ├── assets.rb
│ ├── inflections.rb
│ └── content_security_policy.rb
├── cable.yml
├── boot.rb
├── credentials.yml.enc
├── database.yml
├── locales
│ └── en.yml
├── storage.yml
├── application.rb
└── puma.rb
├── config.ru
├── jwt_console_project
└── jwt_config.example.yml
├── Rakefile
├── db
├── seeds.rb
└── schema.rb
├── connect_test.rb
├── PAYMENTS_INSTALLATION.md
├── LICENSE
└── .github
└── workflows
└── rubyonrails.yml
/storage/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/vendor/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/assets/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/tasks/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.ruby-gemset:
--------------------------------------------------------------------------------
1 | docusign
--------------------------------------------------------------------------------
/.ruby-version:
--------------------------------------------------------------------------------
1 | 3.1.2
2 |
--------------------------------------------------------------------------------
/app/assets/images/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/models/concerns/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/apple-touch-icon.png:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/assets/javascripts/channels/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/quick_acg/.ruby-version:
--------------------------------------------------------------------------------
1 | ruby-2.7.3
2 |
--------------------------------------------------------------------------------
/public/apple-touch-icon-precomposed.png:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/views/layouts/mailer.text.erb:
--------------------------------------------------------------------------------
1 | <%= yield %>
2 |
--------------------------------------------------------------------------------
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/docusign/code-examples-ruby/master/.DS_Store
--------------------------------------------------------------------------------
/app/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/docusign/code-examples-ruby/master/app/.DS_Store
--------------------------------------------------------------------------------
/app/views/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/docusign/code-examples-ruby/master/app/views/.DS_Store
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/docusign/code-examples-ruby/master/public/favicon.ico
--------------------------------------------------------------------------------
/public/header.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/docusign/code-examples-ruby/master/public/header.png
--------------------------------------------------------------------------------
/data/Term_Of_Service.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/docusign/code-examples-ruby/master/data/Term_Of_Service.pdf
--------------------------------------------------------------------------------
/app/controllers/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/docusign/code-examples-ruby/master/app/controllers/.DS_Store
--------------------------------------------------------------------------------
/app/jobs/application_job.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ApplicationJob < ActiveJob::Base
4 | end
5 |
--------------------------------------------------------------------------------
/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby.exe
2 | require_relative "../config/boot"
3 | require "rake"
4 | Rake.application.run
5 |
--------------------------------------------------------------------------------
/app/assets/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/docusign/code-examples-ruby/master/app/assets/images/favicon.png
--------------------------------------------------------------------------------
/data/Offer_Letter_Demo.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/docusign/code-examples-ruby/master/data/Offer_Letter_Demo.docx
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 |
--------------------------------------------------------------------------------
/test/run_tests.rb:
--------------------------------------------------------------------------------
1 | Dir["#{File.dirname(File.absolute_path(__FILE__))}/**/*_test.rb"].sort.each { |file| require file }
2 |
--------------------------------------------------------------------------------
/data/World_Wide_Corp_fields.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/docusign/code-examples-ruby/master/data/World_Wide_Corp_fields.pdf
--------------------------------------------------------------------------------
/data/World_Wide_Corp_lorem.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/docusign/code-examples-ruby/master/data/World_Wide_Corp_lorem.pdf
--------------------------------------------------------------------------------
/quick_acg/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby.exe
2 | require_relative '../config/boot'
3 | require 'rake'
4 | Rake.application.run
5 |
--------------------------------------------------------------------------------
/data/World_Wide_Corp_Web_Form.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/docusign/code-examples-ruby/master/data/World_Wide_Corp_Web_Form.pdf
--------------------------------------------------------------------------------
/data/World_Wide_Corp_fields.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/docusign/code-examples-ruby/master/data/World_Wide_Corp_fields.docx
--------------------------------------------------------------------------------
/data/World_Wide_Corp_salary.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/docusign/code-examples-ruby/master/data/World_Wide_Corp_salary.docx
--------------------------------------------------------------------------------
/data/Offer_Letter_Dynamic_Table.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/docusign/code-examples-ruby/master/data/Offer_Letter_Dynamic_Table.docx
--------------------------------------------------------------------------------
/app/assets/config/manifest.js:
--------------------------------------------------------------------------------
1 | //= link_tree ../images
2 | //= link_directory ../javascripts .js
3 | //= link_directory ../stylesheets .css
4 |
--------------------------------------------------------------------------------
/data/World_Wide_Corp_fields_shown.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/docusign/code-examples-ruby/master/data/World_Wide_Corp_fields_shown.docx
--------------------------------------------------------------------------------
/docs/stripe_skip_account_form_link.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/docusign/code-examples-ruby/master/docs/stripe_skip_account_form_link.png
--------------------------------------------------------------------------------
/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ApplicationController < ActionController::Base
4 | end
5 |
--------------------------------------------------------------------------------
/app/views/layouts/application.html.erb:
--------------------------------------------------------------------------------
1 | <%= csrf_meta_tags %>
2 | <%= render 'layouts/head' %>
3 | <%= yield %>
4 | <%= render 'layouts/foot' %>
--------------------------------------------------------------------------------
/quick_acg/app/assets/config/manifest.js:
--------------------------------------------------------------------------------
1 | //= link_tree ../images
2 | //= link_directory ../javascripts .js
3 | //= link_directory ../stylesheets .css
--------------------------------------------------------------------------------
/app/views/partials/_continue_button.erb:
--------------------------------------------------------------------------------
1 | <%= sanitize @manifest["SupportingTexts"]["ContinueButton"] %>
--------------------------------------------------------------------------------
/app/models/application_record.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ApplicationRecord < ActiveRecord::Base
4 | self.abstract_class = true
5 | end
6 |
--------------------------------------------------------------------------------
/data/World_Wide_Corp_Battle_Plan_Trafalgar.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/docusign/code-examples-ruby/master/data/World_Wide_Corp_Battle_Plan_Trafalgar.docx
--------------------------------------------------------------------------------
/quick_acg/config/boot.rb:
--------------------------------------------------------------------------------
1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2 |
3 | require 'bundler/setup' # Set up gems listed in the Gemfile.
4 |
--------------------------------------------------------------------------------
/app/views/partials/_submit_button.erb:
--------------------------------------------------------------------------------
1 | <%= sanitize @submit_button_text || @manifest["SupportingTexts"]["SubmitButton"] %>
--------------------------------------------------------------------------------
/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby.exe
2 | APP_PATH = File.expand_path("../config/application", __dir__)
3 | require_relative "../config/boot"
4 | require "rails/commands"
5 |
--------------------------------------------------------------------------------
/app/channels/application_cable/channel.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module ApplicationCable
4 | class Channel < ActionCable::Channel::Base
5 | end
6 | end
7 |
--------------------------------------------------------------------------------
/app/views/partials/_email_will_not_be_shared.erb:
--------------------------------------------------------------------------------
1 | <%= @manifest["SupportingTexts"]["HelpingTexts"]["EmailWontBeShared"] %>
--------------------------------------------------------------------------------
/quick_acg/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby.exe
2 | APP_PATH = File.expand_path('../config/application', __dir__)
3 | require_relative '../config/boot'
4 | require 'rails/commands'
5 |
--------------------------------------------------------------------------------
/quick_acg/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require_relative 'application'
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/app/channels/application_cable/connection.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module ApplicationCable
4 | class Connection < ActionCable::Connection::Base
5 | end
6 | end
7 |
--------------------------------------------------------------------------------
/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
5 | load Gem.bin_path('bundler', 'bundle')
6 |
--------------------------------------------------------------------------------
/app/mailers/application_mailer.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ApplicationMailer < ActionMailer::Base
4 | default from: 'from@example.com'
5 | layout 'mailer'
6 | end
7 |
--------------------------------------------------------------------------------
/config/spring.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | %w[
4 | .ruby-version
5 | .rbenv-vars
6 | tmp/restart.txt
7 | tmp/caching-dev.txt
8 | ].each { |path| Spring.watch(path) }
9 |
--------------------------------------------------------------------------------
/app/views/partials/_email_should_differ_from_signer.erb:
--------------------------------------------------------------------------------
1 | <%= @manifest["SupportingTexts"]["HelpingTexts"]["CCEmailShouldDifferFromSigner"] %>
--------------------------------------------------------------------------------
/config.ru:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # This file is used by Rack-based servers to start the application.
4 |
5 | require_relative 'config/environment'
6 |
7 | run Rails.application
8 |
--------------------------------------------------------------------------------
/config/environment.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Load the Rails application.
4 | require_relative 'application'
5 |
6 | # Initialize the Rails application.
7 | Rails.application.initialize!
8 |
--------------------------------------------------------------------------------
/data/userData.csv:
--------------------------------------------------------------------------------
1 | AccountID,FirstName,LastName,UserEmail,PermissionSet
2 | {account_id},First1,Last1,example1@sampleemail.example,DS Admin
3 | {account_id},First2,Last2,example2@sampleemail.example,DS Admin
--------------------------------------------------------------------------------
/quick_acg/config.ru:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # This file is used by Rack-based servers to start the application.
4 |
5 | require_relative 'config/environment'
6 |
7 | run Rails.application
8 |
--------------------------------------------------------------------------------
/app/views/admin_api/aeg004_import_user/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 |
--------------------------------------------------------------------------------
/app/views/admin_api/aeg005_audit_users/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 |
6 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg003_list_envelopes/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 |
--------------------------------------------------------------------------------
/app/views/admin_api/aeg003_bulk_export_user_data/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg008_create_template/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 |
6 |
--------------------------------------------------------------------------------
/app/views/monitor_api/meg001_get_monitoring_dataset/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 |
--------------------------------------------------------------------------------
/app/views/webforms/weg001_create_instance/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 |
--------------------------------------------------------------------------------
/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # Be sure to restart your server when you modify this file.
3 |
4 | # Add new mime types for use in respond_to blocks:
5 | # Mime::Type.register "text/richtext", :rtf
6 |
--------------------------------------------------------------------------------
/jwt_console_project/jwt_config.example.yml:
--------------------------------------------------------------------------------
1 | jwt_integration_key: {INTEGRATION_KEY_JWT}
2 | impersonated_user_guid: {IMPERSONATED_USER_ID}
3 | authorization_server: account-d.docusign.com
4 | pdf_filename: '../data/World_Wide_Corp_lorem.pdf'
5 |
--------------------------------------------------------------------------------
/app/views/webforms/weg002_create_remote_instance/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 |
--------------------------------------------------------------------------------
/app/views/partials/_phone_will_not_be_shared.erb:
--------------------------------------------------------------------------------
1 | <%= "#{@manifest["SupportingTexts"]["HelpingTexts"]["PhoneNumberWillBeNotified"]} #{@manifest["SupportingTexts"]["HelpingTexts"]["PhoneNumberWontBeShared"]}" %>
--------------------------------------------------------------------------------
/config/cable.yml:
--------------------------------------------------------------------------------
1 | development:
2 | adapter: async
3 |
4 | test:
5 | adapter: async
6 |
7 | production:
8 | adapter: redis
9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10 | channel_prefix: code-examples-ruby_production
11 |
--------------------------------------------------------------------------------
/app/views/webforms/weg001_create_instance/web_form_create.html.erb:
--------------------------------------------------------------------------------
1 | <%= @title %>
2 | <%= sanitize @description %>
3 |
4 |
--------------------------------------------------------------------------------
/quick_acg/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require_relative 'config/application'
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/config/boot.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
4 |
5 | require 'bundler/setup' # Set up gems listed in the Gemfile.
6 | require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
7 |
--------------------------------------------------------------------------------
/app/views/webforms/weg002_create_remote_instance/web_form_create.html.erb:
--------------------------------------------------------------------------------
1 | <%= @title %>
2 | <%= sanitize @description %>
3 |
4 |
--------------------------------------------------------------------------------
/app/views/clickwrap/ceg004_list_clickwraps/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg034_use_conditional_recipients/return.html.erb:
--------------------------------------------------------------------------------
1 | Use condition recipients
2 |
3 | Envelope ID: <%= @envelop_id %>
4 | with the conditional routing criteria has been created and sent to the first recipient!
5 |
6 |
7 | Continue
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Add your own tasks in files placed in lib/tasks ending in .rake,
4 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
5 |
6 | require_relative 'config/application'
7 |
8 | Rails.application.load_tasks
9 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg033_unpauses_signature_workflow/return.html.erb:
--------------------------------------------------------------------------------
1 | Envelope unpaused
2 |
3 | The envelope workflow has been resumed and the envelope has been sent to second recipient!
4 |
5 | Envelope ID: <%= @envelop_id %>
6 |
7 |
8 | Continue
--------------------------------------------------------------------------------
/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # Configure sensitive parameters which will be filtered from the log file.
6 | Rails.application.config.filter_parameters += [:password]
7 |
--------------------------------------------------------------------------------
/quick_acg/.gitattributes:
--------------------------------------------------------------------------------
1 | # See https://git-scm.com/docs/gitattributes for more about git attribute files.
2 |
3 | # Mark the database schema as having been generated.
4 | db/schema.rb linguist-generated
5 |
6 | # Mark any vendored files as having been vendored.
7 | vendor/* linguist-vendored
8 |
--------------------------------------------------------------------------------
/app/views/layouts/mailer.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 | <%= yield %>
12 |
13 |
14 |
--------------------------------------------------------------------------------
/config/initializers/application_controller_renderer.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # Be sure to restart your server when you modify this file.
3 |
4 | # ActiveSupport::Reloader.to_prepare do
5 | # ApplicationController.renderer.defaults.merge!(
6 | # http_host: 'example.org',
7 | # https: false
8 | # )
9 | # end
10 |
--------------------------------------------------------------------------------
/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # Specify a serializer for the signed and encrypted cookie jars.
6 | # Valid options are :json, :marshal, and :hybrid.
7 | Rails.application.config.action_dispatch.cookies_serializer = :json
8 |
--------------------------------------------------------------------------------
/bin/yarn:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | APP_ROOT = File.expand_path('..', __dir__)
5 | Dir.chdir(APP_ROOT) do
6 | exec 'yarnpkg', *ARGV
7 | rescue Errno::ENOENT
8 | warn 'Yarn executable was not detected in the system.'
9 | warn 'Download Yarn at https://yarnpkg.com/en/docs/install'
10 | exit 1
11 | end
12 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg032_pauses_signature_workflow/return.html.erb:
--------------------------------------------------------------------------------
1 | Envelope sent
2 |
3 | The envelope has been created and sent!
4 |
5 | Envelope ID: <%= @envelop_id %>
6 |
7 |
8 | To resume a workflow after first recipient signs the envelope use Unpause a signature workflow
9 |
10 |
11 | Continue
--------------------------------------------------------------------------------
/app/views/ds_common/error.erb:
--------------------------------------------------------------------------------
1 | <% title = "Error" %>
2 |
3 | Problem: an error occurred
4 | Error information:
5 |
6 | <% if @error_code %>
7 | <%= @error_code %>: <%= @error_message %>
8 | <% end %>
9 | <% if @error_information %>
10 | <%== @error_information %>
11 | <% end %>
12 | <% if @err %>
13 |
<%= @err %>
14 | <% end %>
15 |
16 |
17 | Continue
--------------------------------------------------------------------------------
/db/seeds.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # This file should contain all the record creation needed to seed the database with its default values.
3 | # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
4 | #
5 | # Examples:
6 | #
7 | # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
8 | # Character.create(name: 'Luke', movie: movies.first)
9 |
--------------------------------------------------------------------------------
/app/views/room_api/reg006_create_an_external_form_fill_session/results.html.erb:
--------------------------------------------------------------------------------
1 | <%= @title %>
2 | <% if !@message.nil? %>
3 | <%= @message.html_safe %>
4 | <% end %>
5 |
6 | <%= @json %>
7 |
8 |
11 |
14 |
17 | Continue
18 |
--------------------------------------------------------------------------------
/app/assets/javascripts/cable.js:
--------------------------------------------------------------------------------
1 | // Action Cable provides the framework to deal with WebSockets in Rails.
2 | // You can generate new channels where WebSocket features live using the `rails generate channel` command.
3 | //
4 | //= require action_cable
5 | //= require_self
6 | //= require_tree ./channels
7 |
8 | (function() {
9 | this.App || (this.App = {});
10 |
11 | App.cable = ActionCable.createConsumer();
12 |
13 | }).call(this);
14 |
--------------------------------------------------------------------------------
/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module ApplicationHelper
4 | require 'json/ext'
5 |
6 | def format_string(string, *args)
7 | string.gsub(/\{(\d+)\}/) { args[::Regexp.last_match(1).to_i] }
8 | end
9 |
10 | def to_json(hash)
11 | hash.to_json
12 | end
13 |
14 | def example_available?(example)
15 | !example['SkipForLanguages'] or !example['SkipForLanguages'].include? 'ruby'
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/config/credentials.yml.enc:
--------------------------------------------------------------------------------
1 | ZeNx1zIdS33ZOe2+PcQJFzCvZdS7biAJviyaK8HOcw2ytQ5RCrL13eqs9uKDtT1iP/xiNRSkXW1HK2hZFYqJfvqoZzR94yAyo5ADjnDIjF5dkngRloNwsr+hMMmynZPVka6eTZ5ZpuGB08fcXlwzemxspVc+/Jf+SmJa/gflXyaV/27UTQJt+LVvHAHVvzggOz++4aH6rqIOAOALrYx049XreiUWAmlmvK8YGKmYeaDNY4qPocojnL2joBf2EaD6rV5AzjnFB7BJXCv0L/VlK3es5kj3kYEMLclLK73dmNwjtMnkw42YXmLLQ0UadvPgULWuuRhBzUtBNahjfK1seaz8JYUwcoEn9I7k99IHniUrOTguw6L3MDhT8YuwNXfa1mz1lJRvyvm5Xa5jwtl5Ql//lpH9nRVqmex6--S8uAQ3BRGDSuh6p1--Ge+RZkXgyWbHNdyBpEhLvw==
--------------------------------------------------------------------------------
/app/services/e_sign/eg004_envelope_info_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eg004EnvelopeInfoService
4 | attr_reader :args
5 |
6 | include ApiCreator
7 |
8 | def initialize(args)
9 | @args = args
10 | end
11 |
12 | def worker
13 | #ds-snippet-start:eSign4Step2
14 | envelope_api = create_envelope_api(args)
15 | envelope_api.get_envelope(args[:account_id], args[:envelope_id])
16 | #ds-snippet-end:eSign4Step2
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/quick_acg/config/credentials.yml.enc:
--------------------------------------------------------------------------------
1 | VwFdOXZ+C/1eCY+cD7sJAKNMTTKqGujd2ae3jErSN7BCN8xJ0g2OiEDiyDKBbq7AWIHxdxzXQ1CBCG2ly0ApaZSQxaL0Kb1sPe4WcV5YZZvLw0JDJVMk7x/NPsvTjzCJs4ybfSUT/8hMs4xDGzKtxOlCYVMXrAdPyzVebV/7K5GhPTJxJTS9TopfxoCeaaGZtpM5yfUqPAKTLnxUGM3q0ul1vc+vJZNmN6clUzDBVT0K1FR9bzcRFML8QPwP3yZIRpg6+R+c+ggYAd8H5F92iFAE0QnxZQwgr2JGGJEzibIIg6Y33+Pjp4RV0WdL4OgfY43VRZp+3n9So2+SH64veB2KV+nWNAYKKXZpZCnKjuDlur6DUd1Q6VNfF5vVxGkpwza2ABJKuQMgslA6OCeYE0fBZ/AZ01oiCyue--z8P9Lw0Um2HS3bJl--JO10GQB7RkBd6Fh59SM41w==
--------------------------------------------------------------------------------
/app/services/e_sign/eg006_envelope_docs_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eg006EnvelopeDocsService
4 | attr_reader :args
5 |
6 | include ApiCreator
7 |
8 | def initialize(args)
9 | @args = args
10 | end
11 |
12 | def worker
13 | #ds-snippet-start:eSign6Step3
14 | envelope_api = create_envelope_api(args)
15 | envelope_api.list_documents args[:account_id], args[:envelope_id]
16 | #ds-snippet-end:eSign6Step3
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/app/services/e_sign/eg018_get_envelope_custom_field_data_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eg018GetEnvelopeCustomFieldDataService
4 | attr_reader :args
5 |
6 | include ApiCreator
7 |
8 | def initialize(args)
9 | @args = args
10 | end
11 |
12 | def worker
13 | #ds-snippet-start:eSign18Step3
14 | create_envelope_api(args).list_custom_fields args[:account_id], args[:envelope_id]
15 | #ds-snippet-end:eSign18Step3
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # Be sure to restart your server when you modify this file.
3 |
4 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
5 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
6 |
7 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
8 | # Rails.backtrace_cleaner.remove_silencers!
9 |
--------------------------------------------------------------------------------
/app/services/e_sign/eg005_envelope_recipients_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eg005EnvelopeRecipientsService
4 | attr_reader :args
5 |
6 | include ApiCreator
7 |
8 | def initialize(args)
9 | @args = args
10 | end
11 |
12 | def worker
13 | #ds-snippet-start:eSign5Step2
14 | envelope_api = create_envelope_api(args)
15 | envelope_api.list_recipients args[:account_id], args[:envelope_id]
16 | #ds-snippet-end:eSign5Step2
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/quick_acg/README.md:
--------------------------------------------------------------------------------
1 | # README
2 |
3 | This README would normally document whatever steps are necessary to get the
4 | application up and running.
5 |
6 | Things you may want to cover:
7 |
8 | * Ruby version
9 |
10 | * System dependencies
11 |
12 | * Configuration
13 |
14 | * Database creation
15 |
16 | * Database initialization
17 |
18 | * How to run the test suite
19 |
20 | * Services (job queues, cache servers, search engines, etc.)
21 |
22 | * Deployment instructions
23 |
24 | * ...
25 |
--------------------------------------------------------------------------------
/app/views/room_api/return.html.erb:
--------------------------------------------------------------------------------
1 | <%=render "room_api/#{@scenarios_name}/information" %>
2 |
3 | Result
4 |
5 | <% if @scenarios_name == 'reg006_create_an_external_form_fill_session' %>
6 | >link
7 | <% end %>
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | Continue
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg033_unpauses_signature_workflow/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% signer_email_index = 0 %>
5 | <% redirect_to32_index = 0 %>
6 |
7 | <% if session[:envelope_id] %>
8 | <%= form_tag eeg033_path, method: :put do -%>
9 | <%= submit_tag 'Submit', class: 'btn btn-docu'%>
10 | <%- end -%>
11 | <% else %>
12 | <%= sanitize format_string(@example["RedirectsToOtherCodeExamples"][redirect_to32_index]["RedirectText"], 'href="eeg032"') %>
13 | <% end %>
--------------------------------------------------------------------------------
/app/services/e_sign/eg027_permissions_delete_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eg027PermissionsDeleteService
4 | attr_reader :args
5 |
6 | include ApiCreator
7 |
8 | def initialize(args)
9 | @args = args
10 | end
11 |
12 | def worker
13 | # Call the eSignature REST API
14 | #ds-snippet-start:eSign27Step3
15 | accounts_api = create_account_api(args)
16 | accounts_api.delete_permission_profile(args[:account_id], args[:permission_profile_id])
17 | #ds-snippet-end:eSign27Step3
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg004_envelope_info/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% redirect_to2_index = 0 %>
4 |
5 | <% if @envelope_ok %>
6 |
9 |
10 | <% else %>
11 | <%= sanitize format_string(@example["RedirectsToOtherCodeExamples"][redirect_to2_index]["RedirectText"], 'href="eeg002"') %>
12 |
13 |
16 | <% end %>
17 |
--------------------------------------------------------------------------------
/quick_acg/config/initializers/assets.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Version of your assets, change this if you want to expire all your assets.
4 | Rails.application.config.assets.version = '1.0'
5 |
6 | # Add additional assets to the asset load path.
7 | # Rails.application.config.assets.paths << Emoji.images_path
8 |
9 | # Precompile additional assets.
10 | # application.js, application.css, and all non-JS/CSS in the app/assets
11 | # folder are already added.
12 | # Rails.application.config.assets.precompile += %w( admin.js admin.css )
13 |
--------------------------------------------------------------------------------
/app/views/admin_api/aeg004_import_user/get_status.html.erb:
--------------------------------------------------------------------------------
1 | <% if @status == "completed" %>
2 |
3 | <%= @h1 %>
4 | <% if !@message.nil? %>
5 | <%= @message.html_safe %>
6 | <% end %>
7 |
8 |
9 |
10 |
11 |
12 | Continue
13 |
14 | <% else %>
15 | Request not complete
16 | The request has not completed, please refresh this page
17 | <% end %>
18 |
--------------------------------------------------------------------------------
/bin/spring:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | # This file loads spring without using Bundler, in order to be fast.
5 | # It gets overwritten when you run the `spring binstub` command.
6 |
7 | unless defined?(Spring)
8 | require 'rubygems'
9 | require 'bundler'
10 |
11 | lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
12 | spring = lockfile.specs.detect { |spec| spec.name == 'spring' }
13 | if spring
14 | Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
15 | gem 'spring', spring.version
16 | require 'spring/binstub'
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # This file contains settings for ActionController::ParamsWrapper which
6 | # is enabled by default.
7 |
8 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
9 | ActiveSupport.on_load(:action_controller) do
10 | wrap_parameters format: [:json]
11 | end
12 |
13 | # To enable root element in JSON for ActiveRecord objects.
14 | # ActiveSupport.on_load(:active_record) do
15 | # self.include_root_in_json = true
16 | # end
17 |
--------------------------------------------------------------------------------
/app/views/clickwrap/ceg003_create_new_clickwrap_version/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% redirect_to1_index = 0 %>
4 |
5 | <% if session[:clickwrap_id] %>
6 | The clickwrap you created via example 1 will be queried.
7 |
8 |
12 |
13 | <% else %>
14 | <%= sanitize format_string(@example["RedirectsToOtherCodeExamples"][redirect_to1_index]["RedirectText"], 'href="ceg001"') %>
15 |
16 | <% end %>
--------------------------------------------------------------------------------
/app/views/ds_common/example_done.erb:
--------------------------------------------------------------------------------
1 | <%= @title %>
2 | <% if !@message.nil? %>
3 | <%= @message.html_safe %>
4 | <% end %>
5 |
6 | <% if @json %>
7 |
8 |
9 |
10 |
11 |
12 | <% end %>
13 |
14 | <% if @check_status %>
15 | Check the request status
16 | <% end %>
17 |
18 | <% if @redirect_url %>
19 | Continue
20 | <% else %>
21 | Continue
22 | <% end %>
23 |
--------------------------------------------------------------------------------
/app/services/connect/eg001_validate_webhook_message_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'openssl'
4 | require 'base64'
5 |
6 | class Connect::Eg001ValidateWebhookMessageService
7 | attr_reader :args
8 |
9 | def initialize(args)
10 | @args = args
11 | end
12 |
13 | #ds-snippet-start:Connect1Step1
14 | def worker
15 | digest = OpenSSL::Digest.new('sha256')
16 | hashBytes = OpenSSL::HMAC.digest(digest, args[:secret], args[:payload])
17 | Base64.encode64(hashBytes)
18 | end
19 |
20 | def hash_valid?
21 | hash = worker(args[:secret], args[:payload])
22 | OpenSSL.secure_compare(hash.chomp, args[:signature])
23 | end
24 | #ds-snippet-end:Connect1Step1
25 | end
26 |
--------------------------------------------------------------------------------
/config/database.yml:
--------------------------------------------------------------------------------
1 | # SQLite version 3.x
2 | # gem install sqlite3
3 | #
4 | # Ensure the SQLite 3 gem is defined in your Gemfile
5 | # gem 'sqlite3'
6 | #
7 | default: &default
8 | adapter: sqlite3
9 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10 | timeout: 5000
11 |
12 | development:
13 | <<: *default
14 | database: db/development.sqlite3
15 |
16 | # Warning: The database defined as "test" will be erased and
17 | # re-generated from your development database when you run "rake".
18 | # Do not set this db to the same as development or production.
19 | test:
20 | <<: *default
21 | database: db/test.sqlite3
22 |
23 | production:
24 | <<: *default
25 | database: db/production.sqlite3
26 |
--------------------------------------------------------------------------------
/app/controllers/clickwrap/ceg004_list_clickwraps_controller.rb:
--------------------------------------------------------------------------------
1 | class Clickwrap::Ceg004ListClickwrapsController < EgController
2 | before_action -> { check_auth('Click') }
3 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 4, 'Click') }
4 |
5 | def create
6 | args = {
7 | account_id: session[:ds_account_id],
8 | base_path: session[:ds_base_path],
9 | access_token: session[:ds_access_token]
10 | }
11 |
12 | results = Clickwrap::Eg004ListClickwrapsService.new(args).worker
13 |
14 | @title = @example['ExampleName']
15 | @message = @example['ResultsPageText']
16 | @json = results.to_json.to_json
17 | render 'ds_common/example_done'
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg006_envelope_docs/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% redirect_to2_index = 0 %>
5 |
6 | <% if @envelope_ok %>
7 |
14 |
15 | <% else %>
16 | <%= sanitize format_string(@example["RedirectsToOtherCodeExamples"][redirect_to2_index]["RedirectText"], 'href="eeg002"') %>
17 |
18 |
21 | <% end %>
22 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg005_envelope_recipients/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% redirect_to2_index = 0 %>
5 |
6 | <% if @envelope_ok %>
7 |
14 |
15 | <% else %>
16 | <%= sanitize format_string(@example["RedirectsToOtherCodeExamples"][redirect_to2_index]["RedirectText"], 'href="eeg002"') %>
17 |
18 |
21 | <% end %>
22 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg015_get_envelope_tab_data/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% redirect_to9_index = 0 %>
5 |
6 | <% if @envelope_ok %>
7 |
14 |
15 | <% else %>
16 | <%= sanitize format_string(@example["RedirectsToOtherCodeExamples"][redirect_to9_index]["RedirectText"], 'href="eeg009"') %>
17 |
18 |
21 | <% end %>
22 |
--------------------------------------------------------------------------------
/config/initializers/assets.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # Version of your assets, change this if you want to expire all your assets.
6 | Rails.application.config.assets.version = '1.0'
7 |
8 | # Add additional assets to the asset load path.
9 | # Rails.application.config.assets.paths << Emoji.images_path
10 | # Add Yarn node_modules folder to the asset load path.
11 | Rails.application.config.assets.paths << Rails.root.join('node_modules')
12 |
13 | # Precompile additional assets.
14 | # application.js, application.css, and all non-JS/CSS in the app/assets
15 | # folder are already added.
16 | # Rails.application.config.assets.precompile += %w( admin.js admin.css )
17 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg018_get_envelope_custom_field_data/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% redirect_to16_index = 0 %>
5 |
6 | <% if @envelope_ok %>
7 |
14 |
15 | <% else %>
16 | <%= sanitize format_string(@example["RedirectsToOtherCodeExamples"][redirect_to16_index]["RedirectText"], 'href="eeg016"') %>
17 |
18 |
21 | <% end %>
22 |
--------------------------------------------------------------------------------
/quick_acg/config/database.yml:
--------------------------------------------------------------------------------
1 | # SQLite. Versions 3.8.0 and up are supported.
2 | # gem install sqlite3
3 | #
4 | # Ensure the SQLite 3 gem is defined in your Gemfile
5 | # gem "sqlite3"
6 | #
7 | default: &default
8 | adapter: sqlite3
9 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10 | timeout: 5000
11 |
12 | development:
13 | <<: *default
14 | database: db/development.sqlite3
15 |
16 | # Warning: The database defined as "test" will be erased and
17 | # re-generated from your development database when you run "rake".
18 | # Do not set this db to the same as development or production.
19 | test:
20 | <<: *default
21 | database: db/test.sqlite3
22 |
23 | production:
24 | <<: *default
25 | database: db/production.sqlite3
26 |
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg003_list_envelopes_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eeg003ListEnvelopesController < EgController
4 | before_action -> { check_auth('eSignature') }
5 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 3, 'eSignature') }
6 |
7 | def create
8 | args = {
9 | account_id: session[:ds_account_id],
10 | base_path: session[:ds_base_path],
11 | access_token: session[:ds_access_token]
12 | }
13 | results = ESign::Eg003ListEnvelopesService.new(args).worker
14 | @title = @example['ExampleName']
15 | @message = @example['ResultsPageText']
16 | @json = results.to_json.to_json
17 | render 'ds_common/example_done'
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/app/controllers/room_api/reg007_create_form_group_controller.rb:
--------------------------------------------------------------------------------
1 | class RoomApi::Reg007CreateFormGroupController < EgController
2 | before_action -> { check_auth('Rooms') }
3 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 7, 'Rooms') }
4 |
5 | def create
6 | args = {
7 | group_name: params[:group_name],
8 | account_id: session[:ds_account_id],
9 | access_token: session[:ds_access_token]
10 | }
11 |
12 | results = RoomApi::Eg007CreateFormGroupService.new(args).worker
13 |
14 | @title = @example['ExampleName']
15 | @message = format_string(@example['ResultsPageText'], results.name)
16 | @json = results.to_json.to_json
17 |
18 | render 'ds_common/example_done'
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/app/controllers/connect/cneg001_validate_webhook_message_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require_relative '../../services/utils'
4 |
5 | class Connect::Cneg001ValidateWebhookMessageController < EgController
6 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 1, 'Connect') }
7 |
8 | def create
9 | args = {
10 | secret: params['secret'],
11 | payload: params['payload']
12 | }
13 | results = Connect::Eg001ValidateWebhookMessageService.new(args).worker
14 | @title = @example['ExampleName']
15 | @message = format_string(@example['ResultsPageText'], results)
16 | render 'ds_common/example_done'
17 | rescue DocuSign_eSign::ApiError => e
18 | handle_error(e)
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/app/services/e_sign/eg025_permissions_set_user_group_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eg025PermissionsSetUserGroupService
4 | attr_reader :args
5 |
6 | include ApiCreator
7 |
8 | def initialize(args)
9 | @args = args
10 | end
11 |
12 | def worker
13 | group_api = create_group_api(args)
14 |
15 | # Construct the request body
16 | #ds-snippet-start:eSign25Step3
17 | params = { groups: [{ permissionProfileId: args[:permission_profile_id], groupId: args[:group_id] }] }
18 | #ds-snippet-end:eSign25Step3
19 |
20 | # Call the eSignature REST API
21 | #ds-snippet-start:eSign25Step4
22 | group_api.update_groups(args[:account_id], params)
23 | #ds-snippet-end:eSign25Step4
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # Be sure to restart your server when you modify this file.
3 |
4 | # Add new inflection rules using the following format. Inflections
5 | # are locale specific, and you may define rules for as many different
6 | # locales as you wish. All of these examples are active by default:
7 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
8 | # inflect.plural /^(ox)$/i, '\1en'
9 | # inflect.singular /^(ox)en/i, '\1'
10 | # inflect.irregular 'person', 'people'
11 | # inflect.uncountable %w( fish sheep )
12 | # end
13 |
14 | # These inflection rules are supported but not enabled by default:
15 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
16 | # inflect.acronym 'RESTful'
17 | # end
18 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/application.css:
--------------------------------------------------------------------------------
1 | /*
2 | * This is a manifest file that'll be compiled into application.css, which will include all the files
3 | * listed below.
4 | *
5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
6 | * vendor/assets/stylesheets directory can be referenced here using a relative path.
7 | *
8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10 | * files in this directory. Styles in this file should be added after the last require_* statement.
11 | * It is generally better to create a new file per style scope.
12 | *
13 | *= require_tree .
14 | *= require_self
15 | */
16 |
--------------------------------------------------------------------------------
/app/views/room_api/reg001_create_room_with_data/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% room_name_index = 0 %>
5 |
6 |
--------------------------------------------------------------------------------
/quick_acg/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2 | #
3 | # If you find yourself ignoring temporary files generated by your text editor
4 | # or operating system, you probably want to add a global ignore instead:
5 | # git config --global core.excludesfile '~/.gitignore_global'
6 |
7 | # Ignore bundler config.
8 | /.bundle
9 |
10 | # Ignore the default SQLite database.
11 | /db/*.sqlite3
12 | /db/*.sqlite3-*
13 |
14 | # Ignore all logfiles and tempfiles.
15 | /log/*
16 | /tmp/*
17 | !/log/.keep
18 | !/tmp/.keep
19 |
20 | # Ignore pidfiles, but keep the directory.
21 | /tmp/pids/*
22 | !/tmp/pids/
23 | !/tmp/pids/.keep
24 |
25 |
26 | /public/assets
27 |
28 | # Ignore master key for decrypting credentials and more.
29 | /config/master.key
30 |
--------------------------------------------------------------------------------
/app/views/clickwrap/ceg001_create_clickwrap/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% click_name_index = 0 %>
5 |
6 |
--------------------------------------------------------------------------------
/app/assets/javascripts/application.js:
--------------------------------------------------------------------------------
1 | // This is a manifest file that'll be compiled into application.js, which will include all the files
2 | // listed below.
3 | //
4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
5 | // vendor/assets/javascripts directory can be referenced here using a relative path.
6 | //
7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8 | // compiled file. JavaScript code in this file should be added after the last require_* statement.
9 | //
10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11 | // about supported directives.
12 | //
13 | //= require rails-ujs
14 | //= require activestorage
15 | //= require turbolinks
16 | //= require_tree .
17 |
--------------------------------------------------------------------------------
/connect_test.rb:
--------------------------------------------------------------------------------
1 | def ComputeHash(secret, payload)
2 | require 'openssl'
3 | require 'base64'
4 |
5 | digest = OpenSSL::Digest.new('sha256')
6 | hashBytes = OpenSSL::HMAC.digest(digest, secret, payload)
7 | base64Hash = Base64.encode64(hashBytes)
8 | return base64Hash;
9 | end
10 |
11 | def HashIsValid(secret, payload, signature)
12 | ver = ComputeHash(secret, payload)
13 | OpenSSL.secure_compare(ver.chomp, signature)
14 | end
15 |
16 | secret = 'xxoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxGE=' # Replace this value with your own secret
17 | signature = 'c60xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxew=' # Replace this value with your own signature
18 | payload = File.read('payload.txt') # Read the payload from a file named payload.txt
19 | puts HashIsValid(secret, payload, signature) # should return true for valid
--------------------------------------------------------------------------------
/app/views/e_sign/eeg024_permission_create/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% profile_index = 0 %>
5 |
6 |
18 |
--------------------------------------------------------------------------------
/app/services/e_sign/eg015_get_envelope_tab_data_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eg015GetEnvelopeTabDataService
4 | attr_reader :args
5 |
6 | include ApiCreator
7 |
8 | def initialize(args)
9 | @args = args
10 | end
11 |
12 | def worker
13 | # Step 3. Call the eSignature REST API
14 | # The Envelopes::getEnvelopeFormData method has many options
15 | # See https://developers.docusign.com/docs/esign-rest-api/reference/Envelopes/EnvelopeFormData/get/
16 | # The get form data call requires an account ID and an envelope ID
17 |
18 | # Exceptions will be caught by the calling function
19 | #ds-snippet-start:eSign15Step3
20 | create_envelope_api(args).get_form_data args[:account_id], args[:envelope_id]
21 | #ds-snippet-end:eSign15Step3
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg039_signing_in_person/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% signer_name_index = 0 %>
5 |
6 |
20 |
--------------------------------------------------------------------------------
/app/controllers/admin_api/aeg011_delete_user_data_from_account_controller.rb:
--------------------------------------------------------------------------------
1 | class AdminApi::Aeg011DeleteUserDataFromAccountController < EgController
2 | before_action -> { check_auth('Admin') }
3 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 11, 'Admin') }
4 |
5 | def create
6 | args = {
7 | account_id: session['ds_account_id'],
8 | access_token: session['ds_access_token'],
9 | user_id: param_gsub(params['user_id'])
10 | }
11 |
12 | results = AdminApi::Eg011DeleteUserDataFromAccountService.new(args).worker
13 |
14 | @title = @example['ExampleName']
15 | @message = @example['ResultsPageText']
16 | @json = results.to_json.to_json
17 | render 'ds_common/example_done'
18 | rescue DocuSign_Admin::ApiError => e
19 | handle_error(e)
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/app/services/room_api/eg003_export_data_from_room_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class RoomApi::Eg003ExportDataFromRoomService
4 | attr_reader :args
5 |
6 | def initialize(args)
7 | @args = args
8 | end
9 |
10 | def worker
11 | #ds-snippet-start:Rooms3Step2
12 | configuration = DocuSign_Rooms::Configuration.new
13 | configuration.host = Rails.configuration.rooms_host
14 |
15 | api_client = DocuSign_Rooms::ApiClient.new(configuration)
16 | api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}")
17 | #ds-snippet-end:Rooms3Step2
18 |
19 | #ds-snippet-start:Rooms3Step3
20 | rooms_api = DocuSign_Rooms::RoomsApi.new(api_client)
21 | rooms_api.get_room_field_data(args[:room_id], args[:account_id])
22 | #ds-snippet-end:Rooms3Step3
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg027_permissions_delete/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% profile_index = 0 %>
5 |
6 |
21 |
--------------------------------------------------------------------------------
/app/views/room_api/reg007_create_form_group/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% form_group_index = 0 %>
5 |
6 |
--------------------------------------------------------------------------------
/app/services/admin_api/eg007_get_user_profile_by_user_id_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class AdminApi::Eg007GetUserProfileByUserIdService
4 | attr_reader :args
5 |
6 | def initialize(args)
7 | @args = args
8 | end
9 |
10 | def worker
11 | #ds-snippet-start:Admin7Step2
12 | configuration = DocuSign_Admin::Configuration.new
13 | configuration.host = Rails.configuration.admin_host
14 |
15 | api_client = DocuSign_Admin::ApiClient.new(configuration)
16 | api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}")
17 | #ds-snippet-end:Admin7Step2
18 |
19 | #ds-snippet-start:Admin7Step3
20 | users_api = DocuSign_Admin::UsersApi.new(api_client)
21 | users_api.get_user_ds_profile(args[:organization_id], args[:user_id])
22 | #ds-snippet-end:Admin7Step3
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg026_permissions_change_single_setting/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% profile_index = 0 %>
5 |
6 |
21 |
--------------------------------------------------------------------------------
/app/services/admin_api/eg001_create_user_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class AdminApi::Eg001CreateUserService
4 | attr_reader :args, :user_data
5 |
6 | def initialize(args, user_data)
7 | @args = args
8 | @user_data = user_data
9 | end
10 |
11 | def worker
12 | #ds-snippet-start:Admin1Step2
13 | configuration = DocuSign_Admin::Configuration.new
14 | configuration.host = Rails.configuration.admin_host
15 |
16 | api_client = DocuSign_Admin::ApiClient.new(configuration)
17 | api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}")
18 | #ds-snippet-end:Admin1Step2
19 |
20 | #ds-snippet-start:Admin1Step6
21 | users_api = DocuSign_Admin::UsersApi.new(api_client)
22 | users_api.create_user(args[:organization_id], user_data)
23 | #ds-snippet-end:Admin1Step6
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/app/controllers/clickwrap/ceg005_clickwrap_responses_controller.rb:
--------------------------------------------------------------------------------
1 | class Clickwrap::Ceg005ClickwrapResponsesController < EgController
2 | before_action -> { check_auth('Click') }
3 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 5, 'Click') }
4 |
5 | def create
6 | args = {
7 | account_id: session[:ds_account_id],
8 | base_path: session[:ds_base_path],
9 | access_token: session[:ds_access_token],
10 | clickwrap_id: session[:clickwrap_id],
11 | client_user_id: param_gsub(params[:client_user_id])
12 | }
13 |
14 | results = Clickwrap::Eg005ClickwrapResponsesService.new(args).worker
15 |
16 | @title = @example['ExampleName']
17 | @message = @example['ResultsPageText']
18 | @json = results.to_json.to_json
19 | render 'ds_common/example_done'
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/app/controllers/room_api/reg003_export_data_from_room_controller.rb:
--------------------------------------------------------------------------------
1 | class RoomApi::Reg003ExportDataFromRoomController < EgController
2 | before_action -> { check_auth('Rooms') }
3 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 3, 'Rooms') }
4 |
5 | def create
6 | args = {
7 | room_id: params['roomId'],
8 | account_id: session[:ds_account_id],
9 | base_path: session[:ds_base_path],
10 | access_token: session[:ds_access_token]
11 | }
12 |
13 | results = RoomApi::Eg003ExportDataFromRoomService.new(args).worker
14 |
15 | @title = @example['ExampleName']
16 | @message = @example['ResultsPageText']
17 | @json = results.to_json.to_json
18 |
19 | render 'ds_common/example_done'
20 | end
21 |
22 | def get
23 | @rooms = RoomApi::GetDataService.new(session).get_rooms
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg015_get_envelope_tab_data_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eeg015GetEnvelopeTabDataController < EgController
4 | before_action -> { check_auth('eSignature') }
5 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 15, 'eSignature') }
6 |
7 | def create
8 | envelope_id = session[:envelope_id]
9 |
10 | args = {
11 | access_token: session['ds_access_token'],
12 | base_path: session['ds_base_path'],
13 | account_id: session['ds_account_id'],
14 | envelope_id: envelope_id
15 | }
16 |
17 | results = ESign::Eg015GetEnvelopeTabDataService.new(args).worker
18 | @title = @example['ExampleName']
19 | @message = 'Results from the EnvelopeFormData::get method:'
20 | @json = results.to_json.to_json
21 | render 'ds_common/example_done'
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/app/views/admin_api/aeg007_get_user_profile_by_user_id/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% user_id_index = 0 %>
5 |
6 |
19 |
--------------------------------------------------------------------------------
/app/views/admin_api/aeg006_get_user_profile_by_email/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% email_index = 0 %>
5 |
6 |
20 |
--------------------------------------------------------------------------------
/app/services/clickwrap/eg004_list_clickwraps_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class Clickwrap::Eg004ListClickwrapsService
4 | attr_reader :args
5 |
6 | def initialize(args)
7 | @args = args
8 | end
9 |
10 | def worker
11 | # Step 2. Construct your API headers
12 | #ds-snippet-start:Click4Step2
13 | configuration = DocuSign_Click::Configuration.new
14 | configuration.host = args[:base_path]
15 |
16 | api_client = DocuSign_Click::ApiClient.new configuration
17 | api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}")
18 | #ds-snippet-end:Click4Step2
19 |
20 | # Step 3. Call the Click API
21 | #ds-snippet-start:Click4Step3
22 | accounts_api = DocuSign_Click::AccountsApi.new(api_client)
23 | accounts_api.get_clickwraps(
24 | args[:account_id]
25 | )
26 | #ds-snippet-end:Click4Step3
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/app/views/ds_common/ds_return.html.erb:
--------------------------------------------------------------------------------
1 | Returned data from Docusign!
2 | Data:
3 |
4 | <% if @event %>
5 | event: <%= @event %>. This event parameter is supplied by Docusign.
6 | Since it could have been spoofed, don't make business decisions based on
7 | its value. Instead, query Docusign as appropriate.
8 | <% end %>
9 |
10 | <% if @envelope_id %>
11 | envelopeId: <%= @envelope_id %>. The envelopeId parameter is supplied by Docusign.
12 | Since it could have been spoofed, don't make business decisions based on
13 | its value. Instead, query Docusign as appropriate.
14 | <% end %>
15 |
16 | <% if @state %>
17 | state: <%= @state %>. This example state was sent to Docusign and has now been received back.
18 | It is usually better to store state in your web framework's session.
19 | <% end %>
20 |
21 | Continue
--------------------------------------------------------------------------------
/app/controllers/clickwrap/ceg003_create_new_clickwrap_version_controller.rb:
--------------------------------------------------------------------------------
1 | class Clickwrap::Ceg003CreateNewClickwrapVersionController < EgController
2 | before_action -> { check_auth('Click') }
3 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 3, 'Click') }
4 |
5 | def create
6 | args = {
7 | account_id: session[:ds_account_id],
8 | base_path: session[:ds_base_path],
9 | access_token: session[:ds_access_token],
10 | clickwrap_id: session[:clickwrap_id],
11 | clickwrap_name: session[:clickwrap_name]
12 | }
13 |
14 | results = Clickwrap::Eg003CreateNewClickwrapVersionService.new(args).worker
15 | puts results.to_json.to_json
16 | @title = @example['ExampleName']
17 | @message = format_string(@example['ResultsPageText'], results.version_number, results.clickwrap_name)
18 | render 'ds_common/example_done'
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg018_get_envelope_custom_field_data_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eeg018GetEnvelopeCustomFieldDataController < EgController
4 | before_action -> { check_auth('eSignature') }
5 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 18, 'eSignature') }
6 |
7 | def create
8 | envelope_id = session[:envelope_id]
9 |
10 | args = {
11 | access_token: session['ds_access_token'],
12 | base_path: session['ds_base_path'],
13 | account_id: session['ds_account_id'],
14 | envelope_id: envelope_id
15 | }
16 |
17 | results = ESign::Eg018GetEnvelopeCustomFieldDataService.new(args).worker
18 | @title = @example['ExampleName']
19 | @message = 'Results from the Envelopes::listStatusChanges method:'
20 | @json = results.to_json.to_json
21 | render 'ds_common/example_done'
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/app/controllers/clickwrap/ceg002_activate_clickwrap_controller.rb:
--------------------------------------------------------------------------------
1 | class Clickwrap::Ceg002ActivateClickwrapController < EgController
2 | before_action -> { check_auth('Click') }
3 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 2, 'Click') }
4 |
5 | def create
6 | args = {
7 | account_id: session[:ds_account_id],
8 | base_path: session[:ds_base_path],
9 | access_token: session[:ds_access_token],
10 | clickwrap_id: params[:clickwrapId]
11 | }
12 |
13 | Clickwrap::Eg002ActivateClickwrapService.new(args).worker
14 |
15 | @title = @example['ExampleName']
16 | @message = @example['ResultsPageText']
17 | render 'ds_common/example_done'
18 | end
19 |
20 | def get
21 | statuses = %w[inactive draft]
22 | @clickwraps = Clickwrap::Eg002ActivateClickwrapService.new(session).get_inactive_clickwraps(statuses).as_json
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/app/controllers/room_api/reg005_get_rooms_with_filters_controller.rb:
--------------------------------------------------------------------------------
1 | class RoomApi::Reg005GetRoomsWithFiltersController < EgController
2 | before_action -> { check_auth('Rooms') }
3 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 5, 'Rooms') }
4 |
5 | def create
6 | args = {
7 | date_from: params[:date_from],
8 | date_to: params[:date_to],
9 | account_id: session[:ds_account_id],
10 | base_path: session[:ds_base_path],
11 | access_token: session[:ds_access_token]
12 | }
13 |
14 | results = RoomApi::Eg005GetRoomsWithFiltersService.new(args).worker
15 |
16 | @title = @example['ExampleName']
17 | @message = @example['ResultsPageText']
18 | @json = results.to_json.to_json
19 |
20 | render 'ds_common/example_done'
21 | end
22 |
23 | def get
24 | @rooms = RoomApi::GetDataService.new(session).get_rooms
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/app/views/ds_common/ds_must_authenticate.erb:
--------------------------------------------------------------------------------
1 |
2 | <%= sanitize @manifest["SupportingTexts"]["LoginPage"]["LoginHeader"] %>
3 |
4 |
16 |
17 |
18 |
<%= @manifest["SupportingTexts"]["LoginPage"]["LoginHelperText"] %>
19 |
20 |
--------------------------------------------------------------------------------
/app/services/admin_api/eg004_import_user_service.rb:
--------------------------------------------------------------------------------
1 | class AdminApi::Eg004ImportUserService
2 | attr_reader :args
3 |
4 | def initialize(args)
5 | @args = args
6 | end
7 |
8 | def worker
9 | #ds-snippet-start:Admin4Step2
10 | configuration = DocuSign_Admin::Configuration.new
11 | configuration.host = Rails.configuration.admin_host
12 |
13 | api_client = DocuSign_Admin::ApiClient.new(configuration)
14 | api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}")
15 | #ds-snippet-end:Admin4Step2
16 |
17 | #ds-snippet-start:Admin4Step3
18 | csv_file_data = File.open(args[:csv_file_path]).read
19 | csv_file_data = csv_file_data.gsub('{account_id}', args[:account_id])
20 |
21 | @bulk_imports_api = DocuSign_Admin::BulkImportsApi.new(api_client)
22 | @bulk_imports_api.create_bulk_import_add_users_request(args[:organization_id], csv_file_data)
23 | #ds-snippet-end:Admin4Step3
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/app/services/admin_api/eg006_get_user_profile_by_email_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class AdminApi::Eg006GetUserProfileByEmailService
4 | attr_reader :args
5 |
6 | def initialize(args)
7 | @args = args
8 | end
9 |
10 | def worker
11 | #ds-snippet-start:Admin6Step2
12 | configuration = DocuSign_Admin::Configuration.new
13 | configuration.host = Rails.configuration.admin_host
14 |
15 | api_client = DocuSign_Admin::ApiClient.new(configuration)
16 | api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}")
17 | #ds-snippet-end:Admin6Step2
18 |
19 | #ds-snippet-start:Admin6Step3
20 | users_api = DocuSign_Admin::UsersApi.new(api_client)
21 |
22 | options = DocuSign_Admin::GetUserDSProfilesByEmailOptions.new
23 | options.email = args[:email]
24 | users_api.get_user_ds_profiles_by_email(args[:organization_id], options)
25 | #ds-snippet-end:Admin6Step3
26 | end
27 | end
28 |
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg012_embedded_console_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eeg012EmbeddedConsoleController < EgController
4 | before_action -> { check_auth('eSignature') }
5 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 12, 'eSignature') }
6 |
7 | def create
8 | envelope_id = session[:envelope_id]
9 |
10 | begin
11 | args = {
12 | account_id: session['ds_account_id'],
13 | base_path: session['ds_base_path'],
14 | access_token: session['ds_access_token'],
15 | envelope_id: envelope_id,
16 | starting_view: params['starting_view'],
17 | ds_return_url: "#{Rails.application.config.app_url}/ds_common-return"
18 | }
19 |
20 | results = ESign::Eg012EmbeddedConsoleService.new(args).worker
21 | redirect_to results['redirect_url']
22 | rescue DocuSign_eSign::ApiError => e
23 | handle_error(e)
24 | end
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/app/controllers/room_api/reg004_add_forms_to_room_controller.rb:
--------------------------------------------------------------------------------
1 | class RoomApi::Reg004AddFormsToRoomController < EgController
2 | before_action -> { check_auth('Rooms') }
3 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 4, 'Rooms') }
4 |
5 | def create
6 | args = {
7 | form_id: params['formId'],
8 | room_id: params['roomId'],
9 | account_id: session[:ds_account_id],
10 | base_path: session[:ds_base_path],
11 | access_token: session[:ds_access_token]
12 | }
13 |
14 | results = RoomApi::Eg004AddFormsToRoomService.new(args).worker
15 |
16 | @title = @example['ExampleName']
17 | @message = @example['ResultsPageText']
18 | @json = results.to_json.to_json
19 |
20 | render 'ds_common/example_done'
21 | end
22 |
23 | def get
24 | @rooms = RoomApi::GetDataService.new(session).get_rooms
25 | @form_libraries = RoomApi::GetDataService.new(session).get_form_libraries
26 | end
27 | end
28 |
--------------------------------------------------------------------------------
/app/controllers/admin_api/aeg006_get_user_profile_by_email_controller.rb:
--------------------------------------------------------------------------------
1 | class AdminApi::Aeg006GetUserProfileByEmailController < EgController
2 | include ApiCreator
3 | before_action -> { check_auth('Admin') }
4 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 6, 'Admin') }
5 |
6 | def create
7 | session[:organization_id] = AdminApi::GetDataService.new(session).get_organization_id if session[:organization_id].nil?
8 |
9 | args = {
10 | access_token: session['ds_access_token'],
11 | organization_id: session['organization_id'],
12 | email: param_gsub(params['email'])
13 | }
14 |
15 | results = AdminApi::Eg006GetUserProfileByEmailService.new(args).worker
16 |
17 | @title = @example['ExampleName']
18 | @message = @example['ResultsPageText']
19 | @json = results.to_json.to_json
20 | render 'ds_common/example_done'
21 | rescue DocuSign_Admin::ApiError => e
22 | handle_error(e)
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/app/controllers/admin_api/aeg010_delete_user_data_from_organization_controller.rb:
--------------------------------------------------------------------------------
1 | class AdminApi::Aeg010DeleteUserDataFromOrganizationController < EgController
2 | before_action -> { check_auth('Admin') }
3 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 10, 'Admin') }
4 |
5 | def create
6 | session[:organization_id] = AdminApi::GetDataService.new(session).get_organization_id if session[:organization_id].nil?
7 |
8 | args = {
9 | access_token: session['ds_access_token'],
10 | email: param_gsub(params['email']),
11 | organization_id: session['organization_id']
12 | }
13 |
14 | results = AdminApi::Eg010DeleteUserDataFromOrganizationService.new(args).worker
15 |
16 | @title = @example['ExampleName']
17 | @message = @example['ResultsPageText']
18 | @json = results.to_json.to_json
19 | render 'ds_common/example_done'
20 | rescue DocuSign_Admin::ApiError => e
21 | handle_error(e)
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg045_delete_restore_envelope/restore.html.erb:
--------------------------------------------------------------------------------
1 | <%= @example["ExampleName"] %>
2 | <%= sanitize @example["ExampleDescription"] %>
3 | <%= sanitize format_string(@manifest["SupportingTexts"]["HelpingTexts"]["EnvelopeWillBeRestored"], @envelope_id) %>
4 |
5 | <% form_index = 0 %>
6 | <% folder_name_index = 1 %>
7 |
8 |
21 |
22 |
--------------------------------------------------------------------------------
/app/controllers/admin_api/aeg007_get_user_profile_by_user_id_controller.rb:
--------------------------------------------------------------------------------
1 | class AdminApi::Aeg007GetUserProfileByUserIdController < EgController
2 | include ApiCreator
3 | before_action -> { check_auth('Admin') }
4 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 7, 'Admin') }
5 |
6 | def create
7 | session[:organization_id] = AdminApi::GetDataService.new(session).get_organization_id if session[:organization_id].nil?
8 |
9 | args = {
10 | access_token: session['ds_access_token'],
11 | organization_id: session['organization_id'],
12 | user_id: param_gsub(params['user_id'])
13 | }
14 |
15 | results = AdminApi::Eg007GetUserProfileByUserIdService.new(args).worker
16 |
17 | @title = @example['ExampleName']
18 | @message = @example['ResultsPageText']
19 | @json = results.to_json.to_json
20 | render 'ds_common/example_done'
21 | rescue DocuSign_Admin::ApiError => e
22 | handle_error(e)
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/app/controllers/room_api/reg001_create_room_with_data_controller.rb:
--------------------------------------------------------------------------------
1 | class RoomApi::Reg001CreateRoomWithDataController < EgController
2 | before_action -> { check_auth('Rooms') }
3 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 1, 'Rooms') }
4 |
5 | def create
6 | args = {
7 | room_name: params[:roomName],
8 | office_id: RoomApi::GetDataService.new(session).get_offices[0]['officeId'],
9 | role_id: RoomApi::GetDataService.new(session).get_default_admin_role_id,
10 | account_id: session[:ds_account_id],
11 | base_path: session[:ds_base_path],
12 | access_token: session[:ds_access_token]
13 | }
14 |
15 | results = RoomApi::Eg001CreateRoomWithDataService.new(args).worker
16 |
17 | @title = @example['ExampleName']
18 | @message = format_string(@example['ResultsPageText'], results.room_id, results.name)
19 | @json = results.to_json.to_json
20 |
21 | render 'ds_common/example_done'
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/app/views/admin_api/aeg010_delete_user_data_from_organization/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% email_index = 0 %>
5 |
6 |
20 |
--------------------------------------------------------------------------------
/bin/update:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | require 'fileutils'
5 | include FileUtils
6 |
7 | # path to your application root.
8 | APP_ROOT = File.expand_path('..', __dir__)
9 |
10 | def system!(*args)
11 | system(*args) || abort("\n== Command #{args} failed ==")
12 | end
13 |
14 | chdir APP_ROOT do
15 | # This script is a way to update your development environment automatically.
16 | # Add necessary update steps to this file.
17 |
18 | puts '== Installing dependencies =='
19 | system! 'gem install bundler --conservative'
20 | system('bundle check') || system!('bundle install')
21 |
22 | # Install JavaScript dependencies if using Yarn
23 | # system('bin/yarn')
24 |
25 | puts "\n== Updating database =="
26 | system! 'bin/rails db:migrate'
27 |
28 | puts "\n== Removing old logs and tempfiles =="
29 | system! 'bin/rails log:clear tmp:clear'
30 |
31 | puts "\n== Restarting application server =="
32 | system! 'bin/rails restart'
33 | end
34 |
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg024_permission_create_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eeg024PermissionCreateController < EgController
4 | before_action -> { check_auth('eSignature') }
5 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 24, 'eSignature') }
6 |
7 | def create
8 | args = {
9 | account_id: session[:ds_account_id],
10 | base_path: session[:ds_base_path],
11 | access_token: session[:ds_access_token],
12 | permission_profile_name: params[:permission_profile_name]
13 | }
14 |
15 | results = ESign::Eg024PermissionCreateService.new(args).worker
16 | # Step 4. a) Call the eSignature API
17 | # b) Display the JSON response
18 | @title = @example['ExampleName']
19 | @message = 'Permission profile was created'
20 | @json = results.to_json.to_json
21 | render 'ds_common/example_done'
22 | rescue DocuSign_eSign::ApiError => e
23 | handle_error(e)
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/app/views/room_api/reg003_export_data_from_room/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% room_id_index = 0 %>
5 | <% redirect_to1_index = 0 %>
6 |
7 | <% if @rooms.count.positive? %>
8 |
9 |
21 |
22 | <% else %>
23 | <%= sanitize format_string(@example["RedirectsToOtherCodeExamples"][redirect_to1_index]["RedirectText"], 'href="reg001"') %>
24 | <% end %>
25 |
--------------------------------------------------------------------------------
/app/views/clickwrap/ceg002_activate_clickwrap/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% redirect_to1_index = 0 %>
4 | <% clickwrap_id_index = 0 %>
5 | <% form_index = 0 %>
6 |
7 | <% if @clickwraps.count.positive? %>
8 |
9 |
21 |
22 | <% else %>
23 | <%= sanitize format_string(@example["RedirectsToOtherCodeExamples"][redirect_to1_index]["RedirectText"], 'href="ceg001"') %>
24 |
25 | <% end %>
--------------------------------------------------------------------------------
/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Files in the config/locales directory are used for internationalization
2 | # and are automatically loaded by Rails. If you want to use locales other
3 | # than English, add the necessary files in this directory.
4 | #
5 | # To use the locales, use `I18n.t`:
6 | #
7 | # I18n.t 'hello'
8 | #
9 | # In views, this is aliased to just `t`:
10 | #
11 | # <%= t('hello') %>
12 | #
13 | # To use a different locale, set it with `I18n.locale`:
14 | #
15 | # I18n.locale = :es
16 | #
17 | # This would use the information in config/locales/es.yml.
18 | #
19 | # The following keys must be escaped otherwise they will not be retrieved by
20 | # the default I18n backend:
21 | #
22 | # true, false, on, off, yes, no
23 | #
24 | # Instead, surround them with single quotes.
25 | #
26 | # en:
27 | # 'true': 'foo'
28 | #
29 | # To learn more, please read the Rails Internationalization guide
30 | # available at http://guides.rubyonrails.org/i18n.html.
31 |
32 | en:
33 | hello: "Hello world"
34 |
--------------------------------------------------------------------------------
/test/eg001_create_clickwrap_test.rb:
--------------------------------------------------------------------------------
1 | require 'date'
2 | require 'rubygems'
3 | require 'test/unit'
4 | require_relative './test_helper'
5 | require_relative '../app/services/api_creator'
6 | require_relative '../app/services/clickwrap/eg001_create_clickwrap_service'
7 |
8 | class Eg001CreateClickwrapTest < TestHelper
9 | setup do
10 | setup_test_data [api_type[:click]]
11 |
12 | args = {
13 | account_id: @account_id,
14 | base_path: @base_path,
15 | access_token: @access_token,
16 | doc_pdf: @data[:term_of_service],
17 | clickwrap_name: "#{@data[:clickwrap_name]}_#{Time.now.strftime("%s%L")}"
18 | }
19 |
20 | @ceg001 = Clickwrap::Eg001CreateClickwrapService.new(args)
21 | end
22 |
23 | test 'should correctly create clickwrap if correct data is provided' do
24 | results = @ceg001.worker
25 |
26 | TestData.set_clickwrap_id(results.clickwrap_id)
27 |
28 | assert_not_nil results
29 | assert_not_empty results.clickwrap_id
30 | end
31 | end
32 |
--------------------------------------------------------------------------------
/quick_acg/app/controllers/ds_common_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class DsCommonController < ApplicationController
4 | def index
5 | session[:api] = 'eSignature'
6 | @show_doc = Rails.application.config.documentation
7 | handle_redirects
8 | end
9 | Rails.configuration.file_watcher
10 | def handle_redirects
11 | if session[:quickstarted].nil?
12 | session[:quickstarted] = true
13 | redirect_to '/auth/docusign'
14 | else
15 | return redirect_to '/auth/docusign' if session[:ds_access_token].nil? || session[:ds_base_path].nil?
16 |
17 | enableCFR = ESign::GetDataService.new(session[:ds_access_token], session[:ds_base_path]).cfr?(session[:ds_account_id])
18 | if enableCFR == 'enabled'
19 | session[:status_cfr] = 'enabled'
20 | redirect_to '/eeg041'
21 | else
22 | redirect_to '/eeg001'
23 | end
24 | end
25 | end
26 |
27 | def ds_must_authenticate
28 | redirect_to '/auth/docusign'
29 | end
30 | end
31 |
--------------------------------------------------------------------------------
/app/controllers/admin_api/aeg005_audit_users_controller.rb:
--------------------------------------------------------------------------------
1 | class AdminApi::Aeg005AuditUsersController < EgController
2 | before_action -> { check_auth('Admin') }
3 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 5, 'Admin') }
4 |
5 | def create
6 | session[:organization_id] = AdminApi::GetDataService.new(session).get_organization_id if session[:organization_id].nil?
7 |
8 | begin
9 | args = {
10 | account_id: session[:ds_account_id],
11 | organization_id: session['organization_id'],
12 | base_path: session[:ds_base_path],
13 | access_token: session[:ds_access_token]
14 | }
15 |
16 | results = AdminApi::Eg005AuditUsersService.new(args).worker
17 |
18 | @title = @example['ExampleName']
19 | @message = @example['ResultsPageText']
20 | @json = results.to_json.to_json
21 |
22 | render 'ds_common/example_done'
23 | rescue DocuSign_Admin::ApiError => e
24 | handle_error(e)
25 | end
26 | end
27 | end
28 |
--------------------------------------------------------------------------------
/app/services/e_sign/eg012_embedded_console_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eg012EmbeddedConsoleService
4 | attr_reader :args
5 |
6 | include ApiCreator
7 |
8 | def initialize(args)
9 | @args = args
10 | end
11 |
12 | def worker
13 | # Step 1. Create the NDSE view request object
14 | # Exceptions will be caught by the calling function
15 | #ds-snippet-start:eSign12Step2
16 | view_request = DocuSign_eSign::ConsoleViewRequest.new({
17 | returnUrl: args[:ds_return_url]
18 | })
19 | view_request.envelope_id = args[:envelope_id] if args[:starting_view] == 'envelope' && args[:envelope_id]
20 | # Step 2. Call the API method
21 | envelope_api = create_envelope_api(args)
22 | results = envelope_api.create_console_view args[:account_id], view_request
23 | #ds-snippet-end:eSign12Step2
24 | { 'redirect_url' => results.url }
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/app/views/admin_api/aeg011_delete_user_data_from_account/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% user_id_index = 0 %>
5 |
6 |
20 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg045_delete_restore_envelope/delete.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% envelope_id_index = 0 %>
5 |
6 |
21 |
22 |
--------------------------------------------------------------------------------
/app/controllers/clickwrap/ceg001_create_clickwrap_controller.rb:
--------------------------------------------------------------------------------
1 | class Clickwrap::Ceg001CreateClickwrapController < EgController
2 | before_action -> { check_auth('Click') }
3 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 1, 'Click') }
4 |
5 | def create
6 | args = {
7 | account_id: session[:ds_account_id],
8 | base_path: session[:ds_base_path],
9 | access_token: session[:ds_access_token],
10 | doc_pdf: File.join('data', Rails.configuration.doc_terms_pdf),
11 | clickwrap_name: param_gsub(params[:clickwrapName])
12 | }
13 |
14 | results = Clickwrap::Eg001CreateClickwrapService.new(args).worker
15 |
16 | session[:clickwrap_id] = results.clickwrap_id
17 | session[:clickwrap_name] = results.clickwrap_name
18 |
19 | @title = @example['ExampleName']
20 | @message = format_string(@example['ResultsPageText'], results.clickwrap_name)
21 | @json = results.to_json.to_json
22 | render 'ds_common/example_done'
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/app/controllers/monitor_api/meg001_get_monitoring_dataset_controller.rb:
--------------------------------------------------------------------------------
1 | class MonitorApi::Meg001GetMonitoringDatasetController < EgController
2 | before_action -> { check_auth('Monitor') }
3 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 1, 'Monitor') }
4 |
5 | def create
6 | args = {
7 | access_token: session[:ds_access_token],
8 | data_set_name: 'monitor',
9 | version: '2.0'
10 | }
11 |
12 | results = MonitorApi::Eg001GetMonitoringDatasetService.new(args).worker
13 |
14 | @title = @example['ExampleName']
15 |
16 | if results != 'Monitor not enabled'
17 | @message = @example['ResultsPageText']
18 | @json = results.to_json.to_json
19 | else
20 | @message = "You do not have Monitor enabled for your account, follow How to enable Monitor for your account to get it enabled."
21 | end
22 |
23 | render 'ds_common/example_done'
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg038_responsive_signing_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eeg038ResponsiveSigningController < EgController
4 | before_action -> { check_auth('eSignature') }
5 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 38, 'eSignature') }
6 |
7 | def create
8 | args = {
9 | account_id: session[:ds_account_id],
10 | base_path: session[:ds_base_path],
11 | access_token: session[:ds_access_token],
12 | signer_email: param_gsub(params[:signerEmail]),
13 | signer_name: param_gsub(params[:signerName]),
14 | cc_email: param_gsub(params[:ccEmail]),
15 | cc_name: param_gsub(params[:ccName]),
16 | ds_ping_url: Rails.application.config.app_url,
17 | signer_client_id: 1000,
18 | doc_file: 'data/order_form.html'
19 | }
20 |
21 | redirect_url = ESign::Eg038ResponsiveSigningService.new(args).worker
22 | redirect_to redirect_url
23 | rescue DocuSign_eSign::ApiError => e
24 | handle_error(e)
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/app/views/clickwrap/ceg005_clickwrap_responses/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% click_id_index = 0 %>
5 | <% redirect_to1_index = 0 %>
6 |
7 | <% if session[:clickwrap_id] %>
8 |
20 |
21 | <% else %>
22 | <%= sanitize format_string(@example["RedirectsToOtherCodeExamples"][redirect_to1_index]["RedirectText"], 'href="ceg001"') %>
23 |
24 | <% end %>
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg028_brands_creating_controller.rb:
--------------------------------------------------------------------------------
1 | class ESign::Eeg028BrandsCreatingController < EgController
2 | before_action -> { check_auth('eSignature') }
3 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 28, 'eSignature') }
4 |
5 | def create
6 | args = {
7 | account_id: session['ds_account_id'],
8 | base_path: session['ds_base_path'],
9 | access_token: session['ds_access_token'],
10 | brandName: params[:brandName],
11 | defaultBrandLanguage: params[:defaultBrandLanguage]
12 | }
13 |
14 | results = ESign::Eg028BrandsCreatingService.new(args).worker
15 | # Step 4. a) Call the eSignature API
16 | # b) Display the JSON response
17 | brand_id = results.brands[0].brand_id
18 | @title = @example['ExampleName']
19 | @message = format_string(@example['ResultsPageText'], brand_id)
20 | @json = results.to_json.to_json
21 | render 'ds_common/example_done'
22 | rescue DocuSign_eSign::ApiError => e
23 | handle_error(e)
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/app/views/clickwrap/ceg006_embed_clickwrap/results.html.erb:
--------------------------------------------------------------------------------
1 | <%= @title %>
2 | <% if !@message.nil? %>
3 | <%= @message.html_safe %>
4 | <% end %>
5 |
6 | <% if !@agreementUrl.nil? %>
7 |
8 | <%= sanitize @manifest["SupportingTexts"]["HelpingTexts"]["EmbedClickwrapURL"] %> <%= @agreementUrl.html_safe %>
9 |
10 | <% end %>
11 |
12 |
13 | <%= sanitize @manifest["SupportingTexts"]["HelpingTexts"]["NOTAGREED"] %>
14 |
15 |
16 | Continue
17 |
18 |
19 |
20 | <%= javascript_tag do %>
21 | docuSignClick.Clickwrap.render({
22 | agreementUrl: "<%= @agreementUrl.html_safe %>",
23 | onAgreed: function () {
24 | // Triggered if the user has just agreed
25 | document.getElementById("agreementStatus").innerHTML = "<%= sanitize @manifest["SupportingTexts"]["HelpingTexts"]["AGREED"] %>";
26 | }
27 | }, "#ds-terms-of-service");
28 | <% end %>
29 |
--------------------------------------------------------------------------------
/app/helpers/eg024_brands_creating_helper.rb:
--------------------------------------------------------------------------------
1 | module Eg024BrandsCreatingHelper
2 | def language_list
3 | languages = [%w[Arabic ar], %w[Armenian hy], ['Bahasa Indonesia', 'id'], ['Bahasa Malay', 'ms'], %w[Bulgarian bg],
4 | ['Chinese Simplified', 'zh_CN'], ['Chinese Traditional', 'zh_TW'], %w[Croatian hr], %w[Czech cs],
5 | %w[Danish da], %w[Dutch nl], ['English UK', 'en_GB'], ['English US', 'en'], %w[Estonian et], %w[Farsi fa],
6 | %w[Hindi hi], %w[Hungarian hu], %w[Italian it], %w[Japanese ja], %w[Korean ko], %w[Latvian lv],
7 | %w[Lithuanian lt], %w[Norwegian no], %w[Polish pl], %w[Portuguese pt], ['Portuguese Brasil', 'pt_BR'], %w[Romanian ro],
8 | %w[Russian ru], %w[Serbian sr], %w[Slovak sk], %w[Slovenian sl], %w[Spanish es], ['Spanish Latin America', 'es_MX'],
9 | %w[Swedish sv], %w[Thai th], %w[Turkish tr], %w[Ukranian uk], %w[Vietnamese vi]]
10 | array = languages.map { |key, value| [key, value] }
11 | options_for_select(array)
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/app/services/room_api/eg008_grant_office_access_to_form_group_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class RoomApi::Eg008GrantOfficeAccessToFormGroupService
4 | attr_reader :args
5 |
6 | def initialize(args)
7 | @args = args
8 | end
9 |
10 | def worker
11 | #ds-snippet-start:Rooms8Step2
12 | configuration = DocuSign_Rooms::Configuration.new
13 | configuration.host = Rails.configuration.rooms_host
14 |
15 | api_client = DocuSign_Rooms::ApiClient.new(configuration)
16 | api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}")
17 | #ds-snippet-end:Rooms8Step2
18 |
19 | #ds-snippet-start:Rooms8Step5
20 | form_groups_api = DocuSign_Rooms::FormGroupsApi.new(api_client)
21 | begin
22 | response = form_groups_api.grant_office_access_to_form_group(args[:form_group_id], args[:office_id], args[:account_id])
23 | rescue Exception
24 | return { exception: 'Failed to grant office access to a form group' }
25 | end
26 | #ds-snippet-end:Rooms8Step5
27 | response
28 | end
29 | end
30 |
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg016_set_envelope_tab_data_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eeg016SetEnvelopeTabDataController < EgController
4 | before_action -> { check_auth('eSignature') }
5 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 16, 'eSignature') }
6 |
7 | def create
8 | args = {
9 | # Validation: Delete any non-usual characters
10 | signer_email: params['signerEmail'].gsub(/([^\w\-.+@, ])+/, ''),
11 | signer_name: params['signerName'].gsub(/([^\w\-., ])+/, ''),
12 | access_token: session['ds_access_token'],
13 | base_path: session['ds_base_path'],
14 | account_id: session['ds_account_id']
15 | }
16 |
17 | begin
18 | results = ESign::Eg016SetEnvelopeTabDataService.new(args).worker
19 |
20 | # Save for future use within the example launcher
21 | session[:envelope_id] = results[:envelope_id]
22 |
23 | redirect_to results[:url]
24 | rescue DocuSign_eSign::ApiError => e
25 | handle_error(e)
26 | end
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/app/services/room_api/eg007_create_form_group_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class RoomApi::Eg007CreateFormGroupService
4 | attr_reader :args
5 |
6 | def initialize(args)
7 | @args = args
8 | end
9 |
10 | def worker
11 | #ds-snippet-start:Rooms7Step2
12 | configuration = DocuSign_Rooms::Configuration.new
13 | configuration.host = Rails.configuration.rooms_host
14 |
15 | api_client = DocuSign_Rooms::ApiClient.new(configuration)
16 | api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}")
17 | #ds-snippet-end:Rooms7Step2
18 |
19 | #ds-snippet-start:Rooms7Step4
20 | rooms_api = DocuSign_Rooms::FormGroupsApi.new(api_client)
21 | rooms_api.create_form_group(args[:account_id], body(args))
22 | #ds-snippet-end:Rooms7Step4
23 | end
24 |
25 | private
26 |
27 | def body(args)
28 | #ds-snippet-start:Rooms7Step3
29 | DocuSign_Rooms::RoomForCreate.new(
30 | {
31 | name: args[:group_name]
32 | }
33 | )
34 | #ds-snippet-end:Rooms7Step3
35 | end
36 | end
37 |
--------------------------------------------------------------------------------
/app/services/room_api/eg005_get_rooms_with_filters_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class RoomApi::Eg005GetRoomsWithFiltersService
4 | attr_reader :args
5 |
6 | def initialize(args)
7 | @args = args
8 | end
9 |
10 | def worker
11 | configuration = DocuSign_Rooms::Configuration.new
12 | configuration.host = Rails.configuration.rooms_host
13 |
14 | #ds-snippet-start:Rooms5Step2
15 | api_client = DocuSign_Rooms::ApiClient.new(configuration)
16 | api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}")
17 | #ds-snippet-end:Rooms5Step2
18 |
19 | #ds-snippet-start:Rooms5Step3
20 | filters = DocuSign_Rooms::GetRoomsOptions.new
21 | filters.field_data_changed_start_date = args[:date_from]
22 | filters.field_data_changed_end_date = args[:date_to]
23 | #ds-snippet-end:Rooms5Step3
24 |
25 | #ds-snippet-start:Rooms5Step4
26 | rooms_api = DocuSign_Rooms::RoomsApi.new(api_client)
27 | rooms_api.get_rooms(args[:account_id], filters)
28 | #ds-snippet-end:Rooms5Step4
29 | end
30 | end
31 |
--------------------------------------------------------------------------------
/app/views/room_api/reg006_create_an_external_form_fill_session/get_rooms.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 1 %>
4 | <% room_index = 0 %>
5 | <% redirect_to1_index = 1 %>
6 |
7 | <% if @rooms.count.positive? %>
8 |
9 |
20 |
21 | <% else %>
22 |
23 |
24 | <%= sanitize format_string(@example["RedirectsToOtherCodeExamples"][redirect_to1_index]["RedirectText"], 'href="reg001"') %>
25 |
26 |
27 | <% end %>
--------------------------------------------------------------------------------
/test/eg028_brands_creating_test.rb:
--------------------------------------------------------------------------------
1 | require 'date'
2 | require 'rubygems'
3 | require 'test/unit'
4 | require_relative './test_helper'
5 | require_relative '../app/services/api_creator'
6 | require_relative '../app/services/e_sign/eg028_brands_creating_service'
7 |
8 | class Eg028BrandsCreatingTest < TestHelper
9 | setup do
10 | setup_test_data [api_type[:e_sign]]
11 |
12 | args = {
13 | account_id: @account_id,
14 | base_path: @base_path,
15 | access_token: @access_token,
16 | brandName: "#{@data[:brand_name]}_#{Time.now.strftime("%s%L")}",
17 | defaultBrandLanguage: @data[:default_brand_language]
18 | }
19 |
20 | @eg028 = ESign::Eg028BrandsCreatingService.new(args)
21 | end
22 |
23 | test 'should correctly create brand if correct data is provided' do
24 | results = @eg028.worker
25 |
26 | TestData.set_brand_id results.brands[0].brand_id
27 |
28 | assert_not_nil results
29 | assert_not_nil results.brands
30 | assert_not_nil results.brands[0]
31 | assert_not_empty results.brands[0].brand_id
32 | end
33 | end
34 |
--------------------------------------------------------------------------------
/app/services/room_api/eg004_add_forms_to_room_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class RoomApi::Eg004AddFormsToRoomService
4 | attr_reader :args
5 |
6 | def initialize(args)
7 | @args = args
8 | end
9 |
10 | def worker
11 | #ds-snippet-start:Rooms4Step2
12 | configuration = DocuSign_Rooms::Configuration.new
13 | configuration.host = Rails.configuration.rooms_host
14 |
15 | api_client = DocuSign_Rooms::ApiClient.new(configuration)
16 | api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}")
17 | #ds-snippet-end:Rooms4Step2
18 |
19 | #ds-snippet-start:Rooms4Step4
20 | rooms_api = DocuSign_Rooms::RoomsApi.new(api_client)
21 |
22 | rooms_api.add_form_to_room(args[:room_id], args[:account_id], body(args[:form_id]))
23 | #ds-snippet-end:Rooms4Step4
24 | end
25 |
26 | def body(form_id)
27 | #ds-snippet-start:Rooms4Step3
28 | DocuSign_Rooms::FormForAdd.new({
29 | formId: form_id
30 | })
31 | #ds-snippet-end:Rooms4Step3
32 | end
33 | end
34 |
--------------------------------------------------------------------------------
/app/services/e_sign/eg003_list_envelopes_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eg003ListEnvelopesService
4 | attr_reader :args
5 |
6 | include ApiCreator
7 |
8 | def initialize(args)
9 | @args = args
10 | end
11 |
12 | def worker
13 | # List the envelopes
14 | # The Envelopes::listStatusChanges method has many options
15 | # See https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/listStatusChange#
16 | # The list status changes call requires at least a from_date OR
17 | # a set of envelopeIds. Here we filter using a from_date.
18 | # Here we set the from_date to filter envelopes for the last month
19 | # Use ISO 8601 date format
20 | #ds-snippet-start:eSign3Step2
21 | envelope_api = create_envelope_api(args)
22 | options = DocuSign_eSign::ListStatusChangesOptions.new
23 | options.from_date = (Date.today - 30).strftime('%Y-%m-%d')
24 | # Exceptions will be caught by the calling function
25 | envelope_api.list_status_changes args[:account_id], options
26 | #ds-snippet-end:eSign3Step2
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/app/services/e_sign/eg028_brands_creating_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eg028BrandsCreatingService
4 | attr_reader :args
5 |
6 | include ApiCreator
7 |
8 | def initialize(args)
9 | @args = args
10 | end
11 |
12 | def worker
13 | # Step 1. Obtain your OAuth token
14 | configuration = DocuSign_eSign::Configuration.new
15 | configuration.host = args[:base_path]
16 | api_client = DocuSign_eSign::ApiClient.new configuration
17 |
18 | # Step 2. Construct your API headers
19 | api_client.default_headers['Authorization'] = "Bearer #{args[:access_token]}"
20 |
21 | # Step 3: Construct your request body
22 | #ds-snippet-start:eSign28Step3
23 | accounts_api = DocuSign_eSign::AccountsApi.new api_client
24 | params = { brandName: args[:brandName], defaultBrandLanguage: args[:defaultBrandLanguage] }
25 | #ds-snippet-end:eSign28Step3
26 |
27 | # Step 4: Call the eSignature API
28 | #ds-snippet-start:eSign28Step4
29 | accounts_api.create_brand(args[:account_id], params)
30 | #ds-snippet-end:eSign28Step4
31 | end
32 | end
33 |
--------------------------------------------------------------------------------
/app/services/admin_api/eg011_delete_user_data_from_account_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class AdminApi::Eg011DeleteUserDataFromAccountService
4 | attr_reader :args
5 |
6 | def initialize(args)
7 | @args = args
8 | end
9 |
10 | def worker
11 | #ds-snippet-start:Admin11Step2
12 | configuration = DocuSign_Admin::Configuration.new
13 | configuration.host = Rails.configuration.admin_host
14 |
15 | api_client = DocuSign_Admin::ApiClient.new(configuration)
16 | api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}")
17 | #ds-snippet-end:Admin11Step2
18 |
19 | #ds-snippet-start:Admin11Step3
20 | accounts_api = DocuSign_Admin::AccountsApi.new(api_client)
21 | membership_redaction_request = DocuSign_Admin::IndividualMembershipDataRedactionRequest.new(
22 | user_id: args[:user_id]
23 | )
24 | #ds-snippet-end:Admin11Step3
25 |
26 | #ds-snippet-start:Admin11Step4
27 | accounts_api.redact_individual_membership_data(args[:account_id], membership_redaction_request)
28 | #ds-snippet-end:Admin11Step4
29 | end
30 | end
31 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg012_embedded_console/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% view_index = 0 %>
5 | <% redirect_to2_index = 0 %>
6 |
7 | <% if !@envelope_ok %>
8 | <%= sanitize format_string(@example["RedirectsToOtherCodeExamples"][redirect_to2_index]["RedirectText"], 'href="eeg002"') %>
9 | <% end %>
10 |
11 |
26 |
--------------------------------------------------------------------------------
/PAYMENTS_INSTALLATION.md:
--------------------------------------------------------------------------------
1 | # Configure a payment gateway
2 |
3 | Docusign offers built-in connections to multiple payment gateways. The payments code example uses a developer account via the Stripe gateway service.
4 |
5 |
6 | ## Create a Stripe payment gateway
7 |
8 | 1. Select the Stripe button on the [**Payments**](https://admindemo.docusign.com/authenticate?goTo=payments) page in your developer account.
9 |
10 | 1. For development, you can skip the Stripe account application by using the **Skip this account form** link at the top of the page.
11 |
12 | 
13 |
14 | An enabled Stripe payment gateway is now associated with your Docusign developer account and is shown under **Payment Gateway**.
15 |
16 | 1. Save the **Gateway Account ID** GUID to the code example launcher configuration file.
17 |
18 |
19 | ## Additional documentation
20 | * [Managing Payment Gateways](https://support.docusign.com/en/guides/managing-payment-gateways)
21 | * [How to send a request for payment](https://developers.docusign.com/docs/esign-rest-api/how-to/request-a-payment)
22 |
--------------------------------------------------------------------------------
/bin/setup:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby.exe
2 | require "fileutils"
3 |
4 | # path to your application root.
5 | APP_ROOT = File.expand_path("..", __dir__)
6 |
7 | def system!(*args)
8 | system(*args) || abort("\n== Command #{args} failed ==")
9 | end
10 |
11 | FileUtils.chdir APP_ROOT do
12 | # This script is a way to set up or update your development environment automatically.
13 | # This script is idempotent, so that you can run it at any time and get an expectable outcome.
14 | # Add necessary setup steps to this file.
15 |
16 | puts "== Installing dependencies =="
17 | system! "gem install bundler --conservative"
18 | system("bundle check") || system!("bundle install")
19 |
20 | # puts "\n== Copying sample files =="
21 | # unless File.exist?("config/database.yml")
22 | # FileUtils.cp "config/database.yml.sample", "config/database.yml"
23 | # end
24 |
25 | puts "\n== Preparing database =="
26 | system! "bin/rails db:prepare"
27 |
28 | puts "\n== Removing old logs and tempfiles =="
29 | system! "bin/rails log:clear tmp:clear"
30 |
31 | puts "\n== Restarting application server =="
32 | system! "bin/rails restart"
33 | end
34 |
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg044_focused_view_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eeg044FocusedViewController < EgController
4 | before_action -> { check_auth('eSignature') }
5 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 44) }
6 |
7 | def create
8 | pdf_file_path = 'data/World_Wide_Corp_lorem.pdf'
9 |
10 | pdf_file_path = '../data/World_Wide_Corp_lorem.pdf' unless File.exist?(pdf_file_path)
11 |
12 | args = {
13 | account_id: session[:ds_account_id],
14 | base_path: session[:ds_base_path],
15 | access_token: session[:ds_access_token],
16 | signer_email: param_gsub(params[:signerEmail]),
17 | signer_name: param_gsub(params[:signerName]),
18 | ds_ping_url: Rails.application.config.app_url,
19 | signer_client_id: 1000,
20 | pdf_filename: pdf_file_path
21 | }
22 |
23 | @integration_key = Rails.application.config.integration_key
24 | @url = ESign::Eg044FocusedViewService.new(args).worker
25 | render 'e_sign/eeg044_focused_view/embed'
26 | rescue DocuSign_eSign::ApiError => e
27 | handle_error(e)
28 | end
29 | end
30 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg028_brands_creating/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% brand_name_index = 0 %>
5 | <% language_index = 1 %>
6 |
7 |
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg035_scheduled_sending_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eeg035ScheduledSendingController < EgController
4 | before_action -> { check_auth('eSignature') }
5 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 35, 'eSignature') }
6 |
7 | def create
8 | envelope_args = {
9 | signer_email: param_gsub(params['signer_email']),
10 | signer_name: param_gsub(params['signer_name']),
11 | resume_date: param_gsub(params['resume_date']),
12 | status: 'sent'
13 | }
14 | args = {
15 | account_id: session['ds_account_id'],
16 | base_path: session['ds_base_path'],
17 | access_token: session['ds_access_token'],
18 | envelope_args: envelope_args
19 | }
20 | results = ESign::Eg035ScheduledSendingService.new(args).worker
21 | session[:envelope_id] = results['envelope_id']
22 | @title = @example['ExampleName']
23 | @message = format_string(@example['ResultsPageText'], results['envelope_id'])
24 | render 'ds_common/example_done'
25 | rescue DocuSign_eSign::ApiError => e
26 | handle_error(e)
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/quick_acg/bin/setup:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby.exe
2 | require 'fileutils'
3 |
4 | # path to your application root.
5 | APP_ROOT = File.expand_path('..', __dir__)
6 |
7 | def system!(*args)
8 | system(*args) || abort("\n== Command #{args} failed ==")
9 | end
10 |
11 | FileUtils.chdir APP_ROOT do
12 | # This script is a way to set up or update your development environment automatically.
13 | # This script is idempotent, so that you can run it at any time and get an expectable outcome.
14 | # Add necessary setup steps to this file.
15 |
16 | puts '== Installing dependencies =='
17 | system! 'gem install bundler --conservative'
18 | system('bundle check') || system!('bundle install')
19 |
20 | # puts "\n== Copying sample files =="
21 | # unless File.exist?("config/database.yml")
22 | # FileUtils.cp "config/database.yml.sample", "config/database.yml"
23 | # end
24 |
25 | puts "\n== Preparing database =="
26 | system! 'bin/rails db:prepare'
27 |
28 | puts "\n== Removing old logs and tempfiles =="
29 | system! 'bin/rails log:clear tmp:clear'
30 |
31 | puts "\n== Restarting application server =="
32 | system! 'bin/rails restart'
33 | end
34 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright (c) 2024 Docusign, Inc. (https://www.docusign.com)
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg011_embedded_sending_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eeg011EmbeddedSendingController < EgController
4 | before_action -> { check_auth('eSignature') }
5 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 11, 'eSignature') }
6 |
7 | def create
8 | envelope_args = {
9 | signer_email: param_gsub(params['signerEmail']),
10 | signer_name: param_gsub(params['signerName']),
11 | cc_email: param_gsub(params['ccEmail']),
12 | cc_name: param_gsub(params['ccName']),
13 | status: 'created'
14 | }
15 |
16 | args = {
17 | account_id: session['ds_account_id'],
18 | base_path: session['ds_base_path'],
19 | access_token: session['ds_access_token'],
20 | starting_view: param_gsub(params['starting_view']),
21 | envelope_args: envelope_args,
22 | ds_return_url: "#{Rails.application.config.app_url}/ds_common-return"
23 | }
24 |
25 | results = ESign::Eg011EmbeddedSendingService.new(args).worker
26 | redirect_to results['redirect_url']
27 | rescue DocuSign_eSign::ApiError => e
28 | handle_error(e)
29 | end
30 | end
31 |
--------------------------------------------------------------------------------
/app/views/partials/_example_info.erb:
--------------------------------------------------------------------------------
1 | <%= @example["ExampleName"] %>
2 | <%= sanitize @example["ExampleDescription"] %>
3 |
4 | <% if @show_doc %>
5 | Documentation about this example.
6 | <% end %>
7 |
8 | <% if @example["Notes"] %>
9 | <%= sanitize @example["Notes"] %>
10 | <% end %>
11 |
12 | <% if @example["LinksToAPIMethod"] %>
13 | <% if @example["LinksToAPIMethod"].length > 1 %>
14 | <%= sanitize @manifest["SupportingTexts"]["APIMethodUsedPlural"] %>
15 | <% else %>
16 | <%= sanitize @manifest["SupportingTexts"]["APIMethodUsed"] %>
17 | <% end %>
18 |
19 | <% @example["LinksToAPIMethod"].each do |link| %>
20 | "><%= link["PathName"] %>
21 | <% end %>
22 | <% end %>
23 |
24 | <% if @example["LinkToHowTo"] %>
25 | Prerequisite: See "><%= @example["LinkToHowTo"][0]["PathName"] %>
26 | <% end %>
27 |
28 |
29 | <%= sanitize format_string(@manifest["SupportingTexts"]["ViewSourceFile"], "#{@source_file} " ) %>
30 |
--------------------------------------------------------------------------------
/app/views/room_api/reg006_create_an_external_form_fill_session/get_forms.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% form_id_index = 0 %>
5 | <% redirect_to4_index = 0 %>
6 |
7 | <% unless @form_libraries.blank? %>
8 |
9 |
21 |
22 | <% else %>
23 |
24 |
25 | <%= sanitize format_string(@example["RedirectsToOtherCodeExamples"][redirect_to4_index]["RedirectText"], 'href="reg004"') %>
26 |
27 |
28 | <% end %>
--------------------------------------------------------------------------------
/app/controllers/notary/neg004_send_with_third_party_notary_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require_relative '../../services/utils'
4 |
5 | class Notary::Neg004SendWithThirdPartyNotaryController < EgController
6 | before_action -> { check_auth('Notary') }
7 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 4, 'Notary') }
8 |
9 | def create
10 | envelope_args = {
11 | signer_email: param_gsub(params['signerEmail']),
12 | signer_name: param_gsub(params['signerName']),
13 | doc_path: File.join('data', Rails.application.config.doc_docx)
14 | }
15 | args = {
16 | account_id: session['ds_account_id'],
17 | base_path: session['ds_base_path'],
18 | access_token: session['ds_access_token'],
19 | envelope_args: envelope_args
20 | }
21 | results = Notary::Eg004SendWithThirdPartyNotaryService.new(args).worker
22 | @title = @example['ExampleName']
23 | @message = format_string(@example['ResultsPageText'], results['envelope_id'])
24 | render 'ds_common/example_done'
25 | rescue DocuSign_eSign::ApiError => e
26 | handle_error(e)
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/db/schema.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # This file is auto-generated from the current state of the database. Instead
4 | # of editing this file, please use the migrations feature of Active Record to
5 | # incrementally modify your database, and then regenerate this schema definition.
6 | #
7 | # Note that this schema.rb definition is the authoritative source for your
8 | # database schema. If you need to create the application database on another
9 | # system, you should be using db:schema:load, not running all the migrations
10 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
11 | # you'll amass, the slower it'll run and the greater likelihood for issues).
12 | #
13 | # It's strongly recommended that you check this file into your version control system.
14 |
15 | ActiveRecord::Schema.define(version: 20_181_203_073_200) do
16 | create_table 'sessions', force: :cascade do |t|
17 | t.datetime 'created_at', null: false
18 | t.datetime 'updated_at', null: false
19 | end
20 |
21 | create_table 'users', force: :cascade do |t|
22 | t.datetime 'created_at', null: false
23 | t.datetime 'updated_at', null: false
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/test/eg002_activate_clickwrap_test.rb:
--------------------------------------------------------------------------------
1 | require 'date'
2 | require 'rubygems'
3 | require 'test/unit'
4 | require_relative './test_helper'
5 | require_relative '../app/services/api_creator'
6 | require_relative '../app/services/clickwrap/eg002_activate_clickwrap_service'
7 |
8 | class Eg002ActivateClickwrapTest < TestHelper
9 | setup do
10 | setup_test_data [api_type[:click]]
11 |
12 | args = {
13 | account_id: @account_id,
14 | base_path: @base_path,
15 | access_token: @access_token,
16 |
17 | ds_account_id: @account_id,
18 | ds_base_path: @base_path,
19 | ds_access_token: @access_token,
20 |
21 | clickwrap_id: TestData.get_clickwrap_id
22 | }
23 |
24 | @ceg002 = Clickwrap::Eg002ActivateClickwrapService.new(args)
25 | end
26 |
27 | test 'should correctly activate clickwrap if correct data is provided' do
28 | results = @ceg002.worker
29 |
30 | assert_not_nil results
31 | end
32 |
33 | test 'should get the list of inactive clickwraps if correct data is provided' do
34 | statuses = %w[inactive draft]
35 | results = @ceg002.get_inactive_clickwraps statuses
36 |
37 | assert_not_nil results
38 | end
39 | end
40 |
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg004_envelope_info_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eeg004EnvelopeInfoController < EgController
4 | before_action -> { check_auth('eSignature') }
5 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 4, 'eSignature') }
6 |
7 | def create
8 | envelope_id = session[:envelope_id]
9 |
10 | if envelope_id
11 | begin
12 | args = {
13 | account_id: session['ds_account_id'],
14 | base_path: session['ds_base_path'],
15 | access_token: session['ds_access_token'],
16 | envelope_id: envelope_id
17 | }
18 | results = ESign::Eg004EnvelopeInfoService.new(args).worker
19 | # results is an object that implements ArrayAccess. Convert to a regular array:
20 | @title = @example['ExampleName']
21 | @message = @example['ResultsPageText']
22 | @json = results.to_json.to_json
23 | render 'ds_common/example_done'
24 | rescue DocuSign_eSign::ApiError => e
25 | handle_error(e)
26 | end
27 | elsif !envelope_id
28 | @title = @example['ExampleName']
29 | @envelope_ok = false
30 | end
31 | end
32 | end
33 |
--------------------------------------------------------------------------------
/app/controllers/room_api/reg002_create_room_with_template_controller.rb:
--------------------------------------------------------------------------------
1 | class RoomApi::Reg002CreateRoomWithTemplateController < EgController
2 | before_action -> { check_auth('Rooms') }
3 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 2, 'Rooms') }
4 |
5 | def create
6 | args = {
7 | room_name: params[:roomName],
8 | office_id: RoomApi::GetDataService.new(session).get_offices[0]['officeId'],
9 | role_id: RoomApi::GetDataService.new(session).get_default_admin_role_id,
10 | template_id: params['templateId'],
11 | account_id: session[:ds_account_id],
12 | base_path: session[:ds_base_path],
13 | access_token: session[:ds_access_token]
14 | }
15 |
16 | results = RoomApi::Eg002CreateRoomWithTemplateService.new(args).worker
17 |
18 | @title = @example['ExampleName']
19 | @message = format_string(@example['ResultsPageText'], results.room_id, results.name)
20 | @json = results.to_json.to_json
21 |
22 | render 'ds_common/example_done'
23 | end
24 |
25 | def get
26 | #ds-snippet-start:Rooms2Step3
27 | @templates = RoomApi::GetDataService.new(session).get_templates
28 | #ds-snippet-end:Rooms2Step3
29 | end
30 | end
31 |
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg019_access_code_authentication_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eeg019AccessCodeAuthenticationController < EgController
4 | before_action -> { check_auth('eSignature') }
5 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 19, 'eSignature') }
6 |
7 | def create
8 | # ***DS.snippet.0.start
9 | envelope_args = {
10 | signer_email: param_gsub(params['signerEmail']),
11 | signer_name: param_gsub(params['signerName']),
12 | accessCode: params['accessCode'],
13 | status: 'sent'
14 | }
15 | args = {
16 | account_id: session['ds_account_id'],
17 | base_path: session['ds_base_path'],
18 | access_token: session['ds_access_token'],
19 | envelope_args: envelope_args
20 | }
21 |
22 | results = ESign::Eg019AccessCodeAuthenticationService.new(args).worker
23 | session[:envelope_id] = results.envelope_id
24 |
25 | @title = @example['ExampleName']
26 | @message = format_string(@example['ResultsPageText'], results.envelope_id)
27 | render 'ds_common/example_done'
28 | rescue DocuSign_eSign::ApiError => e
29 | handle_error(e)
30 | end
31 | # ***DS.snippet.0.end
32 | end
33 |
--------------------------------------------------------------------------------
/app/services/clickwrap/eg005_clickwrap_responses_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class Clickwrap::Eg005ClickwrapResponsesService
4 | attr_reader :args
5 |
6 | def initialize(args)
7 | @args = args
8 | end
9 |
10 | def worker
11 | # Step 2. Construct your API headers
12 | #ds-snippet-start:Click5Step2
13 | configuration = DocuSign_Click::Configuration.new
14 | configuration.host = args[:base_path]
15 |
16 | api_client = DocuSign_Click::ApiClient.new configuration
17 | api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}")
18 | #ds-snippet-end:Click5Step2
19 |
20 | # Step 3. Call the Click API
21 | #ds-snippet-start:Click5Step3
22 | # Set Clickwrap Agreements options
23 | agreements = DocuSign_Click::GetClickwrapAgreementsOptions.new
24 | agreements.client_user_id = args[:client_user_id]
25 | agreements.status = 'agreed'
26 |
27 | # Get clickwrap responses using SDK
28 | accounts_api = DocuSign_Click::AccountsApi.new(api_client)
29 | accounts_api.get_clickwrap_agreements(
30 | args[:account_id],
31 | args[:clickwrap_id],
32 | agreements
33 | )
34 | #ds-snippet-end:Click5Step3
35 | end
36 | end
37 |
--------------------------------------------------------------------------------
/config/storage.yml:
--------------------------------------------------------------------------------
1 | test:
2 | service: Disk
3 | root: <%= Rails.root.join("tmp/storage") %>
4 |
5 | local:
6 | service: Disk
7 | root: <%= Rails.root.join("storage") %>
8 |
9 | # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10 | # amazon:
11 | # service: S3
12 | # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13 | # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14 | # region: us-east-1
15 | # bucket: your_own_bucket
16 |
17 | # Remember not to checkin your GCS keyfile to a repository
18 | # google:
19 | # service: GCS
20 | # project: your_project
21 | # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22 | # bucket: your_own_bucket
23 |
24 | # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25 | # microsoft:
26 | # service: AzureStorage
27 | # storage_account_name: your_account_name
28 | # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29 | # container: your_container_name
30 |
31 | # mirror:
32 | # service: Mirror
33 | # primary: local
34 | # mirrors: [ amazon, google, microsoft ]
35 |
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg008_create_template_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eeg008CreateTemplateController < EgController
4 | before_action -> { check_auth('eSignature') }
5 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 8, 'eSignature') }
6 |
7 | def create
8 | args = {
9 | account_id: session['ds_account_id'],
10 | base_path: session['ds_base_path'],
11 | access_token: session['ds_access_token'],
12 | template_name: 'Example Signer and CC template v2'
13 | }
14 | results = ESign::Eg008CreateTemplateService.new(args).worker
15 | session[:template_id] = results[:template_id]
16 | session[:workflow_template_id] = results[:template_id]
17 | msg = if results.fetch(:created_new_template)
18 | 'The template has been created!'
19 | else
20 | 'Done. The template already existed in your account.'
21 | end
22 | @title = @example['ExampleName']
23 | @message = "#{msg} #{format_string(@example['ResultsPageText'], results[:template_name], results[:template_id])}"
24 | render 'ds_common/example_done'
25 | rescue DocuSign_eSign::ApiError => e
26 | handle_error(e)
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg033_unpauses_signature_workflow_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eeg033UnpausesSignatureWorkflowController < EgController
4 | before_action -> { check_auth('eSignature') }
5 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 33, 'eSignature') }
6 |
7 | def update
8 | args = {
9 | accountId: session['ds_account_id'],
10 | basePath: session['ds_base_path'],
11 | accessToken: session['ds_access_token'],
12 | envelopeId: session['envelope_id'],
13 | status: 'in_progress'
14 | }
15 |
16 | results = ESign::Eg033UnpausesSignatureWorkflowService.new(args).worker
17 |
18 | @envelop_id = results.to_hash[:envelopeId].to_s
19 | render 'e_sign/eeg033_unpauses_signature_workflow/return'
20 | end
21 |
22 | def get
23 | enableCFR = ESign::GetDataService.new(session[:ds_access_token], session[:ds_base_path]).cfr?(session[:ds_account_id])
24 | if enableCFR == 'enabled'
25 | session[:status_cfr] = 'enabled'
26 | @title = 'Not CFR Part 11 compatible'
27 | @error_information = @manifest['SupportingTexts']['CFRError']
28 | render 'ds_common/error'
29 | end
30 | super
31 | end
32 | end
33 |
--------------------------------------------------------------------------------
/config/initializers/content_security_policy.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # Be sure to restart your server when you modify this file.
3 |
4 | # Define an application-wide content security policy
5 | # For further information see the following documentation
6 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
7 |
8 | # Rails.application.config.content_security_policy do |policy|
9 | # policy.default_src :self, :https
10 | # policy.font_src :self, :https, :data
11 | # policy.img_src :self, :https, :data
12 | # policy.object_src :none
13 | # policy.script_src :self, :https
14 | # policy.style_src :self, :https
15 |
16 | # # Specify URI for violation reports
17 | # # policy.report_uri "/csp-violation-report-endpoint"
18 | # end
19 |
20 | # If you are using UJS then enable automatic nonce generation
21 | # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
22 |
23 | # Report CSP violations to a specified URI
24 | # For further information see the following documentation:
25 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
26 | # Rails.application.config.content_security_policy_report_only = true
27 |
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg005_envelope_recipients_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eeg005EnvelopeRecipientsController < EgController
4 | include ApiCreator
5 | before_action -> { check_auth('eSignature') }
6 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 5, 'eSignature') }
7 | skip_before_action :set_meta
8 |
9 | def create
10 | envelope_id = session[:envelope_id] || nil
11 |
12 | if envelope_id
13 | # 2. Call the worker method
14 | args = {
15 | account_id: session['ds_account_id'],
16 | base_path: session['ds_base_path'],
17 | access_token: session['ds_access_token'],
18 | envelope_id: envelope_id
19 | }
20 |
21 | begin
22 | results = ESign::Eg005EnvelopeRecipientsService.new(args).worker
23 | @title = @example['ExampleName']
24 | @message = 'Results from the EnvelopesRecipients::list method:'
25 | @json = results.to_json.to_json
26 | render 'ds_common/example_done'
27 | rescue DocuSign_eSign::ApiError => e
28 | handle_error(e)
29 | end
30 | elsif !envelope_id
31 | @title = @example['ExampleName']
32 | @envelope_ok = false
33 | end
34 | end
35 | end
36 |
--------------------------------------------------------------------------------
/config/application.rb:
--------------------------------------------------------------------------------
1 | require_relative 'boot'
2 | require 'rails/all'
3 | # Require the gems listed in Gemfile, including any gems
4 | # you've limited to :test, :development, or :production.
5 | Bundler.require(*Rails.groups)
6 | module CodeExamplesRuby
7 | class Application < Rails::Application
8 | # Initialize configuration defaults for originally generated Rails version.
9 | config.load_defaults 5.2
10 | # Configuration for Docusign example.
11 | # For a production application, you will store the credentials
12 | # in config/environments/development.rb, production.rb, test.rb, etc
13 | config.app_url = 'http://localhost:3000' # The public url of the application.
14 | # Init Docusign configuration, loaded from config/appsettings.yml file
15 | DOCUSIGN_CONFIG = YAML.load_file("#{Rails.root}/config/appsettings.yml")[Rails.env]
16 | DOCUSIGN_CONFIG.map do |k, v|
17 | config.send("#{k}=", v)
18 | end
19 |
20 | # Settings in config/environments/* take precedence over those specified here.
21 | # Application configuration can go into files in config/initializers
22 | # -- all .rb files in that directory are automatically loaded after loading
23 | # the framework and any gems in your application.
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg025_permissions_set_user_group/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% profile_index = 0 %>
5 | <% group_index = 1 %>
6 |
7 |
30 |
--------------------------------------------------------------------------------
/app/services/room_api/eg009_assign_form_to_form_group_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class RoomApi::Eg009AssignFormToFormGroupService
4 | attr_reader :args
5 |
6 | def initialize(args)
7 | @args = args
8 | end
9 |
10 | def worker
11 | #ds-snippet-start:Rooms9Step2
12 | configuration = DocuSign_Rooms::Configuration.new
13 | configuration.host = Rails.configuration.rooms_host
14 |
15 | api_client = DocuSign_Rooms::ApiClient.new(configuration)
16 | api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}")
17 | #ds-snippet-end:Rooms9Step2
18 |
19 | #ds-snippet-start:Rooms9Step6
20 | form_groups_api = DocuSign_Rooms::FormGroupsApi.new(api_client)
21 | begin
22 | response = form_groups_api.assign_form_group_form(args[:form_group_id], args[:account_id], body(args))
23 | rescue Exception
24 | return { exception: 'Failed to assign a form to a form group' }
25 | end
26 | #ds-snippet-end:Rooms9Step6
27 | response
28 | end
29 |
30 | private
31 |
32 | def body(args)
33 | #ds-snippet-start:Rooms9Step5
34 | DocuSign_Rooms::FormGroupFormToAssign.new(
35 | {
36 | formId: args[:form_id]
37 | }
38 | )
39 | #ds-snippet-end:Rooms9Step5
40 | end
41 | end
42 |
--------------------------------------------------------------------------------
/app/controllers/room_api/reg006_create_an_external_form_fill_session_controller.rb:
--------------------------------------------------------------------------------
1 | class RoomApi::Reg006CreateAnExternalFormFillSessionController < EgController
2 | before_action -> { check_auth('Rooms') }
3 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 6, 'Rooms') }
4 |
5 | def create
6 | args = {
7 | form_id: params['formId'],
8 | room_id: params['roomId'],
9 | account_id: session[:ds_account_id],
10 | base_path: session[:ds_base_path],
11 | access_token: session[:ds_access_token],
12 | allowed_host: request.host_with_port
13 | }
14 | begin
15 | results = RoomApi::Eg006CreateAnExternalFormFillSessionService.new(args).worker
16 |
17 | @title = @example['ExampleName']
18 | @message = @example['ResultsPageText']
19 | @json = results.to_json
20 | @url = results.url
21 |
22 | render 'room_api/reg006_create_an_external_form_fill_session/results'
23 | rescue DocuSign_Rooms::ApiError => e
24 | handle_error(e)
25 | end
26 | end
27 |
28 | def get_rooms
29 | @rooms = RoomApi::GetDataService.new(session).get_rooms
30 | end
31 |
32 | def get_forms
33 | @form_libraries = RoomApi::GetDataService.new(session, params['roomId']).get_forms_from_room
34 | end
35 | end
36 |
--------------------------------------------------------------------------------
/quick_acg/config/application.rb:
--------------------------------------------------------------------------------
1 | require_relative 'boot'
2 | require 'rails/all'
3 | # Require the gems listed in Gemfile, including any gems
4 | # you've limited to :test, :development, or :production.
5 | Bundler.require(*Rails.groups)
6 | module CodeExamplesRuby
7 | class Application < Rails::Application
8 | # Initialize configuration defaults for originally generated Rails version.
9 | config.load_defaults 5.2
10 | # Configuration for Docusign example.
11 | # For a production application, you will store the credentials
12 | # in config/environments/development.rb, production.rb, test.rb, etc
13 | config.app_url = 'http://localhost:3000' # The public url of the application.
14 | # Init Docusign configuration, loaded from config/appsettings.yml file
15 | DOCUSIGN_CONFIG = YAML.load_file(File.join(Rails.root, '../config/appsettings.yml'), aliases: true)[Rails.env]
16 | DOCUSIGN_CONFIG.map do |k, v|
17 | config.send("#{k}=", v)
18 | end
19 |
20 | # Settings in config/environments/* take precedence over those specified here.
21 | # Application configuration can go into files in config/initializers
22 | # -- all .rb files in that directory are automatically loaded after loading
23 | # the framework and any gems in your application.
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg017_set_template_tab_values_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eeg017SetTemplateTabValuesController < EgController
4 | before_action -> { check_auth('eSignature') }
5 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 17, 'eSignature') }
6 |
7 | def create
8 | template_id = session[:template_id]
9 |
10 | if template_id
11 | envelope_args = {
12 | signer_email: params['signerEmail'],
13 | signer_name: params['signerName'],
14 | cc_email: params['ccEmail'],
15 | cc_name: params['ccName'],
16 | ds_ping_url: Rails.application.config.app_url,
17 | template_id: template_id
18 | }
19 | args = {
20 | account_id: session['ds_account_id'],
21 | base_path: session['ds_base_path'],
22 | access_token: session['ds_access_token'],
23 | envelope_args: envelope_args
24 | }
25 | begin
26 | redirect_url = ESign::Eg017SetTemplateTabValuesService.new(args).worker
27 | redirect_to redirect_url
28 | rescue DocuSign_eSign::ApiError => e
29 | handle_error(e)
30 | end
31 | elsif !template_id
32 | @title = @example['ExampleName']
33 | @template_ok = false
34 | end
35 | end
36 | end
37 |
--------------------------------------------------------------------------------
/app/services/e_sign/eg033_unpauses_signature_workflow_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eg033UnpausesSignatureWorkflowService
4 | attr_reader :args
5 |
6 | include ApiCreator
7 |
8 | def initialize(args)
9 | @args = args
10 | end
11 |
12 | def worker
13 | #ds-snippet-start:eSign33Step2
14 | configuration = DocuSign_eSign::Configuration.new
15 | configuration.host = args[:basePath]
16 |
17 | api_client = DocuSign_eSign::ApiClient.new configuration
18 | api_client.set_default_header('Authorization', "Bearer #{args[:accessToken]}")
19 | #ds-snippet-end:eSign33Step2
20 |
21 | #ds-snippet-start:eSign33Step3
22 | workflow = DocuSign_eSign::Workflow.new(status: args[:status])
23 |
24 | envelope_definition = DocuSign_eSign::EnvelopeDefinition.new(workflow: workflow)
25 | #ds-snippet-end:eSign33Step3
26 |
27 | #ds-snippet-start:eSign33Step4
28 | envelopes_api = DocuSign_eSign::EnvelopesApi.new(api_client)
29 |
30 | update_options = DocuSign_eSign::UpdateOptions.new
31 | update_options.resend_envelope = true
32 |
33 | envelopes_api.update(
34 | args[:accountId],
35 | args[:envelopeId],
36 | envelope_definition,
37 | update_options
38 | )
39 | end
40 | #ds-snippet-end:eSign33Step4
41 | end
42 |
--------------------------------------------------------------------------------
/app/controllers/room_api/reg008_grant_office_access_to_form_group_controller.rb:
--------------------------------------------------------------------------------
1 | class RoomApi::Reg008GrantOfficeAccessToFormGroupController < EgController
2 | before_action -> { check_auth('Rooms') }
3 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 8, 'Rooms') }
4 |
5 | def create
6 | args = {
7 | office_id: params[:office_id],
8 | form_group_id: params[:form_group_id],
9 | account_id: session[:ds_account_id],
10 | access_token: session[:ds_access_token]
11 | }
12 |
13 | results = RoomApi::Eg008GrantOfficeAccessToFormGroupService.new(args).worker
14 | result = results.to_json.to_json
15 | if result['exception']
16 | @error_code = results[:exception]
17 | @error_message = 'Office may already have access to form group.'
18 | render 'ds_common/error'
19 | else
20 | @title = @example['ExampleName']
21 | @message = 'office access has been granted for the form group.'
22 | render 'ds_common/example_done'
23 | end
24 | end
25 |
26 | def get
27 | super
28 | # Step 3 start
29 | @offices = RoomApi::GetDataService.new(session).get_offices
30 | # Step 3 end
31 |
32 | # Step 4 start
33 | @form_groups = RoomApi::GetDataService.new(session).get_form_groups
34 | # Step 4 end
35 | end
36 | end
37 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg022_kba_authentication/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% signer_email_index = 0 %>
5 | <% signer_name_index = 1 %>
6 |
7 |
--------------------------------------------------------------------------------
/app/services/e_sign/get_data_service.rb:
--------------------------------------------------------------------------------
1 | class ESign::GetDataService
2 | attr_reader :args
3 |
4 | def initialize(access_token, base_path)
5 | @args = {
6 | access_token: access_token,
7 | base_path: base_path
8 | }
9 | end
10 |
11 | def get_current_user_email
12 | worker
13 |
14 | user_info = @api_client.get_user_info(args[:access_token])
15 | raise 'The user does not have access to account' unless user_info
16 |
17 | user_info.email
18 | end
19 |
20 | def get_current_user_name
21 | worker
22 |
23 | user_info = @api_client.get_user_info(args[:access_token])
24 | raise 'The user does not have access to account' unless user_info
25 |
26 | user_info.name
27 | end
28 |
29 | def cfr?(account_id)
30 | worker
31 | accounts_api = DocuSign_eSign::AccountsApi.new @api_client
32 | account_details = accounts_api.get_account_information(account_id)
33 | account_details.status21_cfr_part11
34 | end
35 |
36 | private
37 |
38 | def worker
39 | configuration = DocuSign_eSign::Configuration.new
40 | configuration.host = args[:base_path]
41 |
42 | @api_client = DocuSign_eSign::ApiClient.new(configuration)
43 | @api_client.set_base_path(args[:base_path])
44 | @api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}")
45 | end
46 | end
47 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg023_idv_authentication/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% signer_email_index = 0 %>
5 | <% signer_name_index = 1 %>
6 |
7 |
27 |
--------------------------------------------------------------------------------
/app/controllers/admin_api/aeg003_bulk_export_user_data_controller.rb:
--------------------------------------------------------------------------------
1 | class AdminApi::Aeg003BulkExportUserDataController < EgController
2 | before_action -> { check_auth('Admin') }
3 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 3, 'Admin') }
4 |
5 | def create
6 | session[:organization_id] = AdminApi::GetDataService.new(session).get_organization_id if session[:organization_id].nil?
7 |
8 | file_path = File.expand_path(File.join(File.dirname(__FILE__), '../../../data/exportedUserData.csv'))
9 |
10 | begin
11 | request_body = {
12 | type: 'organization_memberships_export'
13 | }
14 | args = {
15 | account_id: session['ds_account_id'],
16 | base_path: session['ds_base_path'],
17 | access_token: session['ds_access_token'],
18 | organization_id: session['organization_id'],
19 | file_path: file_path,
20 | request_body: request_body
21 | }
22 |
23 | results = AdminApi::Eg003BulkExportUserDataService.new(args).worker
24 |
25 | @title = @example['ExampleName']
26 | @message = format_string(@example['ResultsPageText'], file_path)
27 | @json = results.to_json.to_json
28 | render 'ds_common/example_done'
29 | rescue DocuSign_Admin::ApiError => e
30 | handle_error(e)
31 | end
32 | end
33 | end
34 |
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg022_kba_authentication_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eeg022KbaAuthenticationController < EgController
4 | before_action -> { check_auth('eSignature') }
5 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 22, 'eSignature') }
6 |
7 | def create
8 | envelope_args = {
9 | signer_email: param_gsub(params['signerEmail']),
10 | signer_name: param_gsub(params['signerName']),
11 | status: 'sent'
12 | }
13 | args = {
14 | account_id: session['ds_account_id'],
15 | base_path: session['ds_base_path'],
16 | access_token: session['ds_access_token'],
17 | envelope_args: envelope_args
18 | }
19 |
20 | if Rails.application.config.signer_email == envelope_args[:signer_email]
21 | @error_code = 400
22 | @error_message = @manifest['SupportingTexts']['IdenticalEmailsNotAllowedErrorMessage']
23 | return render 'ds_common/error'
24 | end
25 |
26 | results = ESign::Eg022KbaAuthenticationService.new(args).worker
27 | session[:envelope_id] = results.envelope_id
28 |
29 | @title = @example['ExampleName']
30 | @message = format_string(@example['ResultsPageText'], results.envelope_id)
31 | render 'ds_common/example_done'
32 | rescue DocuSign_eSign::ApiError => e
33 | handle_error(e)
34 | end
35 | end
36 |
--------------------------------------------------------------------------------
/app/controllers/room_api/reg009_assign_form_to_form_group_controller.rb:
--------------------------------------------------------------------------------
1 | class RoomApi::Reg009AssignFormToFormGroupController < EgController
2 | before_action -> { check_auth('Rooms') }
3 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 9, 'Rooms') }
4 |
5 | def create
6 | args = {
7 | form_id: params[:form_id],
8 | form_group_id: params[:form_group_id],
9 | account_id: session[:ds_account_id],
10 | access_token: session[:ds_access_token]
11 | }
12 |
13 | results = RoomApi::Eg009AssignFormToFormGroupService.new(args).worker
14 | result = results.to_json.to_json
15 | if result['exception']
16 | @error_code = results[:exception]
17 | @error_message = 'Form may already be assigned to form group.'
18 | render 'ds_common/error'
19 | else
20 | @title = @example['ExampleName']
21 | @message = 'Form has been assigned to the selected form group.'
22 |
23 | render 'ds_common/example_done'
24 | end
25 | end
26 |
27 | def get
28 | super
29 | #ds-snippet-start:Rooms9Step3
30 | @forms = RoomApi::GetDataService.new(session).get_form_libraries
31 | #ds-snippet-end:Rooms9Step3
32 |
33 | #ds-snippet-start:Rooms9Step4
34 | @form_groups = RoomApi::GetDataService.new(session).get_form_groups
35 | #ds-snippet-end:Rooms9Step4
36 | end
37 | end
38 |
--------------------------------------------------------------------------------
/app/views/room_api/reg008_grant_office_access_to_form_group/get.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% office_index = 0 %>
5 | <% form_group_index = 1 %>
6 | <% redirect_to7_index = 0 %>
7 |
8 | <% if @form_groups.present? %>
9 |
24 | <% else %>
25 |
26 | <%= sanitize format_string(@example["RedirectsToOtherCodeExamples"][redirect_to7_index]["RedirectText"], 'href="reg007"') %>
27 |
28 | <% end %>
--------------------------------------------------------------------------------
/app/views/room_api/reg009_assign_form_to_form_group/get.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% form_id_index = 0 %>
5 | <% form_group_id_index = 1 %>
6 | <% redirect_to7_index = 0 %>
7 |
8 | <% if @form_groups.present? %>
9 |
24 | <% else %>
25 |
26 | <%= sanitize format_string(@example["RedirectsToOtherCodeExamples"][redirect_to7_index]["RedirectText"], 'href="reg007"') %>
27 |
28 | <% end %>
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg002_signing_via_email_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require_relative '../../services/utils'
4 |
5 | class ESign::Eeg002SigningViaEmailController < EgController
6 | before_action -> { check_auth('eSignature') }
7 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 2, 'eSignature') }
8 |
9 | def create
10 | envelope_args = {
11 | signer_email: param_gsub(params['signerEmail']),
12 | signer_name: param_gsub(params['signerName']),
13 | cc_email: param_gsub(params['ccEmail']),
14 | cc_name: param_gsub(params['ccName']),
15 | status: 'sent',
16 | doc_docx: File.join('data', Rails.application.config.doc_docx),
17 | doc_pdf: File.join('data', Rails.application.config.doc_pdf)
18 | }
19 | args = {
20 | account_id: session['ds_account_id'],
21 | base_path: session['ds_base_path'],
22 | access_token: session['ds_access_token'],
23 | envelope_args: envelope_args
24 | }
25 | results = ESign::Eg002SigningViaEmailService.new(args).worker
26 | session[:envelope_id] = results['envelope_id']
27 | @title = @example['ExampleName']
28 | @message = format_string(@example['ResultsPageText'], results['envelope_id'])
29 | render 'ds_common/example_done'
30 | rescue DocuSign_eSign::ApiError => e
31 | handle_error(e)
32 | end
33 | end
34 |
--------------------------------------------------------------------------------
/app/views/eeg001_embedded_signing/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% signer_email_index = 0 %>
5 | <% signer_name_index = 1 %>
6 |
7 |
--------------------------------------------------------------------------------
/app/views/room_api/reg002_create_room_with_template/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% room_name_index = 0 %>
5 | <% template_index = 1 %>
6 | <% create_room_redirect_index = 0 %>
7 |
8 | <% unless @templates.blank? %>
9 | <% %>
10 |
25 |
26 | <% else %>
27 |
28 | Room
29 | <%= sanitize @example["RedirectsToOtherCodeExamples"][create_room_redirect_index]["RedirectText"] %>
30 |
31 | <% end %>
32 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg044_focused_view/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% signer_email_index = 0 %>
5 | <% signer_name_index = 1 %>
6 |
7 |
--------------------------------------------------------------------------------
/app/services/e_sign/eg045_delete_restore_envelope_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eg045DeleteRestoreEnvelopeService
4 | include ApiCreator
5 |
6 | def delete_envelope(args)
7 | #ds-snippet-start:eSign45Step2
8 | folders_api = create_folders_api(args)
9 | #ds-snippet-end:eSign45Step2
10 |
11 | #ds-snippet-start:eSign45Step3
12 | folders_request = DocuSign_eSign::FoldersRequest.new
13 | folders_request.envelope_ids = [args[:envelope_id]]
14 | #ds-snippet-end:eSign45Step3
15 |
16 | #ds-snippet-start:eSign45Step4
17 | folders_api.move_envelopes(args[:account_id], args[:delete_folder_id], folders_request)
18 | #ds-snippet-end:eSign45Step4
19 | end
20 |
21 | def move_envelope_to_folder(args)
22 | folders_api = create_folders_api(args)
23 |
24 | #ds-snippet-start:eSign45Step6
25 | folders_request = DocuSign_eSign::FoldersRequest.new
26 | folders_request.envelope_ids = [args[:envelope_id]]
27 | folders_request.from_folder_id = args[:from_folder_id]
28 |
29 | folders_api.move_envelopes(args[:account_id], args[:folder_id], folders_request)
30 | #ds-snippet-end:eSign45Step6
31 | end
32 |
33 | def get_folders(args)
34 | folders_api = create_folders_api(args)
35 |
36 | #ds-snippet-start:eSign45Step5
37 | folders_api.list(args[:account_id])
38 | #ds-snippet-end:eSign45Step5
39 | end
40 | end
41 |
--------------------------------------------------------------------------------
/app/views/room_api/reg005_get_rooms_with_filters/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% start_index = 0 %>
5 | <% end_index = 1 %>
6 |
7 | <% if @rooms.count.positive? %>
8 |
9 |
23 |
24 | <% else %>
25 |
26 |
36 |
37 | <% end %>
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg027_permissions_delete_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eeg027PermissionsDeleteController < EgController
4 | include ApiCreator
5 | before_action -> { check_auth('eSignature') }
6 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 27, 'eSignature') }
7 |
8 | def get
9 | args = {
10 | account_id: session['ds_account_id'],
11 | base_path: session['ds_base_path'],
12 | access_token: session['ds_access_token']
13 | }
14 | accounts_api = create_account_api(args)
15 | permissions = accounts_api.list_permissions(args[:account_id], DocuSign_eSign::ListPermissionsOptions.default)
16 | @permissions_lists = permissions.permission_profiles
17 | super
18 | end
19 |
20 | def create
21 | args = {
22 | account_id: session[:ds_account_id],
23 | base_path: session[:ds_base_path],
24 | access_token: session[:ds_access_token],
25 | permission_profile_id: params[:lists]
26 | }
27 |
28 | ESign::Eg027PermissionsDeleteService.new(args).worker
29 | # Step 4. a) Call the eSignature API
30 | # b) Display the JSON response
31 | @title = @example['ExampleName']
32 | @message = "Permission profile #{params[:lists]} was deleted"
33 | render 'ds_common/example_done'
34 | rescue DocuSign_eSign::ApiError => e
35 | handle_error(e)
36 | end
37 | end
38 |
--------------------------------------------------------------------------------
/app/services/room_api/eg006_create_an_external_form_fill_session_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class RoomApi::Eg006CreateAnExternalFormFillSessionService
4 | attr_reader :args
5 |
6 | def initialize(args)
7 | @args = args
8 | end
9 |
10 | def worker
11 | #ds-snippet-start:Rooms6Step2
12 | configuration = DocuSign_Rooms::Configuration.new
13 | configuration.host = Rails.configuration.rooms_host
14 | api_client = DocuSign_Rooms::ApiClient.new(configuration)
15 | api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}")
16 | #ds-snippet-end:Rooms6Step2
17 |
18 | #ds-snippet-start:Rooms6Step4
19 | rooms_api = DocuSign_Rooms::ExternalFormFillSessionsApi.new(api_client)
20 | rooms_api.create_external_form_fill_session(args[:account_id], body(args))
21 | #ds-snippet-end:Rooms6Step4
22 | end
23 |
24 | private
25 |
26 | #ds-snippet-start:Rooms6Step3
27 | def body(args)
28 | DocuSign_Rooms::ExternalFormFillSessionForCreate.new({
29 | formId: args[:form_id],
30 | roomId: args[:room_id],
31 | xFrameAllowedUrl: "http://#{args[:allowed_host]}"
32 | })
33 | end
34 | #ds-snippet-end:Rooms6Step3
35 | end
36 |
--------------------------------------------------------------------------------
/app/views/connect/cneg001_validate_webhook_message/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 |
4 | Prerequisite: See How to validate an HMAC signature .
5 |
6 |
7 | <% form_index = 0 %>
8 | <% secret_index = 0 %>
9 | <% payload_index = 1 %>
10 |
11 |
--------------------------------------------------------------------------------
/app/views/e_sign/eeg016_set_envelope_tab_data/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% signer_name_index = 0 %>
5 | <% signer_email_index = 1 %>
6 |
7 |
8 | <% if @example["Forms"][form_index]["FormName"] %>
9 | <%= sanitize @example["Forms"][form_index]["FormName"] %>
10 | <% end %>
11 |
12 |
13 | <%= @example["Forms"][form_index]["Inputs"][signer_email_index]["InputName"] %>
14 | " required
17 | value="<%= @config.signer_email %>">
18 | <%= render('partials/email_will_not_be_shared') %>
19 |
20 |
21 | <%= @example["Forms"][form_index]["Inputs"][signer_name_index]["InputName"] %>
22 | " name="signerName"
24 | value="<%= @config.signer_name %>" required>
25 |
26 | <%= render('partials/submit_button') %>
27 |
--------------------------------------------------------------------------------
/app/views/admin_api/aeg009_delete_user_product_permission_profile/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% product_index = 0 %>
5 | <% redirect_to2_index = 0 %>
6 |
7 | <% if @email_ok %>
8 | <% if @example["Forms"][form_index]["FormName"] %>
9 | <%= sanitize format_string(@example["Forms"][form_index]["FormName"], @email) %>
10 | <% end %>
11 |
12 |
13 | <% if @permission_profile_list.present? %>
14 |
15 | <%= @example["Forms"][form_index]["Inputs"][product_index]["InputName"] %>
16 | <%= select_tag "product_id", options_for_select(@permission_profile_list.map { |obj| [obj['permission_name'], obj['product_id']] }), { :class => 'form-control' } %>
17 |
18 | <% else %>
19 |
23 | <% end %>
24 | <%= render('partials/submit_button') %>
25 |
26 | <% else %>
27 | <%= sanitize format_string(@example["RedirectsToOtherCodeExamples"][redirect_to2_index]["RedirectText"], 'href="aeg002"') %>
28 |
29 |
30 | <%= render('partials/continue_button') %>
31 |
32 | <% end %>
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg010_send_binary_docs_controller.rb:
--------------------------------------------------------------------------------
1 | class ESign::Eeg010SendBinaryDocsController < EgController
2 | before_action -> { check_auth('eSignature') }
3 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 10, 'eSignature') }
4 |
5 | def create
6 | envelope_args = {
7 | # Validation: Delete any non-usual characters
8 | signer_email: param_gsub(params['signerEmail']),
9 | signer_name: param_gsub(params['signerName']),
10 | cc_email: param_gsub(params['ccEmail']),
11 | cc_name: param_gsub(params['ccName'])
12 | }
13 |
14 | args = {
15 | account_id: session['ds_account_id'],
16 | base_path: session['ds_base_path'],
17 | access_token: session['ds_access_token'],
18 | envelope_args: envelope_args
19 | }
20 |
21 | results = ESign::Eg010SendBinaryDocsService.new(args).worker
22 | session[:envelope_id] = results['envelope_id']
23 | @title = @example['ExampleName']
24 | @message = format_string(@example['ResultsPageText'], results['envelope_id'])
25 | render 'ds_common/example_done'
26 | rescue Net::HTTPError => e
27 | if !e.response.nil?
28 | json_response = JSON.parse e.response
29 | @error_code = json_response['errorCode']
30 | @error_message = json_response['message']
31 | else
32 | @error_code = 'API request problem'
33 | @error_message = e.to_s
34 | end
35 | end
36 | end
37 |
--------------------------------------------------------------------------------
/quick_acg/app/views/ds_common/error.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | <% if @title %>
10 | <%= @title %>
11 | <% else %>
12 | Docusign Ruby Code Examples
13 | <% end %>
14 |
15 |
16 |
19 |
20 |
21 |
22 |
23 |
28 |
29 |
30 |
31 | <% title = "Error" %>
32 |
33 | Problem: an error occurred
34 | Error information:
35 |
36 | <% if @error_code %>
37 | <%= @error_code %>: <%= @error_message %>
38 | <% end %>
39 | <% if @error_information %>
40 | <%== @error_information %>
41 | <% end %>
42 | <% if @err %>
43 |
44 |
<%= @err %>
45 |
46 | <% end %>
47 |
48 |
49 | Continue
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/app/services/admin_api/eg008_update_user_product_permission_profile_service.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class AdminApi::Eg008UpdateUserProductPermissionProfileService
4 | attr_reader :args
5 |
6 | def initialize(args)
7 | @args = args
8 | end
9 |
10 | def worker
11 | #ds-snippet-start:Admin8Step2
12 | configuration = DocuSign_Admin::Configuration.new
13 | configuration.host = Rails.configuration.admin_host
14 |
15 | api_client = DocuSign_Admin::ApiClient.new(configuration)
16 | api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}")
17 | #ds-snippet-end:Admin8Step2
18 |
19 | #ds-snippet-start:Admin8Step3
20 | product_permission_profile = DocuSign_Admin::ProductPermissionProfileRequest.new({ 'permission_profile_id' => args[:permission_profile_id], 'product_id' => args[:product_id] })
21 | user_product_permission_profile_request = DocuSign_Admin::UserProductPermissionProfilesRequest.new({ 'email' => args[:email], 'product_permission_profiles' => [product_permission_profile] })
22 | #ds-snippet-end:Admin8Step3
23 |
24 | #ds-snippet-start:Admin8Step4
25 | product_permission_profiles_api = DocuSign_Admin::ProductPermissionProfilesApi.new(api_client)
26 | product_permission_profiles_api.add_user_product_permission_profiles_by_email(args[:organization_id], args[:account_id], user_product_permission_profile_request)
27 | #ds-snippet-end:Admin8Step4
28 | end
29 | end
30 |
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg031_bulk_sending_envelopes_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eeg031BulkSendingEnvelopesController < EgController
4 | before_action -> { check_auth('eSignature') }
5 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 31, 'eSignature') }
6 |
7 | def create
8 | signers = {
9 | signer_email: param_gsub(params['signerEmail1']),
10 | signer_name: param_gsub(params['signerName1']),
11 | cc_email: param_gsub(params['ccEmail1']),
12 | cc_name: param_gsub(params['ccName1']),
13 | status: 'created',
14 |
15 | signer_email1: param_gsub(params['signerEmail2']),
16 | signer_name1: param_gsub(params['signerName2']),
17 | cc_email1: param_gsub(params['ccEmail2']),
18 | cc_name1: param_gsub(params['ccName2'])
19 | }
20 | args = {
21 | account_id: session['ds_account_id'],
22 | base_path: session['ds_base_path'],
23 | access_token: session['ds_access_token']
24 | }
25 |
26 | results = ESign::Eg031BulkSendingEnvelopesService.new(args, signers).worker
27 | # Step 4. a) Call the eSignature API
28 | # b) Display the JSON response
29 | @title = @example['ExampleName']
30 | @message = @example['ResultsPageText']
31 | @json = results.to_json.to_json
32 |
33 | render 'ds_common/example_done'
34 | rescue DocuSign_eSign::ApiError => e
35 | handle_error(e)
36 | end
37 | end
38 |
--------------------------------------------------------------------------------
/app/views/notary/neg004_send_with_third_party_notary/get.html.erb:
--------------------------------------------------------------------------------
1 | <%= render('partials/example_info') %>
2 |
3 | <% form_index = 0 %>
4 | <% signer_email_index = 0 %>
5 | <% signer_name_index = 1 %>
6 |
7 |
8 | <% if @example["Forms"][form_index]["FormName"] %>
9 | <%= sanitize @example["Forms"][form_index]["FormName"] %>
10 | <% end %>
11 |
12 |
13 | <%= @example["Forms"][form_index]["Inputs"][signer_email_index]["InputName"] %>
14 | " required
17 | value="<%= @config.signer_email %>">
18 | <%= render('partials/email_will_not_be_shared') %>
19 |
20 |
21 | <%= @example["Forms"][form_index]["Inputs"][signer_name_index]["InputName"] %>
22 | " name="signerName"
24 | value="<%= @config.signer_name %>" required>
25 |
26 | <%= render('partials/submit_button') %>
27 |
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg007_envelope_get_doc_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eeg007EnvelopeGetDocController < EgController
4 | before_action -> { check_auth('eSignature') }
5 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 7, 'eSignature') }
6 |
7 | def create
8 | envelope_id = session[:envelope_id]
9 | envelope_documents = session[:envelope_documents]
10 | if envelope_id && envelope_documents
11 | begin
12 | document_id = param_gsub(params['docSelect'])
13 | args = {
14 | account_id: session['ds_account_id'],
15 | base_path: session['ds_base_path'],
16 | access_token: session['ds_access_token'],
17 | envelope_id: envelope_id,
18 | document_id: document_id,
19 | envelope_documents: envelope_documents
20 | }
21 | results = ESign::Eg007EnvelopeGetDocService.new(args).worker
22 | send_data results['data'], filename: results['doc_name'],
23 | content_type: results['mime_type'],
24 | disposition: "attachment; filename=\"#{results['doc_name']}\""
25 | rescue DocuSign_eSign::ApiError => e
26 | handle_error(e)
27 | end
28 | elsif !envelope_id || !envelope_documents
29 | @title = @example['ExampleName']
30 | @envelope_ok = false
31 | @documents_ok = false
32 | end
33 | end
34 | end
35 |
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg042_document_generation_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require_relative '../../services/utils'
4 |
5 | class ESign::Eeg042DocumentGenerationController < EgController
6 | before_action -> { check_auth('eSignature') }
7 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 42, 'eSignature') }
8 |
9 | def create
10 | envelope_args = {
11 | candidate_email: param_gsub(params['candidate_email']),
12 | candidate_name: param_gsub(params['candidate_name']),
13 | manager_name: param_gsub(params['manager_name']),
14 | job_title: param_gsub(params['job_title']),
15 | salary: param_gsub(params['salary']),
16 | rsus: param_gsub(params['rsus']),
17 | start_date: param_gsub(params['start_date']),
18 | doc_file: File.join('data', Rails.application.config.offer_letter_dynamic_table)
19 | }
20 | args = {
21 | account_id: session['ds_account_id'],
22 | base_path: session['ds_base_path'],
23 | access_token: session['ds_access_token'],
24 | envelope_args: envelope_args
25 | }
26 | results = ESign::Eg042DocumentGenerationService.new(args).worker
27 | session[:envelope_id] = results['envelope_id']
28 | @title = @example['ExampleName']
29 | @message = format_string(@example['ResultsPageText'], results['envelope_id'])
30 | render 'ds_common/example_done'
31 | rescue DocuSign_eSign::ApiError => e
32 | handle_error(e)
33 | end
34 | end
35 |
--------------------------------------------------------------------------------
/app/controllers/e_sign/eeg026_permissions_change_single_setting_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ESign::Eeg026PermissionsChangeSingleSettingController < EgController
4 | include ApiCreator
5 | before_action -> { check_auth('eSignature') }
6 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 26, 'eSignature') }
7 |
8 | def get
9 | args = {
10 | account_id: session['ds_account_id'],
11 | base_path: session['ds_base_path'],
12 | access_token: session['ds_access_token']
13 | }
14 | accounts_api = create_account_api(args)
15 | permissions = accounts_api.list_permissions(args[:account_id], DocuSign_eSign::ListPermissionsOptions.default)
16 | @permissions_lists = permissions.permission_profiles
17 | super
18 | end
19 |
20 | def create
21 | args = {
22 | account_id: session[:ds_account_id],
23 | base_path: session[:ds_base_path],
24 | access_token: session[:ds_access_token],
25 | permission_profile_id: params[:lists]
26 | }
27 |
28 | results = ESign::Eg026PermissionsChangeSingleSettingService.new(args).worker
29 | # Step 4. a) Call the eSignature API
30 | # b) Display the JSON response
31 | @title = @example['ExampleName']
32 | @message = 'Existing permission profile was changed'
33 | @json = results.to_json.to_json
34 | render 'ds_common/example_done'
35 | rescue DocuSign_eSign::ApiError => e
36 | handle_error(e)
37 | end
38 | end
39 |
--------------------------------------------------------------------------------
/app/controllers/eeg001_embedded_signing_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class Eeg001EmbeddedSigningController < EgController
4 | before_action -> { check_auth('eSignature') }
5 | before_action -> { @example = Utils::ManifestUtils.new.get_example(@manifest, 1) }
6 |
7 | def create
8 | pdf_file_path = 'data/World_Wide_Corp_lorem.pdf'
9 |
10 | pdf_file_path = '../data/World_Wide_Corp_lorem.pdf' unless File.exist?(pdf_file_path)
11 |
12 | args = {
13 | account_id: session[:ds_account_id],
14 | base_path: session[:ds_base_path],
15 | access_token: session[:ds_access_token],
16 | signer_email: param_gsub(params[:signerEmail]),
17 | signer_name: param_gsub(params[:signerName]),
18 | ds_ping_url: Rails.application.config.app_url,
19 | signer_client_id: 1000,
20 | pdf_filename: pdf_file_path
21 | }
22 |
23 | redirect_url = Eg001EmbeddedSigningService.new(args).worker
24 | redirect_to redirect_url
25 | rescue DocuSign_eSign::ApiError => e
26 | handle_error(e)
27 | end
28 |
29 | def get
30 | enableCFR = ESign::GetDataService.new(session[:ds_access_token], session[:ds_base_path]).cfr?(session[:ds_account_id])
31 | if enableCFR == 'enabled'
32 | session[:status_cfr] = 'enabled'
33 | @title = 'Not CFR Part 11 compatible'
34 | @error_information = @manifest['SupportingTexts']['CFRError']
35 | render 'ds_common/error'
36 | end
37 | session[:been_here] = true
38 | super
39 | end
40 | end
41 |
--------------------------------------------------------------------------------
/app/views/layouts/_foot.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | <% if false %>
22 |
23 |
24 | locals:
25 | <%= JSON.stringify(locals, null, " ") %>
26 |
27 | <% end %>
28 |
29 |
30 |
32 |