Sha256: 42202d740bd3b839947593f046d3dab80d273543f60ba4bbf19e7321726f5d06

Contents?: true

Size: 939 Bytes

Versions: 7

Compression:

Stored size: 939 Bytes

Contents

module Gameball
    class Order
      def self.place_order(body)
        # Validating keys in incoming body
        Gameball::Utils.validate(body, ["playerUniqueId","orderId","totalPaid","totalPrice"], 
            ["mobile","email","totalShipping","totalTax","totalDiscount","lineItems","discountCodes","extra","redeemedAmount","holdReference","guest",
                "merchant"])
        body[:orderDate] = Time.now.utc.iso8601
        res = Gameball::Utils::request("post", "/Integrations/order", body)
        # Check for HTTP Success and throws error if not success
        unless res.kind_of? Net::HTTPSuccess
          if res.kind_of? Net::HTTPInternalServerError
            raise Gameball::GameballError.new("An Internal Server Error has occurred")
          else
            raise Gameball::GameballError.new(res.body) 
          end
        else
          return res
        end
      end
    end
  end
  

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gameball-3.1.5 lib/gameball/models/order.rb
gameball-3.1.4 lib/gameball/models/order.rb
gameball-2.1.4 lib/gameball/models/order.rb
gameball-2.1.3 lib/gameball/models/order.rb
gameball-2.1.1 lib/gameball/models/order.rb
gameball-2.0.1 lib/gameball/models/order.rb
gameball-2.0.0 lib/gameball/models/order.rb