Sha256: cc68fd590847fbec3b912baaa3c36f4d0e7c83a33d6b843d1c32aa9a812bdf41

Contents?: true

Size: 597 Bytes

Versions: 1

Compression:

Stored size: 597 Bytes

Contents

# frozen_string_literal: true

require 'base64'

require 'apple_receipt/next_step_parser'
require 'apple_receipt/receipt_parser'
require 'apple_receipt/validator'

module AppleReceipt
  # Receipt represents an Apple receipt.
  class Receipt
    def initialize(raw_receipt)
      receipt_decoded = Base64.decode64(raw_receipt)
      @version, @signature, @cert, @data = ReceiptParser.parse(receipt_decoded)
    end

    def purchase_info
      NextStepParser.parse(data)
    end

    def valid?
      Validator.new(self).valid?
    end

    attr_reader :version, :signature, :cert, :data
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
apple_receipt-0.1.1 lib/apple_receipt/receipt.rb