itunes-receipt 1.0.0 → 1.1.0

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: 3af833612e81aae09bc91540df286864a5e0d7d3
4
- data.tar.gz: 9a07a02fbb0e1101b3c453b71f4018c0b806267a
3
+ metadata.gz: bc3d7ea5531a43dbc251cb822ac01d79ab2f35d8
4
+ data.tar.gz: c3a3d7f9e9292a594d94ba36eef344aa57f581b2
5
5
  SHA512:
6
- metadata.gz: 567db980094f5d71a613c56762fca1a4fe4a4c2c830bb807679f083db3d37f9d1d1e387ce78ce6891359908fd5ec8acd2bf3900b97998ea4f5c15feffdc08c98
7
- data.tar.gz: 5f72d4ff38935184560f9fb079acfe6a5639c09471bf5a09a15f26f81291a65292e36e4a556d334c5f3115de79c1068cf22ff8dff22c3a82b4017efae7dae3f5
6
+ metadata.gz: b2c52a5448eac9676110e37c6cb108dd96abecf651b063393dcf114c6f73ad96ae59207df61b003f6758e1253d2658bc79a5abf5ed248e91632a9761c09e739c
7
+ data.tar.gz: 68baa2124d7dceb1e5837cc2f87934fb8d39d976ac8a98cb2fc85ab19f682c7443a7ba0be1f267302b3c314eeb3aae60c0ffed3a8faa4381d0703a9b9c17d922
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ namespace :coverage do
8
8
  desc "Open coverage report"
9
9
  task :report do
10
10
  require 'simplecov'
11
- `open "#{File.join SimpleCov.coverage_path, 'index.html' }"`
11
+ `open "#{File.join SimpleCov.coverage_path, 'index.html'}"`
12
12
  end
13
13
  end
14
14
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.1.0
@@ -1,5 +1,5 @@
1
1
  require 'json'
2
- require 'active_support/core_ext'
2
+ require 'active_support/all'
3
3
  require 'restclient_with_cert'
4
4
 
5
5
  module Itunes
@@ -68,13 +68,21 @@ module Itunes
68
68
  receipt_attributes[:is_trial_period]
69
69
  end
70
70
  @itunes_env = attributes[:itunes_env] || Itunes.itunes_env
71
- @latest = if attributes[:latest_receipt_info]
72
- full_receipt_data = attributes[:latest_receipt]
71
+ @latest = case attributes[:latest_receipt_info]
72
+ when Hash
73
73
  self.class.new(
74
74
  :receipt => attributes[:latest_receipt_info],
75
- :latest_receipt => full_receipt_data,
75
+ :latest_receipt => attributes[:latest_receipt],
76
76
  :receipt_type => :latest
77
77
  )
78
+ when Array
79
+ attributes[:latest_receipt_info].collect do |latest_receipt_info|
80
+ self.class.new(
81
+ :receipt => latest_receipt_info,
82
+ :latest_receipt => attributes[:latest_receipt],
83
+ :receipt_type => :latest
84
+ )
85
+ end
78
86
  end
79
87
  @original = if receipt_attributes[:original_transaction_id] || receipt_attributes[:original_purchase_date]
80
88
  self.class.new(:receipt => {
@@ -114,21 +122,6 @@ module Itunes
114
122
  @version_external_identifier = receipt_attributes[:version_external_identifier]
115
123
  end
116
124
 
117
- def as_json
118
- {
119
- :quantity => @quantity,
120
- :product_id => @product_id,
121
- :transaction_id => @transaction_id,
122
- :purchase_date => @purchase_date,
123
- :original_transaction_id => @original.try(:transaction_id),
124
- :original_purchase_date => @original.try(:purchase_date),
125
- :is_trial_period => @is_trial_period
126
- }.tap do |hash|
127
- hash[:application_version] = @application_version if @application_version.present?
128
- hash[:bundle_id] = @bundle_id if @bundle_id.present?
129
- end
130
- end
131
-
132
125
  def application_receipt?
133
126
  !@bundle_id.nil?
134
127
  end
@@ -75,7 +75,7 @@ describe Itunes::Receipt do
75
75
 
76
76
  it 'should not be an application receipt' do
77
77
  receipt = Itunes::Receipt.verify! 'valid_application'
78
- receipt.application_receipt?.should be_false
78
+ receipt.application_receipt?.should == false
79
79
  end
80
80
 
81
81
  it 'should return valid Receipt instance' do
@@ -107,7 +107,7 @@ describe Itunes::Receipt do
107
107
 
108
108
  it 'should be an application receipt' do
109
109
  receipt = Itunes::Receipt.verify! 'valid_application'
110
- receipt.application_receipt?.should be_true
110
+ receipt.application_receipt?.should == true
111
111
  end
112
112
 
113
113
  it 'should return valid Receipt instance' do
@@ -9,12 +9,12 @@ describe Itunes do
9
9
 
10
10
  context 'sandbox' do
11
11
  it 'should be production by default' do
12
- Itunes.sandbox?.should be_false
12
+ Itunes.sandbox?.should == false
13
13
  end
14
14
 
15
15
  it 'should be settable' do
16
16
  Itunes.sandbox!
17
- Itunes.sandbox?.should be_true
17
+ Itunes.sandbox?.should == true
18
18
  end
19
19
  end
20
20
 
metadata CHANGED
@@ -1,125 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itunes-receipt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - nov matake
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-06 00:00:00.000000000 Z
11
+ date: 2014-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.4.3
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
26
  version: 1.4.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: restclient_with_cert
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
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
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activesupport
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '2.3'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: i18n
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0.8'
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
82
  version: '0.8'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '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
96
  version: '2'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: fakeweb
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: 1.3.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
110
  version: 1.3.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: simplecov
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  description: Handle iTunes In App Purchase Receipt Verification
@@ -128,9 +128,9 @@ executables: []
128
128
  extensions: []
129
129
  extra_rdoc_files: []
130
130
  files:
131
- - .gitignore
132
- - .rspec
133
- - .travis.yml
131
+ - ".gitignore"
132
+ - ".rspec"
133
+ - ".travis.yml"
134
134
  - Gemfile
135
135
  - LICENSE
136
136
  - README.rdoc
@@ -159,17 +159,17 @@ require_paths:
159
159
  - lib
160
160
  required_ruby_version: !ruby/object:Gem::Requirement
161
161
  requirements:
162
- - - '>='
162
+ - - ">="
163
163
  - !ruby/object:Gem::Version
164
164
  version: '0'
165
165
  required_rubygems_version: !ruby/object:Gem::Requirement
166
166
  requirements:
167
- - - '>='
167
+ - - ">="
168
168
  - !ruby/object:Gem::Version
169
169
  version: '0'
170
170
  requirements: []
171
171
  rubyforge_project:
172
- rubygems_version: 2.0.3
172
+ rubygems_version: 2.2.2
173
173
  signing_key:
174
174
  specification_version: 4
175
175
  summary: Handle iTunes In App Purchase Receipt Verification