venice 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,41 +1,38 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Venice::PendingRenewalInfo do
4
-
5
- describe ".new" do
6
-
7
- let(:attributes) {
8
- {
9
- "auto_renew_product_id"=>"com.foo.product1",
10
- "original_transaction_id"=>"37xxxxxxxxx89",
11
- "product_id"=>"com.foo.product1",
12
- "auto_renew_status"=>"0",
13
- "is_in_billing_retry_period"=>"0",
14
- "expiration_intent"=>"1"
4
+ describe '.new' do
5
+ let(:attributes) do
6
+ {
7
+ 'auto_renew_product_id' => 'com.foo.product1',
8
+ 'original_transaction_id' => '37xxxxxxxxx89',
9
+ 'product_id' => 'com.foo.product1',
10
+ 'auto_renew_status' => '0',
11
+ 'is_in_billing_retry_period' => '0',
12
+ 'expiration_intent' => '1'
15
13
  }
16
- }
14
+ end
17
15
 
18
16
  subject(:pending_info) do
19
17
  described_class.new(attributes)
20
18
  end
21
19
 
22
- it "parses the attributes correctly" do
20
+ it 'parses the attributes correctly' do
23
21
  expect(subject.expiration_intent).to eql(1)
24
22
  expect(subject.auto_renew_status).to eql(0)
25
- expect(subject.auto_renew_product_id).to eql("com.foo.product1")
23
+ expect(subject.auto_renew_product_id).to eql('com.foo.product1')
26
24
  expect(subject.is_in_billing_retry_period).to eql(false)
27
- expect(subject.product_id).to eql("com.foo.product1")
25
+ expect(subject.product_id).to eql('com.foo.product1')
28
26
  end
29
27
 
30
- it "outputs attributes in hash" do
31
- expect(subject.to_hash).to eql({ :expiration_intent => 1,
32
- :auto_renew_status => 0,
33
- :auto_renew_product_id => "com.foo.product1",
34
- :is_in_billing_retry_period => false,
35
- :product_id => "com.foo.product1",
36
- :price_consent_status => nil,
37
- :cancellation_reason => nil
38
- })
28
+ it 'outputs attributes in hash' do
29
+ expect(subject.to_hash).to eql(expiration_intent: 1,
30
+ auto_renew_status: 0,
31
+ auto_renew_product_id: 'com.foo.product1',
32
+ is_in_billing_retry_period: false,
33
+ product_id: 'com.foo.product1',
34
+ price_consent_status: nil,
35
+ cancellation_reason: nil)
39
36
  end
40
37
  end
41
38
  end
data/spec/receipt_spec.rb CHANGED
@@ -1,50 +1,50 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Venice::Receipt do
4
- describe "parsing the response" do
4
+ describe 'parsing the response' do
5
5
  let(:response) do
6
6
  {
7
- "status" => 0,
8
- "environment" => "Production",
9
- "receipt" => {
10
- "receipt_type" => "Production",
11
- "adam_id" => 7654321,
12
- "bundle_id" => "com.foo.bar",
13
- "application_version" => "2",
14
- "download_id" => 1234567,
15
- "request_date" => "2014-06-04 23:20:47 Etc/GMT",
16
- "request_date_ms" => "1401924047883",
17
- "request_date_pst" => "2014-06-04 16:20:47 America/Los_Angeles",
18
- "original_purchase_date" => "2014-05-17 02:09:45 Etc/GMT",
19
- "original_purchase_date_ms" => "1400292585000",
20
- "original_purchase_date_pst" => "2014-05-16 19:09:45 America/Los_Angeles",
21
- "original_application_version" => "1",
22
- "expiration_date" => "1401924047883",
23
- "in_app" => [
7
+ 'status' => 0,
8
+ 'environment' => 'Production',
9
+ 'receipt' => {
10
+ 'receipt_type' => 'Production',
11
+ 'adam_id' => 7654321,
12
+ 'bundle_id' => 'com.foo.bar',
13
+ 'application_version' => '2',
14
+ 'download_id' => 1234567,
15
+ 'request_date' => '2014-06-04 23:20:47 Etc/GMT',
16
+ 'request_date_ms' => '1401924047883',
17
+ 'request_date_pst' => '2014-06-04 16:20:47 America/Los_Angeles',
18
+ 'original_purchase_date' => '2014-05-17 02:09:45 Etc/GMT',
19
+ 'original_purchase_date_ms' => '1400292585000',
20
+ 'original_purchase_date_pst' => '2014-05-16 19:09:45 America/Los_Angeles',
21
+ 'original_application_version' => '1',
22
+ 'expiration_date' => '1401924047883',
23
+ 'in_app' => [
24
24
  {
25
- "quantity" => "1",
26
- "product_id" => "com.foo.product1",
27
- "transaction_id" => "1000000070107111",
28
- "original_transaction_id" => "1000000061051111",
29
- "purchase_date" => "2014-05-28 14:47:53 Etc/GMT",
30
- "purchase_date_ms" => "1401288473000",
31
- "purchase_date_pst" => "2014-05-28 07:47:53 America/Los_Angeles",
32
- "original_purchase_date" => "2014-05-28 14:47:53 Etc/GMT",
33
- "original_purchase_date_ms" => "1401288473000",
34
- "original_purchase_date_pst" => "2014-05-28 07:47:53 America/Los_Angeles",
35
- "expires_date" => "2014-06-28 14:47:53 Etc/GMT",
36
- "is_trial_period" => "false"
25
+ 'quantity' => '1',
26
+ 'product_id' => 'com.foo.product1',
27
+ 'transaction_id' => '1000000070107111',
28
+ 'original_transaction_id' => '1000000061051111',
29
+ 'purchase_date' => '2014-05-28 14:47:53 Etc/GMT',
30
+ 'purchase_date_ms' => '1401288473000',
31
+ 'purchase_date_pst' => '2014-05-28 07:47:53 America/Los_Angeles',
32
+ 'original_purchase_date' => '2014-05-28 14:47:53 Etc/GMT',
33
+ 'original_purchase_date_ms' => '1401288473000',
34
+ 'original_purchase_date_pst' => '2014-05-28 07:47:53 America/Los_Angeles',
35
+ 'expires_date' => '2014-06-28 14:47:53 Etc/GMT',
36
+ 'is_trial_period' => 'false'
37
37
  }
38
38
  ],
39
- "original_json_response" => {
40
- "pending_renewal_info" => [
39
+ 'original_json_response' => {
40
+ 'pending_renewal_info' => [
41
41
  {
42
- "auto_renew_product_id"=>"com.foo.product1",
43
- "original_transaction_id"=>"37xxxxxxxxx89",
44
- "product_id"=>"com.foo.product1",
45
- "auto_renew_status"=>"0",
46
- "is_in_billing_retry_period"=>"0",
47
- "expiration_intent"=>"1"
42
+ 'auto_renew_product_id' => 'com.foo.product1',
43
+ 'original_transaction_id' => '37xxxxxxxxx89',
44
+ 'product_id' => 'com.foo.product1',
45
+ 'auto_renew_status' => '0',
46
+ 'is_in_billing_retry_period' => '0',
47
+ 'expiration_intent' => '1'
48
48
  }
49
49
  ]
50
50
  }
@@ -54,40 +54,37 @@ describe Venice::Receipt do
54
54
 
55
55
  subject { Venice::Receipt.new(response['receipt']) }
56
56
 
57
- its(:bundle_id) { "com.foo.bar" }
58
- its(:application_version) { "2" }
57
+ its(:bundle_id) { 'com.foo.bar' }
58
+ its(:application_version) { '2' }
59
59
  its(:in_app) { should be_instance_of Array }
60
- its(:original_application_version) { "1" }
60
+ its(:original_application_version) { '1' }
61
61
  its(:original_purchase_date) { should be_instance_of DateTime }
62
62
  its(:expires_at) { should be_instance_of DateTime }
63
- its(:receipt_type) { "Production" }
63
+ its(:receipt_type) { 'Production' }
64
64
  its(:adam_id) { 7654321 }
65
65
  its(:download_id) { 1234567 }
66
66
  its(:requested_at) { should be_instance_of DateTime }
67
67
 
68
- describe "#verify!" do
69
-
68
+ describe '#verify!' do
70
69
  before do
71
70
  Venice::Client.any_instance.stub(:json_response_from_verifying_data).and_return(response)
72
71
  end
73
72
 
74
- let(:receipt) { Venice::Receipt.verify("asdf") }
73
+ let(:receipt) { Venice::Receipt.verify('asdf') }
75
74
 
76
- it "should create the receipt" do
75
+ it 'should create the receipt' do
77
76
  receipt.should_not be_nil
78
77
  end
79
78
  end
80
79
 
81
- it "parses the pending rerenewal information" do
82
- expect(subject.to_hash[:pending_renewal_info]).to eql([{ :expiration_intent => 1,
83
- :auto_renew_status => 0,
84
- :auto_renew_product_id=>"com.foo.product1",
85
- :is_in_billing_retry_period=>false,
86
- :product_id=>"com.foo.product1",
87
- :price_consent_status=>nil,
88
- :cancellation_reason=>nil
89
- }])
80
+ it 'parses the pending rerenewal information' do
81
+ expect(subject.to_hash[:pending_renewal_info]).to eql([{ expiration_intent: 1,
82
+ auto_renew_status: 0,
83
+ auto_renew_product_id: 'com.foo.product1',
84
+ is_in_billing_retry_period: false,
85
+ product_id: 'com.foo.product1',
86
+ price_consent_status: nil,
87
+ cancellation_reason: nil }])
90
88
  end
91
-
92
89
  end
93
90
  end
data/spec/spec_helper.rb CHANGED
@@ -12,9 +12,7 @@ require 'rspec'
12
12
  require 'rspec/its'
13
13
 
14
14
  RSpec.configure do |config|
15
-
16
15
  config.mock_with :rspec do |mocks|
17
16
  mocks.yield_receiver_to_any_instance_implementation_blocks = false
18
17
  end
19
-
20
18
  end
data/venice.gemspec CHANGED
@@ -3,27 +3,27 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
  require "venice/version"
4
4
 
5
5
  Gem::Specification.new do |s|
6
- s.name = "venice"
7
- s.authors = ["Mattt Thompson"]
8
- s.email = "m@mattt.me"
9
- s.license = "MIT"
10
- s.homepage = "http://nomad-cli.com"
6
+ s.name = 'venice'
7
+ s.authors = ['Mattt Thompson']
8
+ s.email = 'm@mattt.me'
9
+ s.license = 'MIT'
10
+ s.homepage = 'http://nomad-cli.com'
11
11
  s.version = Venice::VERSION
12
12
  s.platform = Gem::Platform::RUBY
13
- s.summary = "iTunes In-App Purchase Receipt Verification"
14
- s.description = ""
13
+ s.summary = 'iTunes In-App Purchase Receipt Verification'
14
+ s.description = 'Ruby Gem for In-App Purchase Receipt Verification'
15
15
 
16
- s.add_dependency "json"
17
- s.add_dependency "commander", "~> 4.1"
18
- s.add_dependency "terminal-table", "~> 1.4"
16
+ s.add_dependency 'commander', '~> 4.1'
17
+ s.add_dependency 'json'
18
+ s.add_dependency 'terminal-table', '~> 1.4'
19
19
 
20
- s.add_development_dependency "rspec", "~> 3.6"
21
- s.add_development_dependency "rspec-its", "~> 1.2"
22
- s.add_development_dependency "rake"
23
- s.add_development_dependency "simplecov"
20
+ s.add_development_dependency 'rake'
21
+ s.add_development_dependency 'rspec', '~> 3.6'
22
+ s.add_development_dependency 'rspec-its', '~> 1.2'
23
+ s.add_development_dependency 'simplecov'
24
24
 
25
- s.files = Dir["./**/*"].reject { |file| file =~ /\.\/(bin|log|pkg|script|spec|test|vendor)/ }
25
+ s.files = Dir['./**/*'].reject { |file| file =~ /\.\/(bin|log|pkg|script|spec|test|vendor)/ }
26
26
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
27
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
28
- s.require_paths = ["lib"]
27
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
28
+ s.require_paths = ['lib']
29
29
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: venice
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
  - Mattt Thompson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-11 00:00:00.000000000 Z
11
+ date: 2017-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: json
14
+ name: commander
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '4.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '4.1'
27
27
  - !ruby/object:Gem::Dependency
28
- name: commander
28
+ name: json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '4.1'
33
+ version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '4.1'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: terminal-table
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,47 +53,47 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.4'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rspec
56
+ name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '3.6'
61
+ version: '0'
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: '3.6'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rspec-its
70
+ name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.2'
75
+ version: '3.6'
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: '1.2'
82
+ version: '3.6'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rake
84
+ name: rspec-its
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: '1.2'
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: '0'
96
+ version: '1.2'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: simplecov
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -108,7 +108,7 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
- description: ''
111
+ description: Ruby Gem for In-App Purchase Receipt Verification
112
112
  email: m@mattt.me
113
113
  executables:
114
114
  - iap