class CzechPostB2bClient::ResponseParsers::SendParcelsParser
Public Instance Methods
build_result()
click to toggle source
Calls superclass method
CzechPostB2bClient::ResponseParsers::BaseParser#build_result
# File lib/czech_post_b2b_client/response_parsers/send_parcels_parser.rb, line 6 def build_result super @result[:async_result] = { transaction_id: response_header.dig('idTransaction'), processing_end_expected_at: parse_time_with_correction(response_header.dig('timeStampProcessing')) } end
cpost_time_zone()
click to toggle source
just for info
# File lib/czech_post_b2b_client/response_parsers/send_parcels_parser.rb, line 30 def cpost_time_zone timezone('Europe/Prague') end
parse_time_with_correction(b2b_time_str)
click to toggle source
# File lib/czech_post_b2b_client/response_parsers/send_parcels_parser.rb, line 15 def parse_time_with_correction(b2b_time_str) # b2b time in XML is NOT CORRECT! They return CET time value with UTC timezone # Like `2016-02-25T09:30:03.678Z`, which is actually `2016-02-25T09:30:03.678+0100` (CET) # Or `2016-05-25T09:30:03.678Z`, which is actually `2016-05-25T09:30:03.678+0200` (CET + DST) # But we must be prepare for unnoticed fix by CPost # unfortunattely this can be done for only freshly generated XMLs (comparing b2b_time with Time.now.utc) # but we have to kepp it compatible for old XML # so we pass it up and leave comments in documenation # Users of this gem will have to care of it Time.parse(b2b_time_str) end