class UPS::Parsers::ShipAcceptParser

Public Instance Methods

currency_code() click to toggle source
# File lib/ups/parsers/ship_accept_parser.rb, line 59
def currency_code
  shipment_results[:ShipmentCharges][:TotalCharges][:CurrencyCode]
end
form_graphic_extension() click to toggle source
# File lib/ups/parsers/ship_accept_parser.rb, line 27
def form_graphic_extension
  return unless has_form_graphic?

  ".#{form_graphic[:Image][:ImageFormat][:Code].downcase}"
end
form_graphic_image() click to toggle source
# File lib/ups/parsers/ship_accept_parser.rb, line 33
def form_graphic_image
  return unless has_form_graphic?

  Utils.base64_to_file(form_graphic[:Image][:GraphicImage], form_graphic_extension)
end
graphic_extension()
graphic_image()
Alias for: label_graphic_image
html_image()
Alias for: label_html_image
label_graphic_extension() click to toggle source
# File lib/ups/parsers/ship_accept_parser.rb, line 11
def label_graphic_extension
  packages[0].label_graphic_extension
end
Also aliased as: graphic_extension
label_graphic_image() click to toggle source
# File lib/ups/parsers/ship_accept_parser.rb, line 15
def label_graphic_image
  packages[0].label_graphic_image
end
Also aliased as: graphic_image
label_html_image() click to toggle source
# File lib/ups/parsers/ship_accept_parser.rb, line 19
def label_html_image
  packages[0].label_html_image
end
Also aliased as: html_image
master_carton_id() click to toggle source
# File lib/ups/parsers/ship_accept_parser.rb, line 45
def master_carton_id
  shipment_results[:MasterCartonID]
end
negotiated_rate() click to toggle source
# File lib/ups/parsers/ship_accept_parser.rb, line 55
def negotiated_rate
  negotiated_rate_response && negotiated_rate_response[:NetSummaryCharges][:GrandTotal][:MonetaryValue].to_f
end
packages() click to toggle source
# File lib/ups/parsers/ship_accept_parser.rb, line 39
def packages
  return package_results.map { |package_result| UPS::Models::PackageResult.new(package_result) } if package_results.is_a?(Array)

  [UPS::Models::PackageResult.new(package_results)]
end
total_charge() click to toggle source
# File lib/ups/parsers/ship_accept_parser.rb, line 49
def total_charge
  return shipment_charge unless negotiated_rate

  negotiated_rate
end
tracking_number() click to toggle source
# File lib/ups/parsers/ship_accept_parser.rb, line 7
def tracking_number
  packages[0].tracking_number
end

Private Instance Methods

form_graphic() click to toggle source
# File lib/ups/parsers/ship_accept_parser.rb, line 73
def form_graphic
  shipment_results[:Form]
end
has_form_graphic?() click to toggle source
# File lib/ups/parsers/ship_accept_parser.rb, line 77
def has_form_graphic?
  shipment_results.key?(:Form)
end
negotiated_rate_response() click to toggle source
# File lib/ups/parsers/ship_accept_parser.rb, line 65
def negotiated_rate_response
  shipment_results[:NegotiatedRates]
end
package_results() click to toggle source
# File lib/ups/parsers/ship_accept_parser.rb, line 81
def package_results
  shipment_results[:PackageResults]
end
root_response() click to toggle source
# File lib/ups/parsers/ship_accept_parser.rb, line 89
def root_response
  parsed_response[:ShipmentAcceptResponse]
end
shipment_charge() click to toggle source
# File lib/ups/parsers/ship_accept_parser.rb, line 69
def shipment_charge
  shipment_results[:ShipmentCharges][:TotalCharges][:MonetaryValue].to_f
end
shipment_results() click to toggle source
# File lib/ups/parsers/ship_accept_parser.rb, line 85
def shipment_results
  root_response[:ShipmentResults]
end