class TuffnellsApi::Base
Attributes
account_code[R]
Public Class Methods
new(consignment_no)
click to toggle source
# File lib/tuffnells_api/base.rb, line 12 def initialize consignment_no @consignment_no = consignment_no @account_code = TuffnellsApi.configuration.account_code read_timeout = TuffnellsApi.configuration.read_timeout || 5 proxy = TuffnellsApi.configuration.proxy request = Nokogiri::XML(open(base_uri, proxy_http_basic_authentication: proxy, read_timeout: read_timeout )) @response = TuffnellsApi::TrackingRecord.parse(request, single: true) end
Public Instance Methods
delivery_status()
click to toggle source
# File lib/tuffnells_api/base.rb, line 35 def delivery_status @response.movement_information.movements.last.description end
pod_image()
click to toggle source
# File lib/tuffnells_api/base.rb, line 43 def pod_image @response.image_information.images.last.uri end
postcode()
click to toggle source
# File lib/tuffnells_api/base.rb, line 27 def postcode @response.delivery_address.postcode end
signed_by()
click to toggle source
# File lib/tuffnells_api/base.rb, line 39 def signed_by @response.timed_information.deliveries.last.signature end
total_pieces()
click to toggle source
# File lib/tuffnells_api/base.rb, line 31 def total_pieces @response.consignment_information.pieces end
Private Instance Methods
base_uri()
click to toggle source
# File lib/tuffnells_api/base.rb, line 49 def base_uri "http://www.tpeweb.co.uk/WebServices/Customer/PODTrackingData.asmx/GetTrackingRecord?#{query_string}" end
query_string()
click to toggle source
# File lib/tuffnells_api/base.rb, line 53 def query_string "AccountCode=#{@account_code}&Reference=#{@consignment_no}" end