Sha256: ec8b98c0b9045b760907a4a2c5783fc3c1721150d13e03533757e81291e63cd8
Contents?: true
Size: 1.21 KB
Versions: 3
Compression:
Stored size: 1.21 KB
Contents
# frozen_string_literal: true module CzechPostB2bClient module Services class DeliveringInspector < CzechPostB2bClient::Services::Communicator attr_reader :parcel_codes def initialize(parcel_codes:) super() @parcel_codes = parcel_codes end private def request_builder_args { parcel_codes: parcel_codes } end def request_builder_class CzechPostB2bClient::RequestBuilders::GetParcelStateBuilder end def api_caller_class CzechPostB2bClient::Services::ApiCaller end def response_parser_class CzechPostB2bClient::ResponseParsers::GetParcelStateParser end def endpoint_path '/getParcelState' end def build_result_from(response_hash) result_hash = {} response_hash[:parcels].each_pair do |parcel_code, delivering_hash| result_hash[parcel_code] = { deposited_until: delivering_hash[:deposited_until], deposited_for_days: delivering_hash[:deposited_for_days], current_state: delivering_hash[:states].last, all_states: delivering_hash[:states] } end result_hash end end end end
Version data entries
3 entries across 3 versions & 1 rubygems