czech_post_b2b_client 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/.rubocop.yml +40 -0
- data/CHANGELOG.md +14 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +21 -0
- data/README.md +281 -0
- data/Rakefile +12 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/certs/postsignum_qca4_root.pem +41 -0
- data/certs/postsignum_vca5_sub.pem +44 -0
- data/doc/CzechPostB2bClient.html +479 -0
- data/doc/CzechPostB2bClient/B2BErrors.html +242 -0
- data/doc/CzechPostB2bClient/B2BErrors/BadRequestError.html +145 -0
- data/doc/CzechPostB2bClient/B2BErrors/BaseError.html +376 -0
- data/doc/CzechPostB2bClient/B2BErrors/CustomerRequestsCountOverflowError.html +145 -0
- data/doc/CzechPostB2bClient/B2BErrors/InternalB2BServerError.html +145 -0
- data/doc/CzechPostB2bClient/B2BErrors/InternalBackendServerError.html +145 -0
- data/doc/CzechPostB2bClient/B2BErrors/InternalDataPersistenceServerError.html +145 -0
- data/doc/CzechPostB2bClient/B2BErrors/ProcessingUnfinishedYetError.html +145 -0
- data/doc/CzechPostB2bClient/B2BErrors/ServiceBusyError.html +145 -0
- data/doc/CzechPostB2bClient/B2BErrors/UnauthorizedContractAccessError.html +145 -0
- data/doc/CzechPostB2bClient/B2BErrors/UnauthorizedRoleAccessError.html +145 -0
- data/doc/CzechPostB2bClient/Configuration.html +1005 -0
- data/doc/CzechPostB2bClient/Error.html +128 -0
- data/doc/CzechPostB2bClient/PrintingTemplates.html +199 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AddressData3x8.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel.html +117 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/Blank.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/Blank4OnPage.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/BlankLandscape.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/ForeignPackage.html +115 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/ForeignPackage/EMS.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/ForeignPackage/EMS2x4.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/ForeignPackage/Standard.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/ForeignPackage/Standard4OnPage.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/ForeignPackage/Valuable.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/ForeignPackage/Valuable4OnPage.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/Simple.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/AdressLabel/SimpleWithCODVoucherA.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/Base.html +279 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/CODVoucherA.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/CODVoucherA3OnPage.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/CODVoucherC.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/CODVoucherForCSOB.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/CustomDeclarationCN22.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/CustomDeclarationCN23.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/DeliveryTicket.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/Envelope.html +115 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/Envelope/EnvelopeB4.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/Envelope/EnvelopeC5.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/Envelope/EnvelopeC6.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/Envelope/EnvelopeDL.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/HarmonizedLabel.html +141 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/HarmonizedLabel4OnPage.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/IntegratedDocument.html +129 -0
- data/doc/CzechPostB2bClient/PrintingTemplates/RRLabels3x8.html +129 -0
- data/doc/CzechPostB2bClient/RequestBuilders.html +117 -0
- data/doc/CzechPostB2bClient/RequestBuilders/BaseBuilder.html +396 -0
- data/doc/CzechPostB2bClient/RequestBuilders/GetParcelStateBuilder.html +329 -0
- data/doc/CzechPostB2bClient/RequestBuilders/GetParcelsPrintingBuilder.html +470 -0
- data/doc/CzechPostB2bClient/RequestBuilders/GetResultParcelsBuilder.html +329 -0
- data/doc/CzechPostB2bClient/RequestBuilders/GetStatsBuilder.html +403 -0
- data/doc/CzechPostB2bClient/RequestBuilders/SendParcelsBuilder.html +403 -0
- data/doc/CzechPostB2bClient/ResponseCodes.html +242 -0
- data/doc/CzechPostB2bClient/ResponseCodes/AddressAllowedForBalikovnaOnly.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/AddressIsNotValidForSubject.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/AddressNeedsPhoneNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/AddressSuitableForLocalDelivery.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/AddressValidOnlyForNaPostu.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/AddressValidOnlyForNaPostuDuplicate.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/AddresseeCityRequired.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/AlreadyAssignedOrderNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BadAddressee.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BadCODAmount.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BadFormatReturnNumberDays.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BadHeight.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BadLength.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BadPrefix.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BadPrefixForAddress.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BadPrice.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BadVariableSymbol.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BadWeight.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BadWidth.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BaseCode.html +550 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BatchClosed.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BatchInvalid.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/BatchUnfinished.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/CODAmountOutOfRange.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/CODAmountTooBig.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/CanceledOrderNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/CustomGoodQuantityOutOfRange.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/CustomerIDNotInAccordanceWithParcelCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/DensityOutOfRange.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/DuplicateDuplicateParcelCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/DuplicateParcel.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/DuplicateParcelCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/DuplicitParcelCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/FullSequence.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/FullSequenceDuplicate.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/IllegalCombinationOfServices.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoAddRequiredService75.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoAddService1A.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoAddService1B.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoAddService1D.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoAddService9.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoAddressWasModified.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoAddresseeToLong.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelCustCardNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelCustCardNumberAddresseeDocument.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelHeight.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelLength.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelMobilePhoneOrEmailAddresseeDocument.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelPalettsNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelPersonalIdentificationNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1AB.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1ABForService40.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1AForPostCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1AForService40.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1AWith1B.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1B.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1BAddService1A.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1BForPostCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1BWith1A.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1D.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1E.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService1V.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService25.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService27.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService29.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService30.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService31.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService34.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService34InvalidPhoneNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService45.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService45InvalidPhoneNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService46.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService47.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService5B.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService5BAnd5C.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService5BAnd5D.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService5C.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService5CAnd5D.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelService5D.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelVSVoucher.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCancelWidth.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoCityChanged.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInexactAddress.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidAccount.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidBankCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidBirthDay.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidCODAmount.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidCategoryCustomDecalaration.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidEmail.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidMobilePhoneNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidPhoneNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidPrefixAccount.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidPrice.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidSpecificSymbol.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidTelephoneNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoInvalidWeight.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoMissingPartCityServiceDeliveryOnSundayOrHolidayMayNotBeRealized.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoPriceIsNotNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoPriceIsTooBig.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoService29And47.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InfoSpecialPackagingRequest.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InternalApplicationError.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidAddressAddresseeDocumentForParcelType.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidAddressAddresseeDocumentObjectNotFound.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidAddressAddresseeDocumentWrongCity.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidAddressForBalikovna.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidAddressForBigPackage.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidAddressForCODAmountOver20000.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidAddressForParcelType.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidAddressee.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidAmount.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidAmountCurrency.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidAmountType.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidCODAmount.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidCODCurrency.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidCODCurrencyAccordance.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidCategoryCustomDecalaration.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidContentCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidCurrencyCustomDecalaration.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidCustomGoodNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidCustomerCardNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidCustomerId.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidDensity.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidEmail.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidHeight.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidHsCodeCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidIsoCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidIsoCustomGoodFormat.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidLength.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidLocation.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidMRNCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidMRNCodeControl.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidNumberClosure.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidOrderNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidParcelBarcode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidParcelBarcodeDuplicate.html +145 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidParcelCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidParcelCodeControl.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidParcelResponseCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidParcelTypeForID.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidPartnerCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidPayday.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidPhoneNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidPostCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidPrefixAccordance.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidPrefixCombination.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidPrefixForDimensionsAndFragile.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidPrice.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidPriceCurrency.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidPriceCurrencyAccordance.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidPriceCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidQuantityCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidResponsibleConsignmentNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidReturnNumberDays.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidService18.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidService19.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidServiceCombination.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidServicesForDimensions.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidSignNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidSubisoCountry.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidTareWeight.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidTiming.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidTransmissionDate.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidTypePrefix.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidUseOfService36.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidUseOfService37.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidUseOfService38.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidWeight.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidWeightCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidWeightCustomGoodSummary.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidWeightForService11.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidWidth.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidZPROOrderNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidZPROOrderNumberFormat.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/InvalidostCodeOrCity.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MIssingParcelCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingAddressee.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingAddresseeCity.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingAddresseeStreet.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingAddresseeZipCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingCODAmount.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingCODAmountType.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingCategoryCustomDecalaration.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingCompanyName.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingContentCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingCurrencyCustomDeclaration.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingHandlingInstructions.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingHeight.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingHsCodeCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingIsoCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingLength.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingPalettsNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingParcelCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingParcelCustomGoods.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingPhoneNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingPrefix.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingPrice.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingPriceCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingQuantityCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredAddresseeDocument.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredAddresseeDocumentDuplicate.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredAddresseeEmail.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredEmail.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredFirstNameAddresseeDocument.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredMRNCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredMobileNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredMobileNumberOrEmail.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredParcelCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredPayday.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredPhoneNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredPhoneNumberOrEmail.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredPhoneNumberOrWhat.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredPrice.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredService.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredService10.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredService1AB.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredService1X.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredService2X.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredService3X.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredService3XTrinity.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredService4.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredService4X.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredService4x.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredVoucherPrice.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingRequiredZPROOrderNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingReturnInstructions.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingReturnNumberDays.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingSenderEmail.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingSizeCategory.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingSurname.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingVariableSymbol.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingVariableSymbolDuplicate.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingWeightCustomGood.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/MissingWidth.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/NfoCancelService9.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/NoContractService41.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/NoContractServiceReturnReceipt.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/NotExistingOrderNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/Ok.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/OverenoVecerniDorucovani.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/PalettsNumberOutOfRange.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/ParcelCodeNotAllowed.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/ParcelCodeNotInAssignedRange.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/ParcelDoesNotMeetTheRequirementsForm.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/PriceAndCODAmountTooBig.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/PriceOutOfRange.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/PriceTooBig.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/PriceTooLow.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/ResponsibleConsignmentNumberCannotBeImported.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/ResponsibleConsignmentNumberOutOfRange.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/ServicesCombinationNotAllowed.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/TransmissionAlreadyClosed.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/TransmissionNotExists.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/TransmissionOpened.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/TransmissionUnfinished.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/UnauthorizedAccess.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/UnknownAddresseeCity.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/UnknownAddresseePostCode.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/UnknownPrefix.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/VariableSymbolIsNotNumber.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/WeightCustomGoodOutOfRange.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/WeightIsOutOfRange.html +134 -0
- data/doc/CzechPostB2bClient/ResponseCodes/WeightIsOutOfRangeDuplicate.html +134 -0
- data/doc/CzechPostB2bClient/ResponseParsers.html +117 -0
- data/doc/CzechPostB2bClient/ResponseParsers/BaseParser.html +283 -0
- data/doc/CzechPostB2bClient/ResponseParsers/GetParcelStateParser.html +533 -0
- data/doc/CzechPostB2bClient/ResponseParsers/GetParcelsPrintingParser.html +463 -0
- data/doc/CzechPostB2bClient/ResponseParsers/GetResultParcelsParser.html +625 -0
- data/doc/CzechPostB2bClient/ResponseParsers/GetStatsParser.html +347 -0
- data/doc/CzechPostB2bClient/ResponseParsers/SendParcelsParser.html +231 -0
- data/doc/CzechPostB2bClient/Services.html +117 -0
- data/doc/CzechPostB2bClient/Services/AddressSheetsGenerator.html +451 -0
- data/doc/CzechPostB2bClient/Services/ApiCaller.html +307 -0
- data/doc/CzechPostB2bClient/Services/Communicator.html +220 -0
- data/doc/CzechPostB2bClient/Services/DeliveringInspector.html +324 -0
- data/doc/CzechPostB2bClient/Services/Orchestrator.html +143 -0
- data/doc/CzechPostB2bClient/Services/ParcelsSendProcessUpdater.html +377 -0
- data/doc/CzechPostB2bClient/Services/ParcelsSender.html +402 -0
- data/doc/CzechPostB2bClient/Services/ParcelsSubmissionCloser.html +337 -0
- data/doc/CzechPostB2bClient/Services/TimePeriodStatisticator.html +398 -0
- data/doc/SteppedService.html +224 -0
- data/doc/SteppedService/Base.html +706 -0
- data/doc/SteppedService/Errors.html +365 -0
- data/doc/_index.html +2607 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +496 -0
- data/doc/file.README.html +357 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +357 -0
- data/doc/js/app.js +303 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +923 -0
- data/doc/top-level-namespace.html +110 -0
- data/lib/czech_post_b2b_client.rb +37 -0
- data/lib/czech_post_b2b_client/b2b_errors.rb +105 -0
- data/lib/czech_post_b2b_client/configuration.rb +34 -0
- data/lib/czech_post_b2b_client/printing_templates.rb +166 -0
- data/lib/czech_post_b2b_client/request_builders.rb +8 -0
- data/lib/czech_post_b2b_client/request_builders/base_builder.rb +90 -0
- data/lib/czech_post_b2b_client/request_builders/get_parcel_state_builder.rb +44 -0
- data/lib/czech_post_b2b_client/request_builders/get_parcels_printing_builder.rb +79 -0
- data/lib/czech_post_b2b_client/request_builders/get_result_parcels_builder.rb +28 -0
- data/lib/czech_post_b2b_client/request_builders/get_stats_builder.rb +30 -0
- data/lib/czech_post_b2b_client/request_builders/send_parcels_builder.rb +294 -0
- data/lib/czech_post_b2b_client/response_codes.rb +1900 -0
- data/lib/czech_post_b2b_client/response_parsers.rb +8 -0
- data/lib/czech_post_b2b_client/response_parsers/base_parser.rb +95 -0
- data/lib/czech_post_b2b_client/response_parsers/get_parcel_state_parser.rb +54 -0
- data/lib/czech_post_b2b_client/response_parsers/get_parcels_printing_parser.rb +42 -0
- data/lib/czech_post_b2b_client/response_parsers/get_result_parcels_parser.rb +56 -0
- data/lib/czech_post_b2b_client/response_parsers/get_stats_parser.rb +27 -0
- data/lib/czech_post_b2b_client/response_parsers/send_parcels_parser.rb +13 -0
- data/lib/czech_post_b2b_client/services.rb +10 -0
- data/lib/czech_post_b2b_client/services/address_sheets_generator.rb +55 -0
- data/lib/czech_post_b2b_client/services/api_caller.rb +115 -0
- data/lib/czech_post_b2b_client/services/communicator.rb +28 -0
- data/lib/czech_post_b2b_client/services/delivering_inspector.rb +50 -0
- data/lib/czech_post_b2b_client/services/orchestrator.rb +27 -0
- data/lib/czech_post_b2b_client/services/parcels_send_process_updater.rb +71 -0
- data/lib/czech_post_b2b_client/services/parcels_sender.rb +53 -0
- data/lib/czech_post_b2b_client/services/parcels_submission_closer.rb +23 -0
- data/lib/czech_post_b2b_client/services/time_period_statisticator.rb +44 -0
- data/lib/czech_post_b2b_client/version.rb +5 -0
- data/lib/stepped_service.rb +4 -0
- data/lib/stepped_service/base.rb +139 -0
- data/lib/stepped_service/errors.rb +29 -0
- metadata +571 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CzechPostB2bClient
|
4
|
+
module Services
|
5
|
+
class Communicator < CzechPostB2bClient::Services::Orchestrator
|
6
|
+
def steps
|
7
|
+
%i[build_request call_api process_response]
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
attr_accessor :request_xml, :response_xml, :response_hash
|
13
|
+
|
14
|
+
def build_request
|
15
|
+
self.request_xml = result_of_subservice(request_builder: request_builder_args)
|
16
|
+
end
|
17
|
+
|
18
|
+
def call_api
|
19
|
+
self.response_xml = result_of_subservice(api_caller: { endpoint_path: endpoint_path, xml: request_xml }).xml
|
20
|
+
end
|
21
|
+
|
22
|
+
def process_response
|
23
|
+
self.response_hash = result_of_subservice(response_parser: { xml: response_xml })
|
24
|
+
@result = build_result_from(response_hash) unless response_hash.nil?
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CzechPostB2bClient
|
4
|
+
module Services
|
5
|
+
class DeliveringInspector < CzechPostB2bClient::Services::Communicator
|
6
|
+
attr_reader :parcel_codes
|
7
|
+
|
8
|
+
def initialize(parcel_codes:)
|
9
|
+
@parcel_codes = parcel_codes
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def request_builder_args
|
15
|
+
{ parcel_codes: parcel_codes }
|
16
|
+
end
|
17
|
+
|
18
|
+
def request_builder_class
|
19
|
+
CzechPostB2bClient::RequestBuilders::GetParcelStateBuilder
|
20
|
+
end
|
21
|
+
|
22
|
+
def api_caller_class
|
23
|
+
CzechPostB2bClient::Services::ApiCaller
|
24
|
+
end
|
25
|
+
|
26
|
+
def response_parser_class
|
27
|
+
CzechPostB2bClient::ResponseParsers::GetParcelStateParser
|
28
|
+
end
|
29
|
+
|
30
|
+
def endpoint_path
|
31
|
+
'/getParcelState'
|
32
|
+
end
|
33
|
+
|
34
|
+
def build_result_from(response_hash)
|
35
|
+
puts("RESPONSE_HASH: #{response_hash}")
|
36
|
+
result_hash = {}
|
37
|
+
response_hash[:parcels].each_pair do |parcel_code, delivering_hash|
|
38
|
+
result_hash[parcel_code] = {
|
39
|
+
deposited_until: delivering_hash[:deposited_until],
|
40
|
+
deposited_for_days: delivering_hash[:deposited_for_days],
|
41
|
+
current_state: delivering_hash[:states].last,
|
42
|
+
all_states: delivering_hash[:states]
|
43
|
+
}
|
44
|
+
end
|
45
|
+
puts("RESULT_HASH: #{result_hash}")
|
46
|
+
result_hash
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CzechPostB2bClient
|
4
|
+
module Services
|
5
|
+
class Orchestrator < SteppedService::Base
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
def result_of_subservice(service_hash)
|
10
|
+
service_name = service_hash.keys.first
|
11
|
+
service_class = send("#{service_name}_class")
|
12
|
+
service = service_class.call(service_hash.values.first)
|
13
|
+
|
14
|
+
if service.failed?
|
15
|
+
errors.add_from_hash(Hash[service_name, service.errors.full_messages])
|
16
|
+
fail!
|
17
|
+
end
|
18
|
+
|
19
|
+
service.result
|
20
|
+
end
|
21
|
+
|
22
|
+
def configuration
|
23
|
+
CzechPostB2bClient.configuration
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CzechPostB2bClient
|
4
|
+
module Services
|
5
|
+
class ParcelsSendProcessUpdater < CzechPostB2bClient::Services::Communicator
|
6
|
+
attr_reader :transaction_id
|
7
|
+
|
8
|
+
def initialize(transaction_id:)
|
9
|
+
@transaction_id = transaction_id
|
10
|
+
end
|
11
|
+
|
12
|
+
def steps
|
13
|
+
super + %i[check_for_state_errors]
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def request_builder_args
|
19
|
+
{ transaction_id: transaction_id }
|
20
|
+
end
|
21
|
+
|
22
|
+
def request_builder_class
|
23
|
+
CzechPostB2bClient::RequestBuilders::GetResultParcelsBuilder
|
24
|
+
end
|
25
|
+
|
26
|
+
def api_caller_class
|
27
|
+
CzechPostB2bClient::Services::ApiCaller
|
28
|
+
end
|
29
|
+
|
30
|
+
def response_parser_class
|
31
|
+
CzechPostB2bClient::ResponseParsers::GetResultParcelsParser
|
32
|
+
end
|
33
|
+
|
34
|
+
def endpoint_path
|
35
|
+
'/getResultParcels'
|
36
|
+
end
|
37
|
+
|
38
|
+
def build_result_from(response_hash)
|
39
|
+
OpenStruct.new(parcels_hash: response_hash[:parcels],
|
40
|
+
state_text: response_hash.dig(:response, :state, :text),
|
41
|
+
state_code: response_hash.dig(:response, :state, :code))
|
42
|
+
end
|
43
|
+
|
44
|
+
def check_for_state_errors
|
45
|
+
return if result.state_code == CzechPostB2bClient::ResponseCodes::Ok.code
|
46
|
+
|
47
|
+
r_code = CzechPostB2bClient::ResponseCodes.new_by_code(result.state_code)
|
48
|
+
errors.add(:response_state, r_code.to_s)
|
49
|
+
|
50
|
+
collect_parcel_errors
|
51
|
+
|
52
|
+
fail! unless r_code.info?
|
53
|
+
end
|
54
|
+
|
55
|
+
def collect_parcel_errors
|
56
|
+
result.parcels_hash.each_pair do |parcel_id, parcel_hash|
|
57
|
+
add_errors_for_failed_states(parcel_id, parcel_hash[:states])
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def add_errors_for_failed_states(parcel_id, response_states)
|
62
|
+
response_states.each do |response_state|
|
63
|
+
response_code = response_state[:code]
|
64
|
+
next if response_code == CzechPostB2bClient::ResponseCodes::Ok.code
|
65
|
+
|
66
|
+
errors.add(:parcels, "Parcel[#{parcel_id}] => #{CzechPostB2bClient::ResponseCodes.new_by_code(response_code)}")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CzechPostB2bClient
|
4
|
+
module Services
|
5
|
+
class ParcelsSender < CzechPostB2bClient::Services::Communicator
|
6
|
+
attr_reader :sending_data, :parcels
|
7
|
+
|
8
|
+
def initialize(sending_data:, parcels:)
|
9
|
+
@sending_data = sending_data
|
10
|
+
@parcels = parcels
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def request_builder_args
|
16
|
+
{ common_data: common_data, parcels: parcels }
|
17
|
+
end
|
18
|
+
|
19
|
+
def request_builder_class
|
20
|
+
CzechPostB2bClient::RequestBuilders::SendParcelsBuilder
|
21
|
+
end
|
22
|
+
|
23
|
+
def api_caller_class
|
24
|
+
CzechPostB2bClient::Services::ApiCaller
|
25
|
+
end
|
26
|
+
|
27
|
+
def response_parser_class
|
28
|
+
CzechPostB2bClient::ResponseParsers::SendParcelsParser
|
29
|
+
end
|
30
|
+
|
31
|
+
def common_data
|
32
|
+
data_from_config.merge(sending_data)
|
33
|
+
end
|
34
|
+
|
35
|
+
def data_from_config
|
36
|
+
{
|
37
|
+
contract_id: configuration.contract_id,
|
38
|
+
customer_id: configuration.customer_id,
|
39
|
+
sending_post_office_code: configuration.sending_post_office_code
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
def endpoint_path
|
44
|
+
'/sendParcels'
|
45
|
+
end
|
46
|
+
|
47
|
+
def build_result_from(response_hash)
|
48
|
+
OpenStruct.new(transaction_id: response_hash.dig(:async_result, :transaction_id),
|
49
|
+
processing_end_expected_at: response_hash.dig(:async_result, :processing_end_expected_at))
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CzechPostB2bClient
|
4
|
+
module Services
|
5
|
+
class ParcelsSubmissionCloser < CzechPostB2bClient::Services::ParcelsSender
|
6
|
+
attr_reader :sending_data
|
7
|
+
|
8
|
+
def initialize(sending_data:)
|
9
|
+
@sending_data = sending_data
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def request_builder_args
|
15
|
+
{ common_data: common_closing_data, parcels: [] }
|
16
|
+
end
|
17
|
+
|
18
|
+
def common_closing_data
|
19
|
+
common_data.merge(close_requests_batch: true)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CzechPostB2bClient
|
4
|
+
module Services
|
5
|
+
class TimePeriodStatisticator < CzechPostB2bClient::Services::Communicator
|
6
|
+
attr_reader :from_date, :to_date
|
7
|
+
|
8
|
+
def initialize(from_date:, to_date:)
|
9
|
+
@from_date =from_date
|
10
|
+
@to_date = to_date
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def request_builder_args
|
16
|
+
{ from_date: from_date, to_date: to_date }
|
17
|
+
end
|
18
|
+
|
19
|
+
def request_builder_class
|
20
|
+
CzechPostB2bClient::RequestBuilders::GetStatsBuilder
|
21
|
+
end
|
22
|
+
|
23
|
+
def api_caller_class
|
24
|
+
CzechPostB2bClient::Services::ApiCaller
|
25
|
+
end
|
26
|
+
|
27
|
+
def response_parser_class
|
28
|
+
CzechPostB2bClient::ResponseParsers::GetStatsParser
|
29
|
+
end
|
30
|
+
|
31
|
+
def endpoint_path
|
32
|
+
'/getStats'
|
33
|
+
end
|
34
|
+
|
35
|
+
def build_result_from(response_hash)
|
36
|
+
imports = response_hash[:imports]
|
37
|
+
OpenStruct.new(requests: OpenStruct.new(total: imports[:requested],
|
38
|
+
with_errors: imports[:with_errors],
|
39
|
+
successful: imports[:successful]),
|
40
|
+
imported_parcels: imports[:imported_parcels])
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Service class based on steps chain (see #steps), which can be successfull even with errors.
|
4
|
+
# If execution of step is successful, next step will be executed.
|
5
|
+
# Step can be marked as failed by calling #fail!. That will stop executing steps chain and return as #failed?.
|
6
|
+
# During processing, #errors can be added, but they will not stop the execution.
|
7
|
+
#
|
8
|
+
# Example usage
|
9
|
+
#
|
10
|
+
# class TeaMaker < SteppedService::Base
|
11
|
+
# attr_reader :tea_type, :bags_into_kettle
|
12
|
+
# def initialize(tea_type:, bags_into_kettle:)
|
13
|
+
# @tea_type = tea_type
|
14
|
+
# @bags_into_kettle = bags_into_kettle
|
15
|
+
# end
|
16
|
+
#
|
17
|
+
# def steps
|
18
|
+
# %i[get_water_into_kettle
|
19
|
+
# make_it_boil
|
20
|
+
# put_tea_bags_into_kettle
|
21
|
+
# wait_3mins
|
22
|
+
# pour_tea_into_cups
|
23
|
+
# add_sugar_to_caps]
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
# private
|
27
|
+
#
|
28
|
+
# attr_accessor :teabags, :kettle, :cups
|
29
|
+
#
|
30
|
+
# def get_water_into_kettle
|
31
|
+
# self.kettle = find_kettle
|
32
|
+
# unless kettle
|
33
|
+
# errors.add(:kettle, "There is no kettle in kitchen!")
|
34
|
+
# fail!
|
35
|
+
# end
|
36
|
+
# fill_water_into(kettle)
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
# def make_it_boil
|
40
|
+
# ...
|
41
|
+
# end
|
42
|
+
#
|
43
|
+
# def put_tea_bags_into_kettle
|
44
|
+
# self.teabags = get_teabags(tea_type, bags_into_kettle)
|
45
|
+
# if teabags.empty?
|
46
|
+
# errors.add(:teabags, "There is no #{bags_into_kettle} #{tea_type} tea teabags in storage, using fruit tea teabags.")
|
47
|
+
# self.teabags = get_teabags(:fruit, bags_into_kettle)
|
48
|
+
# if teabags.empty?
|
49
|
+
# errors.add(:teabags, "There is no #{bags_into_kettle} fruit tea teabags in storage either!")
|
50
|
+
# fail!
|
51
|
+
# end
|
52
|
+
# end
|
53
|
+
# insert(teabags, to: kettle)
|
54
|
+
# end
|
55
|
+
#
|
56
|
+
# ...
|
57
|
+
#
|
58
|
+
# def add_sugar_to_caps # last step should fill @result
|
59
|
+
# cups.each{ |c| c.insert(sugar_cube) }
|
60
|
+
# @result = cups
|
61
|
+
# end
|
62
|
+
# end
|
63
|
+
#
|
64
|
+
# calling
|
65
|
+
# teamaker = TeaMaker.call(:black, 2)
|
66
|
+
# will return instance of with:
|
67
|
+
# - if there is no kettle :
|
68
|
+
# teamaker.failure? # => true
|
69
|
+
# teamaker.result # => nil
|
70
|
+
# teamaker.errors[:kettle] # => ["There is no kettle in kitchen!"]
|
71
|
+
# - if there is no black tea but fruit was found:
|
72
|
+
# teamaker.success? # => true
|
73
|
+
# teamaker.result # => _cups with fruit tea_
|
74
|
+
# teamaker.errors[:teabags] # => ["There is no 2 :black tea teabags in storage, using fruit tea teabags."]
|
75
|
+
# - if there is no black or fruit tea:
|
76
|
+
# teamaker.success? # => false
|
77
|
+
# teamaker.result # => nil
|
78
|
+
# teamaker.errors[:teabags] # => ["There is no 2 :black tea teabags in storage, using fruit tea teabags.",
|
79
|
+
# "There is no 2 fruit tea teabags in storage either!"]
|
80
|
+
# - if all goes well:
|
81
|
+
# teamaker.success? # => true
|
82
|
+
# teamaker.result # => _cups with black tea_
|
83
|
+
# teamaker.errors # => {}
|
84
|
+
module SteppedService
|
85
|
+
class Base
|
86
|
+
attr_reader :result
|
87
|
+
|
88
|
+
def self.call(*args, **keyword_args)
|
89
|
+
new(*args, **keyword_args).call
|
90
|
+
end
|
91
|
+
|
92
|
+
# You can override it, to not use steps
|
93
|
+
def call
|
94
|
+
@finished = false
|
95
|
+
@failed = false
|
96
|
+
|
97
|
+
steps.each do |step|
|
98
|
+
send(step)
|
99
|
+
return self if finished? || failed?
|
100
|
+
end
|
101
|
+
finish!
|
102
|
+
self
|
103
|
+
end
|
104
|
+
|
105
|
+
def steps
|
106
|
+
%i[need to be implemented]
|
107
|
+
end
|
108
|
+
|
109
|
+
def finished?
|
110
|
+
finished == true
|
111
|
+
end
|
112
|
+
|
113
|
+
def success?
|
114
|
+
!failure?
|
115
|
+
end
|
116
|
+
|
117
|
+
def failure?
|
118
|
+
failed == true
|
119
|
+
end
|
120
|
+
alias failed? failure?
|
121
|
+
|
122
|
+
def errors
|
123
|
+
# use with errors.add(:network, e.message)
|
124
|
+
@errors ||= Errors.new
|
125
|
+
end
|
126
|
+
|
127
|
+
private
|
128
|
+
|
129
|
+
attr_accessor :finished, :failed
|
130
|
+
|
131
|
+
def finish!
|
132
|
+
self.finished = true
|
133
|
+
end
|
134
|
+
|
135
|
+
def fail!
|
136
|
+
self.failed = true
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|