lib/carousel/client.rb in carousel-ruby-api-0.0.2 vs lib/carousel/client.rb in carousel-ruby-api-0.0.3

- old
+ new

@@ -9,11 +9,11 @@ LIVE_HOST = "web.carousel.eu" LIVE_PATH = "carouselwms" PORT = 443 KEYS_MAP = { "stockid" => "upc" } - attr_accessor :username, :password, :response, :type, :request_uri, :path + attr_accessor :username, :password, :options, :response, :type, :request_uri, :path def initialize(username, password, options = {}) raise "Username is required" unless username raise "Password is required" unless password @@ -28,10 +28,19 @@ end def get_inventory request = Inventory.new(self).build_inventory_request @path = build_path(Inventory::PATH) - map_results(post(request).response['stock']) + inventory_response(request) + end + + # gets the raw inventory response from the provider + # then converts provider specific language to match + # a uniform API, stored on @response, and returns + def inventory_response(request) + response = post(request) + response.response = map_results(response.response['stock']) + response end def order_request(order) @path = build_path(Order::PATH) Order.new(self).build_order_request(order)