Skip to content

Commit

Permalink
codeDepot markers
Browse files Browse the repository at this point in the history
  • Loading branch information
paigesrossi committed Feb 15, 2024
1 parent 6897222 commit d714bb5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
13 changes: 10 additions & 3 deletions app/services/webforms/eg001_create_instance_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,20 @@ def create_web_form_template
end

def list_web_forms
#ds-snippet-start:WebForms1Step2
configuration = DocuSign_WebForms::Configuration.new

api_client = DocuSign_WebForms::ApiClient.new(configuration)
api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}")
#ds-snippet-end:WebForms1Step2

#ds-snippet-start:WebForms1Step3
webforms_api = DocuSign_WebForms::FormManagementApi.new(api_client)

options = DocuSign_WebForms::ListFormsOptions.new
options.search = args[:form_name]

webforms_api.list_forms(args[:account_id], options)
#ds-snippet-end:WebForms1Step3
end

def create_web_form_instance(form_id)
Expand All @@ -47,8 +50,7 @@ def create_web_form_instance(form_id)
api_client = DocuSign_WebForms::ApiClient.new(configuration)
api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}")

webforms_api = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)

#ds-snippet-start:WebForms1Step4
web_form_values = {
'PhoneNumber' => '555-555-5555',
'Yes' => ['Yes'],
Expand All @@ -60,7 +62,12 @@ def create_web_form_instance(form_id)
'formValues' => web_form_values,
'expirationOffset' => '3600'
})
#ds-snippet-end:WebForms1Step4

#ds-snippet-start:WebForms1Step5
webforms_api = DocuSign_WebForms::FormInstanceManagementApi.new(api_client)
webforms_api.create_instance(args[:account_id], form_id, web_form_req_object)
#ds-snippet-end:WebForms1Step5
end

private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

<p><a href="/">Continue</a></p>

<!--
#ds-snippet-start:WebForms1Step6
-->

<script src="https://js.docusign.com/bundle.js"></script>
<script>
async function loadWebform() {
Expand Down Expand Up @@ -87,4 +91,8 @@
webFormWidget.mount("#docusign");
}
loadWebform();
</script>
</script>

<!--
#ds-snippet-end:WebForms1Step6
-->

0 comments on commit d714bb5

Please sign in to comment.