spaceship 0.34.1 → 0.34.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/spaceship/client.rb +5 -1
- data/lib/spaceship/tunes/tester.rb +52 -0
- data/lib/spaceship/tunes/tunes_client.rb +44 -5
- data/lib/spaceship/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7671f2253b40be6539172dfacf3bd98adf213541
|
4
|
+
data.tar.gz: e25c504495870d130a2e5598b7418673277a2ab8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e41bac0b76bb4a61173ab976d8d36bde5629e1ec2d8cbcec654b996b63e985d333295c09b06d15ff7db6c61719b9396f498dff734e956dba53c8160cb5197d64
|
7
|
+
data.tar.gz: f2e2256e3255400a4c08b24b735ba79e49a6c4c6342218b18ca9dba8be44823ed28a887e11f559a3bab9ab6c57e460b8d97c3c89e52d73e1cc0acc216e4ad082
|
data/lib/spaceship/client.rb
CHANGED
@@ -113,11 +113,15 @@ module Spaceship
|
|
113
113
|
c.use :cookie_jar, jar: @cookie
|
114
114
|
c.adapter Faraday.default_adapter
|
115
115
|
|
116
|
-
if ENV['
|
116
|
+
if ENV['SPACESHIP_DEBUG']
|
117
117
|
# for debugging only
|
118
118
|
# This enables tracking of networking requests using Charles Web Proxy
|
119
119
|
c.proxy "https://127.0.0.1:8888"
|
120
120
|
end
|
121
|
+
|
122
|
+
if ENV["DEBUG"]
|
123
|
+
puts "To run _spaceship_ through a local proxy, use SPACESHIP_DEBUG"
|
124
|
+
end
|
121
125
|
end
|
122
126
|
end
|
123
127
|
|
@@ -188,5 +188,57 @@ module Spaceship
|
|
188
188
|
client.remove_tester_from_app!(self, app_id)
|
189
189
|
end
|
190
190
|
end
|
191
|
+
|
192
|
+
class SandboxTester < TunesBase
|
193
|
+
# @return (String) The email of this tester
|
194
|
+
# @example
|
195
|
+
# "tester@spaceship.com"
|
196
|
+
attr_accessor :email
|
197
|
+
|
198
|
+
# @return (String) The first name of this tester
|
199
|
+
# @example
|
200
|
+
# "Cary"
|
201
|
+
attr_accessor :first_name
|
202
|
+
|
203
|
+
# @return (String) The last name of this tester
|
204
|
+
# @example
|
205
|
+
# "Bennett"
|
206
|
+
attr_accessor :last_name
|
207
|
+
|
208
|
+
# @return (String) The two-letter country code of this tester
|
209
|
+
# @example
|
210
|
+
# "US"
|
211
|
+
attr_accessor :country
|
212
|
+
|
213
|
+
attr_mapping(
|
214
|
+
'emailAddress.value' => :email,
|
215
|
+
'firstName.value' => :first_name,
|
216
|
+
'lastName.value' => :last_name,
|
217
|
+
'storeFront.value' => :country
|
218
|
+
)
|
219
|
+
|
220
|
+
def self.url
|
221
|
+
{
|
222
|
+
index: "ra/users/iap",
|
223
|
+
create: "ra/users/iap/add"
|
224
|
+
}
|
225
|
+
end
|
226
|
+
|
227
|
+
def self.all
|
228
|
+
client.sandbox_testers(self).map { |tester| self.new(tester) }
|
229
|
+
end
|
230
|
+
|
231
|
+
def self.create!(email: nil, password: nil, first_name: 'Test', last_name: 'Test', country: 'US')
|
232
|
+
data = client.create_sandbox_tester!(
|
233
|
+
tester_class: self,
|
234
|
+
email: email,
|
235
|
+
password: password,
|
236
|
+
first_name: first_name,
|
237
|
+
last_name: last_name,
|
238
|
+
country: country
|
239
|
+
)
|
240
|
+
self.new(data)
|
241
|
+
end
|
242
|
+
end
|
191
243
|
end
|
192
244
|
end
|
@@ -141,14 +141,20 @@ module Spaceship
|
|
141
141
|
logger.debug("Request was successful")
|
142
142
|
end
|
143
143
|
|
144
|
-
|
144
|
+
# We pass on the `current_language` so that the error message tells the user
|
145
|
+
# what language the error was caused in
|
146
|
+
handle_response_hash = lambda do |hash, current_language = nil|
|
145
147
|
errors = []
|
146
|
-
if hash.kind_of?
|
148
|
+
if hash.kind_of?(Hash)
|
149
|
+
current_language ||= hash["language"]
|
150
|
+
|
147
151
|
hash.each do |key, value|
|
148
|
-
errors += handle_response_hash.call(value)
|
152
|
+
errors += handle_response_hash.call(value, current_language)
|
149
153
|
|
150
|
-
|
151
|
-
|
154
|
+
next unless key == 'errorKeys' and value.kind_of?(Array) and value.count > 0
|
155
|
+
# Prepend the error with the language so it's easier to understand for the user
|
156
|
+
errors += value.collect do |current_error_message|
|
157
|
+
current_language ? "[#{current_language}]: #{current_error_message}" : current_error_message
|
152
158
|
end
|
153
159
|
end
|
154
160
|
elsif hash.kind_of? Array
|
@@ -817,6 +823,39 @@ module Spaceship
|
|
817
823
|
update_tester_from_app!(tester, app_id, false)
|
818
824
|
end
|
819
825
|
|
826
|
+
#####################################################
|
827
|
+
# @!group Sandbox Testers
|
828
|
+
#####################################################
|
829
|
+
def sandbox_testers(tester_class)
|
830
|
+
url = tester_class.url[:index]
|
831
|
+
r = request(:get, url)
|
832
|
+
parse_response(r, 'data')
|
833
|
+
end
|
834
|
+
|
835
|
+
def create_sandbox_tester!(tester_class: nil, email: nil, password: nil, first_name: nil, last_name: nil, country: nil)
|
836
|
+
url = tester_class.url[:create]
|
837
|
+
r = request(:post) do |req|
|
838
|
+
req.url url
|
839
|
+
req.body = {
|
840
|
+
user: {
|
841
|
+
emailAddress: { value: email },
|
842
|
+
password: { value: password },
|
843
|
+
confirmPassword: { value: password },
|
844
|
+
firstName: { value: first_name },
|
845
|
+
lastName: { value: last_name },
|
846
|
+
storeFront: { value: country },
|
847
|
+
birthDay: { value: 1 },
|
848
|
+
birthMonth: { value: 1 },
|
849
|
+
secretQuestion: { value: 'secret_question' },
|
850
|
+
secretAnswer: { value: 'secret_answer' },
|
851
|
+
sandboxAccount: nil
|
852
|
+
}
|
853
|
+
}.to_json
|
854
|
+
req.headers['Content-Type'] = 'application/json'
|
855
|
+
end
|
856
|
+
parse_response(r, 'data')['user']
|
857
|
+
end
|
858
|
+
|
820
859
|
#####################################################
|
821
860
|
# @!group State History
|
822
861
|
#####################################################
|
data/lib/spaceship/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spaceship
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.34.
|
4
|
+
version: 0.34.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix Krause
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-10-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: credentials_manager
|
@@ -394,7 +394,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
394
394
|
version: '0'
|
395
395
|
requirements: []
|
396
396
|
rubyforge_project:
|
397
|
-
rubygems_version: 2.
|
397
|
+
rubygems_version: 2.4.5.1
|
398
398
|
signing_key:
|
399
399
|
specification_version: 4
|
400
400
|
summary: Ruby library to access the Apple Dev Center and iTunes Connect
|