./lib/venice/client.rb in venice-0.1.0 vs ./lib/venice/client.rb in venice-0.2.0

- old
+ new

@@ -4,21 +4,10 @@ module Venice ITUNES_PRODUCTION_RECEIPT_VERIFICATION_ENDPOINT = "https://buy.itunes.apple.com/verifyReceipt" ITUNES_DEVELOPMENT_RECEIPT_VERIFICATION_ENDPOINT = "https://sandbox.itunes.apple.com/verifyReceipt" - RECEIPT_VERIFICATION_ERRORS_BY_STATUS_CODE = { - 21000 => "The App Store could not read the JSON object you provided.", - 21002 => "The data in the receipt-data property was malformed.", - 21003 => "The receipt could not be authenticated.", - 21004 => "The shared secret you provided does not match the shared secret on file for your account.", - 21005 => "The receipt server is not currently available.", - 21006 => "This receipt is valid but the subscription has expired. When this status code is returned to your server, the receipt data is also decoded and returned as part of the response.", - 21007 => "This receipt is a sandbox receipt, but it was sent to the production service for verification.", - 21008 => "This receipt is a production receipt, but it was sent to the sandbox service for verification." - } - class Client attr_accessor :verification_url attr_writer :shared_secret class << self @@ -55,10 +44,10 @@ receipt.latest_expired = Receipt.new(latest_expired_receipt_attributes) end return receipt else - raise (RECEIPT_VERIFICATION_ERRORS_BY_STATUS_CODE[status] || "Unknown Error: #{status}") + raise Receipt::VerificationError.new(status) end end private