itunes_validator 0.4.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 180290e20d6a2e9870ed9ec4a95ae043a67c7245
4
- data.tar.gz: 589cf3b96fcbc5cf5771dfa2ca3402ebc614fa48
3
+ metadata.gz: 8573539341f1a096daee11e179459c6dca29ccee
4
+ data.tar.gz: 288a03b93e04112043db965d05ff8acbc1c31e28
5
5
  SHA512:
6
- metadata.gz: 89c9da7271cf00407765257d39a2b0a05b199b9254380f1da46c14525107e6aa9e2a1ab74f3a9a78c013f522e8ad22cc4191440b85abfe0732e772fb4b5e5f1e
7
- data.tar.gz: 7367d2ff7c302155d80aab29996041e2e3b773bff21aa81656981fa2b410b59b072657b3c68ceb25d2cad8cc14ac17e37029c67615239cb166a21fc31692b4ed
6
+ metadata.gz: f7aff4e13ae9e130fe962f1f6d4a576400bf9cb732afeed770ec0fddfed03dceaf1f436ba358f95018da5503b4ee338f9894d547c95bff8eca37b3d777389435
7
+ data.tar.gz: 4ed39f104237484344a80e3ad7a0f06db51cd1fab19086db84c85003f890418bd4839575f5ea51fe464e84db2291b9b8add91ff689f023bccc9bc5ae33022a99
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # vim: sw=2 et
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rake/testtask'
5
+
6
+ Rake::TestTask.new do |t|
7
+ t.test_files = ['test/coverage.rb'] + FileList['test/test*.rb']
8
+ end
@@ -2,5 +2,5 @@ require_relative 'itunes_validator/client'
2
2
  require_relative 'itunes_validator/receipt'
3
3
 
4
4
  module ItunesValidator
5
- VERSION = '0.4.0'
5
+ VERSION = '0.4.1'
6
6
  end
data/test/coverage.rb ADDED
@@ -0,0 +1,18 @@
1
+ # vim: et sw=2
2
+
3
+ begin
4
+ require 'simplecov'
5
+
6
+ if ENV['COVERALLS_REPO_TOKEN'] || ENV['TRAVIS']
7
+ begin
8
+ require 'coveralls'
9
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
10
+ rescue LoadError
11
+ end
12
+ end
13
+
14
+ SimpleCov.start do
15
+ add_filter '/test/'
16
+ end
17
+ rescue LoadError
18
+ end
@@ -0,0 +1,57 @@
1
+ # vim : et sw=2
2
+
3
+ require 'test/unit'
4
+
5
+ require 'itunes_validator'
6
+
7
+ class TestItunesValidator < Test::Unit::TestCase
8
+ def test_instantiation
9
+ v = ItunesValidator::Client.new
10
+ assert_not_nil(v)
11
+
12
+ v = ItunesValidator::Client.new({foo: 'bar'})
13
+ assert_not_nil(v)
14
+
15
+ v = ItunesValidator::Client.new({shared_secret: 'secret'})
16
+ assert_not_nil(v)
17
+
18
+ v = ItunesValidator::Client.new({proxy_host: '127.0.0.1', proxy_port: 8888})
19
+ assert_not_nil(v)
20
+ end
21
+
22
+ def test_validation
23
+ receipt_data=ENV['RECEIPT_DATA']
24
+ return unless receipt_data
25
+
26
+ v = ItunesValidator::Client.new()
27
+ r = v.validate(receipt_data)
28
+ assert_not_nil(r)
29
+
30
+ proxy = ENV['HTTPS_PROXY'] || ENV['https_proxy'] || ENV['HTTP_PROXY'] || ENV['http_proxy']
31
+ if proxy
32
+ proxy_host, proxy_port = proxy.split(':')
33
+ assert_not_nil(proxy_host)
34
+
35
+ v = ItunesValidator::Client.new({proxy_host: proxy_host, proxy_port: proxy_port})
36
+ r = v.validate(receipt_data)
37
+ assert_not_nil(r)
38
+
39
+ r = ItunesValidator.validate({proxy_host: proxy_host, proxy_port: proxy_port}, receipt_data)
40
+ assert_not_nil(r)
41
+ end
42
+ end
43
+
44
+ def test_invalid_parameters
45
+ assert_raises(ArgumentError) do
46
+ ItunesValidator.validate
47
+ end
48
+
49
+ assert_raises(ItunesValidator::ParameterError) do
50
+ ItunesValidator.validate(nil)
51
+ end
52
+
53
+ assert_raises(ItunesValidator::ParameterError) do
54
+ ItunesValidator.validate({shared_secret: 'secret'}, nil)
55
+ end
56
+ end
57
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itunes_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Talbot
@@ -32,9 +32,12 @@ extra_rdoc_files: []
32
32
  files:
33
33
  - LICENSE
34
34
  - README.md
35
+ - Rakefile
35
36
  - lib/itunes_validator.rb
36
37
  - lib/itunes_validator/client.rb
37
38
  - lib/itunes_validator/receipt.rb
39
+ - test/coverage.rb
40
+ - test/test_itunes_validator.rb
38
41
  homepage: https://github.com/cysp/itunes_validator-ruby
39
42
  licenses:
40
43
  - MPL-2.0