Module: ItunesReceiptDecoder
- Defined in:
- lib/itunes_receipt_decoder.rb,
lib/itunes_receipt_decoder/version.rb,
lib/itunes_receipt_decoder/decode/base.rb,
lib/itunes_receipt_decoder/decode/unified_receipt.rb,
lib/itunes_receipt_decoder/decode/transaction_receipt.rb
Overview
ItunesReceiptDecoder
Defined Under Namespace
Modules: Decode Classes: DecodingError
Constant Summary collapse
- VERSION =
Gem version
'0.2.1'
Class Method Summary collapse
-
.new(receipt_data, options = {}) ⇒ Object
Initializes either ItunesReceiptDecoder::Decode::Transaction or ItunesReceiptDecoder::Decode::Unified with the base64 encoded receipt ==== Arguments.
Class Method Details
.new(receipt_data, options = {}) ⇒ Object
Initializes either ItunesReceiptDecoder::Decode::Transaction or ItunesReceiptDecoder::Decode::Unified with the base64 encoded receipt
Arguments
-
receipt_data- the base64 encoded receipt -
options- optional arguments
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/itunes_receipt_decoder.rb', line 22 def self.new(receipt_data, = {}) raw_receipt = Base64.decode64(receipt_data) rescue ArgumentError => e raise DecodingError, e. else if /^\{*+\}$/ =~ raw_receipt Decode::TransactionReceipt.new(raw_receipt, ) else Decode::UnifiedReceipt.new(raw_receipt, ) end end |