lib/liberic/process.rb in liberic-1.1.0 vs lib/liberic/process.rb in liberic-1.2.0
- old
+ new
@@ -57,18 +57,19 @@
# Will generate a PDF in the current directory if not specified otherwise.
# *WARNING* method signature and parameters are WIP and subject to change
def execute(options = {})
action = options[:action] ||= :validate
eric_action = ACTIONS[action] || (raise ExecutionError.new("Invalid action: #{action}. Valid actions are #{ACTIONS.keys.join(', ')}"))
+ is_printing = %w[submit print_and_submit print_and_submit_auth].include?(action.to_s)
print_params = create_print_params(options)
server_buffer = SDK::API.rueckgabepuffer_erzeugen
result = Helpers::Invocation.with_result_buffer(false) do |local_buffer|
SDK::API.bearbeite_vorgang(@xml, @type,
eric_action,
(action == :submit ? nil : print_params),
options[:encryption],
- (action == :submit ? FFI::MemoryPointer.new(:uint32, 1) : nil), # transferHandle
+ (is_printing ? FFI::MemoryPointer.new(:uint32, 1) : nil), # transferHandle
local_buffer,
server_buffer)
end
server_result = SDK::API.rueckgabepuffer_inhalt(server_buffer)
SDK::API.rueckgabepuffer_freigeben(server_buffer)
@@ -87,9 +88,10 @@
print_and_submit: :sende,
submit: :sende,
print_and_submit_auth: :sende_auth
}
+ # TODO: check for updates regarding version
def create_print_params(options)
params = SDK::Types::DruckParameter.new
params[:version] = 2
params[:ersteSeite] = options[:cover_page] ? 1 : 0
params[:duplexDruck] = options[:duplex] ? 1 : 0