class CzechPostB2bClient::Services::AddressSheetsGenerator
Attributes
options[R]
parcel_codes[R]
Public Class Methods
new(parcel_codes:, options: {})
click to toggle source
# File lib/czech_post_b2b_client/services/address_sheets_generator.rb, line 8 def initialize(parcel_codes:, options: {}) @parcel_codes = parcel_codes @options = options end
Public Instance Methods
steps()
click to toggle source
Calls superclass method
CzechPostB2bClient::Services::Communicator#steps
# File lib/czech_post_b2b_client/services/address_sheets_generator.rb, line 13 def steps super + %i[check_for_state_errors] end
Private Instance Methods
api_caller_class()
click to toggle source
# File lib/czech_post_b2b_client/services/address_sheets_generator.rb, line 27 def api_caller_class CzechPostB2bClient::Services::ApiCaller end
build_result_from(response_hash)
click to toggle source
# File lib/czech_post_b2b_client/services/address_sheets_generator.rb, line 39 def build_result_from(response_hash) OpenStruct.new(pdf_content: response_hash.dig(:printings, :pdf_content), state_text: response_hash.dig(:response, :state, :text), state_code: response_hash.dig(:response, :state, :code)) end
check_for_state_errors()
click to toggle source
# File lib/czech_post_b2b_client/services/address_sheets_generator.rb, line 45 def check_for_state_errors return if result.state_code == CzechPostB2bClient::ResponseCodes::Ok.code r_code = CzechPostB2bClient::ResponseCodes.new_by_code(result.state_code) errors.add(:response_state, r_code.to_s) fail! unless r_code.info? end
endpoint_path()
click to toggle source
# File lib/czech_post_b2b_client/services/address_sheets_generator.rb, line 35 def endpoint_path '/getParcelsPrinting' end
request_builder_args()
click to toggle source
# File lib/czech_post_b2b_client/services/address_sheets_generator.rb, line 19 def request_builder_args { parcel_codes: parcel_codes, options: options } end
request_builder_class()
click to toggle source
# File lib/czech_post_b2b_client/services/address_sheets_generator.rb, line 23 def request_builder_class CzechPostB2bClient::RequestBuilders::GetParcelsPrintingBuilder end
response_parser_class()
click to toggle source
# File lib/czech_post_b2b_client/services/address_sheets_generator.rb, line 31 def response_parser_class CzechPostB2bClient::ResponseParsers::GetParcelsPrintingParser end