Module: Deliveries

Defined in:
lib/deliveries/couriers/mondial_relay/shipments/create/defaults.rb,
lib/deliveries.rb,
lib/deliveries/label.rb,
lib/deliveries/errors.rb,
lib/deliveries/labels.rb,
lib/deliveries/pickup.rb,
lib/deliveries/address.rb,
lib/deliveries/courier.rb,
lib/deliveries/version.rb,
lib/deliveries/couriers.rb,
lib/deliveries/delivery.rb,
lib/deliveries/shipment.rb,
lib/deliveries/checkpoint.rb,
lib/deliveries/label_utils.rb,
lib/deliveries/couriers/ups.rb,
lib/deliveries/tracking_info.rb,
lib/deliveries/couriers/dummy.rb,
lib/deliveries/couriers/spring.rb,
lib/deliveries/collection_point.rb,
lib/deliveries/couriers/envialia.rb,
lib/deliveries/couriers/mondial_relay.rb,
lib/deliveries/couriers/spring/address.rb,
lib/deliveries/couriers/spring/request.rb,
lib/deliveries/couriers/correos_express.rb,
lib/deliveries/couriers/ups/json_request.rb,
lib/deliveries/couriers/mondial_relay_dual.rb,
lib/deliveries/couriers/ups/labels/generate.rb,
lib/deliveries/couriers/ups/shipments/trace.rb,
lib/deliveries/couriers/ups/shipments/create.rb,
lib/deliveries/couriers/mondial_relay/address.rb,
lib/deliveries/couriers/envialia/pickups/trace.rb,
lib/deliveries/couriers/spring/labels/generate.rb,
lib/deliveries/couriers/spring/shipments/trace.rb,
lib/deliveries/couriers/correos_express/address.rb,
lib/deliveries/couriers/envialia/authentication.rb,
lib/deliveries/couriers/envialia/pickups/create.rb,
lib/deliveries/couriers/spring/shipments/create.rb,
lib/deliveries/couriers/envialia/labels/generate.rb,
lib/deliveries/couriers/envialia/shipments/trace.rb,
lib/deliveries/couriers/envialia/shipments/create.rb,
lib/deliveries/couriers/mondial_relay/status_codes.rb,
lib/deliveries/couriers/mondial_relay_dual/address.rb,
lib/deliveries/couriers/ups/collection_points/search.rb,
lib/deliveries/couriers/correos_express/pickups/trace.rb,
lib/deliveries/couriers/mondial_relay/labels/generate.rb,
lib/deliveries/couriers/mondial_relay/shipments/trace.rb,
lib/deliveries/couriers/correos_express/pickups/create.rb,
lib/deliveries/couriers/mondial_relay/shipments/create.rb,
lib/deliveries/couriers/correos_express/labels/generate.rb,
lib/deliveries/couriers/correos_express/shipments/trace.rb,
lib/deliveries/couriers/correos_express/shipments/create.rb,
lib/deliveries/couriers/spring/shipments/create/defaults.rb,
lib/deliveries/couriers/correos_express/pickups/cutoff_time.rb,
lib/deliveries/couriers/mondial_relay_dual/shipments/create.rb,
lib/deliveries/couriers/spring/shipments/create/format_params.rb,
lib/deliveries/couriers/envialia/pickups/trace/format_response.rb,
lib/deliveries/couriers/spring/shipments/trace/format_response.rb,
lib/deliveries/couriers/correos_express/pickups/create/defaults.rb,
lib/deliveries/couriers/correos_express/collection_points/search.rb,
lib/deliveries/couriers/envialia/shipments/trace/format_response.rb,
lib/deliveries/couriers/correos_express/shipments/create/defaults.rb,
lib/deliveries/couriers/mondial_relay/pickups/create/format_params.rb,
lib/deliveries/couriers/correos_express/pickups/create/format_params.rb,
lib/deliveries/couriers/mondial_relay/shipments/create/format_params.rb,
lib/deliveries/couriers/correos_express/pickups/trace/format_response.rb,
lib/deliveries/couriers/mondial_relay/shipments/trace/format_response.rb,
lib/deliveries/couriers/correos_express/shipments/create/format_params.rb,
lib/deliveries/couriers/correos_express/shipments/trace/format_response.rb,
lib/deliveries/couriers/mondial_relay_dual/pickups/create/format_params.rb,
lib/deliveries/couriers/correos_express/pickups/cutoff_time/format_params.rb,
lib/deliveries/couriers/mondial_relay_dual/shipments/create/format_params.rb,
lib/deliveries/couriers/mondial_relay/collection_points/search/format_response.rb,
lib/deliveries/couriers/correos_express/collection_points/search/format_response.rb

Overview

“codigoOficina”=>“4894006”, “nombreOficina”=>“OF.CORREOS: LAMIAKO - 4894006”, “direccionOficina”=>“LANGILERIA 88”, “codigoPostalOficina”=>“48940”, “poblacionOficina”=>“LAMIAKO”, “horarioOficina”=>“L-V:DE 08:30 A 14:30/S:DE 09:30 A 13:00/Festivos:SIN SERVICIO”, “horarioOficinaVerano”=>“L-V:08:30-14:30/S:09:30-13:00/Festivos:SIN SERVICIO”, “geoposicionOficina”=>“43.32142,-3.00031”

Defined Under Namespace

Modules: Courier, Couriers, LabelUtils Classes: APIError, Address, Checkpoint, ClientError, CollectionPoint, Delivery, Error, InvalidDateError, InvalidTimeIntervalError, Label, Labels, Pickup, Shipment, TrackingInfo

Constant Summary collapse

VERSION =
'0.3.3'

Class Method Summary collapse

Class Method Details

.courier(courier_id) ⇒ Object



55
56
57
# File 'lib/deliveries.rb', line 55

def self.courier(courier_id)
  Couriers.const_get(courier_id.to_s.downcase.split('_').map(&:capitalize).join)
end

.debugObject



47
48
49
# File 'lib/deliveries.rb', line 47

def self.debug
  instance_variable_get(:@debug) == true
end

.debug=(debug) ⇒ Object



51
52
53
# File 'lib/deliveries.rb', line 51

def self.debug=(debug)
  instance_variable_set :@debug, debug
end

.get_collection_point(global_point_id) ⇒ Object



59
60
61
62
# File 'lib/deliveries.rb', line 59

def self.get_collection_point(global_point_id)
  global_point = CollectionPoint.parse_global_point_id global_point_id: global_point_id
  courier(global_point.courier_id).get_collection_point global_point_id: global_point_id
end

.live?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/deliveries.rb', line 35

def self.live?
  mode == :live
end

.loggerObject



39
40
41
# File 'lib/deliveries.rb', line 39

def self.logger
  instance_variable_get :@logger
end

.logger=(logger) ⇒ Object



43
44
45
# File 'lib/deliveries.rb', line 43

def self.logger=(logger)
  instance_variable_set :@logger, logger
end

.modeObject



16
17
18
19
20
21
22
# File 'lib/deliveries.rb', line 16

def self.mode
  if instance_variable_defined? :@mode
    instance_variable_get :@mode
  else
    :test
  end
end

.mode=(mode) ⇒ Object



24
25
26
27
28
29
# File 'lib/deliveries.rb', line 24

def self.mode=(mode)
  mode = mode&.to_sym
  raise "Invalid mode #{mode}" unless %i[live test].include?(mode)

  instance_variable_set :@mode, mode
end

.test?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/deliveries.rb', line 31

def self.test?
  mode == :test
end