Class: UPS::Parsers::ShipAcceptParser
Instance Attribute Summary
Attributes inherited from BaseParser
#response
Instance Method Summary
collapse
Methods inherited from BaseParser
#error_description, #initialize, #parsed_response, #status_code, #status_description, #success?
Instance Method Details
#currency_code ⇒ Object
59
60
61
|
# File 'lib/ups/parsers/ship_accept_parser.rb', line 59
def currency_code
shipment_results[:ShipmentCharges][:TotalCharges][:CurrencyCode]
end
|
27
28
29
30
31
|
# 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
|
33
34
35
36
37
|
# 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
|
#label_graphic_extension ⇒ Object
Also known as:
graphic_extension
11
12
13
|
# File 'lib/ups/parsers/ship_accept_parser.rb', line 11
def label_graphic_extension
packages[0].label_graphic_extension
end
|
#label_graphic_image ⇒ Object
Also known as:
graphic_image
15
16
17
|
# File 'lib/ups/parsers/ship_accept_parser.rb', line 15
def label_graphic_image
packages[0].label_graphic_image
end
|
#label_html_image ⇒ Object
Also known as:
html_image
19
20
21
|
# File 'lib/ups/parsers/ship_accept_parser.rb', line 19
def label_html_image
packages[0].label_html_image
end
|
#master_carton_id ⇒ Object
45
46
47
|
# File 'lib/ups/parsers/ship_accept_parser.rb', line 45
def master_carton_id
shipment_results[:MasterCartonID]
end
|
#negotiated_rate ⇒ Object
55
56
57
|
# 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 ⇒ Object
39
40
41
42
43
|
# 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 ⇒ Object
49
50
51
52
53
|
# File 'lib/ups/parsers/ship_accept_parser.rb', line 49
def total_charge
return shipment_charge unless negotiated_rate
negotiated_rate
end
|
#tracking_number ⇒ Object
7
8
9
|
# File 'lib/ups/parsers/ship_accept_parser.rb', line 7
def tracking_number
packages[0].tracking_number
end
|