venice 0.4.3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -4
- data/README.md +1 -0
- data/coverage/assets/0.10.2/application.css +799 -0
- data/coverage/assets/0.10.2/application.js +1707 -0
- data/coverage/assets/0.10.2/colorbox/border.png +0 -0
- data/coverage/assets/0.10.2/colorbox/controls.png +0 -0
- data/coverage/assets/0.10.2/colorbox/loading.gif +0 -0
- data/coverage/assets/0.10.2/colorbox/loading_background.png +0 -0
- data/coverage/assets/0.10.2/favicon_green.png +0 -0
- data/coverage/assets/0.10.2/favicon_red.png +0 -0
- data/coverage/assets/0.10.2/favicon_yellow.png +0 -0
- data/coverage/assets/0.10.2/loading.gif +0 -0
- data/coverage/assets/0.10.2/magnify.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/coverage/index.html +2988 -0
- data/lib/venice/client.rb +8 -4
- data/lib/venice/in_app_receipt.rb +5 -3
- data/lib/venice/version.rb +1 -1
- data/spec/client_spec.rb +1 -1
- data/spec/in_app_receipt_spec.rb +5 -3
- data/venice.gemspec +2 -3
- metadata +28 -3
data/lib/venice/client.rb
CHANGED
@@ -49,10 +49,14 @@ module Venice
|
|
49
49
|
latest_receipt_info_attributes = [latest_receipt_info_attributes] if latest_receipt_info_attributes.is_a?(Hash)
|
50
50
|
|
51
51
|
# AppStore returns 'latest_receipt_info' even if we use over iOS 6. Besides, its format is an Array.
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
52
|
+
if latest_receipt_info_attributes.is_a?(Array)
|
53
|
+
receipt.latest_receipt_info = []
|
54
|
+
latest_receipt_info_attributes.each do |latest_receipt_info_attribute|
|
55
|
+
# latest_receipt_info format is identical with in_app
|
56
|
+
receipt.latest_receipt_info << InAppReceipt.new(latest_receipt_info_attribute)
|
57
|
+
end
|
58
|
+
else
|
59
|
+
receipt.latest_receipt_info = latest_receipt_info_attributes
|
56
60
|
end
|
57
61
|
end
|
58
62
|
|
@@ -54,10 +54,11 @@ module Venice
|
|
54
54
|
@purchased_at = DateTime.parse(attributes['purchase_date']) if attributes['purchase_date']
|
55
55
|
@app_item_id = attributes['app_item_id']
|
56
56
|
@version_external_identifier = attributes['version_external_identifier']
|
57
|
+
@is_trial_period = attributes['is_trial_period'].to_s == 'true'
|
57
58
|
|
58
59
|
# expires_date is in ms since the Epoch, Time.at expects seconds
|
59
60
|
if attributes['expires_date_ms']
|
60
|
-
@expires_at = Time.at(attributes['expires_date_ms'].to_i / 1000)
|
61
|
+
@expires_at = Time.at(attributes['expires_date_ms'].to_i / 1000)
|
61
62
|
elsif attributes['expires_date'] && is_number?(attributes['expires_date'])
|
62
63
|
@expires_at = Time.at(attributes['expires_date'].to_i / 1000)
|
63
64
|
end
|
@@ -86,6 +87,7 @@ module Venice
|
|
86
87
|
original_purchase_date: (@original.purchased_at.httpdate rescue nil),
|
87
88
|
app_item_id: @app_item_id,
|
88
89
|
version_external_identifier: @version_external_identifier,
|
90
|
+
is_trial_period: @is_trial_period,
|
89
91
|
expires_at: (@expires_at.httpdate rescue nil),
|
90
92
|
cancellation_at: (@cancellation_at.httpdate rescue nil)
|
91
93
|
}
|
@@ -95,9 +97,9 @@ module Venice
|
|
95
97
|
def to_json
|
96
98
|
to_hash.to_json
|
97
99
|
end
|
98
|
-
|
100
|
+
|
99
101
|
private
|
100
|
-
|
102
|
+
|
101
103
|
def is_number?(string)
|
102
104
|
!!(string && string.to_s =~ /^[0-9]+$/)
|
103
105
|
end
|
data/lib/venice/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -109,7 +109,7 @@ describe Venice::Client do
|
|
109
109
|
receipt.latest_receipt_info.should_not be_nil
|
110
110
|
receipt.latest_receipt_info.first.product_id.should eq 'com.ficklebits.nsscreencast.monthly_sub'
|
111
111
|
end
|
112
|
-
|
112
|
+
|
113
113
|
context 'when latest_receipt_info is a hash instead of an array' do
|
114
114
|
it 'should still create a latest receipt' do
|
115
115
|
response['latest_receipt_info'] = response['latest_receipt_info'].first
|
data/spec/in_app_receipt_spec.rb
CHANGED
@@ -15,7 +15,7 @@ describe Venice::InAppReceipt do
|
|
15
15
|
'original_purchase_date' => '2014-05-28 14:47:53 Etc/GMT',
|
16
16
|
'original_purchase_date_ms' => '1401288473000',
|
17
17
|
'original_purchase_date_pst' => '2014-05-28 07:47:53 America/Los_Angeles',
|
18
|
-
'is_trial_period' => false,
|
18
|
+
'is_trial_period' => 'false',
|
19
19
|
'version_external_identifier' => '123',
|
20
20
|
'app_item_id' => 'com.foo.app1',
|
21
21
|
'expires_date' => '2014-06-28 07:47:53 America/Los_Angeles',
|
@@ -34,6 +34,7 @@ describe Venice::InAppReceipt do
|
|
34
34
|
its(:purchased_at) { should be_instance_of DateTime }
|
35
35
|
its(:app_item_id) { 'com.foo.app1' }
|
36
36
|
its(:version_external_identifier) { '123' }
|
37
|
+
its(:is_trial_period) { false }
|
37
38
|
its(:original) { should be_instance_of Venice::InAppReceipt }
|
38
39
|
its(:expires_at) { should be_instance_of Time }
|
39
40
|
|
@@ -42,8 +43,8 @@ describe Venice::InAppReceipt do
|
|
42
43
|
subject.original.transaction_id.should == '140xxx867509'
|
43
44
|
subject.original.purchased_at.should be_instance_of DateTime
|
44
45
|
end
|
45
|
-
|
46
|
-
it
|
46
|
+
|
47
|
+
it 'should parse expires_date when expires_date_ms is missing and expires_date is the ms epoch' do
|
47
48
|
attributes.delete('expires_date_ms')
|
48
49
|
attributes['expires_date'] = '1403941685000'
|
49
50
|
in_app_receipt.expires_at.should eq Time.at(1403941685000 / 1000)
|
@@ -54,6 +55,7 @@ describe Venice::InAppReceipt do
|
|
54
55
|
product_id: 'com.foo.product1',
|
55
56
|
transaction_id: '1000000070107235',
|
56
57
|
web_order_line_item_id: '1000000026812043',
|
58
|
+
is_trial_period: false,
|
57
59
|
purchase_date: 'Wed, 28 May 2014 14:47:53 GMT',
|
58
60
|
original_purchase_date: 'Wed, 28 May 2014 14:47:53 GMT')
|
59
61
|
end
|
data/venice.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: venice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mattt Thompson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -120,6 +120,31 @@ files:
|
|
120
120
|
- "./LICENSE"
|
121
121
|
- "./README.md"
|
122
122
|
- "./Rakefile"
|
123
|
+
- "./coverage/assets/0.10.2/application.css"
|
124
|
+
- "./coverage/assets/0.10.2/application.js"
|
125
|
+
- "./coverage/assets/0.10.2/colorbox/border.png"
|
126
|
+
- "./coverage/assets/0.10.2/colorbox/controls.png"
|
127
|
+
- "./coverage/assets/0.10.2/colorbox/loading.gif"
|
128
|
+
- "./coverage/assets/0.10.2/colorbox/loading_background.png"
|
129
|
+
- "./coverage/assets/0.10.2/favicon_green.png"
|
130
|
+
- "./coverage/assets/0.10.2/favicon_red.png"
|
131
|
+
- "./coverage/assets/0.10.2/favicon_yellow.png"
|
132
|
+
- "./coverage/assets/0.10.2/loading.gif"
|
133
|
+
- "./coverage/assets/0.10.2/magnify.png"
|
134
|
+
- "./coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png"
|
135
|
+
- "./coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png"
|
136
|
+
- "./coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png"
|
137
|
+
- "./coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png"
|
138
|
+
- "./coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png"
|
139
|
+
- "./coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png"
|
140
|
+
- "./coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png"
|
141
|
+
- "./coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png"
|
142
|
+
- "./coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png"
|
143
|
+
- "./coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png"
|
144
|
+
- "./coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png"
|
145
|
+
- "./coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png"
|
146
|
+
- "./coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png"
|
147
|
+
- "./coverage/index.html"
|
123
148
|
- "./lib/venice.rb"
|
124
149
|
- "./lib/venice/client.rb"
|
125
150
|
- "./lib/venice/in_app_receipt.rb"
|
@@ -154,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
179
|
version: '0'
|
155
180
|
requirements: []
|
156
181
|
rubyforge_project:
|
157
|
-
rubygems_version: 2.7.
|
182
|
+
rubygems_version: 2.7.6
|
158
183
|
signing_key:
|
159
184
|
specification_version: 4
|
160
185
|
summary: iTunes In-App Purchase Receipt Verification
|