itunes_validator 0.3.0 → 0.3.1
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.
- checksums.yaml +4 -4
- data/lib/itunes_validator/client.rb +14 -5
- data/lib/itunes_validator.rb +1 -1
- metadata +2 -3
- data/lib/itunes_validator/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eccf396503837b383c0c3f976596d998d4fa8f62
|
4
|
+
data.tar.gz: 9ee21081006cde3f5acfcb346ccf58454a6c1f09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e64dff5caaf1fa0643f4acab76711fa2bca6472a9c2713759fc89daf83ffa562dc70beb591b3f772e7b3e51abfee13b91915e986929ddbee5fcae876374c6e46
|
7
|
+
data.tar.gz: a0a9d908b9ba5db9d1dc0e21c9592ae4454b8760b3e43c710bcfa30b049c2ac42e581d697d29a6a67143acc68b6c3afe26ff7ff6beba6d9b3544b362f76354b8
|
@@ -15,6 +15,7 @@ module ItunesValidator
|
|
15
15
|
def initialize(options=nil)
|
16
16
|
@shared_secret = options[:shared_secret] if options
|
17
17
|
@use_latest = (options[:use_latest] if options) || true
|
18
|
+
@return_latest_too = (options[:return_latest_too] if options) || true
|
18
19
|
end
|
19
20
|
|
20
21
|
def validate(receipt_data)
|
@@ -24,7 +25,7 @@ module ItunesValidator
|
|
24
25
|
post_body['receipt-data'] = receipt_data
|
25
26
|
post_body['password'] = @shared_secret if @shared_secret
|
26
27
|
|
27
|
-
receipt_info = nil
|
28
|
+
receipt_info = latest_receipt_info = nil
|
28
29
|
|
29
30
|
uri = URI(APPSTORE_VERIFY_URL_PRODUCTION)
|
30
31
|
begin
|
@@ -41,9 +42,7 @@ module ItunesValidator
|
|
41
42
|
case itunes_status = response_body['status'].to_i
|
42
43
|
when 0
|
43
44
|
receipt_info = response_body['receipt']
|
44
|
-
|
45
|
-
receipt_info = response_body['latest_receipt_info']
|
46
|
-
end
|
45
|
+
latest_receipt_info = response_body['latest_receipt_info']
|
47
46
|
else
|
48
47
|
raise ItunesValidationError.new(itunes_status)
|
49
48
|
end
|
@@ -57,7 +56,17 @@ module ItunesValidator
|
|
57
56
|
end
|
58
57
|
end
|
59
58
|
|
60
|
-
Receipt.from_h(
|
59
|
+
receipts = [receipt_info, latest_receipt_info].map{ |ri| Receipt.from_h(ri) if ri }
|
60
|
+
|
61
|
+
if @use_latest
|
62
|
+
return receipts.compact.last
|
63
|
+
end
|
64
|
+
|
65
|
+
if @return_latest_too
|
66
|
+
return receipts
|
67
|
+
end
|
68
|
+
|
69
|
+
receipts[0]
|
61
70
|
end
|
62
71
|
end
|
63
72
|
|
data/lib/itunes_validator.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itunes_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Talbot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -35,7 +35,6 @@ files:
|
|
35
35
|
- lib/itunes_validator.rb
|
36
36
|
- lib/itunes_validator/client.rb
|
37
37
|
- lib/itunes_validator/receipt.rb
|
38
|
-
- lib/itunes_validator/version.rb
|
39
38
|
homepage: https://github.com/cysp/itunes_validator-ruby
|
40
39
|
licenses:
|
41
40
|
- MPL-2.0
|