Class: ActiveMerchant::Shipping::CPPWSRegisterResponse

Inherits:
Response show all
Includes:
CPPWSErrorResponse
Defined in:
lib/active_shipping/shipping/carriers/canada_post_pws.rb

Instance Attribute Summary collapse

Attributes included from CPPWSErrorResponse

#error_code

Attributes inherited from Response

#message, #params, #request, #test, #xml

Instance Method Summary collapse

Methods included from CPPWSErrorResponse

#handle_error

Methods inherited from Response

#success?, #test?

Constructor Details

#initialize(success, message, params = {}, options = {}) ⇒ CPPWSRegisterResponse

Returns a new instance of CPPWSRegisterResponse.



852
853
854
855
856
# File 'lib/active_shipping/shipping/carriers/canada_post_pws.rb', line 852

def initialize(success, message, params = {}, options = {})
  handle_error(message, options)
  super
  @token_id = options[:token_id]
end

Instance Attribute Details

#token_idObject (readonly)

Returns the value of attribute token_id.



851
852
853
# File 'lib/active_shipping/shipping/carriers/canada_post_pws.rb', line 851

def token_id
  @token_id
end

Instance Method Details

#redirect_url(customer_id, return_url) ⇒ Object



858
859
860
# File 'lib/active_shipping/shipping/carriers/canada_post_pws.rb', line 858

def redirect_url(customer_id, return_url)
  "http://www.canadapost.ca/cpotools/apps/drc/merchant?return-url=#{CGI::escape(return_url)}&token-id=#{token_id}&platform-id=#{customer_id}"
end