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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45e40e19795d3d805ea61453fe6bea1d5e94ec3a
4
- data.tar.gz: 9ba798923e9c36b324aa93c860f6ea75687e56bc
3
+ metadata.gz: 6f615841c7e717eea9ef742eda59d4feb24ad652
4
+ data.tar.gz: 93fd76119eb4bfdaede4f1f1367fd8c7af6f914d
5
5
  SHA512:
6
- metadata.gz: f6e4a4bd35ab65c5ad309052f8b27408b3bd570701a39674f9b6120900242ebe2199bf5814788a8fa9572774a8686cc3b57908eeda35223a5c7786b4e921181e
7
- data.tar.gz: 8f3e4cd0adff6af8067667294fb439e05a840e69c9b24d73c0af0a607d348d4a8ffcbe3392e469fd2fab36e26155241739936ae91a8c1509f32595f7a1bf299d
6
+ metadata.gz: c93b86afaab15e059887f755bfcd1f60cdf0bd981aa2f67dc3b5d96f213686d6430fb22ff872698474a8caf4589cefe79fd1072eab06e8df25c9c36bfb08a9d7
7
+ data.tar.gz: f323f66ec300dc86e3a6b1a8cab5b6c2dda7f6d5234cc4f6925ef08350fcdf1e9a88b8b611500b17113a716ecdc02e0c88125234a2eca820e0facc9b890a1b7d
@@ -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'
@@ -1 +1 @@
1
- 2.3.1
1
+ 2.4.1
@@ -2,18 +2,20 @@ language: ruby
2
2
  sudo: false
3
3
  cache: bundler
4
4
  rvm:
5
- - '2.3.1'
6
- - '2.3.0'
7
- - '2.2'
8
- - '2.1'
9
- - '2.0'
5
+ - 2.4.1
6
+ - 2.3.4
7
+ - 2.2
8
+ - 2.1
9
+ - 2.0
10
10
  - ruby-head
11
- - rbx-2
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
@@ -12,4 +12,4 @@ end
12
12
 
13
13
  RuboCop::RakeTask.new
14
14
 
15
- task default: [:spec, :rubocop]
15
+ task default: %i(spec rubocop)
@@ -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.39'
27
- spec.add_development_dependency 'inch', '~> 0.5'
28
- spec.add_development_dependency 'bundler', '~> 1.7'
29
- spec.add_development_dependency 'rake', '~> 11.1'
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.9'
32
- spec.add_development_dependency 'minitest-around', '~> 0.3'
33
- spec.add_development_dependency 'webmock', '~> 2.1'
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
@@ -16,7 +16,7 @@ module CandyCheck
16
16
  # Check if the latest expiration date is passed
17
17
  # @return [bool]
18
18
  def expired?
19
- overdue_days > 0
19
+ expires_at.to_time <= Time.now.utc
20
20
  end
21
21
 
22
22
  # Check if in trial
@@ -1,6 +1,6 @@
1
1
  module CandyCheck
2
2
  module PlayStore
3
- # Describes a succeful subscription validation
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 payd currency
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.each do |k, v|
9
- instance_variable_set "@#{k}", v
10
- end if attributes.is_a? Hash
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
 
@@ -1,4 +1,4 @@
1
1
  module CandyCheck
2
2
  # The current gem's version
3
- VERSION = '0.1.0.pre'.freeze
3
+ VERSION = '0.1.1'.freeze
4
4
  end
@@ -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
@@ -45,7 +45,7 @@ describe CandyCheck::PlayStore::Receipt do
45
45
  end
46
46
 
47
47
  it 'returns the purchased_at' do
48
- expected = DateTime.new(2015, 1, 19, 14, 03, 57)
48
+ expected = DateTime.new(2015, 1, 19, 14, 3, 57)
49
49
  subject.purchased_at.must_equal expected
50
50
  end
51
51
  end
@@ -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
@@ -69,8 +69,7 @@ describe CandyCheck::PlayStore::Verification do
69
69
  DummyGoogleClient = Struct.new(:response) do
70
70
  attr_reader :package, :product_id, :token
71
71
 
72
- def boot!
73
- end
72
+ def boot!; end
74
73
 
75
74
  def verify(package, product_id, token)
76
75
  @package = package
@@ -9,6 +9,8 @@ require 'minitest/around/spec'
9
9
 
10
10
  require 'webmock/minitest'
11
11
 
12
+ require 'timecop'
13
+
12
14
  require_relative 'support/with_fixtures'
13
15
  require_relative 'support/with_temp_file'
14
16
  require_relative 'support/with_command'
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.0.pre
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: 2016-10-25 00:00:00.000000000 Z
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.39'
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.39'
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.5'
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.5'
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.7'
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.7'
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: '11.1'
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: '11.1'
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.9'
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.9'
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.3'
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.3'
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: '2.1'
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: '2.1'
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: 1.3.1
284
+ version: '0'
271
285
  requirements: []
272
286
  rubyforge_project:
273
- rubygems_version: 2.5.1
287
+ rubygems_version: 2.6.11
274
288
  signing_key:
275
289
  specification_version: 4
276
290
  summary: Check and verify in-app receipts