Sha256: 14616c8792d0232d8c9c172e97b7a147c83cc73f3883ae0f6585dfe3eca15415

Contents?: true

Size: 704 Bytes

Versions: 5

Compression:

Stored size: 704 Bytes

Contents

require 'json'
require 'active_support/core_ext'
require 'restclient_with_cert'

module Itunes

  ENDPOINT = {
    :production => 'https://buy.itunes.apple.com/verifyReceipt',
    :sandbox => 'https://sandbox.itunes.apple.com/verifyReceipt'
  }

  def self.endpoint
    ENDPOINT[itunes_env]
  end

  def self.itunes_env
    sandbox? ? :sandbox : :production
  end

  def self.sandbox?
    @@sandbox
  end
  def self.sandbox!
    self.sandbox = true
  end
  def self.sandbox=(boolean)
    @@sandbox = boolean
  end
  self.sandbox = false

  def self.shared_secret
    @@shared_secret
  end
  def self.shared_secret=(shared_secret)
    @@shared_secret = shared_secret
  end
  self.shared_secret = nil

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
itunes-receipt-1.0.0 lib/itunes.rb
itunes-receipt-0.1.5 lib/itunes.rb
itunes-receipt-0.1.4 lib/itunes.rb
itunes-receipt-0.1.3 lib/itunes.rb
itunes-receipt-0.1.2 lib/itunes.rb