Class: SimpleShipping::Abstract::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_shipping/abstract/request.rb

Overview

Base class for request builders. Every service has its own implementation.

Direct Known Subclasses

Fedex::Request, Ups::Request

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(credentials) ⇒ Request

Returns a new instance of Request.



7
8
9
# File 'lib/simple_shipping/abstract/request.rb', line 7

def initialize(credentials)
  @credentials = credentials
end

Instance Attribute Details

#credentialsObject (readonly)

Returns the value of attribute credentials.



4
5
6
# File 'lib/simple_shipping/abstract/request.rb', line 4

def credentials
  @credentials
end

#typeObject (readonly)

Returns the value of attribute type.



5
6
7
# File 'lib/simple_shipping/abstract/request.rb', line 5

def type
  @type
end

Instance Method Details

#response(savon_response) ⇒ SimpleShipping::Abstract::Response

Wrap the Savon response with specific response for shipment provider.

Parameters:

  • savon_response (Savon::Response)

Returns:



16
17
18
# File 'lib/simple_shipping/abstract/request.rb', line 16

def response(savon_response)
  response_class.new(savon_response)
end

#response_classClass

Response class to wrap Savon response.

Returns:

  • (Class)


23
24
25
# File 'lib/simple_shipping/abstract/request.rb', line 23

def response_class
  Response
end