Method: Oca::Epak::Client#create_pickup_order

Defined in:
lib/oca-epak/epak/client.rb

#create_pickup_order(opts = {}) ⇒ Hash?

Creates a Pickup Order, which lets OCA know you want to make a delivery.

Parameters:

  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :pickup_data (Oca::Epak::PickupData)

    Pickup Data object

  • :confirm_pickup (Boolean)

    Confirm Pickup? Defaults to false

  • :days_to_pickup (Integer)

    Days OCA should wait before pickup, default: 1

  • :pickup_range (Integer)

    Range to be used when picking it up, default: 1

Returns:

  • (Hash, nil)

See Also:


36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/oca-epak/epak/client.rb', line 36

def create_pickup_order(opts = {})
  confirm_pickup = opts.fetch(:confirm_pickup, FALSE_STRING)
  days_to_pickup = opts.fetch(:days_to_pickup, ONE_STRING)
  pickup_range = opts.fetch(:pickup_range, ONE_STRING)
  rendered_xml = opts[:pickup_data].to_xml

  message = { USER_STRING => username, PASSWORD_STRING => password,
              "xml_Datos" => rendered_xml,
              "ConfirmarRetiro" => confirm_pickup.to_s,
              "DiasHastaRetiro" => days_to_pickup,
              "idFranjaHoraria" => pickup_range }
  response = client.call(:ingreso_or, message: message)
  parse_result(response, :ingreso_or)
end