appleslice 0.0.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 315d85605da4a9ccc9f33f92870ed7eb024f5dc6
4
+ data.tar.gz: 9dc9478206ba37b8523ee11869c5402297a770e0
5
+ SHA512:
6
+ metadata.gz: 1b4bdaeba8caec98e5de333080ad280a92109126950047e64e409836f5bb9d121b314d37e10f8f12910400f85ed7b8db47138e713827c49a3637b6bf4e67c89d
7
+ data.tar.gz: cf12196136564a0dda4c764222a759dd287c3c6773c1af94ed93dfe7a341749195ff7c3220b86e72d4a19ef94f9af512665579b55c8655ec1c8abff5c19c3650
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in AppleSlice.gemspec
4
+ gemspec
5
+
6
+ group :spec do
7
+ gem 'rspec'
8
+ end
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Turboprop Inc
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,86 @@
1
+ # AppleSlice - Parse iTunes Connect emails
2
+
3
+ Create an instance of `AppleSlice::Email` with your email's HTML body and slice away!
4
+
5
+ ```ruby
6
+ require "appleslice"
7
+
8
+ email_body = "<!DOCTYPE HTML PUBLIC>..."
9
+
10
+ slice = AppleSlice::Email.new(email_body)
11
+
12
+ slice.review_status
13
+ # => :waiting_for_upload
14
+ slice.app_sku
15
+ # => "SKU_9000"
16
+ slice.app_version_number
17
+ # => "1.0.5"
18
+ slice.app_name
19
+ # => "Awesome App"
20
+ slice.app_apple_id
21
+ # => "98123921"
22
+ slice.itunes_url
23
+ # => http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=98123921&mt=8
24
+ ```
25
+
26
+ ## Installation
27
+
28
+ Add this line to your application's Gemfile:
29
+
30
+ gem 'appleslice'
31
+
32
+ And then execute:
33
+
34
+ $ bundle
35
+
36
+ Or install it yourself as:
37
+
38
+ $ gem install appleslice
39
+
40
+ ## Usage
41
+
42
+ The zeroth step to using AppleSlice is to get Apple emails into your Ruby system - you could use an email service like [Postmark](http://postmarkapp.com) or [Sendgrid](http://www.sendgrid.com) for that, or many other methods.
43
+
44
+ AppleSlice parses the following information for these types of emails:
45
+
46
+ #### Status Updates
47
+
48
+ - `#review_status`
49
+ - `#app_sku`
50
+ - `#app_version_number`
51
+ - `#app_name`
52
+ - `#app_apple_id`
53
+ - `#itunes_url`
54
+
55
+ #### Rejection
56
+
57
+ - `#review_status`
58
+ - `#app_name`
59
+ - `#app_apple_id`
60
+ - `#itunes_url`
61
+ - `#resolution_center_url`
62
+
63
+ #### All Emails
64
+
65
+ - `#rejected?`
66
+ - `#scheduled_maintenance?`
67
+
68
+ Valid values for `#review_status` are:
69
+
70
+ - `:waiting_for_upload`
71
+ - `:waiting_for_review`
72
+ - `:in_review`
73
+ - `:processing_for_app_store`
74
+ - `:ready_for_sale`
75
+ - `:developer_rejected`
76
+ - `:developer_removed_from_sale`
77
+
78
+ ## Contact
79
+
80
+ [Clay Allsopp](http://clayallsopp.com/)
81
+ - [clay@usepropeller.com](mailto:clay@usepropeller.com)
82
+ - [@clayallsopp](https://twitter.com/clayallsopp)
83
+
84
+ ## License
85
+
86
+ AppleSlice is available under the MIT license. See the [LICENSE](LICENSE) file for more info.
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'appleslice/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "appleslice"
8
+ spec.version = AppleSlice::VERSION
9
+ spec.authors = ["Clay Allsopp"]
10
+ spec.email = ["clay@usepropeller.com"]
11
+ spec.summary = %q{Easily parse Apple & iTunes Connect emails}
12
+ spec.homepage = "https://github.com/usepropeller/appleslice"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "nokogiri", ">= 1.6.0"
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.5"
23
+ spec.add_development_dependency "rake"
24
+ end
@@ -0,0 +1,5 @@
1
+ require 'nokogiri'
2
+ require 'cgi'
3
+
4
+ require "appleslice/version"
5
+ require 'appleslice/email'
@@ -0,0 +1,95 @@
1
+ module AppleSlice
2
+ class Email
3
+ ITUNES_URL_FORMAT = "http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=%s&mt=8"
4
+
5
+ STATUS_CONTENT_TO_STATUS = {
6
+ "The status for the following app has changed to Waiting For Upload.".downcase => :waiting_for_upload,
7
+ "The status for the following app has changed to Waiting For Review.".downcase => :waiting_for_review,
8
+ "The status for the following app has changed to In Review.".downcase => :in_review,
9
+ "The status for the following app has changed to Processing for App Store.".downcase => :processing_for_app_store,
10
+ "The following app has been approved and the app status has changed to Ready for Sale:".downcase => :ready_for_sale,
11
+ "The status for the following app has changed to Developer Rejected.".downcase => :developer_rejected,
12
+ "The status for the following app has changed to Developer Removed From Sale.".downcase => :developer_removed_from_sale
13
+ }
14
+
15
+ attr_reader :body
16
+ attr_accessor :id
17
+
18
+ class UnknownEmailTypeError < StandardError; end
19
+ class BadDataError < StandardError; end
20
+
21
+ def initialize(body)
22
+ @body = body
23
+ @noko = Nokogiri::HTML.fragment(@body)
24
+ end
25
+
26
+ def review_status
27
+ if @body.include?('we are unable to post this version.')
28
+ return :rejected
29
+ end
30
+
31
+ status_content = @noko.search('p').first.content.downcase
32
+ status = STATUS_CONTENT_TO_STATUS[status_content]
33
+ status || begin
34
+ message = "Unknown email type - content: #{status_content}"
35
+ message = "Unknown email type - content: #{status_content} - id: #{self.id}" if self.id
36
+ raise UnknownEmailTypeError, message
37
+ end
38
+ end
39
+
40
+ def itunes_url
41
+ ITUNES_URL_FORMAT % app_apple_id
42
+ end
43
+
44
+ def app_sku
45
+ return nil if rejected?
46
+ find_td('App SKU: ')
47
+ end
48
+
49
+ def app_version_number
50
+ return nil if rejected?
51
+ find_td('App Version Number: ')
52
+ end
53
+
54
+ def app_name
55
+ if rejected?
56
+ letter = @noko.css('#rejectionEmail p')[1]
57
+ letter.content.split("Your app ")[-1].split(' has been reviewed')[0]
58
+ else
59
+ find_td('App Name: ').strip
60
+ end
61
+ end
62
+
63
+ def app_apple_id
64
+ if rejected?
65
+ params = URI.parse(resolution_center_url).query
66
+ CGI::parse(params)['adamId'].first
67
+ else
68
+ find_td('App Apple ID:')
69
+ end
70
+ end
71
+
72
+ def resolution_center_url
73
+ return nil unless rejected?
74
+ @noko.css('#rejectionEmail a').first[:href]
75
+ end
76
+
77
+ def rejected?
78
+ review_status == :rejected
79
+ end
80
+
81
+ def scheduled_maintenance?
82
+ @body.include?("will undergo scheduled maintenance on ")
83
+ end
84
+
85
+ private
86
+ def find_td(prefix)
87
+ matches = @noko.search('td').select { |n|
88
+ n.content.start_with?(prefix)
89
+ }
90
+ raise BadDataError, "Multiple matches for TD prefix #{prefix}" if matches.count > 1
91
+ match = matches.first
92
+ match.content.split(prefix)[-1]
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,3 @@
1
+ module AppleSlice
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,152 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
+ <html>
3
+ <head>
4
+ <title>iTunes Connect</title>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6
+ <style type="text/css">
7
+ A { text-decoration: none; }
8
+
9
+ A:link { color: #0088CC; text-decoration: none; }
10
+
11
+ A:visited { text-decoration: none; }
12
+
13
+ A:active { color: #696969; text-decoration: underline;}
14
+
15
+ A:hover { text-decoration: underline; }
16
+
17
+ BODY, TD, P, UL, OL {
18
+ font-family: Helvetica, Lucida Grande, Arial, sans-serif;
19
+ font-size: 14px;
20
+ line-height: 18px;
21
+ color: #666666;
22
+ text-align: justify;
23
+ }
24
+
25
+ P {
26
+ margin-bottom: 1em;
27
+ }
28
+
29
+ H1 {
30
+ line-height:145%;
31
+ }
32
+
33
+ HR {
34
+ border: 0;
35
+ border-top: 1px solid #dddddd;
36
+ margin: 10px 0px 15px 0px;
37
+ }
38
+
39
+ @media only screen and (max-device-width: 481px) and (min-device-pixel-ratio : 2), only screen and (min-device-width: 481px) and (-webkit-min-device-pixel-ratio : 2) {
40
+ img { visibility:hidden; }
41
+ *[id=header] { background:url('https://itc-mzstatic-origin.itunes.apple.com/itc/images/email/email-itc-logo@2X.png') no-repeat 0 top; -webkit-background-size: 173px 45px; }
42
+ *[id=hr-fade] { background:url('https://itc-mzstatic-origin.itunes.apple.com/itc/images/email/email-hr@2X.png') no-repeat 0 top; -webkit-background-size: 648px 18px; }
43
+ }
44
+
45
+ @media only screen and (max-device-width: 480px) {
46
+
47
+ table[class="table"], td[class="cell"] {
48
+ width: 270px !important;
49
+ }
50
+ table[class="table3"], td[class="cell3"] {
51
+ width: 270px !important;
52
+ text-align: left !important;
53
+ }
54
+ img[id="header"] {
55
+ width: 135px !important;
56
+ height: 35px !important;
57
+ }
58
+ td[id="header"] {
59
+ -webkit-background-size: 135px 35px;
60
+ }
61
+ table[class="footer_table"] {
62
+ display: none !important;
63
+ }
64
+
65
+ .hide { max-height: none !important; font-size: 11px !important; display: block !important; }
66
+
67
+ p {
68
+ text-align: left !important;
69
+ }
70
+
71
+ }
72
+ </style>
73
+ </head>
74
+ <body>
75
+ <table class="table" border="0" cellspacing="0" cellpadding="0" align="center" width="700">
76
+ <tr align="center">
77
+ <td class="spacer" align="left" valign="top" bgcolor="#ffffff" width="20">
78
+ <img src="https://itc-mzstatic-origin.itunes.apple.com/itc/images/email/spacer.gif" border="0" alt="" width="20" height="1">
79
+ </td>
80
+ <td align="left">
81
+ <table class="table3" width="648" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#ffffff" >
82
+ <tr>
83
+ <td class="cell3" id="header" width="648" align="left" style="padding-bottom: 10px;">
84
+ <img id="header" src="https://itc-mzstatic-origin.itunes.apple.com/itc/images/email/email-itc-logo.png" border="0" alt="iTunes Connect" width="173" height="45">
85
+ </td>
86
+ </tr>
87
+ <tr>
88
+ <td class="cell3" style="font-size: 0px; line-height: 1px; background:none; border-top:solid 1px #dddddd; height:1px; width:648px; margin:0px 0px 0px 0px; padding-bottom: 15px">\u00a0</td>
89
+ </tr>
90
+ <tr>
91
+ <td class="cell3" align="left" valign="top" bgcolor="#ffffff" width="648" style="font-family: Helvetica, Lucida Grande, Arial, sans-serif; font-size: 14px; line-height: 18px; color: #666666; text-align: justify;">
92
+
93
+
94
+
95
+ \t<p>Dear <%= @user_name %>,</p>
96
+ <p>iTunes Connect will undergo scheduled maintenance on Wednesday, May 14, 2014 for approximately four hours starting at 8 a.m. (PT).</p>
97
+ <p>During this time, iTunes Connect and content delivery will not be available.</p>
98
+ <p>If you have any questions, <a href="http://www.apple.com/itunes/go/itunesconnect/contactus">contact us</a>.</p>
99
+ <p>Regards,</p>
100
+ <p>The iTunes Store team</p>
101
+
102
+
103
+
104
+ </td>
105
+ </tr>
106
+ </table>
107
+ </td>
108
+ <td class="spacer" align="right" valign="top" bgcolor="#ffffff" width="20">
109
+ <img src="https://itc-mzstatic-origin.itunes.apple.com/itc/images/email/spacer.gif" border="0" alt="" width="20" height="1">
110
+ </td>
111
+ </tr>
112
+ </table>
113
+ <table class="footer_table" width="700" border="0" cellspacing="0" cellpadding="0" align="center" style="margin-top:25px; margin-bottom:15px;">
114
+ <tr>
115
+ <td class="cell" align="left">\u00a0</td>
116
+ </tr>
117
+ <tr>
118
+ <td class="cell" style="font-size:10px; line-height: 12px; color:#9f9f9f; font-family: Helvetica, Lucida Grande, Arial, sans-serif; text-align: center; -webkit-text-size-adjust:none;">
119
+ <a href="http://www.apple.com/itunes/go/itunesconnect/contactus">Contact Us</a> | <a href="http://itunesconnect.apple.com">iTunes Connect</a> | 1 Infinite Loop, Cupertino, CA 95014
120
+ </td>
121
+ </tr>
122
+ <tr>
123
+ <td class="cell" id="hr-fade" style="text-align: center;">
124
+ <img id="footer" src="https://itc-mzstatic-origin.itunes.apple.com/itc/images/email/email-hr.png" width="648" height="18"/>
125
+ </td>
126
+ </tr>
127
+ <tr>
128
+ <td class="cell" style="font-size:10px; line-height: 12px; color:#9f9f9f; font-family: Helvetica, Lucida Grande, Arial, sans-serif; text-align: center; -webkit-text-size-adjust:none;">
129
+ <a href="http://www.apple.com/legal/privacy/">Privacy Policy</a> | <a href="http://www.apple.com/support/itunes/legal/terms.html">Terms of Service</a> | <a href="http://www.apple.com/support/itunes/legal/policies.html">Terms of Sale</a>
130
+ </td>
131
+ </tr>
132
+ </table>
133
+ <table class="hide" width="270" border="0" cellspacing="0" cellpadding="0" align="center" style="margin-top:45px; margin-bottom:15px; max-height: 0px; font-size: 0; display: none;">
134
+ <tr>
135
+ <td class="hide" style="max-height: 0px; font-size: 0; display: none; height: 1px; background:none; border-top:solid 1px #dddddd; width:648px; margin:0px 0px 0px 0px;">\u00a0</td>
136
+ </tr>
137
+ <tr>
138
+ <td class="hide" style="line-height: 120%; color:#9f9f9f; font-family: Helvetica, Lucida Grande, Arial, sans-serif; text-align: center; max-height: 0px; font-size: 0; display: none; -webkit-text-size-adjust:none;"><br/>
139
+ <a href="http://www.apple.com/itunes/go/itunesconnect/contactus">Contact Us</a> | <a href="http://itunesconnect.apple.com">iTunes Connect</a><br/>1 Infinite Loop, Cupertino, CA 95014
140
+ </td>
141
+ </tr>
142
+ <tr>
143
+ <td class="hide" align="left" style="max-height: 0px; font-size: 0; display: none; line-height: 120%;">\u00a0</td>
144
+ </tr>
145
+ <tr>
146
+ <td class="hide" style="line-height: 120%; color:#9f9f9f; font-family: Helvetica, Lucida Grande, Arial, sans-serif; text-align: center; max-height: 0px; font-size: 0; display: none; -webkit-text-size-adjust:none;">
147
+ <a href="http://www.apple.com/legal/privacy/">Privacy Policy</a> | <a href="http://www.apple.com/support/itunes/legal/terms.html">Terms of Service</a> | <a href="http://www.apple.com/support/itunes/legal/policies.html">Terms of Sale</a>
148
+ </td>
149
+ </tr>
150
+ </table>
151
+ </body>
152
+ </html>
@@ -0,0 +1,163 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
+ <html>
3
+ <head>
4
+ <title>iTunes Connect</title>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6
+ <style type="text/css">
7
+ A { text-decoration: none; }
8
+
9
+ A:link { color: #0088CC; text-decoration: none; }
10
+
11
+ A:visited { text-decoration: none; }
12
+
13
+ A:active { color: #696969; text-decoration: underline;}
14
+
15
+ A:hover { text-decoration: underline; }
16
+
17
+ BODY, TD, P, UL, OL {
18
+ font-family: Helvetica, Lucida Grande, Arial, sans-serif;
19
+ font-size: 14px;
20
+ line-height: 18px;
21
+ color: #666666;
22
+ text-align: justify;
23
+ }
24
+
25
+ P {
26
+ margin-bottom: 1em;
27
+ }
28
+
29
+ H1 {
30
+ line-height:145%;
31
+ }
32
+
33
+ HR {
34
+ border: 0;
35
+ border-top: 1px solid #dddddd;
36
+ margin: 10px 0px 15px 0px;
37
+ }
38
+
39
+ @media only screen and (max-device-width: 481px) and (min-device-pixel-ratio : 2), only screen and (min-device-width: 481px) and (-webkit-min-device-pixel-ratio : 2) {
40
+ img { visibility:hidden; }
41
+ *[id=header] { background:url('https://itc-mzstatic-origin.itunes.apple.com/itc/images/email/email-itc-logo@2X.png') no-repeat 0 top; -webkit-background-size: 173px 45px; }
42
+ *[id=hr-fade] { background:url('https://itc-mzstatic-origin.itunes.apple.com/itc/images/email/email-hr@2X.png') no-repeat 0 top; -webkit-background-size: 648px 18px; }
43
+ }
44
+
45
+ @media only screen and (max-device-width: 480px) {
46
+
47
+ table[class="table"], td[class="cell"] {
48
+ width: 270px !important;
49
+ }
50
+ table[class="table3"], td[class="cell3"] {
51
+ width: 270px !important;
52
+ text-align: left !important;
53
+ }
54
+ img[id="header"] {
55
+ width: 135px !important;
56
+ height: 35px !important;
57
+ }
58
+ td[id="header"] {
59
+ -webkit-background-size: 135px 35px;
60
+ }
61
+ table[class="footer_table"] {
62
+ display: none !important;
63
+ }
64
+
65
+ .hide { max-height: none !important; font-size: 11px !important; display: block !important; }
66
+
67
+ p {
68
+ text-align: left !important;
69
+ }
70
+
71
+ }
72
+ </style>
73
+ </head>
74
+ <body>
75
+ <table class="table" border="0" cellspacing="0" cellpadding="0" align="center" width="700">
76
+ <tr align="center">
77
+ <td class="spacer" align="left" valign="top" bgcolor="#ffffff" width="20">
78
+ <img src="https://itc-mzstatic-origin.itunes.apple.com/itc/images/email/spacer.gif" border="0" alt="" width="20" height="1">
79
+ </td>
80
+ <td align="left">
81
+ <table class="table3" width="648" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#ffffff" >
82
+ <tr>
83
+ <td class="cell3" id="header" width="648" align="left" style="padding-bottom: 10px;">
84
+ <img id="header" src="https://itc-mzstatic-origin.itunes.apple.com/itc/images/email/email-itc-logo.png" border="0" alt="iTunes Connect" width="173" height="45">
85
+ </td>
86
+ </tr>
87
+ <tr>
88
+ <td class="cell3" style="font-size: 0px; line-height: 1px; background:none; border-top:solid 1px #dddddd; height:1px; width:648px; margin:0px 0px 0px 0px; padding-bottom: 15px">\u00a0</td>
89
+ </tr>
90
+ <tr>
91
+ <td class="cell3" align="left" valign="top" bgcolor="#ffffff" width="648" style="font-family: Helvetica, Lucida Grande, Arial, sans-serif; font-size: 14px; line-height: 18px; color: #666666; text-align: justify;">
92
+
93
+
94
+
95
+ Dear User,
96
+ <p>The following app has been approved and the app status has changed to Ready for Sale:</p>
97
+ <table id="details" cellpadding="0" cellspacing="0" border="0">
98
+ <tr><td>App Name: <%= @app_name %> <a target="_blank" href="https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=<%= @app_apple_id %>&mt=8"><img border="0" src="https://itc.mzstatic.com/itc/images/arrow.png" /></a></td></tr>
99
+ <tr><td>App Version Number: <%= @app_version_number %></td></tr>
100
+ <tr><td>App Type: iOS App</td></tr>
101
+ <tr><td>App SKU: <%= @app_sku %></td></tr>
102
+ <tr><td>App Apple ID:<%= @app_apple_id %></td></tr>
103
+ </table>
104
+
105
+ <p>If your contracts are not in effect at this time, your app status will be Pending Contract. You may track the progress of your contracts in the <a target="_blank" href="http://www.apple.com/itunes/go/itunesconnect/contracts">Contracts, Tax, and Banking</a> module in iTunes Connect.</p>
106
+ <p>To make changes to this app, sign in to iTunes Connect and open the <a target="_blank" href="http://www.apple.com/itunes/go/itunesconnect/manageApps">Manage Your Applications</a> module.</p>
107
+ <p>It can take up to 24 hours before your app is available on the App Store. This delay is dependent on any app availability issues.</p>
108
+ <p>Before you market your app, read the <a href="https://developer.apple.com/appstore/AppStoreMarketingGuidelines.pdf">App Store Marketing and Advertising Guidelines</a> for Developers. The guidelines include information on using the App Store badge, best practices to market apps on the App Store, and details on the use of Apple product images.</p>
109
+ <p>If you have any questions regarding your app, use the <a target="_blank" href="http://www.apple.com/itunes/go/itunesconnect/contactus">Contact Us</a> module on iTunes Connect.</p>
110
+ <p>Regards,<br/>
111
+ The App Store team</p>
112
+
113
+
114
+
115
+ </td>
116
+ </tr>
117
+ </table>
118
+ </td>
119
+ <td class="spacer" align="right" valign="top" bgcolor="#ffffff" width="20">
120
+ <img src="https://itc-mzstatic-origin.itunes.apple.com/itc/images/email/spacer.gif" border="0" alt="" width="20" height="1">
121
+ </td>
122
+ </tr>
123
+ </table>
124
+ <table class="footer_table" width="700" border="0" cellspacing="0" cellpadding="0" align="center" style="margin-top:25px; margin-bottom:15px;">
125
+ <tr>
126
+ <td class="cell" align="left">\u00a0</td>
127
+ </tr>
128
+ <tr>
129
+ <td class="cell" style="font-size:10px; line-height: 12px; color:#9f9f9f; font-family: Helvetica, Lucida Grande, Arial, sans-serif; text-align: center; -webkit-text-size-adjust:none;">
130
+ <a href="http://www.apple.com/itunes/go/itunesconnect/contactus">Contact Us</a> | <a href="http://itunesconnect.apple.com">iTunes Connect</a> | 1 Infinite Loop, Cupertino, CA 95014
131
+ </td>
132
+ </tr>
133
+ <tr>
134
+ <td class="cell" id="hr-fade" style="text-align: center;">
135
+ <img id="footer" src="https://itc-mzstatic-origin.itunes.apple.com/itc/images/email/email-hr.png" width="648" height="18"/>
136
+ </td>
137
+ </tr>
138
+ <tr>
139
+ <td class="cell" style="font-size:10px; line-height: 12px; color:#9f9f9f; font-family: Helvetica, Lucida Grande, Arial, sans-serif; text-align: center; -webkit-text-size-adjust:none;">
140
+ <a href="http://www.apple.com/legal/privacy/">Privacy Policy</a> | <a href="http://www.apple.com/support/itunes/legal/terms.html">Terms of Service</a> | <a href="http://www.apple.com/support/itunes/legal/policies.html">Terms of Sale</a>
141
+ </td>
142
+ </tr>
143
+ </table>
144
+ <table class="hide" width="270" border="0" cellspacing="0" cellpadding="0" align="center" style="margin-top:45px; margin-bottom:15px; max-height: 0px; font-size: 0; display: none;">
145
+ <tr>
146
+ <td class="hide" style="max-height: 0px; font-size: 0; display: none; height: 1px; background:none; border-top:solid 1px #dddddd; width:648px; margin:0px 0px 0px 0px;">\u00a0</td>
147
+ </tr>
148
+ <tr>
149
+ <td class="hide" style="line-height: 120%; color:#9f9f9f; font-family: Helvetica, Lucida Grande, Arial, sans-serif; text-align: center; max-height: 0px; font-size: 0; display: none; -webkit-text-size-adjust:none;"><br/>
150
+ <a href="http://www.apple.com/itunes/go/itunesconnect/contactus">Contact Us</a> | <a href="http://itunesconnect.apple.com">iTunes Connect</a><br/>1 Infinite Loop, Cupertino, CA 95014
151
+ </td>
152
+ </tr>
153
+ <tr>
154
+ <td class="hide" align="left" style="max-height: 0px; font-size: 0; display: none; line-height: 120%;">\u00a0</td>
155
+ </tr>
156
+ <tr>
157
+ <td class="hide" style="line-height: 120%; color:#9f9f9f; font-family: Helvetica, Lucida Grande, Arial, sans-serif; text-align: center; max-height: 0px; font-size: 0; display: none; -webkit-text-size-adjust:none;">
158
+ <a href="http://www.apple.com/legal/privacy/">Privacy Policy</a> | <a href="http://www.apple.com/support/itunes/legal/terms.html">Terms of Service</a> | <a href="http://www.apple.com/support/itunes/legal/policies.html">Terms of Sale</a>
159
+ </td>
160
+ </tr>
161
+ </table>
162
+ </body>
163
+ </html>
@@ -0,0 +1,161 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
+ <html>
3
+ <head>
4
+ <title>iTunes Connect</title>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6
+ <style type="text/css">
7
+ A { text-decoration: none; }
8
+
9
+ A:link { color: #0088CC; text-decoration: none; }
10
+
11
+ A:visited { text-decoration: none; }
12
+
13
+ A:active { color: #696969; text-decoration: underline;}
14
+
15
+ A:hover { text-decoration: underline; }
16
+
17
+ BODY, TD, P, UL, OL {
18
+ font-family: Helvetica, Lucida Grande, Arial, sans-serif;
19
+ font-size: 14px;
20
+ line-height: 18px;
21
+ color: #666666;
22
+ text-align: justify;
23
+ }
24
+
25
+ P {
26
+ margin-bottom: 1em;
27
+ }
28
+
29
+ H1 {
30
+ line-height:145%;
31
+ }
32
+
33
+ HR {
34
+ border: 0;
35
+ border-top: 1px solid #dddddd;
36
+ margin: 10px 0px 15px 0px;
37
+ }
38
+
39
+ @media only screen and (max-device-width: 481px) and (min-device-pixel-ratio : 2), only screen and (min-device-width: 481px) and (-webkit-min-device-pixel-ratio : 2) {
40
+ img { visibility:hidden; }
41
+ *[id=header] { background:url('https://itc-mzstatic-origin.itunes.apple.com/itc/images/email/email-itc-logo@2X.png') no-repeat 0 top; -webkit-background-size: 173px 45px; }
42
+ *[id=hr-fade] { background:url('https://itc-mzstatic-origin.itunes.apple.com/itc/images/email/email-hr@2X.png') no-repeat 0 top; -webkit-background-size: 648px 18px; }
43
+ }
44
+
45
+ @media only screen and (max-device-width: 480px) {
46
+
47
+ table[class="table"], td[class="cell"] {
48
+ width: 270px !important;
49
+ }
50
+ table[class="table3"], td[class="cell3"] {
51
+ width: 270px !important;
52
+ text-align: left !important;
53
+ }
54
+ img[id="header"] {
55
+ width: 135px !important;
56
+ height: 35px !important;
57
+ }
58
+ td[id="header"] {
59
+ -webkit-background-size: 135px 35px;
60
+ }
61
+ table[class="footer_table"] {
62
+ display: none !important;
63
+ }
64
+
65
+ .hide { max-height: none !important; font-size: 11px !important; display: block !important; }
66
+
67
+ p {
68
+ text-align: left !important;
69
+ }
70
+
71
+ }
72
+ </style>
73
+ </head>
74
+ <body>
75
+ <table class="table" border="0" cellspacing="0" cellpadding="0" align="center" width="700">
76
+ <tr align="center">
77
+ <td class="spacer" align="left" valign="top" bgcolor="#ffffff" width="20">
78
+ <img src="https://itc-mzstatic-origin.itunes.apple.com/itc/images/email/spacer.gif" border="0" alt="" width="20" height="1">
79
+ </td>
80
+ <td align="left">
81
+ <table class="table3" width="648" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#ffffff" >
82
+ <tr>
83
+ <td class="cell3" id="header" width="648" align="left" style="padding-bottom: 10px;">
84
+ <img id="header" src="https://itc-mzstatic-origin.itunes.apple.com/itc/images/email/email-itc-logo.png" border="0" alt="iTunes Connect" width="173" height="45">
85
+ </td>
86
+ </tr>
87
+ <tr>
88
+ <td class="cell3" style="font-size: 0px; line-height: 1px; background:none; border-top:solid 1px #dddddd; height:1px; width:648px; margin:0px 0px 0px 0px; padding-bottom: 15px">\u00a0</td>
89
+ </tr>
90
+ <tr>
91
+ <td class="cell3" align="left" valign="top" bgcolor="#ffffff" width="648" style="font-family: Helvetica, Lucida Grande, Arial, sans-serif; font-size: 14px; line-height: 18px; color: #666666; text-align: justify;">
92
+
93
+
94
+
95
+ <div id="rejectionEmail">
96
+ <p>Hello <%= @user_name %>,</p>
97
+ <p>Your app <%= @app_name %> has been reviewed, but we are unable to post this version. For details, or to directly contact the App Review team, visit the <a href="<%= @resolution_url || "https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/da/rejectionReasons?adamId=#{@app_apple_id}" %>">Resolution Center</a> in iTunes Connect. Do not reply to this email.</p>
98
+
99
+
100
+
101
+ <p>Regards,</p>
102
+
103
+ <p>App Review</p>
104
+
105
+ <p>
106
+ Converse with fellow developers and Apple engineers on technical topics.<br>
107
+ Apple Developer Forums \u2014 <a href="http://devforums.apple.com" target="_blank">http://devforums.apple.com</a>
108
+ </p>
109
+ </div>
110
+
111
+
112
+
113
+ </td>
114
+ </tr>
115
+ </table>
116
+ </td>
117
+ <td class="spacer" align="right" valign="top" bgcolor="#ffffff" width="20">
118
+ <img src="https://itc-mzstatic-origin.itunes.apple.com/itc/images/email/spacer.gif" border="0" alt="" width="20" height="1">
119
+ </td>
120
+ </tr>
121
+ </table>
122
+ <table class="footer_table" width="700" border="0" cellspacing="0" cellpadding="0" align="center" style="margin-top:25px; margin-bottom:15px;">
123
+ <tr>
124
+ <td class="cell" align="left">\u00a0</td>
125
+ </tr>
126
+ <tr>
127
+ <td class="cell" style="font-size:10px; line-height: 12px; color:#9f9f9f; font-family: Helvetica, Lucida Grande, Arial, sans-serif; text-align: center; -webkit-text-size-adjust:none;">
128
+ <a href="http://www.apple.com/itunes/go/itunesconnect/contactus">Contact Us</a> | <a href="http://itunesconnect.apple.com">iTunes Connect</a> | 1 Infinite Loop, Cupertino, CA 95014
129
+ </td>
130
+ </tr>
131
+ <tr>
132
+ <td class="cell" id="hr-fade" style="text-align: center;">
133
+ <img id="footer" src="https://itc-mzstatic-origin.itunes.apple.com/itc/images/email/email-hr.png" width="648" height="18"/>
134
+ </td>
135
+ </tr>
136
+ <tr>
137
+ <td class="cell" style="font-size:10px; line-height: 12px; color:#9f9f9f; font-family: Helvetica, Lucida Grande, Arial, sans-serif; text-align: center; -webkit-text-size-adjust:none;">
138
+ <a href="http://www.apple.com/legal/privacy/">Privacy Policy</a> | <a href="http://www.apple.com/support/itunes/legal/terms.html">Terms of Service</a> | <a href="http://www.apple.com/support/itunes/legal/policies.html">Terms of Sale</a>
139
+ </td>
140
+ </tr>
141
+ </table>
142
+ <table class="hide" width="270" border="0" cellspacing="0" cellpadding="0" align="center" style="margin-top:45px; margin-bottom:15px; max-height: 0px; font-size: 0; display: none;">
143
+ <tr>
144
+ <td class="hide" style="max-height: 0px; font-size: 0; display: none; height: 1px; background:none; border-top:solid 1px #dddddd; width:648px; margin:0px 0px 0px 0px;">\u00a0</td>
145
+ </tr>
146
+ <tr>
147
+ <td class="hide" style="line-height: 120%; color:#9f9f9f; font-family: Helvetica, Lucida Grande, Arial, sans-serif; text-align: center; max-height: 0px; font-size: 0; display: none; -webkit-text-size-adjust:none;"><br/>
148
+ <a href="http://www.apple.com/itunes/go/itunesconnect/contactus">Contact Us</a> | <a href="http://itunesconnect.apple.com">iTunes Connect</a><br/>1 Infinite Loop, Cupertino, CA 95014
149
+ </td>
150
+ </tr>
151
+ <tr>
152
+ <td class="hide" align="left" style="max-height: 0px; font-size: 0; display: none; line-height: 120%;">\u00a0</td>
153
+ </tr>
154
+ <tr>
155
+ <td class="hide" style="line-height: 120%; color:#9f9f9f; font-family: Helvetica, Lucida Grande, Arial, sans-serif; text-align: center; max-height: 0px; font-size: 0; display: none; -webkit-text-size-adjust:none;">
156
+ <a href="http://www.apple.com/legal/privacy/">Privacy Policy</a> | <a href="http://www.apple.com/support/itunes/legal/terms.html">Terms of Service</a> | <a href="http://www.apple.com/support/itunes/legal/policies.html">Terms of Sale</a>
157
+ </td>
158
+ </tr>
159
+ </table>
160
+ </body>
161
+ </html>
@@ -0,0 +1,170 @@
1
+ <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'><!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
2
+ <html>
3
+ <head>
4
+ <title>iTunes Connect</title>
5
+ <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
6
+ <style type='text/css'>
7
+ A { text-decoration: none; }
8
+
9
+ A:link { color: #0088CC; text-decoration: none; }
10
+
11
+ A:visited { text-decoration: none; }
12
+
13
+ A:active { color: #696969; text-decoration: underline;}
14
+
15
+ A:hover { text-decoration: underline; }
16
+
17
+ BODY, TD, P, UL, OL {
18
+ font-family: Helvetica, Lucida Grande, Arial, sans-serif;
19
+ font-size: 14px;
20
+ line-height: 18px;
21
+ color: #666666;
22
+ text-align: justify;
23
+ }
24
+
25
+ P {
26
+ margin-bottom: 1em;
27
+ }
28
+
29
+ H1 {
30
+ line-height:145%;
31
+ }
32
+
33
+ HR {
34
+ border: 0;
35
+ border-top: 1px solid #dddddd;
36
+ margin: 10px 0px 15px 0px;
37
+ }
38
+
39
+ @media only screen and (max-device-width: 481px) and (min-device-pixel-ratio : 2), only screen and (min-device-width: 481px) and (-webkit-min-device-pixel-ratio : 2) {
40
+ img { visibility:hidden; }
41
+ *[id=header] { background:url('https://itc-mzstatic-origin.itunes.apple.comhttps://itc.mzstatic.com/itc/images/email/email-itc-logo@2X.png') no-repeat 0 top; -webkit-background-size: 173px 45px; }
42
+ *[id=hr-fade] { background:url('https://itc-mzstatic-origin.itunes.apple.comhttps://itc.mzstatic.com/itc/images/email/email-hr@2X.png') no-repeat 0 top; -webkit-background-size: 648px 18px; }
43
+ }
44
+
45
+ @media only screen and (max-device-width: 480px) {
46
+
47
+ table[class='table'], td[class='cell'] {
48
+ width: 270px !important;
49
+ }
50
+ table[class='table3'], td[class='cell3'] {
51
+ width: 270px !important;
52
+ text-align: left !important;
53
+ }
54
+ img[id='header'] {
55
+ width: 135px !important;
56
+ height: 35px !important;
57
+ }
58
+ td[id='header'] {
59
+ -webkit-background-size: 135px 35px;
60
+ }
61
+ table[class='footer_table'] {
62
+ display: none !important;
63
+ }
64
+
65
+ .hide { max-height: none !important; font-size: 11px !important; display: block !important; }
66
+
67
+ p {
68
+ text-align: left !important;
69
+ }
70
+
71
+ }
72
+ </style>
73
+ </head>
74
+ <body>
75
+ <table class='table' border='0' cellspacing='0' cellpadding='0' align='center' width='700'>
76
+ <tr align='center'>
77
+ <td class='spacer' align='left' valign='top' bgcolor='#ffffff' width='20'>
78
+ <img src='https://itc-mzstatic-origin.itunes.apple.comhttps://itc.mzstatic.com/itc/images/email/spacer.gif' border='0' alt='' width='20' height='1'>
79
+ </td>
80
+ <td align='left'>
81
+ <table class='table3' width='648' border='0' cellpadding='0' cellspacing='0' align='center' bgcolor='#ffffff' >
82
+ <tr>
83
+ <td class='cell3' id='header' width='648' align='left' style='padding-bottom: 10px;'>
84
+ <img id='header' src='https://itc-mzstatic-origin.itunes.apple.comhttps://itc.mzstatic.com/itc/images/email/email-itc-logo.png' border='0' alt='iTunes Connect' width='173' height='45'>
85
+ </td>
86
+ </tr>
87
+ <tr>
88
+ <td class='cell3' style='font-size: 0px; line-height: 1px; background:none; border-top:solid 1px #dddddd; height:1px; width:648px; margin:0px 0px 0px 0px; padding-bottom: 15px'>\u00a0</td>
89
+ </tr>
90
+ <tr>
91
+ <td class='cell3' align='left' valign='top' bgcolor='#ffffff' width='648' style='font-family: Helvetica, Lucida Grande, Arial, sans-serif; font-size: 14px; line-height: 18px; color: #666666; text-align: justify;'>
92
+
93
+
94
+
95
+ <br>Dear User,
96
+ <p>The status for the following app has changed to <strong><%= @status_string || "Waiting For Upload" %></strong>.</p>
97
+
98
+
99
+
100
+
101
+
102
+ <table id='details' cellpadding='0' cellspacing='0' border='0'>
103
+ <tr><td>App Name: <%= @app_name %></td></tr>
104
+ <tr><td>App Version Number: <%= @app_version_number %></td></tr>
105
+ <tr><td>App SKU: <%= @app_sku %></td></tr>
106
+ <tr><td>App Apple ID:<%= @app_apple_id %></td></tr>
107
+
108
+ </table>
109
+
110
+
111
+ \t <p>To make changes to this app, sign in to iTunes Connect and open the <a target='_blank' href='http://www.apple.com/itunes/go/itunesconnect/manageApps'>Manage Your Applications</a> module.</p>
112
+ \t <p>If you have any questions regarding your app, click <a target='_blank' href='http://www.apple.com/itunes/go/itunesconnect/contactus'>Contact Us</a> in iTunes Connect.</p>
113
+
114
+
115
+
116
+
117
+ <p>Regards,</p>
118
+ <p>The iTunes Store team</p>
119
+
120
+
121
+
122
+ </td>
123
+ </tr>
124
+ </table>
125
+ </td>
126
+ <td class='spacer' align='right' valign='top' bgcolor='#ffffff' width='20'>
127
+ <img src='https://itc-mzstatic-origin.itunes.apple.comhttps://itc.mzstatic.com/itc/images/email/spacer.gif' border='0' alt='' width='20' height='1'>
128
+ </td>
129
+ </tr>
130
+ </table>
131
+ <table class='footer_table' width='700' border='0' cellspacing='0' cellpadding='0' align='center' style='margin-top:25px; margin-bottom:15px;'>
132
+ <tr>
133
+ <td class='cell' align='left'>\u00a0</td>
134
+ </tr>
135
+ <tr>
136
+ <td class='cell' style='font-size:10px; line-height: 12px; color:#9f9f9f; font-family: Helvetica, Lucida Grande, Arial, sans-serif; text-align: center; -webkit-text-size-adjust:none;'>
137
+ <a href='http://www.apple.com/itunes/go/itunesconnect/contactus'>Contact Us</a> | <a href='http://itunesconnect.apple.com'>iTunes Connect</a> | 1 Infinite Loop, Cupertino, CA 95014
138
+ </td>
139
+ </tr>
140
+ <tr>
141
+ <td class='cell' id='hr-fade' style='text-align: center;'>
142
+ <img id='footer' src='https://itc-mzstatic-origin.itunes.apple.comhttps://itc.mzstatic.com/itc/images/email/email-hr.png' width='648' height='18'/>
143
+ </td>
144
+ </tr>
145
+ <tr>
146
+ <td class='cell' style='font-size:10px; line-height: 12px; color:#9f9f9f; font-family: Helvetica, Lucida Grande, Arial, sans-serif; text-align: center; -webkit-text-size-adjust:none;'>
147
+ <a href='http://www.apple.com/legal/privacy/'>Privacy Policy</a> | <a href='http://www.apple.com/support/itunes/legal/terms.html'>Terms of Service</a> | <a href='http://www.apple.com/support/itunes/legal/policies.html'>Terms of Sale</a>
148
+ </td>
149
+ </tr>
150
+ </table>
151
+ <table class='hide' width='270' border='0' cellspacing='0' cellpadding='0' align='center' style='margin-top:45px; margin-bottom:15px; max-height: 0px; font-size: 0; display: none;'>
152
+ <tr>
153
+ <td class='hide' style='max-height: 0px; font-size: 0; display: none; height: 1px; background:none; border-top:solid 1px #dddddd; width:648px; margin:0px 0px 0px 0px;'>\u00a0</td>
154
+ </tr>
155
+ <tr>
156
+ <td class='hide' style='line-height: 120%; color:#9f9f9f; font-family: Helvetica, Lucida Grande, Arial, sans-serif; text-align: center; max-height: 0px; font-size: 0; display: none; -webkit-text-size-adjust:none;'><br/>
157
+ <a href='http://www.apple.com/itunes/go/itunesconnect/contactus'>Contact Us</a> | <a href='http://itunesconnect.apple.com'>iTunes Connect</a><br/>1 Infinite Loop, Cupertino, CA 95014
158
+ </td>
159
+ </tr>
160
+ <tr>
161
+ <td class='hide' align='left' style='max-height: 0px; font-size: 0; display: none; line-height: 120%;'>\u00a0</td>
162
+ </tr>
163
+ <tr>
164
+ <td class='hide' style='line-height: 120%; color:#9f9f9f; font-family: Helvetica, Lucida Grande, Arial, sans-serif; text-align: center; max-height: 0px; font-size: 0; display: none; -webkit-text-size-adjust:none;'>
165
+ <a href='http://www.apple.com/legal/privacy/'>Privacy Policy</a> | <a href='http://www.apple.com/support/itunes/legal/terms.html'>Terms of Service</a> | <a href='http://www.apple.com/support/itunes/legal/policies.html'>Terms of Sale</a>
166
+ </td>
167
+ </tr>
168
+ </table>
169
+ </body>
170
+ </html>
@@ -0,0 +1,163 @@
1
+ require 'spec_helper'
2
+
3
+ describe AppleSlice::Email do
4
+
5
+ describe "#review_status" do
6
+ it "should return :rejected if rejected" do
7
+ body = email_data("rejected")
8
+ AppleSlice::Email.new(body).review_status.should == :rejected
9
+ end
10
+
11
+ it "should return :ready_for_sale for that email" do
12
+ body = email_data("ready_for_sale")
13
+ AppleSlice::Email.new(body).review_status.should == :ready_for_sale
14
+ end
15
+
16
+ it "should return correct values" do
17
+ [["Waiting For Upload", :waiting_for_upload],
18
+ ["Waiting For Review", :waiting_for_review],
19
+ ["In Review", :in_review],
20
+ ["Processing for App Store", :processing_for_app_store],
21
+ ["Developer Rejected", :developer_rejected],
22
+ ["Developer Removed From Sale", :developer_removed_from_sale]
23
+ ].each do |string, status|
24
+ body = email_data("status_update", status_string: string)
25
+ AppleSlice::Email.new(body).review_status.should == status
26
+ end
27
+ end
28
+ end
29
+
30
+ describe "#rejected?" do
31
+ it "returns true if rejected" do
32
+ body = email_data("rejected")
33
+ AppleSlice::Email.new(body).rejected?.should == true
34
+ end
35
+
36
+ it "returns false if not rejected" do
37
+ body = email_data("ready_for_sale")
38
+ AppleSlice::Email.new(body).rejected?.should == false
39
+ body = email_data("status_update")
40
+ AppleSlice::Email.new(body).rejected?.should == false
41
+ end
42
+ end
43
+
44
+ describe "#app_sku" do
45
+ it "returns nil if rejected" do
46
+ body = email_data("rejected")
47
+ AppleSlice::Email.new(body).app_sku.should == nil
48
+ end
49
+
50
+ it "works for update emails" do
51
+ body = email_data("status_update", app_sku: "SKU_1000")
52
+ AppleSlice::Email.new(body).app_sku.should == "SKU_1000"
53
+ end
54
+
55
+ it "works for ready for sale emails" do
56
+ body = email_data("ready_for_sale", app_sku: "SKU_1000")
57
+ AppleSlice::Email.new(body).app_sku.should == "SKU_1000"
58
+ end
59
+ end
60
+
61
+ describe "#app_version_number" do
62
+ it "returns nil if rejected" do
63
+ body = email_data("rejected")
64
+ AppleSlice::Email.new(body).app_version_number.should == nil
65
+ end
66
+
67
+ it "works for update emails" do
68
+ body = email_data("status_update", app_version_number: "1.0.5")
69
+ AppleSlice::Email.new(body).app_version_number.should == "1.0.5"
70
+ end
71
+
72
+ it "works for ready for sale emails" do
73
+ body = email_data("ready_for_sale", app_version_number: "1.1.0")
74
+ AppleSlice::Email.new(body).app_version_number.should == "1.1.0"
75
+ end
76
+ end
77
+
78
+ describe "#app_name" do
79
+ it "works if rejected" do
80
+ body = email_data("rejected", app_name: "APP_NAME")
81
+ AppleSlice::Email.new(body).app_name.should == "APP_NAME"
82
+ end
83
+
84
+ it "works for update emails" do
85
+ body = email_data("status_update", app_name: "APP_NAME")
86
+ AppleSlice::Email.new(body).app_name.should == "APP_NAME"
87
+ end
88
+
89
+ it "works for ready for sale emails" do
90
+ body = email_data("ready_for_sale", app_name: "APP_NAME")
91
+ AppleSlice::Email.new(body).app_name.should == "APP_NAME"
92
+ end
93
+ end
94
+
95
+ describe "#app_apple_id" do
96
+ it "works if rejected" do
97
+ body = email_data("rejected", app_name: "APP_NAME", app_apple_id: "REJECT_ID")
98
+ AppleSlice::Email.new(body).app_apple_id.should == "REJECT_ID"
99
+ end
100
+
101
+ it "works for update emails" do
102
+ body = email_data("status_update", app_apple_id: "APP_ID")
103
+ AppleSlice::Email.new(body).app_apple_id.should == "APP_ID"
104
+ end
105
+
106
+ it "works for ready for sale emails" do
107
+ body = email_data("ready_for_sale", app_apple_id: "APP_ID")
108
+ AppleSlice::Email.new(body).app_apple_id.should == "APP_ID"
109
+ end
110
+ end
111
+
112
+ describe "#resolution_center_url" do
113
+ it "works if rejected" do
114
+ url = "https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/da/rejectionReasons?adamId=herpderp"
115
+ body = email_data("rejected", app_name: "APP_NAME", resolution_url: url)
116
+ AppleSlice::Email.new(body).resolution_center_url.should == url
117
+ end
118
+
119
+ it "returns nil for update emails" do
120
+ body = email_data("status_update")
121
+ AppleSlice::Email.new(body).resolution_center_url.should == nil
122
+ end
123
+
124
+ it "returns nil for ready for sale emails" do
125
+ body = email_data("ready_for_sale")
126
+ AppleSlice::Email.new(body).resolution_center_url.should == nil
127
+ end
128
+ end
129
+
130
+ describe "#itunes_url" do
131
+ it "works if rejected" do
132
+ body = email_data("rejected", app_name: "APP_NAME", app_apple_id: "REJECT_ID")
133
+ AppleSlice::Email.new(body).itunes_url.should == (AppleSlice::Email::ITUNES_URL_FORMAT % "REJECT_ID")
134
+ end
135
+
136
+ it "works for update emails" do
137
+ body = email_data("status_update", app_apple_id: "APP_ID")
138
+ AppleSlice::Email.new(body).itunes_url.should == (AppleSlice::Email::ITUNES_URL_FORMAT % "APP_ID")
139
+ end
140
+
141
+ it "works for ready for sale emails" do
142
+ body = email_data("ready_for_sale", app_apple_id: "APP_ID")
143
+ AppleSlice::Email.new(body).itunes_url.should == (AppleSlice::Email::ITUNES_URL_FORMAT % "APP_ID")
144
+ end
145
+ end
146
+
147
+ describe "#scheduled_maintenance?" do
148
+ it "works for correct email" do
149
+ body = email_data("maintenance")
150
+ AppleSlice::Email.new(body).scheduled_maintenance?.should == true
151
+ end
152
+
153
+ it "returns false for other emails" do
154
+ body = email_data("rejected")
155
+ AppleSlice::Email.new(body).scheduled_maintenance?.should == false
156
+ body = email_data("status_update")
157
+ AppleSlice::Email.new(body).scheduled_maintenance?.should == false
158
+ body = email_data("ready_for_sale")
159
+ AppleSlice::Email.new(body).scheduled_maintenance?.should == false
160
+ end
161
+ end
162
+
163
+ end
@@ -0,0 +1,37 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ Bundler.require(:default, :spec)
4
+
5
+ require 'erb'
6
+
7
+ module Helpers
8
+ def project_root
9
+ File.expand_path(File.join(File.dirname(__FILE__), '..'))
10
+ end
11
+
12
+ def specs_root
13
+ File.join(project_root, 'spec')
14
+ end
15
+
16
+ class Context
17
+ def get_binding
18
+ binding()
19
+ end
20
+ end
21
+
22
+ def email_data(file_name, erb_data = {})
23
+ file_name << ".html.erb" unless file_name.end_with?(".html.erb")
24
+ template = IO.read(File.join(specs_root, 'data', file_name))
25
+
26
+ context = Context.new
27
+ erb_data.each do |k, v|
28
+ context.instance_variable_set("@#{k}", v)
29
+ end
30
+ renderer = ERB.new(template)
31
+ renderer.result(context.get_binding)
32
+ end
33
+ end
34
+
35
+ RSpec.configure do |c|
36
+ c.include Helpers
37
+ end
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: appleslice
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Clay Allsopp
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: nokogiri
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.6.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.6.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.5'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description:
56
+ email:
57
+ - clay@usepropeller.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - Gemfile
64
+ - LICENSE
65
+ - README.md
66
+ - Rakefile
67
+ - appleslice.gemspec
68
+ - lib/appleslice.rb
69
+ - lib/appleslice/email.rb
70
+ - lib/appleslice/version.rb
71
+ - spec/data/maintenance.html.erb
72
+ - spec/data/ready_for_sale.html.erb
73
+ - spec/data/rejected.html.erb
74
+ - spec/data/status_update.html.erb
75
+ - spec/email_spec.rb
76
+ - spec/spec_helper.rb
77
+ homepage: https://github.com/usepropeller/appleslice
78
+ licenses:
79
+ - MIT
80
+ metadata: {}
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubyforge_project:
97
+ rubygems_version: 2.0.3
98
+ signing_key:
99
+ specification_version: 4
100
+ summary: Easily parse Apple & iTunes Connect emails
101
+ test_files:
102
+ - spec/data/maintenance.html.erb
103
+ - spec/data/ready_for_sale.html.erb
104
+ - spec/data/rejected.html.erb
105
+ - spec/data/status_update.html.erb
106
+ - spec/email_spec.rb
107
+ - spec/spec_helper.rb
108
+ has_rdoc: