dropbox-sign 1.0.0.pre.beta2301
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +78 -0
- data/LICENSE +21 -0
- data/README.md +333 -0
- data/Rakefile +10 -0
- data/bin/generate-examples.php +269 -0
- data/bin/php +16 -0
- data/bin/replace +11 -0
- data/bin/ruby +16 -0
- data/bin/scan_for +32 -0
- data/composer.json +10 -0
- data/composer.lock +246 -0
- data/docs/AccountApi.md +301 -0
- data/docs/AccountCreateRequest.md +13 -0
- data/docs/AccountCreateResponse.md +12 -0
- data/docs/AccountGetResponse.md +11 -0
- data/docs/AccountResponse.md +19 -0
- data/docs/AccountResponseQuotas.md +14 -0
- data/docs/AccountUpdateRequest.md +12 -0
- data/docs/AccountVerifyRequest.md +10 -0
- data/docs/AccountVerifyResponse.md +11 -0
- data/docs/AccountVerifyResponseAccount.md +10 -0
- data/docs/ApiAppApi.md +402 -0
- data/docs/ApiAppCreateRequest.md +16 -0
- data/docs/ApiAppGetResponse.md +11 -0
- data/docs/ApiAppListResponse.md +12 -0
- data/docs/ApiAppResponse.md +19 -0
- data/docs/ApiAppResponseOAuth.md +13 -0
- data/docs/ApiAppResponseOptions.md +10 -0
- data/docs/ApiAppResponseOwnerAccount.md +11 -0
- data/docs/ApiAppResponseWhiteLabelingOptions.md +23 -0
- data/docs/ApiAppUpdateRequest.md +16 -0
- data/docs/BulkSendJobApi.md +155 -0
- data/docs/BulkSendJobGetResponse.md +13 -0
- data/docs/BulkSendJobGetResponseSignatureRequests.md +33 -0
- data/docs/BulkSendJobListResponse.md +12 -0
- data/docs/BulkSendJobResponse.md +13 -0
- data/docs/BulkSendJobSendResponse.md +11 -0
- data/docs/EmbeddedApi.md +158 -0
- data/docs/EmbeddedEditUrlRequest.md +19 -0
- data/docs/EmbeddedEditUrlResponse.md +11 -0
- data/docs/EmbeddedEditUrlResponseEmbedded.md +11 -0
- data/docs/EmbeddedSignUrlResponse.md +11 -0
- data/docs/EmbeddedSignUrlResponseEmbedded.md +11 -0
- data/docs/ErrorResponse.md +10 -0
- data/docs/ErrorResponseError.md +12 -0
- data/docs/EventCallbackRequest.md +13 -0
- data/docs/EventCallbackRequestEvent.md +13 -0
- data/docs/EventCallbackRequestEventMetadata.md +13 -0
- data/docs/FileResponse.md +11 -0
- data/docs/FileResponseDataUri.md +10 -0
- data/docs/ListInfoResponse.md +13 -0
- data/docs/OAuthApi.md +158 -0
- data/docs/OAuthTokenGenerateRequest.md +14 -0
- data/docs/OAuthTokenRefreshRequest.md +11 -0
- data/docs/OAuthTokenResponse.md +14 -0
- data/docs/ReportApi.md +83 -0
- data/docs/ReportCreateRequest.md +12 -0
- data/docs/ReportCreateResponse.md +11 -0
- data/docs/ReportResponse.md +13 -0
- data/docs/SignatureRequestApi.md +1377 -0
- data/docs/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.md +22 -0
- data/docs/SignatureRequestBulkSendWithTemplateRequest.md +22 -0
- data/docs/SignatureRequestCreateEmbeddedRequest.md +33 -0
- data/docs/SignatureRequestCreateEmbeddedWithTemplateRequest.md +24 -0
- data/docs/SignatureRequestGetResponse.md +11 -0
- data/docs/SignatureRequestListResponse.md +12 -0
- data/docs/SignatureRequestRemindRequest.md +11 -0
- data/docs/SignatureRequestResponse.md +32 -0
- data/docs/SignatureRequestResponseAttachment.md +15 -0
- data/docs/SignatureRequestResponseCustomFieldBase.md +17 -0
- data/docs/SignatureRequestResponseCustomFieldCheckbox.md +11 -0
- data/docs/SignatureRequestResponseCustomFieldText.md +11 -0
- data/docs/SignatureRequestResponseCustomFieldTypeEnum.md +9 -0
- data/docs/SignatureRequestResponseDataBase.md +14 -0
- data/docs/SignatureRequestResponseDataTypeEnum.md +9 -0
- data/docs/SignatureRequestResponseDataValueCheckbox.md +11 -0
- data/docs/SignatureRequestResponseDataValueCheckboxMerge.md +11 -0
- data/docs/SignatureRequestResponseDataValueDateSigned.md +11 -0
- data/docs/SignatureRequestResponseDataValueDropdown.md +11 -0
- data/docs/SignatureRequestResponseDataValueInitials.md +11 -0
- data/docs/SignatureRequestResponseDataValueRadio.md +11 -0
- data/docs/SignatureRequestResponseDataValueSignature.md +11 -0
- data/docs/SignatureRequestResponseDataValueText.md +11 -0
- data/docs/SignatureRequestResponseDataValueTextMerge.md +11 -0
- data/docs/SignatureRequestResponseSignatures.md +28 -0
- data/docs/SignatureRequestSendRequest.md +34 -0
- data/docs/SignatureRequestSendWithTemplateRequest.md +25 -0
- data/docs/SignatureRequestUpdateRequest.md +13 -0
- data/docs/SubAttachment.md +13 -0
- data/docs/SubBulkSignerList.md +11 -0
- data/docs/SubBulkSignerListCustomField.md +11 -0
- data/docs/SubCC.md +11 -0
- data/docs/SubCustomField.md +17 -0
- data/docs/SubEditorOptions.md +11 -0
- data/docs/SubFieldOptions.md +10 -0
- data/docs/SubFormFieldGroup.md +12 -0
- data/docs/SubFormFieldRule.md +13 -0
- data/docs/SubFormFieldRuleAction.md +13 -0
- data/docs/SubFormFieldRuleTrigger.md +13 -0
- data/docs/SubFormFieldsPerDocumentBase.md +33 -0
- data/docs/SubFormFieldsPerDocumentCheckbox.md +12 -0
- data/docs/SubFormFieldsPerDocumentCheckboxMerge.md +10 -0
- data/docs/SubFormFieldsPerDocumentDateSigned.md +10 -0
- data/docs/SubFormFieldsPerDocumentDropdown.md +12 -0
- data/docs/SubFormFieldsPerDocumentHyperlink.md +12 -0
- data/docs/SubFormFieldsPerDocumentInitials.md +10 -0
- data/docs/SubFormFieldsPerDocumentRadio.md +12 -0
- data/docs/SubFormFieldsPerDocumentSignature.md +10 -0
- data/docs/SubFormFieldsPerDocumentText.md +17 -0
- data/docs/SubFormFieldsPerDocumentTextMerge.md +10 -0
- data/docs/SubFormFieldsPerDocumentTypeEnum.md +9 -0
- data/docs/SubMergeField.md +11 -0
- data/docs/SubOAuth.md +11 -0
- data/docs/SubOptions.md +10 -0
- data/docs/SubSignatureRequestGroupedSigners.md +12 -0
- data/docs/SubSignatureRequestSigner.md +15 -0
- data/docs/SubSignatureRequestTemplateSigner.md +15 -0
- data/docs/SubSigningOptions.md +16 -0
- data/docs/SubTeamResponse.md +11 -0
- data/docs/SubTemplateRole.md +11 -0
- data/docs/SubUnclaimedDraftSigner.md +12 -0
- data/docs/SubUnclaimedDraftTemplateSigner.md +12 -0
- data/docs/SubWhiteLabelingOptions.md +26 -0
- data/docs/TeamAddMemberRequest.md +12 -0
- data/docs/TeamApi.md +737 -0
- data/docs/TeamCreateRequest.md +10 -0
- data/docs/TeamGetInfoResponse.md +11 -0
- data/docs/TeamGetResponse.md +11 -0
- data/docs/TeamInfoResponse.md +14 -0
- data/docs/TeamInviteResponse.md +15 -0
- data/docs/TeamInvitesResponse.md +11 -0
- data/docs/TeamMemberResponse.md +12 -0
- data/docs/TeamMembersResponse.md +12 -0
- data/docs/TeamParentResponse.md +11 -0
- data/docs/TeamRemoveMemberRequest.md +14 -0
- data/docs/TeamResponse.md +12 -0
- data/docs/TeamSubTeamsResponse.md +12 -0
- data/docs/TeamUpdateRequest.md +10 -0
- data/docs/TemplateAddUserRequest.md +12 -0
- data/docs/TemplateApi.md +782 -0
- data/docs/TemplateCreateEmbeddedDraftRequest.md +34 -0
- data/docs/TemplateCreateEmbeddedDraftResponse.md +11 -0
- data/docs/TemplateCreateEmbeddedDraftResponseTemplate.md +13 -0
- data/docs/TemplateEditResponse.md +10 -0
- data/docs/TemplateGetResponse.md +11 -0
- data/docs/TemplateListResponse.md +12 -0
- data/docs/TemplateRemoveUserRequest.md +11 -0
- data/docs/TemplateResponse.md +24 -0
- data/docs/TemplateResponseAccount.md +15 -0
- data/docs/TemplateResponseAccountQuota.md +13 -0
- data/docs/TemplateResponseCCRole.md +10 -0
- data/docs/TemplateResponseCustomField.md +22 -0
- data/docs/TemplateResponseDocument.md +15 -0
- data/docs/TemplateResponseDocumentCustomField.md +25 -0
- data/docs/TemplateResponseDocumentFieldGroup.md +11 -0
- data/docs/TemplateResponseDocumentFormField.md +23 -0
- data/docs/TemplateResponseDocumentStaticField.md +19 -0
- data/docs/TemplateResponseFieldAvgTextLength.md +11 -0
- data/docs/TemplateResponseNamedFormField.md +23 -0
- data/docs/TemplateResponseSignerRole.md +11 -0
- data/docs/TemplateUpdateFilesRequest.md +15 -0
- data/docs/TemplateUpdateFilesResponse.md +10 -0
- data/docs/TemplateUpdateFilesResponseTemplate.md +11 -0
- data/docs/UnclaimedDraftApi.md +359 -0
- data/docs/UnclaimedDraftCreateEmbeddedRequest.md +45 -0
- data/docs/UnclaimedDraftCreateEmbeddedWithTemplateRequest.md +38 -0
- data/docs/UnclaimedDraftCreateRequest.md +33 -0
- data/docs/UnclaimedDraftCreateResponse.md +11 -0
- data/docs/UnclaimedDraftEditAndResendRequest.md +17 -0
- data/docs/UnclaimedDraftResponse.md +15 -0
- data/docs/WarningResponse.md +11 -0
- data/dropbox-sign.gemspec +38 -0
- data/examples/AccountCreate.rb +21 -0
- data/examples/AccountGet.rb +18 -0
- data/examples/AccountUpdate.rb +21 -0
- data/examples/AccountVerify.rb +21 -0
- data/examples/ApiAppCreate.rb +35 -0
- data/examples/ApiAppDelete.rb +20 -0
- data/examples/ApiAppGet.rb +20 -0
- data/examples/ApiAppList.rb +21 -0
- data/examples/ApiAppUpdate.rb +32 -0
- data/examples/BulkSendJobGet.rb +20 -0
- data/examples/BulkSendJobList.rb +21 -0
- data/examples/EmbeddedEditUrl.rb +24 -0
- data/examples/EmbeddedSignUrl.rb +20 -0
- data/examples/EventCallback.rb +32 -0
- data/examples/OauthTokenGenerate.rb +24 -0
- data/examples/OauthTokenRefresh.rb +21 -0
- data/examples/ReportCreate.rb +23 -0
- data/examples/SignatureRequestBulkCreateEmbeddedWithTemplate.rb +59 -0
- data/examples/SignatureRequestBulkSendWithTemplate.rb +58 -0
- data/examples/SignatureRequestCancel.rb +20 -0
- data/examples/SignatureRequestCreateEmbedded.rb +46 -0
- data/examples/SignatureRequestCreateEmbeddedWithTemplate.rb +39 -0
- data/examples/SignatureRequestFiles.rb +20 -0
- data/examples/SignatureRequestFilesAsDataUri.rb +20 -0
- data/examples/SignatureRequestFilesAsFileUrl.rb +20 -0
- data/examples/SignatureRequestGet.rb +20 -0
- data/examples/SignatureRequestList.rb +21 -0
- data/examples/SignatureRequestReleaseHold.rb +20 -0
- data/examples/SignatureRequestRemind.rb +23 -0
- data/examples/SignatureRequestRemove.rb +20 -0
- data/examples/SignatureRequestSend.rb +56 -0
- data/examples/SignatureRequestSendWithTemplate.rb +50 -0
- data/examples/SignatureRequestUpdate.rb +24 -0
- data/examples/TeamAddMember.rb +21 -0
- data/examples/TeamCreate.rb +21 -0
- data/examples/TeamDelete.rb +18 -0
- data/examples/TeamGet.rb +18 -0
- data/examples/TeamInfo.rb +18 -0
- data/examples/TeamInvites.rb +20 -0
- data/examples/TeamMembers.rb +20 -0
- data/examples/TeamRemoveMember.rb +22 -0
- data/examples/TeamSubTeams.rb +20 -0
- data/examples/TeamUpdate.rb +21 -0
- data/examples/TemplateAddUser.rb +23 -0
- data/examples/TemplateCreateEmbeddedDraft.rb +49 -0
- data/examples/TemplateDelete.rb +20 -0
- data/examples/TemplateFiles.rb +20 -0
- data/examples/TemplateFilesAsDataUri.rb +20 -0
- data/examples/TemplateFilesAsFileUrl.rb +20 -0
- data/examples/TemplateGet.rb +20 -0
- data/examples/TemplateList.rb +20 -0
- data/examples/TemplateRemoveUser.rb +23 -0
- data/examples/TemplateUpdateFiles.rb +23 -0
- data/examples/UnclaimedDraftCreate.rb +56 -0
- data/examples/UnclaimedDraftCreateEmbedded.rb +24 -0
- data/examples/UnclaimedDraftCreateEmbeddedWithTemplate.rb +35 -0
- data/examples/UnclaimedDraftEditAndResend.rb +24 -0
- data/lib/dropbox-sign/api/account_api.rb +446 -0
- data/lib/dropbox-sign/api/api_app_api.rb +504 -0
- data/lib/dropbox-sign/api/bulk_send_job_api.rb +213 -0
- data/lib/dropbox-sign/api/embedded_api.rb +234 -0
- data/lib/dropbox-sign/api/o_auth_api.rb +215 -0
- data/lib/dropbox-sign/api/report_api.rb +134 -0
- data/lib/dropbox-sign/api/signature_request_api.rb +1620 -0
- data/lib/dropbox-sign/api/team_api.rb +1011 -0
- data/lib/dropbox-sign/api/template_api.rb +1037 -0
- data/lib/dropbox-sign/api/unclaimed_draft_api.rb +467 -0
- data/lib/dropbox-sign/api_client.rb +417 -0
- data/lib/dropbox-sign/api_error.rb +60 -0
- data/lib/dropbox-sign/configuration.rb +303 -0
- data/lib/dropbox-sign/event_callback_helper.rb +54 -0
- data/lib/dropbox-sign/models/account_create_request.rb +285 -0
- data/lib/dropbox-sign/models/account_create_response.rb +270 -0
- data/lib/dropbox-sign/models/account_get_response.rb +261 -0
- data/lib/dropbox-sign/models/account_response.rb +343 -0
- data/lib/dropbox-sign/models/account_response_quotas.rb +296 -0
- data/lib/dropbox-sign/models/account_update_request.rb +271 -0
- data/lib/dropbox-sign/models/account_verify_request.rb +255 -0
- data/lib/dropbox-sign/models/account_verify_response.rb +261 -0
- data/lib/dropbox-sign/models/account_verify_response_account.rb +250 -0
- data/lib/dropbox-sign/models/api_app_create_request.rb +347 -0
- data/lib/dropbox-sign/models/api_app_get_response.rb +261 -0
- data/lib/dropbox-sign/models/api_app_list_response.rb +273 -0
- data/lib/dropbox-sign/models/api_app_response.rb +343 -0
- data/lib/dropbox-sign/models/api_app_response_o_auth.rb +283 -0
- data/lib/dropbox-sign/models/api_app_response_options.rb +251 -0
- data/lib/dropbox-sign/models/api_app_response_owner_account.rb +261 -0
- data/lib/dropbox-sign/models/api_app_response_white_labeling_options.rb +367 -0
- data/lib/dropbox-sign/models/api_app_update_request.rb +324 -0
- data/lib/dropbox-sign/models/bulk_send_job_get_response.rb +282 -0
- data/lib/dropbox-sign/models/bulk_send_job_get_response_signature_requests.rb +503 -0
- data/lib/dropbox-sign/models/bulk_send_job_list_response.rb +273 -0
- data/lib/dropbox-sign/models/bulk_send_job_response.rb +282 -0
- data/lib/dropbox-sign/models/bulk_send_job_send_response.rb +261 -0
- data/lib/dropbox-sign/models/embedded_edit_url_request.rb +357 -0
- data/lib/dropbox-sign/models/embedded_edit_url_response.rb +261 -0
- data/lib/dropbox-sign/models/embedded_edit_url_response_embedded.rb +261 -0
- data/lib/dropbox-sign/models/embedded_sign_url_response.rb +261 -0
- data/lib/dropbox-sign/models/embedded_sign_url_response_embedded.rb +261 -0
- data/lib/dropbox-sign/models/error_response.rb +254 -0
- data/lib/dropbox-sign/models/error_response_error.rb +281 -0
- data/lib/dropbox-sign/models/event_callback_request.rb +281 -0
- data/lib/dropbox-sign/models/event_callback_request_event.rb +334 -0
- data/lib/dropbox-sign/models/event_callback_request_event_metadata.rb +285 -0
- data/lib/dropbox-sign/models/file_response.rb +260 -0
- data/lib/dropbox-sign/models/file_response_data_uri.rb +250 -0
- data/lib/dropbox-sign/models/list_info_response.rb +282 -0
- data/lib/dropbox-sign/models/o_auth_token_generate_request.rb +317 -0
- data/lib/dropbox-sign/models/o_auth_token_refresh_request.rb +272 -0
- data/lib/dropbox-sign/models/o_auth_token_response.rb +287 -0
- data/lib/dropbox-sign/models/report_create_request.rb +319 -0
- data/lib/dropbox-sign/models/report_create_response.rb +261 -0
- data/lib/dropbox-sign/models/report_response.rb +305 -0
- data/lib/dropbox-sign/models/signature_request_bulk_create_embedded_with_template_request.rb +445 -0
- data/lib/dropbox-sign/models/signature_request_bulk_send_with_template_request.rb +440 -0
- data/lib/dropbox-sign/models/signature_request_create_embedded_request.rb +569 -0
- data/lib/dropbox-sign/models/signature_request_create_embedded_with_template_request.rb +475 -0
- data/lib/dropbox-sign/models/signature_request_get_response.rb +261 -0
- data/lib/dropbox-sign/models/signature_request_list_response.rb +273 -0
- data/lib/dropbox-sign/models/signature_request_remind_request.rb +265 -0
- data/lib/dropbox-sign/models/signature_request_response.rb +494 -0
- data/lib/dropbox-sign/models/signature_request_response_attachment.rb +323 -0
- data/lib/dropbox-sign/models/signature_request_response_custom_field_base.rb +316 -0
- data/lib/dropbox-sign/models/signature_request_response_custom_field_checkbox.rb +272 -0
- data/lib/dropbox-sign/models/signature_request_response_custom_field_text.rb +272 -0
- data/lib/dropbox-sign/models/signature_request_response_custom_field_type_enum.rb +40 -0
- data/lib/dropbox-sign/models/signature_request_response_data_base.rb +326 -0
- data/lib/dropbox-sign/models/signature_request_response_data_type_enum.rb +47 -0
- data/lib/dropbox-sign/models/signature_request_response_data_value_checkbox.rb +266 -0
- data/lib/dropbox-sign/models/signature_request_response_data_value_checkbox_merge.rb +266 -0
- data/lib/dropbox-sign/models/signature_request_response_data_value_date_signed.rb +266 -0
- data/lib/dropbox-sign/models/signature_request_response_data_value_dropdown.rb +266 -0
- data/lib/dropbox-sign/models/signature_request_response_data_value_initials.rb +266 -0
- data/lib/dropbox-sign/models/signature_request_response_data_value_radio.rb +266 -0
- data/lib/dropbox-sign/models/signature_request_response_data_value_signature.rb +266 -0
- data/lib/dropbox-sign/models/signature_request_response_data_value_text.rb +266 -0
- data/lib/dropbox-sign/models/signature_request_response_data_value_text_merge.rb +266 -0
- data/lib/dropbox-sign/models/signature_request_response_signatures.rb +446 -0
- data/lib/dropbox-sign/models/signature_request_send_request.rb +574 -0
- data/lib/dropbox-sign/models/signature_request_send_with_template_request.rb +480 -0
- data/lib/dropbox-sign/models/signature_request_update_request.rb +286 -0
- data/lib/dropbox-sign/models/sub_attachment.rb +292 -0
- data/lib/dropbox-sign/models/sub_bulk_signer_list.rb +264 -0
- data/lib/dropbox-sign/models/sub_bulk_signer_list_custom_field.rb +270 -0
- data/lib/dropbox-sign/models/sub_cc.rb +270 -0
- data/lib/dropbox-sign/models/sub_custom_field.rb +288 -0
- data/lib/dropbox-sign/models/sub_editor_options.rb +265 -0
- data/lib/dropbox-sign/models/sub_field_options.rb +290 -0
- data/lib/dropbox-sign/models/sub_form_field_group.rb +285 -0
- data/lib/dropbox-sign/models/sub_form_field_rule.rb +353 -0
- data/lib/dropbox-sign/models/sub_form_field_rule_action.rb +323 -0
- data/lib/dropbox-sign/models/sub_form_field_rule_trigger.rb +326 -0
- data/lib/dropbox-sign/models/sub_form_fields_per_document_base.rb +435 -0
- data/lib/dropbox-sign/models/sub_form_fields_per_document_checkbox.rb +287 -0
- data/lib/dropbox-sign/models/sub_form_fields_per_document_checkbox_merge.rb +262 -0
- data/lib/dropbox-sign/models/sub_form_fields_per_document_date_signed.rb +262 -0
- data/lib/dropbox-sign/models/sub_form_fields_per_document_dropdown.rb +308 -0
- data/lib/dropbox-sign/models/sub_form_fields_per_document_hyperlink.rb +292 -0
- data/lib/dropbox-sign/models/sub_form_fields_per_document_initials.rb +262 -0
- data/lib/dropbox-sign/models/sub_form_fields_per_document_radio.rb +292 -0
- data/lib/dropbox-sign/models/sub_form_fields_per_document_signature.rb +262 -0
- data/lib/dropbox-sign/models/sub_form_fields_per_document_text.rb +364 -0
- data/lib/dropbox-sign/models/sub_form_fields_per_document_text_merge.rb +262 -0
- data/lib/dropbox-sign/models/sub_form_fields_per_document_type_enum.rb +48 -0
- data/lib/dropbox-sign/models/sub_merge_field.rb +304 -0
- data/lib/dropbox-sign/models/sub_o_auth.rb +285 -0
- data/lib/dropbox-sign/models/sub_options.rb +253 -0
- data/lib/dropbox-sign/models/sub_signature_request_grouped_signers.rb +283 -0
- data/lib/dropbox-sign/models/sub_signature_request_signer.rb +369 -0
- data/lib/dropbox-sign/models/sub_signature_request_template_signer.rb +373 -0
- data/lib/dropbox-sign/models/sub_signing_options.rb +338 -0
- data/lib/dropbox-sign/models/sub_team_response.rb +260 -0
- data/lib/dropbox-sign/models/sub_template_role.rb +261 -0
- data/lib/dropbox-sign/models/sub_unclaimed_draft_signer.rb +281 -0
- data/lib/dropbox-sign/models/sub_unclaimed_draft_template_signer.rb +285 -0
- data/lib/dropbox-sign/models/sub_white_labeling_options.rb +439 -0
- data/lib/dropbox-sign/models/team_add_member_request.rb +304 -0
- data/lib/dropbox-sign/models/team_create_request.rb +252 -0
- data/lib/dropbox-sign/models/team_get_info_response.rb +261 -0
- data/lib/dropbox-sign/models/team_get_response.rb +261 -0
- data/lib/dropbox-sign/models/team_info_response.rb +290 -0
- data/lib/dropbox-sign/models/team_invite_response.rb +300 -0
- data/lib/dropbox-sign/models/team_invites_response.rb +263 -0
- data/lib/dropbox-sign/models/team_member_response.rb +270 -0
- data/lib/dropbox-sign/models/team_members_response.rb +272 -0
- data/lib/dropbox-sign/models/team_parent_response.rb +261 -0
- data/lib/dropbox-sign/models/team_remove_member_request.rb +324 -0
- data/lib/dropbox-sign/models/team_response.rb +274 -0
- data/lib/dropbox-sign/models/team_sub_teams_response.rb +272 -0
- data/lib/dropbox-sign/models/team_update_request.rb +250 -0
- data/lib/dropbox-sign/models/template_add_user_request.rb +272 -0
- data/lib/dropbox-sign/models/template_create_embedded_draft_request.rb +567 -0
- data/lib/dropbox-sign/models/template_create_embedded_draft_response.rb +261 -0
- data/lib/dropbox-sign/models/template_create_embedded_draft_response_template.rb +283 -0
- data/lib/dropbox-sign/models/template_edit_response.rb +250 -0
- data/lib/dropbox-sign/models/template_get_response.rb +261 -0
- data/lib/dropbox-sign/models/template_list_response.rb +273 -0
- data/lib/dropbox-sign/models/template_remove_user_request.rb +260 -0
- data/lib/dropbox-sign/models/template_response.rb +410 -0
- data/lib/dropbox-sign/models/template_response_account.rb +299 -0
- data/lib/dropbox-sign/models/template_response_account_quota.rb +281 -0
- data/lib/dropbox-sign/models/template_response_cc_role.rb +250 -0
- data/lib/dropbox-sign/models/template_response_custom_field.rb +407 -0
- data/lib/dropbox-sign/models/template_response_document.rb +309 -0
- data/lib/dropbox-sign/models/template_response_document_custom_field.rb +438 -0
- data/lib/dropbox-sign/models/template_response_document_field_group.rb +260 -0
- data/lib/dropbox-sign/models/template_response_document_form_field.rb +417 -0
- data/lib/dropbox-sign/models/template_response_document_static_field.rb +341 -0
- data/lib/dropbox-sign/models/template_response_field_avg_text_length.rb +261 -0
- data/lib/dropbox-sign/models/template_response_named_form_field.rb +383 -0
- data/lib/dropbox-sign/models/template_response_signer_role.rb +260 -0
- data/lib/dropbox-sign/models/template_update_files_request.rb +336 -0
- data/lib/dropbox-sign/models/template_update_files_response.rb +249 -0
- data/lib/dropbox-sign/models/template_update_files_response_template.rb +263 -0
- data/lib/dropbox-sign/models/unclaimed_draft_create_embedded_request.rb +728 -0
- data/lib/dropbox-sign/models/unclaimed_draft_create_embedded_with_template_request.rb +631 -0
- data/lib/dropbox-sign/models/unclaimed_draft_create_request.rb +586 -0
- data/lib/dropbox-sign/models/unclaimed_draft_create_response.rb +261 -0
- data/lib/dropbox-sign/models/unclaimed_draft_edit_and_resend_request.rb +328 -0
- data/lib/dropbox-sign/models/unclaimed_draft_response.rb +305 -0
- data/lib/dropbox-sign/models/warning_response.rb +271 -0
- data/lib/dropbox-sign/version.rb +18 -0
- data/lib/dropbox-sign.rb +204 -0
- data/openapi-config.yaml +21 -0
- data/openapi-sdk.yaml +11080 -0
- data/run-build +53 -0
- data/spec/api/account_api_spec.rb +107 -0
- data/spec/api/api_app_api_spec.rb +95 -0
- data/spec/api/bulk_send_job_api_spec.rb +52 -0
- data/spec/api/embedded_api_spec.rb +55 -0
- data/spec/api/oauth_api_spec.rb +55 -0
- data/spec/api/report_api_spec.rb +38 -0
- data/spec/api/signature_request_api_spec.rb +263 -0
- data/spec/api/team_api_spec.rb +105 -0
- data/spec/api/template_api_spec.rb +147 -0
- data/spec/api/unclaimed_draft_api_spec.rb +95 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/event_callback_helper_spec.rb +22 -0
- data/spec/fixtures_spec.rb +59 -0
- data/spec/models/sub_form_fields_per_document_base_spec.rb +24 -0
- data/spec/spec_helper.rb +111 -0
- data/spec/test_utils.rb +19 -0
- data/templates/Gemfile.mustache +10 -0
- data/templates/README.mustache +133 -0
- data/templates/Rakefile.mustache +10 -0
- data/templates/api.mustache +283 -0
- data/templates/api_client.mustache +291 -0
- data/templates/api_client_faraday_partial.mustache +136 -0
- data/templates/api_client_spec.mustache +220 -0
- data/templates/api_client_typhoeus_partial.mustache +153 -0
- data/templates/api_doc.mustache +77 -0
- data/templates/api_error.mustache +52 -0
- data/templates/api_info.mustache +12 -0
- data/templates/api_test.mustache +47 -0
- data/templates/base_object.mustache +132 -0
- data/templates/configuration.mustache +372 -0
- data/templates/configuration_spec.mustache +34 -0
- data/templates/configuration_tls_faraday_partial.mustache +29 -0
- data/templates/configuration_tls_typhoeus_partial.mustache +34 -0
- data/templates/event_callback_helper.mustache +46 -0
- data/templates/gem.mustache +55 -0
- data/templates/gemspec.mustache +35 -0
- data/templates/git_push.sh.mustache +57 -0
- data/templates/gitignore.mustache +41 -0
- data/templates/model.mustache +29 -0
- data/templates/model_doc.mustache +12 -0
- data/templates/model_test.mustache +77 -0
- data/templates/partial_model_enum_class.mustache +20 -0
- data/templates/partial_model_generic.mustache +414 -0
- data/templates/partial_model_generic_doc.mustache +10 -0
- data/templates/partial_oneof_module.mustache +137 -0
- data/templates/partial_oneof_module_doc.mustache +92 -0
- data/templates/rspec.mustache +2 -0
- data/templates/rubocop.mustache +148 -0
- data/templates/spec_helper.mustache +103 -0
- data/templates/travis.mustache +14 -0
- data/templates/version.mustache +10 -0
- data/test_fixtures/AccountCreateRequest.json +7 -0
- data/test_fixtures/AccountCreateResponse.json +15 -0
- data/test_fixtures/AccountGetResponse.json +14 -0
- data/test_fixtures/AccountUpdateRequest.json +5 -0
- data/test_fixtures/AccountVerifyRequest.json +5 -0
- data/test_fixtures/AccountVerifyResponse.json +7 -0
- data/test_fixtures/ApiAppCreateRequest.json +35 -0
- data/test_fixtures/ApiAppGetResponse.json +27 -0
- data/test_fixtures/ApiAppListResponse.json +42 -0
- data/test_fixtures/ApiAppUpdateRequest.json +35 -0
- data/test_fixtures/BulkSendJobGetResponse.json +67 -0
- data/test_fixtures/BulkSendJobListResponse.json +24 -0
- data/test_fixtures/BulkSendJobSendResponse.json +10 -0
- data/test_fixtures/EmbeddedEditUrlRequest.json +28 -0
- data/test_fixtures/EmbeddedEditUrlResponse.json +8 -0
- data/test_fixtures/EmbeddedSignUrlResponse.json +8 -0
- data/test_fixtures/ErrorResponse.json +9 -0
- data/test_fixtures/EventCallbackHelper.json +50 -0
- data/test_fixtures/FileResponse.json +6 -0
- data/test_fixtures/OAuthTokenGenerateRequest.json +9 -0
- data/test_fixtures/OAuthTokenRefreshRequest.json +6 -0
- data/test_fixtures/OAuthTokenResponse.json +15 -0
- data/test_fixtures/ReportCreateRequest.json +10 -0
- data/test_fixtures/ReportCreateResponse.json +13 -0
- data/test_fixtures/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.json +67 -0
- data/test_fixtures/SignatureRequestBulkSendWithTemplateRequest.json +66 -0
- data/test_fixtures/SignatureRequestCreateEmbeddedRequest.json +252 -0
- data/test_fixtures/SignatureRequestCreateEmbeddedWithTemplateRequest.json +60 -0
- data/test_fixtures/SignatureRequestGetResponse.json +146 -0
- data/test_fixtures/SignatureRequestListResponse.json +102 -0
- data/test_fixtures/SignatureRequestRemindRequest.json +5 -0
- data/test_fixtures/SignatureRequestSendRequest.json +463 -0
- data/test_fixtures/SignatureRequestSendWithTemplateRequest.json +48 -0
- data/test_fixtures/SignatureRequestUpdateRequest.json +7 -0
- data/test_fixtures/SubFormFieldsPerDocument.json +107 -0
- data/test_fixtures/TeamAddMemberRequest.json +6 -0
- data/test_fixtures/TeamCreateRequest.json +5 -0
- data/test_fixtures/TeamGetResponse.json +34 -0
- data/test_fixtures/TeamRemoveMemberRequest.json +7 -0
- data/test_fixtures/TeamUpdateRequest.json +5 -0
- data/test_fixtures/TemplateAddUserRequest.json +7 -0
- data/test_fixtures/TemplateCreateEmbeddedDraftRequest.json +118 -0
- data/test_fixtures/TemplateCreateEmbeddedDraftResponse.json +9 -0
- data/test_fixtures/TemplateGetResponse.json +102 -0
- data/test_fixtures/TemplateListResponse.json +143 -0
- data/test_fixtures/TemplateRemoveUserRequest.json +6 -0
- data/test_fixtures/TemplateUpdateFilesRequest.json +11 -0
- data/test_fixtures/TemplateUpdateFilesResponse.json +7 -0
- data/test_fixtures/UnclaimedDraftCreateEmbeddedRequest.json +134 -0
- data/test_fixtures/UnclaimedDraftCreateEmbeddedWithTemplateRequest.json +67 -0
- data/test_fixtures/UnclaimedDraftCreateRequest.json +119 -0
- data/test_fixtures/UnclaimedDraftCreateResponse.json +9 -0
- data/test_fixtures/UnclaimedDraftEditAndResendRequest.json +15 -0
- data/test_fixtures/bulk-send-sample.csv +3 -0
- data/test_fixtures/pdf-sample-2.pdf +0 -0
- data/test_fixtures/pdf-sample.pdf +0 -0
- data/vendor/autoload.php +7 -0
- data/vendor/bin/yaml-lint +117 -0
- data/vendor/composer/ClassLoader.php +572 -0
- data/vendor/composer/InstalledVersions.php +350 -0
- data/vendor/composer/LICENSE +21 -0
- data/vendor/composer/autoload_classmap.php +10 -0
- data/vendor/composer/autoload_files.php +11 -0
- data/vendor/composer/autoload_namespaces.php +9 -0
- data/vendor/composer/autoload_psr4.php +11 -0
- data/vendor/composer/autoload_real.php +80 -0
- data/vendor/composer/autoload_static.php +46 -0
- data/vendor/composer/installed.json +239 -0
- data/vendor/composer/installed.php +50 -0
- data/vendor/composer/platform_check.php +26 -0
- data/vendor/symfony/deprecation-contracts/.gitignore +3 -0
- data/vendor/symfony/deprecation-contracts/CHANGELOG.md +5 -0
- data/vendor/symfony/deprecation-contracts/LICENSE +19 -0
- data/vendor/symfony/deprecation-contracts/README.md +26 -0
- data/vendor/symfony/deprecation-contracts/composer.json +35 -0
- data/vendor/symfony/deprecation-contracts/function.php +27 -0
- data/vendor/symfony/polyfill-ctype/Ctype.php +232 -0
- data/vendor/symfony/polyfill-ctype/LICENSE +19 -0
- data/vendor/symfony/polyfill-ctype/README.md +12 -0
- data/vendor/symfony/polyfill-ctype/bootstrap.php +50 -0
- data/vendor/symfony/polyfill-ctype/bootstrap80.php +46 -0
- data/vendor/symfony/polyfill-ctype/composer.json +41 -0
- data/vendor/symfony/yaml/CHANGELOG.md +237 -0
- data/vendor/symfony/yaml/Command/LintCommand.php +289 -0
- data/vendor/symfony/yaml/Dumper.php +140 -0
- data/vendor/symfony/yaml/Escaper.php +95 -0
- data/vendor/symfony/yaml/Exception/DumpException.php +21 -0
- data/vendor/symfony/yaml/Exception/ExceptionInterface.php +21 -0
- data/vendor/symfony/yaml/Exception/ParseException.php +132 -0
- data/vendor/symfony/yaml/Exception/RuntimeException.php +21 -0
- data/vendor/symfony/yaml/Inline.php +812 -0
- data/vendor/symfony/yaml/LICENSE +19 -0
- data/vendor/symfony/yaml/Parser.php +1305 -0
- data/vendor/symfony/yaml/README.md +13 -0
- data/vendor/symfony/yaml/Resources/bin/yaml-lint +45 -0
- data/vendor/symfony/yaml/Tag/TaggedValue.php +38 -0
- data/vendor/symfony/yaml/Unescaper.php +132 -0
- data/vendor/symfony/yaml/Yaml.php +100 -0
- data/vendor/symfony/yaml/composer.json +42 -0
- metadata +650 -0
@@ -0,0 +1,417 @@
|
|
1
|
+
=begin
|
2
|
+
#Dropbox Sign API
|
3
|
+
|
4
|
+
#Dropbox Sign v3 API
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 3.0.0
|
7
|
+
Contact: apisupport@hellosign.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.3.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'json'
|
15
|
+
require 'logger'
|
16
|
+
require 'tempfile'
|
17
|
+
require 'time'
|
18
|
+
require 'typhoeus'
|
19
|
+
|
20
|
+
module Dropbox
|
21
|
+
end
|
22
|
+
|
23
|
+
module Dropbox::Sign
|
24
|
+
class ApiClient
|
25
|
+
# The Configuration object holding settings to be used in the API client.
|
26
|
+
attr_accessor :config
|
27
|
+
|
28
|
+
# Defines the headers to be used in HTTP requests of all API calls by default.
|
29
|
+
#
|
30
|
+
# @return [Hash]
|
31
|
+
attr_accessor :default_headers
|
32
|
+
|
33
|
+
# Initializes the ApiClient
|
34
|
+
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
35
|
+
def initialize(config = Configuration.default)
|
36
|
+
@config = config
|
37
|
+
@user_agent = "OpenAPI-Generator/#{VERSION}/ruby"
|
38
|
+
@default_headers = {
|
39
|
+
'Content-Type' => 'application/json',
|
40
|
+
'User-Agent' => @user_agent
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.default
|
45
|
+
@@default ||= ApiClient.new
|
46
|
+
end
|
47
|
+
|
48
|
+
# Call an API with given options.
|
49
|
+
#
|
50
|
+
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
51
|
+
# the data deserialized from response body (could be nil), response status code and response headers.
|
52
|
+
def call_api(http_method, path, opts = {})
|
53
|
+
request = build_request(http_method, path, opts)
|
54
|
+
response = request.run
|
55
|
+
|
56
|
+
if @config.debugging
|
57
|
+
@config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
58
|
+
end
|
59
|
+
|
60
|
+
unless response.success?
|
61
|
+
if response.timed_out?
|
62
|
+
fail ApiError.new('Connection timed out')
|
63
|
+
elsif response.code == 0
|
64
|
+
# Errors from libcurl will be made visible here
|
65
|
+
fail ApiError.new(:code => 0,
|
66
|
+
:message => response.return_message)
|
67
|
+
else
|
68
|
+
fail ApiError.new(:code => response.code,
|
69
|
+
:response_headers => response.headers,
|
70
|
+
:response_body => response.body),
|
71
|
+
response.status_message
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
if opts[:return_type]
|
76
|
+
data = deserialize(response, opts[:return_type])
|
77
|
+
else
|
78
|
+
data = nil
|
79
|
+
end
|
80
|
+
return data, response.code, response.headers
|
81
|
+
end
|
82
|
+
|
83
|
+
# Builds the HTTP request
|
84
|
+
#
|
85
|
+
# @param [String] http_method HTTP method/verb (e.g. POST)
|
86
|
+
# @param [String] path URL path (e.g. /account/new)
|
87
|
+
# @option opts [Hash] :header_params Header parameters
|
88
|
+
# @option opts [Hash] :query_params Query parameters
|
89
|
+
# @option opts [Hash] :form_params Query parameters
|
90
|
+
# @option opts [Object] :body HTTP body (JSON/XML)
|
91
|
+
# @return [Typhoeus::Request] A Typhoeus Request
|
92
|
+
def build_request(http_method, path, opts = {})
|
93
|
+
url = build_request_url(path, opts)
|
94
|
+
http_method = http_method.to_sym.downcase
|
95
|
+
|
96
|
+
header_params = @default_headers.merge(opts[:header_params] || {})
|
97
|
+
query_params = opts[:query_params] || {}
|
98
|
+
form_params = opts[:form_params] || {}
|
99
|
+
|
100
|
+
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
101
|
+
|
102
|
+
# set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
|
103
|
+
_verify_ssl_host = @config.verify_ssl_host ? 2 : 0
|
104
|
+
|
105
|
+
req_opts = {
|
106
|
+
:method => http_method,
|
107
|
+
:headers => header_params,
|
108
|
+
:params => query_params,
|
109
|
+
:params_encoding => @config.params_encoding,
|
110
|
+
:timeout => @config.timeout,
|
111
|
+
:ssl_verifypeer => @config.verify_ssl,
|
112
|
+
:ssl_verifyhost => _verify_ssl_host,
|
113
|
+
:sslcert => @config.cert_file,
|
114
|
+
:sslkey => @config.key_file,
|
115
|
+
:verbose => @config.debugging
|
116
|
+
}
|
117
|
+
|
118
|
+
# set custom cert, if provided
|
119
|
+
req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
|
120
|
+
|
121
|
+
if [:post, :patch, :put, :delete].include?(http_method)
|
122
|
+
req_body = build_request_body(header_params, form_params, opts[:body])
|
123
|
+
req_opts.update :body => req_body
|
124
|
+
if @config.debugging
|
125
|
+
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
request = Typhoeus::Request.new(url, req_opts)
|
130
|
+
download_file(request) if opts[:return_type] == 'File'
|
131
|
+
request
|
132
|
+
end
|
133
|
+
|
134
|
+
# Builds the HTTP request body
|
135
|
+
#
|
136
|
+
# @param [Hash] header_params Header parameters
|
137
|
+
# @param [Hash] form_params Query parameters
|
138
|
+
# @param [Object] body HTTP body (JSON/XML)
|
139
|
+
# @return [String] HTTP body data in the form of string
|
140
|
+
def build_request_body(header_params, form_params, body)
|
141
|
+
# http form
|
142
|
+
if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
|
143
|
+
header_params['Content-Type'] == 'multipart/form-data'
|
144
|
+
data = {}
|
145
|
+
form_params.each do |key, value|
|
146
|
+
case value
|
147
|
+
when ::File, ::Array, nil
|
148
|
+
# let typhoeus handle File, Array and nil parameters
|
149
|
+
data[key] = value
|
150
|
+
else
|
151
|
+
data[key] = value.to_s
|
152
|
+
end
|
153
|
+
end
|
154
|
+
elsif body
|
155
|
+
data = body.is_a?(String) ? body : body.to_json
|
156
|
+
else
|
157
|
+
data = nil
|
158
|
+
end
|
159
|
+
data
|
160
|
+
end
|
161
|
+
|
162
|
+
# Save response body into a file in (the defined) temporary folder, using the filename
|
163
|
+
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
164
|
+
# The response body is written to the file in chunks in order to handle files which
|
165
|
+
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
166
|
+
# process can use.
|
167
|
+
#
|
168
|
+
# @see Configuration#temp_folder_path
|
169
|
+
def download_file(request)
|
170
|
+
tempfile = nil
|
171
|
+
encoding = nil
|
172
|
+
request.on_headers do |response|
|
173
|
+
content_disposition = response.headers['Content-Disposition']
|
174
|
+
if content_disposition && content_disposition =~ /filename=/i
|
175
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
176
|
+
prefix = sanitize_filename(filename)
|
177
|
+
else
|
178
|
+
prefix = 'download-'
|
179
|
+
end
|
180
|
+
prefix = prefix + '-' unless prefix.end_with?('-')
|
181
|
+
encoding = response.body.encoding
|
182
|
+
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
183
|
+
@tempfile = tempfile
|
184
|
+
end
|
185
|
+
request.on_body do |chunk|
|
186
|
+
chunk.force_encoding(encoding)
|
187
|
+
tempfile.write(chunk)
|
188
|
+
end
|
189
|
+
request.on_complete do |response|
|
190
|
+
if tempfile
|
191
|
+
tempfile.close
|
192
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
193
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
194
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
195
|
+
"explicitly with `tempfile.delete`"
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
# Check if the given MIME is a JSON MIME.
|
201
|
+
# JSON MIME examples:
|
202
|
+
# application/json
|
203
|
+
# application/json; charset=UTF8
|
204
|
+
# APPLICATION/JSON
|
205
|
+
# */*
|
206
|
+
# @param [String] mime MIME
|
207
|
+
# @return [Boolean] True if the MIME is application/json
|
208
|
+
def json_mime?(mime)
|
209
|
+
(mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
|
210
|
+
end
|
211
|
+
|
212
|
+
# Deserialize the response to the given return type.
|
213
|
+
#
|
214
|
+
# @param [Response] response HTTP response
|
215
|
+
# @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
|
216
|
+
def deserialize(response, return_type)
|
217
|
+
body = response.body
|
218
|
+
|
219
|
+
# handle file downloading - return the File instance processed in request callbacks
|
220
|
+
# note that response body is empty when the file is written in chunks in request on_body callback
|
221
|
+
return @tempfile if return_type == 'File'
|
222
|
+
|
223
|
+
return nil if body.nil? || body.empty?
|
224
|
+
|
225
|
+
# return response body directly for String return type
|
226
|
+
return body if return_type == 'String'
|
227
|
+
|
228
|
+
# ensuring a default content type
|
229
|
+
content_type = response.headers['Content-Type'] || 'application/json'
|
230
|
+
|
231
|
+
fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
|
232
|
+
|
233
|
+
begin
|
234
|
+
data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
|
235
|
+
rescue JSON::ParserError => e
|
236
|
+
if %w(String Date Time).include?(return_type)
|
237
|
+
data = body
|
238
|
+
else
|
239
|
+
raise e
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
convert_to_type data, return_type
|
244
|
+
end
|
245
|
+
|
246
|
+
# Convert data to the given return type.
|
247
|
+
# @param [Object] data Data to be converted
|
248
|
+
# @param [String] return_type Return type
|
249
|
+
# @return [Mixed] Data in a particular type
|
250
|
+
def convert_to_type(data, return_type)
|
251
|
+
return nil if data.nil?
|
252
|
+
case return_type
|
253
|
+
when 'String'
|
254
|
+
data.to_s
|
255
|
+
when 'Integer'
|
256
|
+
data.to_i
|
257
|
+
when 'Float'
|
258
|
+
data.to_f
|
259
|
+
when 'Boolean'
|
260
|
+
data == true
|
261
|
+
when 'Time'
|
262
|
+
# parse date time (expecting ISO 8601 format)
|
263
|
+
Time.parse data
|
264
|
+
when 'Date'
|
265
|
+
# parse date time (expecting ISO 8601 format)
|
266
|
+
Date.parse data
|
267
|
+
when 'Object'
|
268
|
+
# generic object (usually a Hash), return directly
|
269
|
+
data
|
270
|
+
when /\AArray<(.+)>\z/
|
271
|
+
# e.g. Array<Pet>
|
272
|
+
sub_type = $1
|
273
|
+
data.map { |item| convert_to_type(item, sub_type) }
|
274
|
+
when /\AHash\<String, (.+)\>\z/
|
275
|
+
# e.g. Hash<String, Integer>
|
276
|
+
sub_type = $1
|
277
|
+
{}.tap do |hash|
|
278
|
+
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
279
|
+
end
|
280
|
+
else
|
281
|
+
# models (e.g. Pet)
|
282
|
+
klass = Dropbox::Sign.const_get(return_type)
|
283
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
# Sanitize filename by removing path.
|
288
|
+
# e.g. ../../sun.gif becomes sun.gif
|
289
|
+
#
|
290
|
+
# @param [String] filename the filename to be sanitized
|
291
|
+
# @return [String] the sanitized filename
|
292
|
+
def sanitize_filename(filename)
|
293
|
+
filename.gsub(/.*[\/\\]/, '')
|
294
|
+
end
|
295
|
+
|
296
|
+
def build_request_url(path, opts = {})
|
297
|
+
# Add leading and trailing slashes to path
|
298
|
+
path = "/#{path}".gsub(/\/+/, '/')
|
299
|
+
@config.base_url(opts[:operation]) + path
|
300
|
+
end
|
301
|
+
|
302
|
+
# Update header and query params based on authentication settings.
|
303
|
+
#
|
304
|
+
# @param [Hash] header_params Header parameters
|
305
|
+
# @param [Hash] query_params Query parameters
|
306
|
+
# @param [String] auth_names Authentication scheme name
|
307
|
+
def update_params_for_auth!(header_params, query_params, auth_names)
|
308
|
+
Array(auth_names).each do |auth_name|
|
309
|
+
auth_setting = @config.auth_settings[auth_name]
|
310
|
+
next unless auth_setting
|
311
|
+
case auth_setting[:in]
|
312
|
+
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
|
313
|
+
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
|
314
|
+
else fail ArgumentError, 'Authentication token must be in `query` or `header`'
|
315
|
+
end
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
# Sets user agent in HTTP header
|
320
|
+
#
|
321
|
+
# @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
|
322
|
+
def user_agent=(user_agent)
|
323
|
+
@user_agent = user_agent
|
324
|
+
@default_headers['User-Agent'] = @user_agent
|
325
|
+
end
|
326
|
+
|
327
|
+
# Return Accept header based on an array of accepts provided.
|
328
|
+
# @param [Array] accepts array for Accept
|
329
|
+
# @return [String] the Accept header (e.g. application/json)
|
330
|
+
def select_header_accept(accepts)
|
331
|
+
return nil if accepts.nil? || accepts.empty?
|
332
|
+
# use JSON when present, otherwise use all of the provided
|
333
|
+
json_accept = accepts.find { |s| json_mime?(s) }
|
334
|
+
json_accept || accepts.join(',')
|
335
|
+
end
|
336
|
+
|
337
|
+
# Return Content-Type header based on an array of content types provided.
|
338
|
+
# @param [Array] content_types array for Content-Type
|
339
|
+
# @return [String] the Content-Type header (e.g. application/json)
|
340
|
+
def select_header_content_type(content_types)
|
341
|
+
# return nil by default
|
342
|
+
return if content_types.nil? || content_types.empty?
|
343
|
+
# use JSON when present, otherwise use the first one
|
344
|
+
json_content_type = content_types.find { |s| json_mime?(s) }
|
345
|
+
json_content_type || content_types.first
|
346
|
+
end
|
347
|
+
|
348
|
+
# Convert object (array, hash, object, etc) to JSON string.
|
349
|
+
# @param [Object] model object to be converted into JSON string
|
350
|
+
# @return [String] JSON string representation of the object
|
351
|
+
def object_to_http_body(model)
|
352
|
+
return model if model.nil? || model.is_a?(String)
|
353
|
+
local_body = nil
|
354
|
+
if model.is_a?(Array)
|
355
|
+
local_body = model.map { |m| object_to_hash(m) }
|
356
|
+
else
|
357
|
+
local_body = object_to_hash(model)
|
358
|
+
end
|
359
|
+
local_body.to_json
|
360
|
+
end
|
361
|
+
|
362
|
+
# Convert object(non-array) to hash.
|
363
|
+
# @param [Object] obj object to be converted into JSON string
|
364
|
+
# @return [String] JSON string representation of the object
|
365
|
+
def object_to_hash(obj)
|
366
|
+
if obj.respond_to?(:to_hash)
|
367
|
+
obj.to_hash
|
368
|
+
else
|
369
|
+
obj
|
370
|
+
end
|
371
|
+
end
|
372
|
+
|
373
|
+
# Build parameter value according to the given collection format.
|
374
|
+
# @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
|
375
|
+
def build_collection_param(param, collection_format)
|
376
|
+
case collection_format
|
377
|
+
when :csv
|
378
|
+
param.join(',')
|
379
|
+
when :ssv
|
380
|
+
param.join(' ')
|
381
|
+
when :tsv
|
382
|
+
param.join("\t")
|
383
|
+
when :pipes
|
384
|
+
param.join('|')
|
385
|
+
when :multi
|
386
|
+
# return the array directly as typhoeus will handle it as expected
|
387
|
+
param
|
388
|
+
else
|
389
|
+
fail "unknown collection format: #{collection_format.inspect}"
|
390
|
+
end
|
391
|
+
end
|
392
|
+
|
393
|
+
def generate_form_data(obj, openapi_types)
|
394
|
+
params = {}
|
395
|
+
has_file = false
|
396
|
+
|
397
|
+
openapi_types.each do |field, type|
|
398
|
+
if !obj.respond_to? field
|
399
|
+
next
|
400
|
+
end
|
401
|
+
|
402
|
+
data = obj.public_send(field)
|
403
|
+
if !data.nil? && ['Array<File>', 'File'].include?(type.to_s)
|
404
|
+
params[field] = data
|
405
|
+
has_file = true
|
406
|
+
elsif !data.nil?
|
407
|
+
params[field] = object_to_http_body(data)
|
408
|
+
end
|
409
|
+
end
|
410
|
+
|
411
|
+
{
|
412
|
+
:has_file => has_file,
|
413
|
+
:params => params,
|
414
|
+
}
|
415
|
+
end
|
416
|
+
end
|
417
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
=begin
|
2
|
+
#Dropbox Sign API
|
3
|
+
|
4
|
+
#Dropbox Sign v3 API
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 3.0.0
|
7
|
+
Contact: apisupport@hellosign.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.3.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
module Dropbox
|
14
|
+
end
|
15
|
+
|
16
|
+
module Dropbox::Sign
|
17
|
+
class ApiError < StandardError
|
18
|
+
attr_reader :code, :response_headers, :response_body
|
19
|
+
|
20
|
+
# Usage examples:
|
21
|
+
# ApiError.new
|
22
|
+
# ApiError.new("message")
|
23
|
+
# ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
|
24
|
+
# ApiError.new(:code => 404, :message => "Not Found")
|
25
|
+
def initialize(arg = nil)
|
26
|
+
if arg.is_a? Hash
|
27
|
+
if arg.key?(:message) || arg.key?('message')
|
28
|
+
super(arg[:message] || arg['message'])
|
29
|
+
else
|
30
|
+
super arg
|
31
|
+
end
|
32
|
+
|
33
|
+
arg.each do |k, v|
|
34
|
+
instance_variable_set "@#{k}", v
|
35
|
+
end
|
36
|
+
else
|
37
|
+
super arg
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Override to_s to display a friendly error message
|
42
|
+
def to_s
|
43
|
+
message
|
44
|
+
end
|
45
|
+
|
46
|
+
def message
|
47
|
+
if @message.nil?
|
48
|
+
msg = "Error message: the server returns an error"
|
49
|
+
else
|
50
|
+
msg = @message
|
51
|
+
end
|
52
|
+
|
53
|
+
msg += "\nHTTP status code: #{code}" if code
|
54
|
+
msg += "\nResponse headers: #{response_headers}" if response_headers
|
55
|
+
msg += "\nResponse body: #{response_body}" if response_body
|
56
|
+
|
57
|
+
msg
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|