module FedexLabelService
Constants
- VERSION
Attributes
configuration[W]
Public Class Methods
call(message)
click to toggle source
# File lib/fedex_label_service.rb, line 41 def self.call(message) client = Savon.client(wsdl: FedexLabelService.configuration.wsdl) begin @response = client.call(:process_shipment, message: message) rescue Savon::SOAPFault => error puts error.http.inspect end @response end
configuration()
click to toggle source
# File lib/fedex_label_service.rb, line 15 def self.configuration @configuration ||= Configuration.new end
configure() { |configuration| ... }
click to toggle source
# File lib/fedex_label_service.rb, line 23 def self.configure yield(configuration) end
message(service, sender_attributes, recipient_attributes)
click to toggle source
# File lib/fedex_label_service.rb, line 31 def self.message(service, sender_attributes, recipient_attributes) if service == 'smartpost' message = FedexLabelService::SmartpostMessage.build(sender_attributes, recipient_attributes) elsif service == 'ground' message = FedexLabelService::GroundMessage.build(sender_attributes, recipient_attributes) end message end
parsed_response(response)
click to toggle source
# File lib/fedex_label_service.rb, line 53 def self.parsed_response(response) { tracking_number: response.body[:process_shipment_reply][:completed_shipment_detail][:completed_package_details][:tracking_ids][:tracking_number], label_data: response.body[:process_shipment_reply][:completed_shipment_detail][:completed_package_details][:label][:parts][:image] } end
reset()
click to toggle source
# File lib/fedex_label_service.rb, line 19 def self.reset @configuration = Configuration.new end
root()
click to toggle source
# File lib/fedex_label_service.rb, line 27 def self.root Pathname.new File.expand_path('..', __dir__) end