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,136 @@
|
|
1
|
+
# Call an API with given options.
|
2
|
+
#
|
3
|
+
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
4
|
+
# the data deserialized from response body (could be nil), response status code and response headers.
|
5
|
+
def call_api(http_method, path, opts = {})
|
6
|
+
ssl_options = {
|
7
|
+
:ca_file => @config.ssl_ca_file,
|
8
|
+
:verify => @config.ssl_verify,
|
9
|
+
:verify_mode => @config.ssl_verify_mode,
|
10
|
+
:client_cert => @config.ssl_client_cert,
|
11
|
+
:client_key => @config.ssl_client_key
|
12
|
+
}
|
13
|
+
|
14
|
+
connection = Faraday.new(:url => config.base_url, :ssl => ssl_options) do |conn|
|
15
|
+
conn.request(:basic_auth, config.username, config.password)
|
16
|
+
@config.configure_middleware(conn)
|
17
|
+
if opts[:header_params]["Content-Type"] == "multipart/form-data"
|
18
|
+
conn.request :multipart
|
19
|
+
conn.request :url_encoded
|
20
|
+
end
|
21
|
+
conn.adapter(Faraday.default_adapter)
|
22
|
+
end
|
23
|
+
|
24
|
+
begin
|
25
|
+
response = connection.public_send(http_method.to_sym.downcase) do |req|
|
26
|
+
build_request(http_method, path, req, opts)
|
27
|
+
end
|
28
|
+
|
29
|
+
if @config.debugging
|
30
|
+
@config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
31
|
+
end
|
32
|
+
|
33
|
+
unless response.success?
|
34
|
+
if response.status == 0
|
35
|
+
# Errors from libcurl will be made visible here
|
36
|
+
fail ApiError.new(:code => 0,
|
37
|
+
:message => response.return_message)
|
38
|
+
else
|
39
|
+
fail ApiError.new(:code => response.status,
|
40
|
+
:response_headers => response.headers,
|
41
|
+
:response_body => response.body),
|
42
|
+
response.reason_phrase
|
43
|
+
end
|
44
|
+
end
|
45
|
+
rescue Faraday::TimeoutError
|
46
|
+
fail ApiError.new('Connection timed out')
|
47
|
+
end
|
48
|
+
|
49
|
+
if opts[:return_type]
|
50
|
+
data = deserialize(response, opts[:return_type])
|
51
|
+
else
|
52
|
+
data = nil
|
53
|
+
end
|
54
|
+
return data, response.status, response.headers
|
55
|
+
end
|
56
|
+
|
57
|
+
# Builds the HTTP request
|
58
|
+
#
|
59
|
+
# @param [String] http_method HTTP method/verb (e.g. POST)
|
60
|
+
# @param [String] path URL path (e.g. /account/new)
|
61
|
+
# @option opts [Hash] :header_params Header parameters
|
62
|
+
# @option opts [Hash] :query_params Query parameters
|
63
|
+
# @option opts [Hash] :form_params Query parameters
|
64
|
+
# @option opts [Object] :body HTTP body (JSON/XML)
|
65
|
+
# @return [Typhoeus::Request] A Typhoeus Request
|
66
|
+
def build_request(http_method, path, request, opts = {})
|
67
|
+
url = build_request_url(path, opts)
|
68
|
+
http_method = http_method.to_sym.downcase
|
69
|
+
|
70
|
+
header_params = @default_headers.merge(opts[:header_params] || {})
|
71
|
+
query_params = opts[:query_params] || {}
|
72
|
+
form_params = opts[:form_params] || {}
|
73
|
+
|
74
|
+
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
75
|
+
|
76
|
+
req_opts = {
|
77
|
+
:params_encoding => @config.params_encoding,
|
78
|
+
:timeout => @config.timeout,
|
79
|
+
:verbose => @config.debugging
|
80
|
+
}
|
81
|
+
|
82
|
+
if [:post, :patch, :put, :delete].include?(http_method)
|
83
|
+
req_body = build_request_body(header_params, form_params, opts[:body])
|
84
|
+
if @config.debugging
|
85
|
+
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
request.headers = header_params
|
89
|
+
request.body = req_body
|
90
|
+
request.options = OpenStruct.new(req_opts)
|
91
|
+
request.url url
|
92
|
+
request.params = query_params
|
93
|
+
download_file(request) if opts[:return_type] == 'File'
|
94
|
+
request
|
95
|
+
end
|
96
|
+
|
97
|
+
# Builds the HTTP request body
|
98
|
+
#
|
99
|
+
# @param [Hash] header_params Header parameters
|
100
|
+
# @param [Hash] form_params Query parameters
|
101
|
+
# @param [Object] body HTTP body (JSON/XML)
|
102
|
+
# @return [String] HTTP body data in the form of string
|
103
|
+
def build_request_body(header_params, form_params, body)
|
104
|
+
# http form
|
105
|
+
if header_params['Content-Type'] == 'application/x-www-form-urlencoded'
|
106
|
+
data = URI.encode_www_form(form_params)
|
107
|
+
elsif header_params['Content-Type'] == 'multipart/form-data'
|
108
|
+
data = {}
|
109
|
+
form_params.each do |key, value|
|
110
|
+
case value
|
111
|
+
when ::File, ::Tempfile
|
112
|
+
# TODO hardcode to application/octet-stream, need better way to detect content type
|
113
|
+
data[key] = Faraday::UploadIO.new(value.path, 'application/octet-stream', value.path)
|
114
|
+
when ::Array, nil
|
115
|
+
# let Faraday handle Array and nil parameters
|
116
|
+
data[key] = value
|
117
|
+
else
|
118
|
+
data[key] = value.to_s
|
119
|
+
end
|
120
|
+
end
|
121
|
+
elsif body
|
122
|
+
data = body.is_a?(String) ? body : body.to_json
|
123
|
+
else
|
124
|
+
data = nil
|
125
|
+
end
|
126
|
+
data
|
127
|
+
end
|
128
|
+
|
129
|
+
def download_file(request)
|
130
|
+
@stream = []
|
131
|
+
|
132
|
+
# handle streaming Responses
|
133
|
+
request.options.on_data = Proc.new do |chunk, overall_received_bytes|
|
134
|
+
@stream << chunk
|
135
|
+
end
|
136
|
+
end
|
@@ -0,0 +1,220 @@
|
|
1
|
+
=begin
|
2
|
+
{{> api_info}}
|
3
|
+
=end
|
4
|
+
|
5
|
+
require 'spec_helper'
|
6
|
+
|
7
|
+
describe {{moduleName}}::ApiClient do
|
8
|
+
context 'initialization' do
|
9
|
+
context 'URL stuff' do
|
10
|
+
context 'host' do
|
11
|
+
it 'removes http from host' do
|
12
|
+
{{moduleName}}.configure { |c| c.host = 'http://example.com' }
|
13
|
+
expect({{moduleName}}::Configuration.default.host).to eq('example.com')
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'removes https from host' do
|
17
|
+
{{moduleName}}.configure { |c| c.host = 'https://wookiee.com' }
|
18
|
+
expect({{moduleName}}::ApiClient.default.config.host).to eq('wookiee.com')
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'removes trailing path from host' do
|
22
|
+
{{moduleName}}.configure { |c| c.host = 'hobo.com/v4' }
|
23
|
+
expect({{moduleName}}::Configuration.default.host).to eq('hobo.com')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'base_path' do
|
28
|
+
it "prepends a slash to base_path" do
|
29
|
+
{{moduleName}}.configure { |c| c.base_path = 'v4/dog' }
|
30
|
+
expect({{moduleName}}::Configuration.default.base_path).to eq('/v4/dog')
|
31
|
+
end
|
32
|
+
|
33
|
+
it "doesn't prepend a slash if one is already there" do
|
34
|
+
{{moduleName}}.configure { |c| c.base_path = '/v4/dog' }
|
35
|
+
expect({{moduleName}}::Configuration.default.base_path).to eq('/v4/dog')
|
36
|
+
end
|
37
|
+
|
38
|
+
it "ends up as a blank string if nil" do
|
39
|
+
{{moduleName}}.configure { |c| c.base_path = nil }
|
40
|
+
expect({{moduleName}}::Configuration.default.base_path).to eq('')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
{{^isFaraday}}
|
47
|
+
describe 'params_encoding in #build_request' do
|
48
|
+
let(:config) { {{moduleName}}::Configuration.new }
|
49
|
+
let(:api_client) { {{moduleName}}::ApiClient.new(config) }
|
50
|
+
|
51
|
+
it 'defaults to nil' do
|
52
|
+
expect({{moduleName}}::Configuration.default.params_encoding).to eq(nil)
|
53
|
+
expect(config.params_encoding).to eq(nil)
|
54
|
+
|
55
|
+
request = api_client.build_request(:get, '/test')
|
56
|
+
expect(request.options[:params_encoding]).to eq(nil)
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'can be customized' do
|
60
|
+
config.params_encoding = :multi
|
61
|
+
request = api_client.build_request(:get, '/test')
|
62
|
+
expect(request.options[:params_encoding]).to eq(:multi)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe 'timeout in #build_request' do
|
67
|
+
let(:config) { {{moduleName}}::Configuration.new }
|
68
|
+
let(:api_client) { {{moduleName}}::ApiClient.new(config) }
|
69
|
+
|
70
|
+
it 'defaults to 0' do
|
71
|
+
expect({{moduleName}}::Configuration.default.timeout).to eq(0)
|
72
|
+
expect(config.timeout).to eq(0)
|
73
|
+
|
74
|
+
request = api_client.build_request(:get, '/test')
|
75
|
+
expect(request.options[:timeout]).to eq(0)
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'can be customized' do
|
79
|
+
config.timeout = 100
|
80
|
+
request = api_client.build_request(:get, '/test')
|
81
|
+
expect(request.options[:timeout]).to eq(100)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
{{/isFaraday}}
|
86
|
+
describe '#deserialize' do
|
87
|
+
it "handles Array<Integer>" do
|
88
|
+
api_client = {{moduleName}}::ApiClient.new
|
89
|
+
headers = { 'Content-Type' => 'application/json' }
|
90
|
+
response = double('response', headers: headers, body: '[12, 34]')
|
91
|
+
data = api_client.deserialize(response, 'Array<Integer>')
|
92
|
+
expect(data).to be_instance_of(Array)
|
93
|
+
expect(data).to eq([12, 34])
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'handles Array<Array<Integer>>' do
|
97
|
+
api_client = {{moduleName}}::ApiClient.new
|
98
|
+
headers = { 'Content-Type' => 'application/json' }
|
99
|
+
response = double('response', headers: headers, body: '[[12, 34], [56]]')
|
100
|
+
data = api_client.deserialize(response, 'Array<Array<Integer>>')
|
101
|
+
expect(data).to be_instance_of(Array)
|
102
|
+
expect(data).to eq([[12, 34], [56]])
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'handles Hash<String, String>' do
|
106
|
+
api_client = {{moduleName}}::ApiClient.new
|
107
|
+
headers = { 'Content-Type' => 'application/json' }
|
108
|
+
response = double('response', headers: headers, body: '{"message": "Hello"}')
|
109
|
+
data = api_client.deserialize(response, 'Hash<String, String>')
|
110
|
+
expect(data).to be_instance_of(Hash)
|
111
|
+
expect(data).to eq(:message => 'Hello')
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
describe "#object_to_hash" do
|
116
|
+
it 'ignores nils and includes empty arrays' do
|
117
|
+
# uncomment below to test object_to_hash for model
|
118
|
+
# api_client = {{moduleName}}::ApiClient.new
|
119
|
+
# _model = {{moduleName}}::ModelName.new
|
120
|
+
# update the model attribute below
|
121
|
+
# _model.id = 1
|
122
|
+
# update the expected value (hash) below
|
123
|
+
# expected = {id: 1, name: '', tags: []}
|
124
|
+
# expect(api_client.object_to_hash(_model)).to eq(expected)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
describe '#build_collection_param' do
|
129
|
+
let(:param) { ['aa', 'bb', 'cc'] }
|
130
|
+
let(:api_client) { {{moduleName}}::ApiClient.new }
|
131
|
+
|
132
|
+
it 'works for csv' do
|
133
|
+
expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
|
134
|
+
end
|
135
|
+
|
136
|
+
it 'works for ssv' do
|
137
|
+
expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
|
138
|
+
end
|
139
|
+
|
140
|
+
it 'works for tsv' do
|
141
|
+
expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'works for pipes' do
|
145
|
+
expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
|
146
|
+
end
|
147
|
+
|
148
|
+
it 'works for multi' do
|
149
|
+
expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
|
150
|
+
end
|
151
|
+
|
152
|
+
it 'fails for invalid collection format' do
|
153
|
+
expect { api_client.build_collection_param(param, :INVALID) }.to raise_error(RuntimeError, 'unknown collection format: :INVALID')
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
describe '#json_mime?' do
|
158
|
+
let(:api_client) { {{moduleName}}::ApiClient.new }
|
159
|
+
|
160
|
+
it 'works' do
|
161
|
+
expect(api_client.json_mime?(nil)).to eq false
|
162
|
+
expect(api_client.json_mime?('')).to eq false
|
163
|
+
|
164
|
+
expect(api_client.json_mime?('application/json')).to eq true
|
165
|
+
expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
|
166
|
+
expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
|
167
|
+
|
168
|
+
expect(api_client.json_mime?('application/xml')).to eq false
|
169
|
+
expect(api_client.json_mime?('text/plain')).to eq false
|
170
|
+
expect(api_client.json_mime?('application/jsonp')).to eq false
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
describe '#select_header_accept' do
|
175
|
+
let(:api_client) { {{moduleName}}::ApiClient.new }
|
176
|
+
|
177
|
+
it 'works' do
|
178
|
+
expect(api_client.select_header_accept(nil)).to be_nil
|
179
|
+
expect(api_client.select_header_accept([])).to be_nil
|
180
|
+
|
181
|
+
expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
|
182
|
+
expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
183
|
+
expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
184
|
+
|
185
|
+
expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
|
186
|
+
expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
describe '#select_header_content_type' do
|
191
|
+
let(:api_client) { {{moduleName}}::ApiClient.new }
|
192
|
+
|
193
|
+
it 'works' do
|
194
|
+
expect(api_client.select_header_content_type(nil)).to be_nil
|
195
|
+
expect(api_client.select_header_content_type([])).to be_nil
|
196
|
+
|
197
|
+
expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
|
198
|
+
expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
199
|
+
expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
200
|
+
expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
|
201
|
+
expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
describe '#sanitize_filename' do
|
206
|
+
let(:api_client) { {{moduleName}}::ApiClient.new }
|
207
|
+
|
208
|
+
it 'works' do
|
209
|
+
expect(api_client.sanitize_filename('sun')).to eq('sun')
|
210
|
+
expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
|
211
|
+
expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
|
212
|
+
expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
|
213
|
+
expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
|
214
|
+
expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
|
215
|
+
expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
|
216
|
+
expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
|
217
|
+
expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
@@ -0,0 +1,153 @@
|
|
1
|
+
# Call an API with given options.
|
2
|
+
#
|
3
|
+
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
4
|
+
# the data deserialized from response body (could be nil), response status code and response headers.
|
5
|
+
def call_api(http_method, path, opts = {})
|
6
|
+
request = build_request(http_method, path, opts)
|
7
|
+
response = request.run
|
8
|
+
|
9
|
+
if @config.debugging
|
10
|
+
@config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
11
|
+
end
|
12
|
+
|
13
|
+
unless response.success?
|
14
|
+
if response.timed_out?
|
15
|
+
fail ApiError.new('Connection timed out')
|
16
|
+
elsif response.code == 0
|
17
|
+
# Errors from libcurl will be made visible here
|
18
|
+
fail ApiError.new(:code => 0,
|
19
|
+
:message => response.return_message)
|
20
|
+
else
|
21
|
+
fail ApiError.new(:code => response.code,
|
22
|
+
:response_headers => response.headers,
|
23
|
+
:response_body => response.body),
|
24
|
+
response.status_message
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
if opts[:return_type]
|
29
|
+
data = deserialize(response, opts[:return_type])
|
30
|
+
else
|
31
|
+
data = nil
|
32
|
+
end
|
33
|
+
return data, response.code, response.headers
|
34
|
+
end
|
35
|
+
|
36
|
+
# Builds the HTTP request
|
37
|
+
#
|
38
|
+
# @param [String] http_method HTTP method/verb (e.g. POST)
|
39
|
+
# @param [String] path URL path (e.g. /account/new)
|
40
|
+
# @option opts [Hash] :header_params Header parameters
|
41
|
+
# @option opts [Hash] :query_params Query parameters
|
42
|
+
# @option opts [Hash] :form_params Query parameters
|
43
|
+
# @option opts [Object] :body HTTP body (JSON/XML)
|
44
|
+
# @return [Typhoeus::Request] A Typhoeus Request
|
45
|
+
def build_request(http_method, path, opts = {})
|
46
|
+
url = build_request_url(path, opts)
|
47
|
+
http_method = http_method.to_sym.downcase
|
48
|
+
|
49
|
+
header_params = @default_headers.merge(opts[:header_params] || {})
|
50
|
+
query_params = opts[:query_params] || {}
|
51
|
+
form_params = opts[:form_params] || {}
|
52
|
+
|
53
|
+
{{#hasAuthMethods}}
|
54
|
+
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
55
|
+
{{/hasAuthMethods}}
|
56
|
+
|
57
|
+
# set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
|
58
|
+
_verify_ssl_host = @config.verify_ssl_host ? 2 : 0
|
59
|
+
|
60
|
+
req_opts = {
|
61
|
+
:method => http_method,
|
62
|
+
:headers => header_params,
|
63
|
+
:params => query_params,
|
64
|
+
:params_encoding => @config.params_encoding,
|
65
|
+
:timeout => @config.timeout,
|
66
|
+
:ssl_verifypeer => @config.verify_ssl,
|
67
|
+
:ssl_verifyhost => _verify_ssl_host,
|
68
|
+
:sslcert => @config.cert_file,
|
69
|
+
:sslkey => @config.key_file,
|
70
|
+
:verbose => @config.debugging
|
71
|
+
}
|
72
|
+
|
73
|
+
# set custom cert, if provided
|
74
|
+
req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
|
75
|
+
|
76
|
+
if [:post, :patch, :put, :delete].include?(http_method)
|
77
|
+
req_body = build_request_body(header_params, form_params, opts[:body])
|
78
|
+
req_opts.update :body => req_body
|
79
|
+
if @config.debugging
|
80
|
+
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
request = Typhoeus::Request.new(url, req_opts)
|
85
|
+
download_file(request) if opts[:return_type] == 'File'
|
86
|
+
request
|
87
|
+
end
|
88
|
+
|
89
|
+
# Builds the HTTP request body
|
90
|
+
#
|
91
|
+
# @param [Hash] header_params Header parameters
|
92
|
+
# @param [Hash] form_params Query parameters
|
93
|
+
# @param [Object] body HTTP body (JSON/XML)
|
94
|
+
# @return [String] HTTP body data in the form of string
|
95
|
+
def build_request_body(header_params, form_params, body)
|
96
|
+
# http form
|
97
|
+
if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
|
98
|
+
header_params['Content-Type'] == 'multipart/form-data'
|
99
|
+
data = {}
|
100
|
+
form_params.each do |key, value|
|
101
|
+
case value
|
102
|
+
when ::File, ::Array, nil
|
103
|
+
# let typhoeus handle File, Array and nil parameters
|
104
|
+
data[key] = value
|
105
|
+
else
|
106
|
+
data[key] = value.to_s
|
107
|
+
end
|
108
|
+
end
|
109
|
+
elsif body
|
110
|
+
data = body.is_a?(String) ? body : body.to_json
|
111
|
+
else
|
112
|
+
data = nil
|
113
|
+
end
|
114
|
+
data
|
115
|
+
end
|
116
|
+
|
117
|
+
# Save response body into a file in (the defined) temporary folder, using the filename
|
118
|
+
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
119
|
+
# The response body is written to the file in chunks in order to handle files which
|
120
|
+
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
121
|
+
# process can use.
|
122
|
+
#
|
123
|
+
# @see Configuration#temp_folder_path
|
124
|
+
def download_file(request)
|
125
|
+
tempfile = nil
|
126
|
+
encoding = nil
|
127
|
+
request.on_headers do |response|
|
128
|
+
content_disposition = response.headers['Content-Disposition']
|
129
|
+
if content_disposition && content_disposition =~ /filename=/i
|
130
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
131
|
+
prefix = sanitize_filename(filename)
|
132
|
+
else
|
133
|
+
prefix = 'download-'
|
134
|
+
end
|
135
|
+
prefix = prefix + '-' unless prefix.end_with?('-')
|
136
|
+
encoding = response.body.encoding
|
137
|
+
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
138
|
+
@tempfile = tempfile
|
139
|
+
end
|
140
|
+
request.on_body do |chunk|
|
141
|
+
chunk.force_encoding(encoding)
|
142
|
+
tempfile.write(chunk)
|
143
|
+
end
|
144
|
+
request.on_complete do |response|
|
145
|
+
if tempfile
|
146
|
+
tempfile.close
|
147
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
148
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
149
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
150
|
+
"explicitly with `tempfile.delete`"
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# {{moduleName}}::{{classname}}{{#description}}
|
2
|
+
|
3
|
+
{{.}}{{/description}}
|
4
|
+
|
5
|
+
All URIs are relative to *{{basePath}}*
|
6
|
+
|
7
|
+
| Method | HTTP request | Description |
|
8
|
+
| ------ | ------------ | ----------- |
|
9
|
+
{{#operations}}
|
10
|
+
{{#operation}}
|
11
|
+
| [`{{operationId}}`]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** `{{path}}` | {{summary}} |
|
12
|
+
{{/operation}}
|
13
|
+
{{/operations}}
|
14
|
+
|
15
|
+
{{#operations}}
|
16
|
+
{{#operation}}
|
17
|
+
|
18
|
+
## `{{operationId}}`
|
19
|
+
|
20
|
+
> `{{#returnType}}{{#returnTypeIsPrimitive}}{{returnType}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}<{{{returnType}}}>{{/returnTypeIsPrimitive}} {{/returnType}}{{operationId}}{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}}`
|
21
|
+
|
22
|
+
{{{summary}}}{{#notes}}
|
23
|
+
|
24
|
+
{{{.}}}{{/notes}}
|
25
|
+
|
26
|
+
### Examples
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
REPLACE_ME_WITH_EXAMPLE_FOR__{{{operationId}}}_Ruby_CODE
|
30
|
+
```
|
31
|
+
|
32
|
+
#### Using the `{{operationId}}_with_http_info` variant
|
33
|
+
|
34
|
+
This returns an Array which contains the response data{{^returnType}} (`nil` in this case){{/returnType}}, status code and headers.
|
35
|
+
|
36
|
+
> `<Array({{#returnType}}{{#returnTypeIsPrimitive}}{{returnType}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}<{{{returnType}}}>{{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}nil{{/returnType}}, Integer, Hash)> {{operationId}}_with_http_info{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}}`
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
begin
|
40
|
+
{{#summary}}# {{{.}}}{{/summary}}
|
41
|
+
data, status_code, headers = api_instance.{{{operationId}}}_with_http_info{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}}
|
42
|
+
p status_code # => 2xx
|
43
|
+
p headers # => { ... }
|
44
|
+
p data # => {{#returnType}}{{#returnTypeIsPrimitive}}{{returnType}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}<{{{returnType}}}>{{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}nil{{/returnType}}
|
45
|
+
rescue {{{moduleName}}}::ApiError => e
|
46
|
+
puts "Error when calling {{classname}}->{{{operationId}}}_with_http_info: #{e}"
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
### Parameters
|
51
|
+
|
52
|
+
{{^allParams}}
|
53
|
+
This endpoint does not need any parameter.
|
54
|
+
{{/allParams}}
|
55
|
+
{{#allParams}}
|
56
|
+
{{#-first}}
|
57
|
+
| Name | Type | Description | Notes |
|
58
|
+
| ---- | ---- | ----------- | ----- |
|
59
|
+
{{/-first}}
|
60
|
+
| `{{paramName}}` | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}} | {{description}} | {{^required}}[optional]{{/required}}{{#defaultValue}}[default to {{.}}]{{/defaultValue}} |
|
61
|
+
{{/allParams}}
|
62
|
+
|
63
|
+
### Return type
|
64
|
+
|
65
|
+
{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}nil (empty response body){{/returnType}}
|
66
|
+
|
67
|
+
### Authorization
|
68
|
+
|
69
|
+
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}}
|
70
|
+
|
71
|
+
### HTTP request headers
|
72
|
+
|
73
|
+
- **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
|
74
|
+
- **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}}
|
75
|
+
|
76
|
+
{{/operation}}
|
77
|
+
{{/operations}}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
=begin
|
2
|
+
{{> api_info}}
|
3
|
+
=end
|
4
|
+
|
5
|
+
module Dropbox
|
6
|
+
end
|
7
|
+
|
8
|
+
module {{moduleName}}
|
9
|
+
class ApiError < StandardError
|
10
|
+
attr_reader :code, :response_headers, :response_body
|
11
|
+
|
12
|
+
# Usage examples:
|
13
|
+
# ApiError.new
|
14
|
+
# ApiError.new("message")
|
15
|
+
# ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
|
16
|
+
# ApiError.new(:code => 404, :message => "Not Found")
|
17
|
+
def initialize(arg = nil)
|
18
|
+
if arg.is_a? Hash
|
19
|
+
if arg.key?(:message) || arg.key?('message')
|
20
|
+
super(arg[:message] || arg['message'])
|
21
|
+
else
|
22
|
+
super arg
|
23
|
+
end
|
24
|
+
|
25
|
+
arg.each do |k, v|
|
26
|
+
instance_variable_set "@#{k}", v
|
27
|
+
end
|
28
|
+
else
|
29
|
+
super arg
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# Override to_s to display a friendly error message
|
34
|
+
def to_s
|
35
|
+
message
|
36
|
+
end
|
37
|
+
|
38
|
+
def message
|
39
|
+
if @message.nil?
|
40
|
+
msg = "Error message: the server returns an error"
|
41
|
+
else
|
42
|
+
msg = @message
|
43
|
+
end
|
44
|
+
|
45
|
+
msg += "\nHTTP status code: #{code}" if code
|
46
|
+
msg += "\nResponse headers: #{response_headers}" if response_headers
|
47
|
+
msg += "\nResponse body: #{response_body}" if response_body
|
48
|
+
|
49
|
+
msg
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
{{#appName}}
|
2
|
+
#{{{.}}}
|
3
|
+
|
4
|
+
{{/appName}}
|
5
|
+
{{#appDescription}}
|
6
|
+
#{{{.}}}
|
7
|
+
|
8
|
+
{{/appDescription}}
|
9
|
+
{{#version}}The version of the OpenAPI document: {{.}}{{/version}}
|
10
|
+
{{#infoEmail}}Contact: {{{.}}}{{/infoEmail}}
|
11
|
+
Generated by: https://openapi-generator.tech
|
12
|
+
OpenAPI Generator version: {{{generatorVersion}}}
|