ios-receipt 0.1.3 → 0.1.4
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/ios/receipt/result.rb +10 -9
- data/lib/ios/receipt/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 911593675fa6cdd21f74bb4f9424edf2531c75ee
|
4
|
+
data.tar.gz: 6b8a60b1a78100a7a6cfbc93c9f31b16b1d68834
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcb3276a2776218b15578563c738d835f5f980b15c7f9e42d3fd0eeeed9b9983b803da78a818075cc27debed59d223fd3f8c8eec5b2b3b0f8698c73bec829667
|
7
|
+
data.tar.gz: 9e49987e1d2f5b7fe8a8d22fd24f20e4cce671418bafb55639cd877ef35f5184fdb70da8f1f72ac4db100932f77278b40cd751d455c063ac73ed4fb3b7bb58e2
|
data/lib/ios/receipt/result.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
class Ios::Receipt::Result
|
2
2
|
attr_reader :result, :environment, :bundle_id, :application_version, :original_application_version,
|
3
|
-
:in_app, :latest
|
3
|
+
:in_app, :latest, :receipt_style
|
4
4
|
|
5
5
|
def initialize(result, environment=nil)
|
6
6
|
@result = result
|
7
7
|
@status = result['status']
|
8
8
|
check_status!
|
9
|
-
|
9
|
+
|
10
10
|
@environment = (result['environment'] || environment).try(:downcase).try(:to_sym)
|
11
11
|
raise Ios::Receipt::Exceptions::InvalidConfiguration if @environment.nil?
|
12
12
|
|
@@ -15,7 +15,8 @@ class Ios::Receipt::Result
|
|
15
15
|
@application_version = receipt['application_version']
|
16
16
|
@original_application_version = receipt['original_application_version']
|
17
17
|
|
18
|
-
|
18
|
+
@receipt_style = receipt['original_transaction_id'] ? :ios6 : :ios7
|
19
|
+
if @receipt_style == :ios6
|
19
20
|
latest = result['latest_receipt_info'] || result['latest_expired_receipt_info']
|
20
21
|
@latest = if latest
|
21
22
|
[ Ios::Receipt::Receipt.new(latest) ]
|
@@ -37,15 +38,15 @@ class Ios::Receipt::Result
|
|
37
38
|
def once_off_receipts
|
38
39
|
@once_offs ||= @latest.select { |r| r.once_off? }
|
39
40
|
end
|
40
|
-
|
41
|
+
|
41
42
|
def expired?
|
42
43
|
@status == 21006
|
43
44
|
end
|
44
|
-
|
45
|
+
|
45
46
|
def sandbox?
|
46
47
|
@environment == :sandbox
|
47
48
|
end
|
48
|
-
|
49
|
+
|
49
50
|
def production?
|
50
51
|
@environment == :production
|
51
52
|
end
|
@@ -65,9 +66,9 @@ class Ios::Receipt::Result
|
|
65
66
|
def transaction_ids
|
66
67
|
(@in_app.collect { |r| r.transaction_id } + @latest.collect { |r| r.transaction_id }).flatten.compact.uniq
|
67
68
|
end
|
68
|
-
|
69
|
+
|
69
70
|
protected
|
70
|
-
|
71
|
+
|
71
72
|
def check_status!
|
72
73
|
case @status
|
73
74
|
when 21000 then raise Ios::Receipt::Exceptions::Json
|
@@ -79,4 +80,4 @@ class Ios::Receipt::Result
|
|
79
80
|
when 21008 then raise Ios::Receipt::Exceptions::ProductionReceipt
|
80
81
|
end
|
81
82
|
end
|
82
|
-
end
|
83
|
+
end
|
data/lib/ios/receipt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ios-receipt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DailyBurn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|