yapstone-so 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +79 -0
- data/README.md +260 -0
- data/Rakefile +10 -0
- data/docs/AbstractEntity.md +17 -0
- data/docs/ActionResource.md +25 -0
- data/docs/ActionStatusResource.md +21 -0
- data/docs/AddressResource.md +31 -0
- data/docs/ApplicantConsentRequest.md +25 -0
- data/docs/ApplicantConsentResource.md +27 -0
- data/docs/ApplicantConsentType.md +16 -0
- data/docs/ApplicantResource.md +39 -0
- data/docs/AssetRequest.md +25 -0
- data/docs/AssetRequestAllOf.md +17 -0
- data/docs/AssetRequestCommon.md +23 -0
- data/docs/AssetResource.md +29 -0
- data/docs/AssetResourceAllOf.md +19 -0
- data/docs/AssetUpdateRequest.md +27 -0
- data/docs/AssetUpdateRequestAllOf.md +19 -0
- data/docs/AssetsApi.md +276 -0
- data/docs/AssetsResource.md +19 -0
- data/docs/AssetsResourceAllOf.md +17 -0
- data/docs/AuthenticationApi.md +58 -0
- data/docs/BankAccountDataResource.md +23 -0
- data/docs/BankAccountResource.md +25 -0
- data/docs/BeneficialOwnerRequest.md +27 -0
- data/docs/BeneficialOwnerResource.md +31 -0
- data/docs/BeneficialOwnersPatch.md +21 -0
- data/docs/BusinessApplicantAdminFieldsResource.md +17 -0
- data/docs/BusinessApplicantAdminResource.md +49 -0
- data/docs/BusinessApplicantRequest.md +39 -0
- data/docs/BusinessApplicantResource.md +23 -0
- data/docs/BusinessApplicantResourceAllOf.md +23 -0
- data/docs/BusinessApplicantUpdateRequest.md +41 -0
- data/docs/BusinessApplicantsApi.md +276 -0
- data/docs/BusinessApplicantsResource.md +19 -0
- data/docs/BusinessApplicantsResourceAllOf.md +17 -0
- data/docs/BusinessIdType.md +16 -0
- data/docs/BusinessIdentificationResource.md +25 -0
- data/docs/BusinessOwnerResource.md +17 -0
- data/docs/BusinessProfileResource.md +33 -0
- data/docs/BusinessUpdateIdentificationResource.md +25 -0
- data/docs/CapabilityResource.md +19 -0
- data/docs/CardDataResource.md +35 -0
- data/docs/Consent.md +25 -0
- data/docs/ConsentRequest.md +25 -0
- data/docs/ConsentResource.md +27 -0
- data/docs/ConsentType.md +16 -0
- data/docs/ContractCreateRequest.md +21 -0
- data/docs/ContractResource.md +23 -0
- data/docs/ContractResourceDTO.md +17 -0
- data/docs/ContractResourceDTOAllOf.md +17 -0
- data/docs/ContractUpdateRequest.md +19 -0
- data/docs/ContractsApi.md +227 -0
- data/docs/CustomerHistoryResource.md +19 -0
- data/docs/DeactivateRequest.md +19 -0
- data/docs/DeactivateResponse.md +21 -0
- data/docs/DirectDebitConsentResource.md +19 -0
- data/docs/DirectDebitFrequencyType.md +16 -0
- data/docs/DirectDebitSchemeType.md +16 -0
- data/docs/DirectDebtCapabilityResource.md +23 -0
- data/docs/EntitiesResource.md +17 -0
- data/docs/EntityHistoryResource.md +17 -0
- data/docs/EntityProductStatusResource.md +19 -0
- data/docs/EntityUpdateEvent.md +23 -0
- data/docs/EntityUpdatedAttribute.md +21 -0
- data/docs/Errors.md +19 -0
- data/docs/ExpirationDateResource.md +19 -0
- data/docs/Gender.md +16 -0
- data/docs/GovIdentificationResource.md +29 -0
- data/docs/GovIdentificationUpdateResource.md +29 -0
- data/docs/GovernmentIdType.md +16 -0
- data/docs/IndividualApplicantAdminFieldsResource.md +17 -0
- data/docs/IndividualApplicantAdminResource.md +43 -0
- data/docs/IndividualApplicantRequest.md +33 -0
- data/docs/IndividualApplicantResource.md +17 -0
- data/docs/IndividualApplicantUpdateRequest.md +35 -0
- data/docs/IndividualApplicantsApi.md +276 -0
- data/docs/IndividualApplicantsResource.md +19 -0
- data/docs/IndividualApplicantsResourceAllOf.md +17 -0
- data/docs/IndividualOwnerResource.md +19 -0
- data/docs/InlineResponse200.md +25 -0
- data/docs/InstrumentsApi.md +274 -0
- data/docs/IssuerScope.md +16 -0
- data/docs/MarketPlaceApplicantResource.md +17 -0
- data/docs/MarketPlacePropertyResource.md +27 -0
- data/docs/MarketplaceProductAdd.md +27 -0
- data/docs/MarketplaceProductBasic.md +23 -0
- data/docs/MarketplaceProductExtra.md +33 -0
- data/docs/MarketplaceProductExtraAllOf.md +25 -0
- data/docs/MarketplaceProductPayoutInstrumentResource.md +19 -0
- data/docs/MarketplaceProductPayoutInstrumentUpdate.md +21 -0
- data/docs/MarketplaceProductResource.md +39 -0
- data/docs/MarketplaceProductSubResource.md +37 -0
- data/docs/MarketplaceProductUpdate.md +37 -0
- data/docs/MarketplaceProductsApi.md +116 -0
- data/docs/MarketplacesApi.md +227 -0
- data/docs/Meta.md +21 -0
- data/docs/MoneyResource.md +19 -0
- data/docs/NameResource.md +27 -0
- data/docs/OwnerRequest.md +21 -0
- data/docs/OwnerResource.md +23 -0
- data/docs/Pagination.md +21 -0
- data/docs/PatchOperation.md +16 -0
- data/docs/PayoutInstrumentRequest.md +29 -0
- data/docs/PayoutInstrumentResource.md +35 -0
- data/docs/PayoutInstrumentResourceCommonEntities.md +23 -0
- data/docs/PayoutInstrumentUpdateRequest.md +31 -0
- data/docs/PayoutInstrumentsApi.md +274 -0
- data/docs/PayoutInstrumentsResource.md +19 -0
- data/docs/PayoutInstrumentsResourceAllOf.md +17 -0
- data/docs/PayoutProductAdd.md +19 -0
- data/docs/PayoutProductResource.md +27 -0
- data/docs/PayoutProductSubResource.md +25 -0
- data/docs/PayoutProductSubResourceAllOf.md +23 -0
- data/docs/PayoutProductsApi.md +61 -0
- data/docs/PayoutsApi.md +227 -0
- data/docs/PhoneResource.md +19 -0
- data/docs/PriceSettingResource.md +29 -0
- data/docs/PrimaryContactResource.md +35 -0
- data/docs/Product.md +16 -0
- data/docs/ProductRead.md +17 -0
- data/docs/ProductWrite.md +17 -0
- data/docs/ProfileResource.md +35 -0
- data/docs/PropertyHistoryResource.md +27 -0
- data/docs/PropertyInfoResource.md +23 -0
- data/docs/PropertyOwnerResource.md +31 -0
- data/docs/PropertyResource.md +27 -0
- data/docs/PropertyTrackerResource.md +23 -0
- data/docs/RegistrationResource.md +21 -0
- data/docs/ReservationSettingResource.md +19 -0
- data/docs/Resource.md +17 -0
- data/docs/SocialNetworkResource.md +19 -0
- data/docs/StatusReasonResource.md +23 -0
- data/docs/StatusRequest.md +17 -0
- data/docs/StatusResource.md +21 -0
- data/docs/StaySettingResource.md +19 -0
- data/docs/SuspensionReasonResource.md +17 -0
- data/docs/TravelerResource.md +23 -0
- data/git_push.sh +55 -0
- data/lib/yapstone-so/api/assets_api.rb +335 -0
- data/lib/yapstone-so/api/authentication_api.rb +92 -0
- data/lib/yapstone-so/api/business_applicants_api.rb +339 -0
- data/lib/yapstone-so/api/contracts_api.rb +284 -0
- data/lib/yapstone-so/api/individual_applicants_api.rb +339 -0
- data/lib/yapstone-so/api/instruments_api.rb +332 -0
- data/lib/yapstone-so/api/marketplace_products_api.rb +154 -0
- data/lib/yapstone-so/api/marketplaces_api.rb +304 -0
- data/lib/yapstone-so/api/payout_instruments_api.rb +332 -0
- data/lib/yapstone-so/api/payout_products_api.rb +84 -0
- data/lib/yapstone-so/api/payouts_api.rb +304 -0
- data/lib/yapstone-so/api_client.rb +386 -0
- data/lib/yapstone-so/api_error.rb +57 -0
- data/lib/yapstone-so/configuration.rb +249 -0
- data/lib/yapstone-so/models/abstract_entity.rb +232 -0
- data/lib/yapstone-so/models/action_resource.rb +238 -0
- data/lib/yapstone-so/models/action_status_resource.rb +260 -0
- data/lib/yapstone-so/models/address_resource.rb +444 -0
- data/lib/yapstone-so/models/applicant_consent_request.rb +317 -0
- data/lib/yapstone-so/models/applicant_consent_resource.rb +271 -0
- data/lib/yapstone-so/models/applicant_consent_type.rb +39 -0
- data/lib/yapstone-so/models/applicant_resource.rb +391 -0
- data/lib/yapstone-so/models/asset_request.rb +325 -0
- data/lib/yapstone-so/models/asset_request_all_of.rb +199 -0
- data/lib/yapstone-so/models/asset_request_common.rb +305 -0
- data/lib/yapstone-so/models/asset_resource.rb +344 -0
- data/lib/yapstone-so/models/asset_resource_all_of.rb +206 -0
- data/lib/yapstone-so/models/asset_update_request.rb +334 -0
- data/lib/yapstone-so/models/asset_update_request_all_of.rb +208 -0
- data/lib/yapstone-so/models/assets_resource.rb +225 -0
- data/lib/yapstone-so/models/assets_resource_all_of.rb +204 -0
- data/lib/yapstone-so/models/bank_account_data_resource.rb +228 -0
- data/lib/yapstone-so/models/bank_account_resource.rb +334 -0
- data/lib/yapstone-so/models/beneficial_owner_request.rb +293 -0
- data/lib/yapstone-so/models/beneficial_owner_resource.rb +312 -0
- data/lib/yapstone-so/models/beneficial_owners_patch.rb +221 -0
- data/lib/yapstone-so/models/business_applicant_admin_fields_resource.rb +198 -0
- data/lib/yapstone-so/models/business_applicant_admin_resource.rb +442 -0
- data/lib/yapstone-so/models/business_applicant_request.rb +375 -0
- data/lib/yapstone-so/models/business_applicant_resource.rb +239 -0
- data/lib/yapstone-so/models/business_applicant_resource_all_of.rb +226 -0
- data/lib/yapstone-so/models/business_applicant_update_request.rb +360 -0
- data/lib/yapstone-so/models/business_applicants_resource.rb +225 -0
- data/lib/yapstone-so/models/business_applicants_resource_all_of.rb +204 -0
- data/lib/yapstone-so/models/business_id_type.rb +37 -0
- data/lib/yapstone-so/models/business_identification_resource.rb +267 -0
- data/lib/yapstone-so/models/business_owner_resource.rb +231 -0
- data/lib/yapstone-so/models/business_profile_resource.rb +416 -0
- data/lib/yapstone-so/models/business_update_identification_resource.rb +253 -0
- data/lib/yapstone-so/models/capability_resource.rb +249 -0
- data/lib/yapstone-so/models/card_data_resource.rb +382 -0
- data/lib/yapstone-so/models/consent.rb +329 -0
- data/lib/yapstone-so/models/consent_request.rb +318 -0
- data/lib/yapstone-so/models/consent_resource.rb +272 -0
- data/lib/yapstone-so/models/consent_type.rb +36 -0
- data/lib/yapstone-so/models/contract_create_request.rb +260 -0
- data/lib/yapstone-so/models/contract_resource.rb +270 -0
- data/lib/yapstone-so/models/contract_resource_dto.rb +205 -0
- data/lib/yapstone-so/models/contract_resource_dto_all_of.rb +198 -0
- data/lib/yapstone-so/models/contract_update_request.rb +250 -0
- data/lib/yapstone-so/models/customer_history_resource.rb +206 -0
- data/lib/yapstone-so/models/deactivate_request.rb +228 -0
- data/lib/yapstone-so/models/deactivate_response.rb +221 -0
- data/lib/yapstone-so/models/direct_debit_consent_resource.rb +252 -0
- data/lib/yapstone-so/models/direct_debit_frequency_type.rb +36 -0
- data/lib/yapstone-so/models/direct_debit_scheme_type.rb +37 -0
- data/lib/yapstone-so/models/direct_debt_capability_resource.rb +283 -0
- data/lib/yapstone-so/models/entities_resource.rb +202 -0
- data/lib/yapstone-so/models/entity_history_resource.rb +200 -0
- data/lib/yapstone-so/models/entity_product_status_resource.rb +206 -0
- data/lib/yapstone-so/models/entity_update_event.rb +230 -0
- data/lib/yapstone-so/models/entity_updated_attribute.rb +218 -0
- data/lib/yapstone-so/models/errors.rb +205 -0
- data/lib/yapstone-so/models/expiration_date_resource.rb +238 -0
- data/lib/yapstone-so/models/gender.rb +37 -0
- data/lib/yapstone-so/models/gov_identification_resource.rb +336 -0
- data/lib/yapstone-so/models/gov_identification_update_resource.rb +322 -0
- data/lib/yapstone-so/models/government_id_type.rb +43 -0
- data/lib/yapstone-so/models/individual_applicant_admin_fields_resource.rb +198 -0
- data/lib/yapstone-so/models/individual_applicant_admin_resource.rb +411 -0
- data/lib/yapstone-so/models/individual_applicant_request.rb +345 -0
- data/lib/yapstone-so/models/individual_applicant_resource.rb +207 -0
- data/lib/yapstone-so/models/individual_applicant_update_request.rb +330 -0
- data/lib/yapstone-so/models/individual_applicants_resource.rb +225 -0
- data/lib/yapstone-so/models/individual_applicants_resource_all_of.rb +204 -0
- data/lib/yapstone-so/models/individual_owner_resource.rb +296 -0
- data/lib/yapstone-so/models/inline_response200.rb +232 -0
- data/lib/yapstone-so/models/issuer_scope.rb +39 -0
- data/lib/yapstone-so/models/market_place_applicant_resource.rb +197 -0
- data/lib/yapstone-so/models/market_place_property_resource.rb +261 -0
- data/lib/yapstone-so/models/marketplace_product_add.rb +293 -0
- data/lib/yapstone-so/models/marketplace_product_basic.rb +261 -0
- data/lib/yapstone-so/models/marketplace_product_extra.rb +328 -0
- data/lib/yapstone-so/models/marketplace_product_extra_all_of.rb +268 -0
- data/lib/yapstone-so/models/marketplace_product_payout_instrument_resource.rb +217 -0
- data/lib/yapstone-so/models/marketplace_product_payout_instrument_update.rb +233 -0
- data/lib/yapstone-so/models/marketplace_product_resource.rb +363 -0
- data/lib/yapstone-so/models/marketplace_product_sub_resource.rb +353 -0
- data/lib/yapstone-so/models/marketplace_product_update.rb +352 -0
- data/lib/yapstone-so/models/meta.rb +231 -0
- data/lib/yapstone-so/models/money_resource.rb +218 -0
- data/lib/yapstone-so/models/name_resource.rb +444 -0
- data/lib/yapstone-so/models/owner_request.rb +305 -0
- data/lib/yapstone-so/models/owner_resource.rb +315 -0
- data/lib/yapstone-so/models/pagination.rb +224 -0
- data/lib/yapstone-so/models/patch_operation.rb +37 -0
- data/lib/yapstone-so/models/payout_instrument_request.rb +340 -0
- data/lib/yapstone-so/models/payout_instrument_resource.rb +371 -0
- data/lib/yapstone-so/models/payout_instrument_resource_common_entities.rb +300 -0
- data/lib/yapstone-so/models/payout_instrument_update_request.rb +349 -0
- data/lib/yapstone-so/models/payout_instruments_resource.rb +225 -0
- data/lib/yapstone-so/models/payout_instruments_resource_all_of.rb +204 -0
- data/lib/yapstone-so/models/payout_product_add.rb +217 -0
- data/lib/yapstone-so/models/payout_product_resource.rb +255 -0
- data/lib/yapstone-so/models/payout_product_sub_resource.rb +245 -0
- data/lib/yapstone-so/models/payout_product_sub_resource_all_of.rb +224 -0
- data/lib/yapstone-so/models/phone_resource.rb +228 -0
- data/lib/yapstone-so/models/price_setting_resource.rb +301 -0
- data/lib/yapstone-so/models/primary_contact_resource.rb +417 -0
- data/lib/yapstone-so/models/product.rb +36 -0
- data/lib/yapstone-so/models/product_read.rb +199 -0
- data/lib/yapstone-so/models/product_write.rb +199 -0
- data/lib/yapstone-so/models/profile_resource.rb +422 -0
- data/lib/yapstone-so/models/property_history_resource.rb +245 -0
- data/lib/yapstone-so/models/property_info_resource.rb +229 -0
- data/lib/yapstone-so/models/property_owner_resource.rb +341 -0
- data/lib/yapstone-so/models/property_resource.rb +315 -0
- data/lib/yapstone-so/models/property_tracker_resource.rb +228 -0
- data/lib/yapstone-so/models/registration_resource.rb +253 -0
- data/lib/yapstone-so/models/reservation_setting_resource.rb +206 -0
- data/lib/yapstone-so/models/resource.rb +198 -0
- data/lib/yapstone-so/models/social_network_resource.rb +291 -0
- data/lib/yapstone-so/models/status_reason_resource.rb +267 -0
- data/lib/yapstone-so/models/status_request.rb +232 -0
- data/lib/yapstone-so/models/status_resource.rb +259 -0
- data/lib/yapstone-so/models/stay_setting_resource.rb +208 -0
- data/lib/yapstone-so/models/suspension_reason_resource.rb +198 -0
- data/lib/yapstone-so/models/traveler_resource.rb +278 -0
- data/lib/yapstone-so/version.rb +15 -0
- data/lib/yapstone-so.rb +174 -0
- data/spec/api/assets_api_spec.rb +93 -0
- data/spec/api/authentication_api_spec.rb +48 -0
- data/spec/api/business_applicants_api_spec.rb +93 -0
- data/spec/api/contracts_api_spec.rb +84 -0
- data/spec/api/individual_applicants_api_spec.rb +93 -0
- data/spec/api/instruments_api_spec.rb +92 -0
- data/spec/api/marketplace_products_api_spec.rb +60 -0
- data/spec/api/marketplaces_api_spec.rb +85 -0
- data/spec/api/payout_instruments_api_spec.rb +92 -0
- data/spec/api/payout_products_api_spec.rb +47 -0
- data/spec/api/payouts_api_spec.rb +85 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/abstract_entity_spec.rb +41 -0
- data/spec/models/action_resource_spec.rb +65 -0
- data/spec/models/action_status_resource_spec.rb +57 -0
- data/spec/models/address_resource_spec.rb +83 -0
- data/spec/models/applicant_consent_request_spec.rb +65 -0
- data/spec/models/applicant_consent_resource_spec.rb +71 -0
- data/spec/models/applicant_consent_type_spec.rb +35 -0
- data/spec/models/applicant_resource_spec.rb +107 -0
- data/spec/models/asset_request_all_of_spec.rb +41 -0
- data/spec/models/asset_request_common_spec.rb +63 -0
- data/spec/models/asset_request_spec.rb +69 -0
- data/spec/models/asset_resource_all_of_spec.rb +47 -0
- data/spec/models/asset_resource_spec.rb +81 -0
- data/spec/models/asset_update_request_all_of_spec.rb +47 -0
- data/spec/models/asset_update_request_spec.rb +75 -0
- data/spec/models/assets_resource_all_of_spec.rb +41 -0
- data/spec/models/assets_resource_spec.rb +47 -0
- data/spec/models/bank_account_data_resource_spec.rb +59 -0
- data/spec/models/bank_account_resource_spec.rb +69 -0
- data/spec/models/beneficial_owner_request_spec.rb +71 -0
- data/spec/models/beneficial_owner_resource_spec.rb +83 -0
- data/spec/models/beneficial_owners_patch_spec.rb +53 -0
- data/spec/models/business_applicant_admin_fields_resource_spec.rb +41 -0
- data/spec/models/business_applicant_admin_resource_spec.rb +137 -0
- data/spec/models/business_applicant_request_spec.rb +107 -0
- data/spec/models/business_applicant_resource_all_of_spec.rb +59 -0
- data/spec/models/business_applicant_resource_spec.rb +59 -0
- data/spec/models/business_applicant_update_request_spec.rb +113 -0
- data/spec/models/business_applicants_resource_all_of_spec.rb +41 -0
- data/spec/models/business_applicants_resource_spec.rb +47 -0
- data/spec/models/business_id_type_spec.rb +35 -0
- data/spec/models/business_identification_resource_spec.rb +65 -0
- data/spec/models/business_owner_resource_spec.rb +41 -0
- data/spec/models/business_profile_resource_spec.rb +93 -0
- data/spec/models/business_update_identification_resource_spec.rb +65 -0
- data/spec/models/capability_resource_spec.rb +51 -0
- data/spec/models/card_data_resource_spec.rb +107 -0
- data/spec/models/consent_request_spec.rb +65 -0
- data/spec/models/consent_resource_spec.rb +71 -0
- data/spec/models/consent_spec.rb +69 -0
- data/spec/models/consent_type_spec.rb +35 -0
- data/spec/models/contract_create_request_spec.rb +53 -0
- data/spec/models/contract_resource_dto_all_of_spec.rb +41 -0
- data/spec/models/contract_resource_dto_spec.rb +41 -0
- data/spec/models/contract_resource_spec.rb +59 -0
- data/spec/models/contract_update_request_spec.rb +47 -0
- data/spec/models/customer_history_resource_spec.rb +47 -0
- data/spec/models/deactivate_request_spec.rb +47 -0
- data/spec/models/deactivate_response_spec.rb +53 -0
- data/spec/models/direct_debit_consent_resource_spec.rb +51 -0
- data/spec/models/direct_debit_frequency_type_spec.rb +35 -0
- data/spec/models/direct_debit_scheme_type_spec.rb +35 -0
- data/spec/models/direct_debt_capability_resource_spec.rb +67 -0
- data/spec/models/entities_resource_spec.rb +41 -0
- data/spec/models/entity_history_resource_spec.rb +41 -0
- data/spec/models/entity_product_status_resource_spec.rb +47 -0
- data/spec/models/entity_update_event_spec.rb +59 -0
- data/spec/models/entity_updated_attribute_spec.rb +53 -0
- data/spec/models/errors_spec.rb +47 -0
- data/spec/models/expiration_date_resource_spec.rb +47 -0
- data/spec/models/gender_spec.rb +35 -0
- data/spec/models/gov_identification_resource_spec.rb +77 -0
- data/spec/models/gov_identification_update_resource_spec.rb +77 -0
- data/spec/models/government_id_type_spec.rb +35 -0
- data/spec/models/individual_applicant_admin_fields_resource_spec.rb +41 -0
- data/spec/models/individual_applicant_admin_resource_spec.rb +119 -0
- data/spec/models/individual_applicant_request_spec.rb +89 -0
- data/spec/models/individual_applicant_resource_spec.rb +41 -0
- data/spec/models/individual_applicant_update_request_spec.rb +95 -0
- data/spec/models/individual_applicants_resource_all_of_spec.rb +41 -0
- data/spec/models/individual_applicants_resource_spec.rb +47 -0
- data/spec/models/individual_owner_resource_spec.rb +47 -0
- data/spec/models/inline_response200_spec.rb +65 -0
- data/spec/models/issuer_scope_spec.rb +35 -0
- data/spec/models/market_place_applicant_resource_spec.rb +41 -0
- data/spec/models/market_place_property_resource_spec.rb +71 -0
- data/spec/models/marketplace_product_add_spec.rb +75 -0
- data/spec/models/marketplace_product_basic_spec.rb +63 -0
- data/spec/models/marketplace_product_extra_all_of_spec.rb +69 -0
- data/spec/models/marketplace_product_extra_spec.rb +97 -0
- data/spec/models/marketplace_product_payout_instrument_resource_spec.rb +47 -0
- data/spec/models/marketplace_product_payout_instrument_update_spec.rb +53 -0
- data/spec/models/marketplace_product_resource_spec.rb +115 -0
- data/spec/models/marketplace_product_sub_resource_spec.rb +109 -0
- data/spec/models/marketplace_product_update_spec.rb +109 -0
- data/spec/models/meta_spec.rb +53 -0
- data/spec/models/money_resource_spec.rb +47 -0
- data/spec/models/name_resource_spec.rb +75 -0
- data/spec/models/owner_request_spec.rb +53 -0
- data/spec/models/owner_resource_spec.rb +59 -0
- data/spec/models/pagination_spec.rb +53 -0
- data/spec/models/patch_operation_spec.rb +35 -0
- data/spec/models/payout_instrument_request_spec.rb +81 -0
- data/spec/models/payout_instrument_resource_common_entities_spec.rb +63 -0
- data/spec/models/payout_instrument_resource_spec.rb +99 -0
- data/spec/models/payout_instrument_update_request_spec.rb +87 -0
- data/spec/models/payout_instruments_resource_all_of_spec.rb +41 -0
- data/spec/models/payout_instruments_resource_spec.rb +47 -0
- data/spec/models/payout_product_add_spec.rb +47 -0
- data/spec/models/payout_product_resource_spec.rb +71 -0
- data/spec/models/payout_product_sub_resource_all_of_spec.rb +59 -0
- data/spec/models/payout_product_sub_resource_spec.rb +65 -0
- data/spec/models/phone_resource_spec.rb +47 -0
- data/spec/models/price_setting_resource_spec.rb +85 -0
- data/spec/models/primary_contact_resource_spec.rb +95 -0
- data/spec/models/product_read_spec.rb +41 -0
- data/spec/models/product_spec.rb +35 -0
- data/spec/models/product_write_spec.rb +41 -0
- data/spec/models/profile_resource_spec.rb +95 -0
- data/spec/models/property_history_resource_spec.rb +71 -0
- data/spec/models/property_info_resource_spec.rb +59 -0
- data/spec/models/property_owner_resource_spec.rb +83 -0
- data/spec/models/property_resource_spec.rb +71 -0
- data/spec/models/property_tracker_resource_spec.rb +59 -0
- data/spec/models/registration_resource_spec.rb +53 -0
- data/spec/models/reservation_setting_resource_spec.rb +47 -0
- data/spec/models/resource_spec.rb +41 -0
- data/spec/models/social_network_resource_spec.rb +51 -0
- data/spec/models/status_reason_resource_spec.rb +63 -0
- data/spec/models/status_request_spec.rb +45 -0
- data/spec/models/status_resource_spec.rb +57 -0
- data/spec/models/stay_setting_resource_spec.rb +47 -0
- data/spec/models/suspension_reason_resource_spec.rb +41 -0
- data/spec/models/traveler_resource_spec.rb +59 -0
- data/spec/spec_helper.rb +111 -0
- data/yapstone-so.gemspec +45 -0
- metadata +781 -0
@@ -0,0 +1,304 @@
|
|
1
|
+
=begin
|
2
|
+
#Yapstone Staged On-Boarding Services
|
3
|
+
|
4
|
+
#Set of API's that allow clients to onboard with Yapstone.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'cgi'
|
14
|
+
|
15
|
+
module Yapstone
|
16
|
+
class PayoutsApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Add a payout product in a given contract.
|
23
|
+
# @param contract_id [String] The unique id of the Contract Resource.
|
24
|
+
# @param payout_product_add [PayoutProductAdd] The payout instruments list
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @return [PayoutProductResource]
|
27
|
+
def add_payout_product(contract_id, payout_product_add, opts = {})
|
28
|
+
data, _status_code, _headers = add_payout_product_with_http_info(contract_id, payout_product_add, opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# Add a payout product in a given contract.
|
33
|
+
# @param contract_id [String] The unique id of the Contract Resource.
|
34
|
+
# @param payout_product_add [PayoutProductAdd] The payout instruments list
|
35
|
+
# @param [Hash] opts the optional parameters
|
36
|
+
# @return [Array<(PayoutProductResource, Integer, Hash)>] PayoutProductResource data, response status code and response headers
|
37
|
+
def add_payout_product_with_http_info(contract_id, payout_product_add, opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: PayoutsApi.add_payout_product ...'
|
40
|
+
end
|
41
|
+
# verify the required parameter 'contract_id' is set
|
42
|
+
if @api_client.config.client_side_validation && contract_id.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'contract_id' when calling PayoutsApi.add_payout_product"
|
44
|
+
end
|
45
|
+
# verify the required parameter 'payout_product_add' is set
|
46
|
+
if @api_client.config.client_side_validation && payout_product_add.nil?
|
47
|
+
fail ArgumentError, "Missing the required parameter 'payout_product_add' when calling PayoutsApi.add_payout_product"
|
48
|
+
end
|
49
|
+
# resource path
|
50
|
+
local_var_path = '/contracts/{contractId}/payouts'.sub('{' + 'contractId' + '}', CGI.escape(contract_id.to_s).gsub('%2F', '/'))
|
51
|
+
|
52
|
+
# query parameters
|
53
|
+
query_params = opts[:query_params] || {}
|
54
|
+
|
55
|
+
# header parameters
|
56
|
+
header_params = opts[:header_params] || {}
|
57
|
+
# HTTP header 'Accept' (if needed)
|
58
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
59
|
+
# HTTP header 'Content-Type'
|
60
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
61
|
+
|
62
|
+
# form parameters
|
63
|
+
form_params = opts[:form_params] || {}
|
64
|
+
|
65
|
+
# http body (model)
|
66
|
+
post_body = opts[:body] || @api_client.object_to_http_body(payout_product_add)
|
67
|
+
|
68
|
+
# return_type
|
69
|
+
return_type = opts[:return_type] || 'PayoutProductResource'
|
70
|
+
|
71
|
+
# auth_names
|
72
|
+
auth_names = opts[:auth_names] || ['Bearer']
|
73
|
+
|
74
|
+
new_options = opts.merge(
|
75
|
+
:header_params => header_params,
|
76
|
+
:query_params => query_params,
|
77
|
+
:form_params => form_params,
|
78
|
+
:body => post_body,
|
79
|
+
:auth_names => auth_names,
|
80
|
+
:return_type => return_type
|
81
|
+
)
|
82
|
+
|
83
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
84
|
+
if @api_client.config.debugging
|
85
|
+
@api_client.config.logger.debug "API called: PayoutsApi#add_payout_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
86
|
+
end
|
87
|
+
return data, status_code, headers
|
88
|
+
end
|
89
|
+
|
90
|
+
# deactivate the Payout Product Resource.
|
91
|
+
# @param contract_id [String] The unique id of the Contract Resource.
|
92
|
+
# @param payout_instrument_id [String] The unique id of the Payout Instrument Resource.
|
93
|
+
# @param deactivate_request [DeactivateRequest] The details of the deactivation process.
|
94
|
+
# @param [Hash] opts the optional parameters
|
95
|
+
# @return [nil]
|
96
|
+
def deactivate_payout_product(contract_id, payout_instrument_id, deactivate_request, opts = {})
|
97
|
+
deactivate_payout_product_with_http_info(contract_id, payout_instrument_id, deactivate_request, opts)
|
98
|
+
nil
|
99
|
+
end
|
100
|
+
|
101
|
+
# deactivate the Payout Product Resource.
|
102
|
+
# @param contract_id [String] The unique id of the Contract Resource.
|
103
|
+
# @param payout_instrument_id [String] The unique id of the Payout Instrument Resource.
|
104
|
+
# @param deactivate_request [DeactivateRequest] The details of the deactivation process.
|
105
|
+
# @param [Hash] opts the optional parameters
|
106
|
+
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
107
|
+
def deactivate_payout_product_with_http_info(contract_id, payout_instrument_id, deactivate_request, opts = {})
|
108
|
+
if @api_client.config.debugging
|
109
|
+
@api_client.config.logger.debug 'Calling API: PayoutsApi.deactivate_payout_product ...'
|
110
|
+
end
|
111
|
+
# verify the required parameter 'contract_id' is set
|
112
|
+
if @api_client.config.client_side_validation && contract_id.nil?
|
113
|
+
fail ArgumentError, "Missing the required parameter 'contract_id' when calling PayoutsApi.deactivate_payout_product"
|
114
|
+
end
|
115
|
+
# verify the required parameter 'payout_instrument_id' is set
|
116
|
+
if @api_client.config.client_side_validation && payout_instrument_id.nil?
|
117
|
+
fail ArgumentError, "Missing the required parameter 'payout_instrument_id' when calling PayoutsApi.deactivate_payout_product"
|
118
|
+
end
|
119
|
+
# verify the required parameter 'deactivate_request' is set
|
120
|
+
if @api_client.config.client_side_validation && deactivate_request.nil?
|
121
|
+
fail ArgumentError, "Missing the required parameter 'deactivate_request' when calling PayoutsApi.deactivate_payout_product"
|
122
|
+
end
|
123
|
+
# resource path
|
124
|
+
local_var_path = '/contracts/{contractId}/payouts/{payoutInstrumentId}'.sub('{' + 'contractId' + '}', CGI.escape(contract_id.to_s).gsub('%2F', '/')).sub('{' + 'payoutInstrumentId' + '}', CGI.escape(payout_instrument_id.to_s).gsub('%2F', '/'))
|
125
|
+
|
126
|
+
# query parameters
|
127
|
+
query_params = opts[:query_params] || {}
|
128
|
+
|
129
|
+
# header parameters
|
130
|
+
header_params = opts[:header_params] || {}
|
131
|
+
# HTTP header 'Accept' (if needed)
|
132
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
133
|
+
# HTTP header 'Content-Type'
|
134
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
135
|
+
|
136
|
+
# form parameters
|
137
|
+
form_params = opts[:form_params] || {}
|
138
|
+
|
139
|
+
# http body (model)
|
140
|
+
post_body = opts[:body] || @api_client.object_to_http_body(deactivate_request)
|
141
|
+
|
142
|
+
# return_type
|
143
|
+
return_type = opts[:return_type]
|
144
|
+
|
145
|
+
# auth_names
|
146
|
+
auth_names = opts[:auth_names] || ['Bearer']
|
147
|
+
|
148
|
+
new_options = opts.merge(
|
149
|
+
:header_params => header_params,
|
150
|
+
:query_params => query_params,
|
151
|
+
:form_params => form_params,
|
152
|
+
:body => post_body,
|
153
|
+
:auth_names => auth_names,
|
154
|
+
:return_type => return_type
|
155
|
+
)
|
156
|
+
|
157
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
158
|
+
if @api_client.config.debugging
|
159
|
+
@api_client.config.logger.debug "API called: PayoutsApi#deactivate_payout_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
160
|
+
end
|
161
|
+
return data, status_code, headers
|
162
|
+
end
|
163
|
+
|
164
|
+
# Retrieves an Payout Resource from the system for the given contractId and payoutInstrumentId.
|
165
|
+
# @param contract_id [String] The unique id of the Contract Resource.
|
166
|
+
# @param payout_instrument_id [String] The unique id of the Payout Instrument Resource.
|
167
|
+
# @param [Hash] opts the optional parameters
|
168
|
+
# @return [PayoutProductResource]
|
169
|
+
def get_payout_product_by_instrument_id(contract_id, payout_instrument_id, opts = {})
|
170
|
+
data, _status_code, _headers = get_payout_product_by_instrument_id_with_http_info(contract_id, payout_instrument_id, opts)
|
171
|
+
data
|
172
|
+
end
|
173
|
+
|
174
|
+
# Retrieves an Payout Resource from the system for the given contractId and payoutInstrumentId.
|
175
|
+
# @param contract_id [String] The unique id of the Contract Resource.
|
176
|
+
# @param payout_instrument_id [String] The unique id of the Payout Instrument Resource.
|
177
|
+
# @param [Hash] opts the optional parameters
|
178
|
+
# @return [Array<(PayoutProductResource, Integer, Hash)>] PayoutProductResource data, response status code and response headers
|
179
|
+
def get_payout_product_by_instrument_id_with_http_info(contract_id, payout_instrument_id, opts = {})
|
180
|
+
if @api_client.config.debugging
|
181
|
+
@api_client.config.logger.debug 'Calling API: PayoutsApi.get_payout_product_by_instrument_id ...'
|
182
|
+
end
|
183
|
+
# verify the required parameter 'contract_id' is set
|
184
|
+
if @api_client.config.client_side_validation && contract_id.nil?
|
185
|
+
fail ArgumentError, "Missing the required parameter 'contract_id' when calling PayoutsApi.get_payout_product_by_instrument_id"
|
186
|
+
end
|
187
|
+
# verify the required parameter 'payout_instrument_id' is set
|
188
|
+
if @api_client.config.client_side_validation && payout_instrument_id.nil?
|
189
|
+
fail ArgumentError, "Missing the required parameter 'payout_instrument_id' when calling PayoutsApi.get_payout_product_by_instrument_id"
|
190
|
+
end
|
191
|
+
# resource path
|
192
|
+
local_var_path = '/contracts/{contractId}/payouts/{payoutInstrumentId}'.sub('{' + 'contractId' + '}', CGI.escape(contract_id.to_s).gsub('%2F', '/')).sub('{' + 'payoutInstrumentId' + '}', CGI.escape(payout_instrument_id.to_s).gsub('%2F', '/'))
|
193
|
+
|
194
|
+
# query parameters
|
195
|
+
query_params = opts[:query_params] || {}
|
196
|
+
|
197
|
+
# header parameters
|
198
|
+
header_params = opts[:header_params] || {}
|
199
|
+
# HTTP header 'Accept' (if needed)
|
200
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
201
|
+
|
202
|
+
# form parameters
|
203
|
+
form_params = opts[:form_params] || {}
|
204
|
+
|
205
|
+
# http body (model)
|
206
|
+
post_body = opts[:body]
|
207
|
+
|
208
|
+
# return_type
|
209
|
+
return_type = opts[:return_type] || 'PayoutProductResource'
|
210
|
+
|
211
|
+
# auth_names
|
212
|
+
auth_names = opts[:auth_names] || ['Bearer']
|
213
|
+
|
214
|
+
new_options = opts.merge(
|
215
|
+
:header_params => header_params,
|
216
|
+
:query_params => query_params,
|
217
|
+
:form_params => form_params,
|
218
|
+
:body => post_body,
|
219
|
+
:auth_names => auth_names,
|
220
|
+
:return_type => return_type
|
221
|
+
)
|
222
|
+
|
223
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
224
|
+
if @api_client.config.debugging
|
225
|
+
@api_client.config.logger.debug "API called: PayoutsApi#get_payout_product_by_instrument_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
226
|
+
end
|
227
|
+
return data, status_code, headers
|
228
|
+
end
|
229
|
+
|
230
|
+
# Updates the Payout product in the Contract Resource.
|
231
|
+
# @param contract_id [String] The unique id of the Contract Resource.
|
232
|
+
# @param payout_instrument_id [String] The unique id of the Payout Instrument Resource.
|
233
|
+
# @param payout_product_resource [PayoutProductResource] The Payout Resource to be updated.
|
234
|
+
# @param [Hash] opts the optional parameters
|
235
|
+
# @return [PayoutProductResource]
|
236
|
+
def update_payout_product(contract_id, payout_instrument_id, payout_product_resource, opts = {})
|
237
|
+
data, _status_code, _headers = update_payout_product_with_http_info(contract_id, payout_instrument_id, payout_product_resource, opts)
|
238
|
+
data
|
239
|
+
end
|
240
|
+
|
241
|
+
# Updates the Payout product in the Contract Resource.
|
242
|
+
# @param contract_id [String] The unique id of the Contract Resource.
|
243
|
+
# @param payout_instrument_id [String] The unique id of the Payout Instrument Resource.
|
244
|
+
# @param payout_product_resource [PayoutProductResource] The Payout Resource to be updated.
|
245
|
+
# @param [Hash] opts the optional parameters
|
246
|
+
# @return [Array<(PayoutProductResource, Integer, Hash)>] PayoutProductResource data, response status code and response headers
|
247
|
+
def update_payout_product_with_http_info(contract_id, payout_instrument_id, payout_product_resource, opts = {})
|
248
|
+
if @api_client.config.debugging
|
249
|
+
@api_client.config.logger.debug 'Calling API: PayoutsApi.update_payout_product ...'
|
250
|
+
end
|
251
|
+
# verify the required parameter 'contract_id' is set
|
252
|
+
if @api_client.config.client_side_validation && contract_id.nil?
|
253
|
+
fail ArgumentError, "Missing the required parameter 'contract_id' when calling PayoutsApi.update_payout_product"
|
254
|
+
end
|
255
|
+
# verify the required parameter 'payout_instrument_id' is set
|
256
|
+
if @api_client.config.client_side_validation && payout_instrument_id.nil?
|
257
|
+
fail ArgumentError, "Missing the required parameter 'payout_instrument_id' when calling PayoutsApi.update_payout_product"
|
258
|
+
end
|
259
|
+
# verify the required parameter 'payout_product_resource' is set
|
260
|
+
if @api_client.config.client_side_validation && payout_product_resource.nil?
|
261
|
+
fail ArgumentError, "Missing the required parameter 'payout_product_resource' when calling PayoutsApi.update_payout_product"
|
262
|
+
end
|
263
|
+
# resource path
|
264
|
+
local_var_path = '/contracts/{contractId}/payouts/{payoutInstrumentId}'.sub('{' + 'contractId' + '}', CGI.escape(contract_id.to_s).gsub('%2F', '/')).sub('{' + 'payoutInstrumentId' + '}', CGI.escape(payout_instrument_id.to_s).gsub('%2F', '/'))
|
265
|
+
|
266
|
+
# query parameters
|
267
|
+
query_params = opts[:query_params] || {}
|
268
|
+
|
269
|
+
# header parameters
|
270
|
+
header_params = opts[:header_params] || {}
|
271
|
+
# HTTP header 'Accept' (if needed)
|
272
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
273
|
+
# HTTP header 'Content-Type'
|
274
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json-patch+json'])
|
275
|
+
|
276
|
+
# form parameters
|
277
|
+
form_params = opts[:form_params] || {}
|
278
|
+
|
279
|
+
# http body (model)
|
280
|
+
post_body = opts[:body] || @api_client.object_to_http_body(payout_product_resource)
|
281
|
+
|
282
|
+
# return_type
|
283
|
+
return_type = opts[:return_type] || 'PayoutProductResource'
|
284
|
+
|
285
|
+
# auth_names
|
286
|
+
auth_names = opts[:auth_names] || ['Bearer']
|
287
|
+
|
288
|
+
new_options = opts.merge(
|
289
|
+
:header_params => header_params,
|
290
|
+
:query_params => query_params,
|
291
|
+
:form_params => form_params,
|
292
|
+
:body => post_body,
|
293
|
+
:auth_names => auth_names,
|
294
|
+
:return_type => return_type
|
295
|
+
)
|
296
|
+
|
297
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
|
298
|
+
if @api_client.config.debugging
|
299
|
+
@api_client.config.logger.debug "API called: PayoutsApi#update_payout_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
300
|
+
end
|
301
|
+
return data, status_code, headers
|
302
|
+
end
|
303
|
+
end
|
304
|
+
end
|
@@ -0,0 +1,386 @@
|
|
1
|
+
=begin
|
2
|
+
#Yapstone Staged On-Boarding Services
|
3
|
+
|
4
|
+
#Set of API's that allow clients to onboard with Yapstone.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'json'
|
15
|
+
require 'logger'
|
16
|
+
require 'tempfile'
|
17
|
+
require 'typhoeus'
|
18
|
+
|
19
|
+
module Yapstone
|
20
|
+
class ApiClient
|
21
|
+
# The Configuration object holding settings to be used in the API client.
|
22
|
+
attr_accessor :config
|
23
|
+
|
24
|
+
# Defines the headers to be used in HTTP requests of all API calls by default.
|
25
|
+
#
|
26
|
+
# @return [Hash]
|
27
|
+
attr_accessor :default_headers
|
28
|
+
|
29
|
+
# Initializes the ApiClient
|
30
|
+
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
31
|
+
def initialize(config = Configuration.default)
|
32
|
+
@config = config
|
33
|
+
@user_agent = "OpenAPI-Generator/#{VERSION}/ruby"
|
34
|
+
@default_headers = {
|
35
|
+
'Content-Type' => 'application/json',
|
36
|
+
'User-Agent' => @user_agent
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.default
|
41
|
+
@@default ||= ApiClient.new
|
42
|
+
end
|
43
|
+
|
44
|
+
# Call an API with given options.
|
45
|
+
#
|
46
|
+
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
47
|
+
# the data deserialized from response body (could be nil), response status code and response headers.
|
48
|
+
def call_api(http_method, path, opts = {})
|
49
|
+
request = build_request(http_method, path, opts)
|
50
|
+
response = request.run
|
51
|
+
|
52
|
+
if @config.debugging
|
53
|
+
@config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
54
|
+
end
|
55
|
+
|
56
|
+
unless response.success?
|
57
|
+
if response.timed_out?
|
58
|
+
fail ApiError.new('Connection timed out')
|
59
|
+
elsif response.code == 0
|
60
|
+
# Errors from libcurl will be made visible here
|
61
|
+
fail ApiError.new(:code => 0,
|
62
|
+
:message => response.return_message)
|
63
|
+
else
|
64
|
+
fail ApiError.new(:code => response.code,
|
65
|
+
:response_headers => response.headers,
|
66
|
+
:response_body => response.body),
|
67
|
+
response.status_message
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
if opts[:return_type]
|
72
|
+
data = deserialize(response, opts[:return_type])
|
73
|
+
else
|
74
|
+
data = nil
|
75
|
+
end
|
76
|
+
return data, response.code, response.headers
|
77
|
+
end
|
78
|
+
|
79
|
+
# Builds the HTTP request
|
80
|
+
#
|
81
|
+
# @param [String] http_method HTTP method/verb (e.g. POST)
|
82
|
+
# @param [String] path URL path (e.g. /account/new)
|
83
|
+
# @option opts [Hash] :header_params Header parameters
|
84
|
+
# @option opts [Hash] :query_params Query parameters
|
85
|
+
# @option opts [Hash] :form_params Query parameters
|
86
|
+
# @option opts [Object] :body HTTP body (JSON/XML)
|
87
|
+
# @return [Typhoeus::Request] A Typhoeus Request
|
88
|
+
def build_request(http_method, path, opts = {})
|
89
|
+
url = build_request_url(path)
|
90
|
+
http_method = http_method.to_sym.downcase
|
91
|
+
|
92
|
+
header_params = @default_headers.merge(opts[:header_params] || {})
|
93
|
+
query_params = opts[:query_params] || {}
|
94
|
+
form_params = opts[:form_params] || {}
|
95
|
+
|
96
|
+
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
97
|
+
|
98
|
+
# set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
|
99
|
+
_verify_ssl_host = @config.verify_ssl_host ? 2 : 0
|
100
|
+
|
101
|
+
req_opts = {
|
102
|
+
:method => http_method,
|
103
|
+
:headers => header_params,
|
104
|
+
:params => query_params,
|
105
|
+
:params_encoding => @config.params_encoding,
|
106
|
+
:timeout => @config.timeout,
|
107
|
+
:ssl_verifypeer => @config.verify_ssl,
|
108
|
+
:ssl_verifyhost => _verify_ssl_host,
|
109
|
+
:sslcert => @config.cert_file,
|
110
|
+
:sslkey => @config.key_file,
|
111
|
+
:verbose => @config.debugging
|
112
|
+
}
|
113
|
+
|
114
|
+
# set custom cert, if provided
|
115
|
+
req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
|
116
|
+
|
117
|
+
if [:post, :patch, :put, :delete].include?(http_method)
|
118
|
+
req_body = build_request_body(header_params, form_params, opts[:body])
|
119
|
+
req_opts.update :body => req_body
|
120
|
+
if @config.debugging
|
121
|
+
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
request = Typhoeus::Request.new(url, req_opts)
|
126
|
+
download_file(request) if opts[:return_type] == 'File'
|
127
|
+
request
|
128
|
+
end
|
129
|
+
|
130
|
+
# Check if the given MIME is a JSON MIME.
|
131
|
+
# JSON MIME examples:
|
132
|
+
# application/json
|
133
|
+
# application/json; charset=UTF8
|
134
|
+
# APPLICATION/JSON
|
135
|
+
# */*
|
136
|
+
# @param [String] mime MIME
|
137
|
+
# @return [Boolean] True if the MIME is application/json
|
138
|
+
def json_mime?(mime)
|
139
|
+
(mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
|
140
|
+
end
|
141
|
+
|
142
|
+
# Deserialize the response to the given return type.
|
143
|
+
#
|
144
|
+
# @param [Response] response HTTP response
|
145
|
+
# @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
|
146
|
+
def deserialize(response, return_type)
|
147
|
+
body = response.body
|
148
|
+
|
149
|
+
# handle file downloading - return the File instance processed in request callbacks
|
150
|
+
# note that response body is empty when the file is written in chunks in request on_body callback
|
151
|
+
return @tempfile if return_type == 'File'
|
152
|
+
|
153
|
+
return nil if body.nil? || body.empty?
|
154
|
+
|
155
|
+
# return response body directly for String return type
|
156
|
+
return body if return_type == 'String'
|
157
|
+
|
158
|
+
# ensuring a default content type
|
159
|
+
content_type = response.headers['Content-Type'] || 'application/json'
|
160
|
+
|
161
|
+
fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
|
162
|
+
|
163
|
+
begin
|
164
|
+
data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
|
165
|
+
rescue JSON::ParserError => e
|
166
|
+
if %w(String Date DateTime).include?(return_type)
|
167
|
+
data = body
|
168
|
+
else
|
169
|
+
raise e
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
convert_to_type data, return_type
|
174
|
+
end
|
175
|
+
|
176
|
+
# Convert data to the given return type.
|
177
|
+
# @param [Object] data Data to be converted
|
178
|
+
# @param [String] return_type Return type
|
179
|
+
# @return [Mixed] Data in a particular type
|
180
|
+
def convert_to_type(data, return_type)
|
181
|
+
return nil if data.nil?
|
182
|
+
case return_type
|
183
|
+
when 'String'
|
184
|
+
data.to_s
|
185
|
+
when 'Integer'
|
186
|
+
data.to_i
|
187
|
+
when 'Float'
|
188
|
+
data.to_f
|
189
|
+
when 'Boolean'
|
190
|
+
data == true
|
191
|
+
when 'DateTime'
|
192
|
+
# parse date time (expecting ISO 8601 format)
|
193
|
+
DateTime.parse data
|
194
|
+
when 'Date'
|
195
|
+
# parse date time (expecting ISO 8601 format)
|
196
|
+
Date.parse data
|
197
|
+
when 'Object'
|
198
|
+
# generic object (usually a Hash), return directly
|
199
|
+
data
|
200
|
+
when /\AArray<(.+)>\z/
|
201
|
+
# e.g. Array<Pet>
|
202
|
+
sub_type = $1
|
203
|
+
data.map { |item| convert_to_type(item, sub_type) }
|
204
|
+
when /\AHash\<String, (.+)\>\z/
|
205
|
+
# e.g. Hash<String, Integer>
|
206
|
+
sub_type = $1
|
207
|
+
{}.tap do |hash|
|
208
|
+
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
209
|
+
end
|
210
|
+
else
|
211
|
+
# models, e.g. Pet
|
212
|
+
Yapstone.const_get(return_type).build_from_hash(data)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
# Save response body into a file in (the defined) temporary folder, using the filename
|
217
|
+
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
218
|
+
# The response body is written to the file in chunks in order to handle files which
|
219
|
+
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
220
|
+
# process can use.
|
221
|
+
#
|
222
|
+
# @see Configuration#temp_folder_path
|
223
|
+
def download_file(request)
|
224
|
+
tempfile = nil
|
225
|
+
encoding = nil
|
226
|
+
request.on_headers do |response|
|
227
|
+
content_disposition = response.headers['Content-Disposition']
|
228
|
+
if content_disposition && content_disposition =~ /filename=/i
|
229
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
230
|
+
prefix = sanitize_filename(filename)
|
231
|
+
else
|
232
|
+
prefix = 'download-'
|
233
|
+
end
|
234
|
+
prefix = prefix + '-' unless prefix.end_with?('-')
|
235
|
+
encoding = response.body.encoding
|
236
|
+
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
237
|
+
@tempfile = tempfile
|
238
|
+
end
|
239
|
+
request.on_body do |chunk|
|
240
|
+
chunk.force_encoding(encoding)
|
241
|
+
tempfile.write(chunk)
|
242
|
+
end
|
243
|
+
request.on_complete do |response|
|
244
|
+
tempfile.close if tempfile
|
245
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
246
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
247
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
248
|
+
"explicitly with `tempfile.delete`"
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
# Sanitize filename by removing path.
|
253
|
+
# e.g. ../../sun.gif becomes sun.gif
|
254
|
+
#
|
255
|
+
# @param [String] filename the filename to be sanitized
|
256
|
+
# @return [String] the sanitized filename
|
257
|
+
def sanitize_filename(filename)
|
258
|
+
filename.gsub(/.*[\/\\]/, '')
|
259
|
+
end
|
260
|
+
|
261
|
+
def build_request_url(path)
|
262
|
+
# Add leading and trailing slashes to path
|
263
|
+
path = "/#{path}".gsub(/\/+/, '/')
|
264
|
+
@config.base_url + path
|
265
|
+
end
|
266
|
+
|
267
|
+
# Builds the HTTP request body
|
268
|
+
#
|
269
|
+
# @param [Hash] header_params Header parameters
|
270
|
+
# @param [Hash] form_params Query parameters
|
271
|
+
# @param [Object] body HTTP body (JSON/XML)
|
272
|
+
# @return [String] HTTP body data in the form of string
|
273
|
+
def build_request_body(header_params, form_params, body)
|
274
|
+
# http form
|
275
|
+
if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
|
276
|
+
header_params['Content-Type'] == 'multipart/form-data'
|
277
|
+
data = {}
|
278
|
+
form_params.each do |key, value|
|
279
|
+
case value
|
280
|
+
when ::File, ::Array, nil
|
281
|
+
# let typhoeus handle File, Array and nil parameters
|
282
|
+
data[key] = value
|
283
|
+
else
|
284
|
+
data[key] = value.to_s
|
285
|
+
end
|
286
|
+
end
|
287
|
+
elsif body
|
288
|
+
data = body.is_a?(String) ? body : body.to_json
|
289
|
+
else
|
290
|
+
data = nil
|
291
|
+
end
|
292
|
+
data
|
293
|
+
end
|
294
|
+
|
295
|
+
# Update hearder and query params based on authentication settings.
|
296
|
+
#
|
297
|
+
# @param [Hash] header_params Header parameters
|
298
|
+
# @param [Hash] query_params Query parameters
|
299
|
+
# @param [String] auth_names Authentication scheme name
|
300
|
+
def update_params_for_auth!(header_params, query_params, auth_names)
|
301
|
+
Array(auth_names).each do |auth_name|
|
302
|
+
auth_setting = @config.auth_settings[auth_name]
|
303
|
+
next unless auth_setting
|
304
|
+
case auth_setting[:in]
|
305
|
+
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
|
306
|
+
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
|
307
|
+
else fail ArgumentError, 'Authentication token must be in `query` of `header`'
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
# Sets user agent in HTTP header
|
313
|
+
#
|
314
|
+
# @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
|
315
|
+
def user_agent=(user_agent)
|
316
|
+
@user_agent = user_agent
|
317
|
+
@default_headers['User-Agent'] = @user_agent
|
318
|
+
end
|
319
|
+
|
320
|
+
# Return Accept header based on an array of accepts provided.
|
321
|
+
# @param [Array] accepts array for Accept
|
322
|
+
# @return [String] the Accept header (e.g. application/json)
|
323
|
+
def select_header_accept(accepts)
|
324
|
+
return nil if accepts.nil? || accepts.empty?
|
325
|
+
# use JSON when present, otherwise use all of the provided
|
326
|
+
json_accept = accepts.find { |s| json_mime?(s) }
|
327
|
+
json_accept || accepts.join(',')
|
328
|
+
end
|
329
|
+
|
330
|
+
# Return Content-Type header based on an array of content types provided.
|
331
|
+
# @param [Array] content_types array for Content-Type
|
332
|
+
# @return [String] the Content-Type header (e.g. application/json)
|
333
|
+
def select_header_content_type(content_types)
|
334
|
+
# use application/json by default
|
335
|
+
return 'application/json' if content_types.nil? || content_types.empty?
|
336
|
+
# use JSON when present, otherwise use the first one
|
337
|
+
json_content_type = content_types.find { |s| json_mime?(s) }
|
338
|
+
json_content_type || content_types.first
|
339
|
+
end
|
340
|
+
|
341
|
+
# Convert object (array, hash, object, etc) to JSON string.
|
342
|
+
# @param [Object] model object to be converted into JSON string
|
343
|
+
# @return [String] JSON string representation of the object
|
344
|
+
def object_to_http_body(model)
|
345
|
+
return model if model.nil? || model.is_a?(String)
|
346
|
+
local_body = nil
|
347
|
+
if model.is_a?(Array)
|
348
|
+
local_body = model.map { |m| object_to_hash(m) }
|
349
|
+
else
|
350
|
+
local_body = object_to_hash(model)
|
351
|
+
end
|
352
|
+
local_body.to_json
|
353
|
+
end
|
354
|
+
|
355
|
+
# Convert object(non-array) to hash.
|
356
|
+
# @param [Object] obj object to be converted into JSON string
|
357
|
+
# @return [String] JSON string representation of the object
|
358
|
+
def object_to_hash(obj)
|
359
|
+
if obj.respond_to?(:to_hash)
|
360
|
+
obj.to_hash
|
361
|
+
else
|
362
|
+
obj
|
363
|
+
end
|
364
|
+
end
|
365
|
+
|
366
|
+
# Build parameter value according to the given collection format.
|
367
|
+
# @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
|
368
|
+
def build_collection_param(param, collection_format)
|
369
|
+
case collection_format
|
370
|
+
when :csv
|
371
|
+
param.join(',')
|
372
|
+
when :ssv
|
373
|
+
param.join(' ')
|
374
|
+
when :tsv
|
375
|
+
param.join("\t")
|
376
|
+
when :pipes
|
377
|
+
param.join('|')
|
378
|
+
when :multi
|
379
|
+
# return the array directly as typhoeus will handle it as expected
|
380
|
+
param
|
381
|
+
else
|
382
|
+
fail "unknown collection format: #{collection_format.inspect}"
|
383
|
+
end
|
384
|
+
end
|
385
|
+
end
|
386
|
+
end
|