Sha256: a21efa8cf4f875e964787d683402387a7c2a60446401bb8fac3724c58ca38266

Contents?: true

Size: 699 Bytes

Versions: 2

Compression:

Stored size: 699 Bytes

Contents

require 'json'
require 'active_support/all'
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

2 entries across 2 versions & 2 rubygems

Version Path
suhovius-itunes-receipt-1.1.1 lib/itunes.rb
itunes-receipt-1.1.0 lib/itunes.rb