Class: SimpleShipping::Fedex::Request

Inherits:
Abstract::Request show all
Extended by:
ActiveSupport::Autoload
Defined in:
lib/simple_shipping/fedex/request.rb

Overview

Builds a complete request for the FedEx service.

Direct Known Subclasses

ShipmentRequest

Instance Attribute Summary

Attributes inherited from Abstract::Request

#credentials, #type

Instance Method Summary collapse

Methods inherited from Abstract::Request

#response, #response_class

Constructor Details

#initialize(credentials, shipment) ⇒ Request

Returns a new instance of Request.



8
9
10
11
# File 'lib/simple_shipping/fedex/request.rb', line 8

def initialize(credentials, shipment)
  super(credentials)
  @shipment = shipment
end

Instance Method Details

#body(opts = {}) ⇒ Object

Build a complete request from a shipment object.



14
15
16
17
18
19
20
# File 'lib/simple_shipping/fedex/request.rb', line 14

def body(opts = {})
  {'WebAuthenticationDetail' => web_authentication_detail,
   'ClientDetail'            => client_detail,
   'Version'                 => version,
   'RequestedShipment'       => ShipmentBuilder.build(@shipment, opts),
   :order! => ['WebAuthenticationDetail', 'ClientDetail', 'Version', 'RequestedShipment'] }
end