class CzechPostB2bClient::Services::ParcelsAsyncSender

Attributes

parcels[R]
sending_data[R]

Public Class Methods

new(sending_data:, parcels:) click to toggle source
# File lib/czech_post_b2b_client/services/parcels_async_sender.rb, line 8
def initialize(sending_data:, parcels:)
  @sending_data = sending_data
  @parcels = parcels
end

Private Instance Methods

api_caller_class() click to toggle source
# File lib/czech_post_b2b_client/services/parcels_async_sender.rb, line 23
def api_caller_class
  CzechPostB2bClient::Services::ApiCaller
end
build_result_from(response_hash) click to toggle source
# File lib/czech_post_b2b_client/services/parcels_async_sender.rb, line 47
def build_result_from(response_hash)
  OpenStruct.new(transaction_id: response_hash.dig(:async_result, :transaction_id),
                 processing_end_expected_at: response_hash.dig(:async_result, :processing_end_expected_at))
end
common_data() click to toggle source
# File lib/czech_post_b2b_client/services/parcels_async_sender.rb, line 31
def common_data
  data_from_config.merge(sending_data)
end
data_from_config() click to toggle source
# File lib/czech_post_b2b_client/services/parcels_async_sender.rb, line 35
def data_from_config
  {
    contract_id: configuration.contract_id,
    customer_id: configuration.customer_id,
    sending_post_office_code: configuration.sending_post_office_code
  }
end
endpoint_path() click to toggle source
# File lib/czech_post_b2b_client/services/parcels_async_sender.rb, line 43
def endpoint_path
  '/sendParcels'
end
request_builder_args() click to toggle source
# File lib/czech_post_b2b_client/services/parcels_async_sender.rb, line 15
def request_builder_args
  { common_data: common_data, parcels: parcels }
end
request_builder_class() click to toggle source
# File lib/czech_post_b2b_client/services/parcels_async_sender.rb, line 19
def request_builder_class
  CzechPostB2bClient::RequestBuilders::SendParcelsBuilder
end
response_parser_class() click to toggle source
# File lib/czech_post_b2b_client/services/parcels_async_sender.rb, line 27
def response_parser_class
  CzechPostB2bClient::ResponseParsers::SendParcelsParser
end