Class: Fedex::Shipment

Inherits:
Object
  • Object
show all
Defined in:
lib/fedex/shipment.rb

Direct Known Subclasses

Request::Label

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Shipment

In order to use Fedex rates API you must first apply for a developer(and later production keys), Visit / Fedex Developer Center for more information about how to obtain your keys. return a Fedex::Shipment object

Parameters:

  • key (String)
    • Fedex web service key

  • password (String)
    • Fedex password

  • account_number (String)
    • Fedex account_number

  • meter (String)
    • Fedex meter number

  • mode (String)
    • development/production


19
20
21
# File 'lib/fedex/shipment.rb', line 19

def initialize(options={})
  @credentials = Credentials.new(options)
end

Instance Method Details

#label(options = {}) ⇒ Object

Parameters:

  • shipper, (Hash)

    A hash containing the shipper information

  • recipient, (Hash)

    A hash containing the recipient information

  • packages, (Array)

    An arrary including a hash for each package being shipped

  • service_type, (String)

    A valid fedex service type, to view a complete list of services Fedex::Shipment::SERVICE_TYPES

  • filename, (String)

    A location where the label will be saved

  • label_specification, (Hash)

    A hash containing the label printer settings



29
30
31
# File 'lib/fedex/shipment.rb', line 29

def label(options = {})
  Request::Label.new(@credentials, options).process_request
end

#rate(options = {}) ⇒ Object

Parameters:

  • shipper, (Hash)

    A hash containing the shipper information

  • recipient, (Hash)

    A hash containing the recipient information

  • packages, (Array)

    An arrary including a hash for each package being shipped

  • service_type, (String)

    A valid fedex service type, to view a complete list of services Fedex::Shipment::SERVICE_TYPES



37
38
39
# File 'lib/fedex/shipment.rb', line 37

def rate(options = {})
  Request::Rate.new(@credentials, options).process_request
end

#ship(options = {}) ⇒ Object

Parameters:

  • shipper, (Hash)

    A hash containing the shipper information

  • recipient, (Hash)

    A hash containing the recipient information

  • packages, (Array)

    An arrary including a hash for each package being shipped

  • service_type, (String)

    A valid fedex service type, to view a complete list of services Fedex::Shipment::SERVICE_TYPES



50
51
52
# File 'lib/fedex/shipment.rb', line 50

def ship(options = {})
  Request::Shipment.new(@credentials, options).process_request
end

#track(options = {}) ⇒ Object

Parameters:

  • package_id, (Hash)

    A string with the requested tracking number

  • package_type, (Hash)

    A string identifitying the type of tracking number used. Full list Fedex::Track::PACKAGE_IDENTIFIER_TYPES



56
57
58
# File 'lib/fedex/shipment.rb', line 56

def track(options = {})
  Request::TrackingInformation.new(@credentials, options).process_request
end

#validate_address(options = {}) ⇒ Object

Parameters:

  • address, (Hash)

    A hash containing the address information



42
43
44
# File 'lib/fedex/shipment.rb', line 42

def validate_address(options = {})
  Request::Address.new(@credentials, options).process_request
end