candy_check 0.1.0.pre → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +17 -0
- data/.ruby-version +1 -1
- data/.travis.yml +10 -8
- data/README.md +3 -1
- data/Rakefile +1 -1
- data/candy_check.gemspec +9 -7
- data/lib/candy_check/app_store/receipt_collection.rb +1 -1
- data/lib/candy_check/play_store/subscription.rb +3 -2
- data/lib/candy_check/utils/config.rb +5 -3
- data/lib/candy_check/version.rb +1 -1
- data/spec/app_store/receipt_collection_spec.rb +6 -0
- data/spec/play_store/receipt_spec.rb +1 -1
- data/spec/play_store/subscription_verification_spec.rb +1 -2
- data/spec/play_store/verification_spec.rb +1 -2
- data/spec/spec_helper.rb +2 -0
- metadata +33 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f615841c7e717eea9ef742eda59d4feb24ad652
|
4
|
+
data.tar.gz: 93fd76119eb4bfdaede4f1f1367fd8c7af6f914d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c93b86afaab15e059887f755bfcd1f60cdf0bd981aa2f67dc3b5d96f213686d6430fb22ff872698474a8caf4589cefe79fd1072eab06e8df25c9c36bfb08a9d7
|
7
|
+
data.tar.gz: f323f66ec300dc86e3a6b1a8cab5b6c2dda7f6d5234cc4f6925ef08350fcdf1e9a88b8b611500b17113a716ecdc02e0c88125234a2eca820e0facc9b890a1b7d
|
data/.rubocop.yml
CHANGED
@@ -5,3 +5,20 @@ AllCops:
|
|
5
5
|
- 'vendor/**/*'
|
6
6
|
Style/Documentation:
|
7
7
|
Enabled: false
|
8
|
+
Style/FrozenStringLiteralComment:
|
9
|
+
Enabled: false
|
10
|
+
Style/NumericPredicate:
|
11
|
+
Enabled: false
|
12
|
+
Lint/UnifiedInteger:
|
13
|
+
Enabled: false
|
14
|
+
Style/PercentLiteralDelimiters:
|
15
|
+
PreferredDelimiters:
|
16
|
+
default: ()
|
17
|
+
"%i": ()
|
18
|
+
"%w": ()
|
19
|
+
Metrics/BlockLength:
|
20
|
+
Exclude:
|
21
|
+
- 'spec/**/*'
|
22
|
+
Security/MarshalLoad:
|
23
|
+
Exclude:
|
24
|
+
- 'lib/candy_check/play_store/discovery_repository.rb'
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.4.1
|
data/.travis.yml
CHANGED
@@ -2,18 +2,20 @@ language: ruby
|
|
2
2
|
sudo: false
|
3
3
|
cache: bundler
|
4
4
|
rvm:
|
5
|
-
-
|
6
|
-
-
|
7
|
-
-
|
8
|
-
-
|
9
|
-
-
|
5
|
+
- 2.4.1
|
6
|
+
- 2.3.4
|
7
|
+
- 2.2
|
8
|
+
- 2.1
|
9
|
+
- 2.0
|
10
10
|
- ruby-head
|
11
|
-
-
|
12
|
-
- jruby-20mode
|
13
|
-
- jruby-21mode
|
11
|
+
- jruby-1.7.26
|
14
12
|
- jruby-head
|
13
|
+
env:
|
14
|
+
global:
|
15
|
+
- JRUBY_OPTS="--2.0"
|
15
16
|
matrix:
|
16
17
|
allow_failures:
|
17
18
|
- rvm: ruby-head
|
18
19
|
- rvm: jruby-head
|
19
20
|
fast_finish: true
|
21
|
+
before_install: gem install bundler -v 1.14.6
|
data/README.md
CHANGED
@@ -87,7 +87,9 @@ Please see the class documentation for [`CandyCheck::AppStore::ReceiptCollection
|
|
87
87
|
|
88
88
|
First initialize and **boot** a verifier instance for your application. This loads the API discovery and
|
89
89
|
fetches the needed OAuth access token. When configuring a `cache_file` the discovery is loaded (or dumped) to
|
90
|
-
this file
|
90
|
+
this file.
|
91
|
+
|
92
|
+
> **Remarks:** Both `application_name` and `application_version` represent *your* application against Google's APIs. You may use any values here, but I suggest to refelect the name of the used service account here.
|
91
93
|
|
92
94
|
```ruby
|
93
95
|
config = CandyCheck::PlayStore::Config.new(
|
data/Rakefile
CHANGED
data/candy_check.gemspec
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
|
2
3
|
lib = File.expand_path('../lib', __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'candy_check/version'
|
@@ -23,12 +24,13 @@ Gem::Specification.new do |spec|
|
|
23
24
|
spec.add_dependency 'google-api-client', '~> 0.8.6'
|
24
25
|
spec.add_dependency 'thor', '~> 0.19'
|
25
26
|
|
26
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
27
|
-
spec.add_development_dependency 'inch', '~> 0.
|
28
|
-
spec.add_development_dependency 'bundler', '~> 1.
|
29
|
-
spec.add_development_dependency 'rake', '~>
|
27
|
+
spec.add_development_dependency 'rubocop', '~> 0.48'
|
28
|
+
spec.add_development_dependency 'inch', '~> 0.7'
|
29
|
+
spec.add_development_dependency 'bundler', '~> 1.14'
|
30
|
+
spec.add_development_dependency 'rake', '~> 12.0'
|
30
31
|
spec.add_development_dependency 'coveralls', '~> 0.8'
|
31
|
-
spec.add_development_dependency 'minitest', '~> 5.
|
32
|
-
spec.add_development_dependency 'minitest-around', '~> 0.
|
33
|
-
spec.add_development_dependency 'webmock', '~>
|
32
|
+
spec.add_development_dependency 'minitest', '~> 5.10'
|
33
|
+
spec.add_development_dependency 'minitest-around', '~> 0.4'
|
34
|
+
spec.add_development_dependency 'webmock', '~> 3.0'
|
35
|
+
spec.add_development_dependency 'timecop', '~> 0.8'
|
34
36
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module CandyCheck
|
2
2
|
module PlayStore
|
3
|
-
# Describes a
|
3
|
+
# Describes a successfully validated subscription
|
4
4
|
class Subscription
|
5
5
|
include Utils::AttributeReader
|
6
6
|
|
@@ -80,7 +80,8 @@ module CandyCheck
|
|
80
80
|
read_integer('paymentState')
|
81
81
|
end
|
82
82
|
|
83
|
-
# Get the price amount for the subscription in micros in the
|
83
|
+
# Get the price amount for the subscription in micros in the payed
|
84
|
+
# currency
|
84
85
|
# @return [Integer]
|
85
86
|
def price_amount_micros
|
86
87
|
read_integer('priceAmountMicros')
|
@@ -5,9 +5,11 @@ module CandyCheck
|
|
5
5
|
# Initializes a new configuration from a hash
|
6
6
|
# @param attributes [Hash]
|
7
7
|
def initialize(attributes)
|
8
|
-
attributes.
|
9
|
-
|
10
|
-
|
8
|
+
if attributes.is_a?(Hash)
|
9
|
+
attributes.each do |k, v|
|
10
|
+
instance_variable_set "@#{k}", v
|
11
|
+
end
|
12
|
+
end
|
11
13
|
validate!
|
12
14
|
end
|
13
15
|
|
data/lib/candy_check/version.rb
CHANGED
@@ -34,6 +34,12 @@ describe CandyCheck::AppStore::ReceiptCollection do
|
|
34
34
|
expected = DateTime.new(2015, 4, 15, 12, 52, 40)
|
35
35
|
subject.expires_at.must_equal expected
|
36
36
|
end
|
37
|
+
|
38
|
+
it 'is expired? at same pointin time' do
|
39
|
+
Timecop.freeze(Time.utc(2015, 4, 15, 12, 52, 40)) do
|
40
|
+
subject.expired?.must_be_true
|
41
|
+
end
|
42
|
+
end
|
37
43
|
end
|
38
44
|
|
39
45
|
describe 'unexpired trial subscription' do
|
@@ -85,8 +85,7 @@ describe CandyCheck::PlayStore::SubscriptionVerification do
|
|
85
85
|
DummyGoogleSubsClient = Struct.new(:response) do
|
86
86
|
attr_reader :package, :product_id, :token
|
87
87
|
|
88
|
-
def boot
|
89
|
-
end
|
88
|
+
def boot!; end
|
90
89
|
|
91
90
|
def verify_subscription(package, product_id, token)
|
92
91
|
@package = package
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: candy_check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Thiel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -58,56 +58,56 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
61
|
+
version: '0.48'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0.
|
68
|
+
version: '0.48'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: inch
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0.
|
75
|
+
version: '0.7'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0.
|
82
|
+
version: '0.7'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: bundler
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '1.
|
89
|
+
version: '1.14'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '1.
|
96
|
+
version: '1.14'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '12.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '12.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: coveralls
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,42 +128,56 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '5.
|
131
|
+
version: '5.10'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '5.
|
138
|
+
version: '5.10'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: minitest-around
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '0.
|
145
|
+
version: '0.4'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '0.
|
152
|
+
version: '0.4'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: webmock
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
159
|
+
version: '3.0'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: '
|
166
|
+
version: '3.0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: timecop
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0.8'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0.8'
|
167
181
|
description:
|
168
182
|
email:
|
169
183
|
- jonas@thiel.io
|
@@ -265,12 +279,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
265
279
|
version: '2.0'
|
266
280
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
267
281
|
requirements:
|
268
|
-
- - "
|
282
|
+
- - ">="
|
269
283
|
- !ruby/object:Gem::Version
|
270
|
-
version:
|
284
|
+
version: '0'
|
271
285
|
requirements: []
|
272
286
|
rubyforge_project:
|
273
|
-
rubygems_version: 2.
|
287
|
+
rubygems_version: 2.6.11
|
274
288
|
signing_key:
|
275
289
|
specification_version: 4
|
276
290
|
summary: Check and verify in-app receipts
|