itunes-receipt 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/README.rdoc +21 -0
  2. data/VERSION +1 -1
  3. data/lib/itunes/receipt.rb +4 -0
  4. metadata +1 -7
@@ -6,6 +6,27 @@ Handle iTunes In App Purchase Receipt Verification.
6
6
 
7
7
  gem install itunes-receipt
8
8
 
9
+ == Usage
10
+
11
+ require 'itunes/receipt'
12
+
13
+ # pass Base64 encoded raw receipt data which you received from your iOS app
14
+ receipt = Itunes::Receipt.verify! 'ewoJInNpZ25hdHVyZSIgPSAi...'
15
+ receipt.product_id # => 'com.example.products.100gems'
16
+ receipt.transaction_id # => '1234567890'
17
+ :
18
+
19
+ See lib/itunes/receipt.rb for more attributes.
20
+
21
+ If you want to accept iTunes sandbox receipts, do like this.
22
+ With <code>allow_sandbox_receipt</code> option specified, this gem post given receipt data to iTunes production first, and when iTunes production tells it's sandbox receipt, re-send it to iTunes sandbox again automatically.
23
+ Without this option, this gem just raises an exception.
24
+
25
+ receipt = Itunes::Receipt.verify! 'ewoJInNpZ25hdHVyZSIgPSAi...', :allow_sandbox_receipt
26
+
27
+ If you want to accept ONLY iTunes sandbox receipts (in your stable server etc.), call <code>Itunes.sandbox!</code> somewhere before you call <code>Itunes::Receipt.verify!</code>.
28
+ Then all verification call after that goes to iTunes sandbox, until you do <code>Itunes.sandbox = false</code>.
29
+
9
30
  == Note on Patches/Pull Requests
10
31
 
11
32
  * Fork the project.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -49,6 +49,10 @@ module Itunes
49
49
  @itunes_env = attributes[:itunes_env] || Itunes.itunes_env
50
50
  end
51
51
 
52
+ def sandbox?
53
+ itunes_env == :sandbox
54
+ end
55
+
52
56
  def self.verify!(receipt_data, allow_sandbox_receipt = false)
53
57
  request_data = {:'receipt-data' => receipt_data}
54
58
  request_data.merge!(:password => Itunes.shared_secret) if Itunes.shared_secret
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itunes-receipt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -176,18 +176,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
176
176
  - - ! '>='
177
177
  - !ruby/object:Gem::Version
178
178
  version: '0'
179
- segments:
180
- - 0
181
- hash: 2311659879300256820
182
179
  required_rubygems_version: !ruby/object:Gem::Requirement
183
180
  none: false
184
181
  requirements:
185
182
  - - ! '>='
186
183
  - !ruby/object:Gem::Version
187
184
  version: '0'
188
- segments:
189
- - 0
190
- hash: 2311659879300256820
191
185
  requirements: []
192
186
  rubyforge_project:
193
187
  rubygems_version: 1.8.24