class TaxCloud::Responses::Lookup
Attributes
cart_id[RW]
Cart ID.
cart_items[RW]
Cart items.
Public Class Methods
new(savon_response)
click to toggle source
Parameters¶ ↑
- savon_response
-
SOAP response.
Calls superclass method
TaxCloud::Responses::Base::new
# File lib/tax_cloud/responses/lookup.rb, line 20 def initialize(savon_response) super savon_response self.cart_id = match('lookup_response/lookup_result/cart_id') # there can be on response or an array of responses cart_item_responses = match('lookup_response/lookup_result/cart_items_response/cart_item_response') self.cart_items = if cart_item_responses.is_a?(Array) cart_item_responses.map do |cart_item_response| TaxCloud::Responses::CartItem.new(cart_item_response) end else [TaxCloud::Responses::CartItem.new(cart_item_responses)] end end
Public Instance Methods
tax_amount()
click to toggle source
Total tax amount in this cart.
# File lib/tax_cloud/responses/lookup.rb, line 35 def tax_amount cart_items.reduce(0) { |a, e| a + e.tax_amount } end