spaceship 0.3.4 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,7 @@ module Spaceship
17
17
  def login_url
18
18
  cache_path = "/tmp/spaceship_itc_login_url.txt"
19
19
  begin
20
- cached = File.read(cache_path)
20
+ cached = File.read(cache_path)
21
21
  rescue Errno::ENOENT
22
22
  end
23
23
  return cached if cached
@@ -61,7 +61,7 @@ module Spaceship
61
61
  # User Credentials are wrong
62
62
  raise InvalidUserCredentialsError.new(response)
63
63
  end
64
-
64
+
65
65
  return @client
66
66
  else
67
67
  # User Credentials are wrong
@@ -71,30 +71,30 @@ module Spaceship
71
71
 
72
72
  def handle_itc_response(raw)
73
73
  return unless raw
74
- return unless raw.kind_of?Hash
74
+ return unless raw.kind_of? Hash
75
75
 
76
76
  data = raw['data'] || raw # sometimes it's with data, sometimes it isn't
77
-
77
+
78
78
  if data.fetch('sectionErrorKeys', []).count == 0 and
79
- data.fetch('sectionInfoKeys', []).count == 0 and
79
+ data.fetch('sectionInfoKeys', []).count == 0 and
80
80
  data.fetch('sectionWarningKeys', []).count == 0
81
-
81
+
82
82
  logger.debug("Request was successful")
83
83
  end
84
84
 
85
- def handle_response_hash(hash)
85
+ handle_response_hash = lambda do |hash|
86
86
  errors = []
87
- if hash.kind_of?Hash
87
+ if hash.kind_of? Hash
88
88
  hash.each do |key, value|
89
- errors = errors + handle_response_hash(value)
89
+ errors = errors + handle_response_hash.call(value)
90
90
 
91
- if key == 'errorKeys' and value.kind_of?Array and value.count > 0
91
+ if key == 'errorKeys' and value.kind_of? Array and value.count > 0
92
92
  errors = errors + value
93
93
  end
94
94
  end
95
- elsif hash.kind_of?Array
95
+ elsif hash.kind_of? Array
96
96
  hash.each do |value|
97
- errors = errors + handle_response_hash(value)
97
+ errors = errors + handle_response_hash.call(value)
98
98
  end
99
99
  else
100
100
  # We don't care about simple values
@@ -102,7 +102,7 @@ module Spaceship
102
102
  return errors
103
103
  end
104
104
 
105
- errors = handle_response_hash(data)
105
+ errors = handle_response_hash.call(data)
106
106
  errors = errors + data.fetch('sectionErrorKeys') if data['sectionErrorKeys']
107
107
 
108
108
  # Sometimes there is a different kind of error in the JSON response
@@ -120,7 +120,6 @@ module Spaceship
120
120
  return data
121
121
  end
122
122
 
123
-
124
123
  #####################################################
125
124
  # @!group Applications
126
125
  #####################################################
@@ -131,14 +130,14 @@ module Spaceship
131
130
  end
132
131
 
133
132
  # Creates a new application on iTunes Connect
134
- # @param name (String): The name of your app as it will appear on the App Store.
133
+ # @param name (String): The name of your app as it will appear on the App Store.
135
134
  # This can't be longer than 255 characters.
136
- # @param primary_language (String): If localized app information isn't available in an
135
+ # @param primary_language (String): If localized app information isn't available in an
137
136
  # App Store territory, the information from your primary language will be used instead.
138
- # @param version (String): The version number is shown on the App Store and should
137
+ # @param version (String): The version number is shown on the App Store and should
139
138
  # match the one you used in Xcode.
140
139
  # @param sku (String): A unique ID for your app that is not visible on the App Store.
141
- # @param bundle_id (String): The bundle ID must match the one you used in Xcode. It
140
+ # @param bundle_id (String): The bundle ID must match the one you used in Xcode. It
142
141
  # can't be changed after you submit your first build.
143
142
  def create_application!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil)
144
143
  # First, we need to fetch the data from Apple, which we then modify with the user's values
@@ -160,7 +159,7 @@ module Spaceship
160
159
  req.body = data.to_json
161
160
  req.headers['Content-Type'] = 'application/json'
162
161
  end
163
-
162
+
164
163
  data = parse_response(r, 'data')
165
164
  handle_itc_response(data)
166
165
  end
@@ -203,7 +202,7 @@ module Spaceship
203
202
  req.body = data.to_json
204
203
  req.headers['Content-Type'] = 'application/json'
205
204
  end
206
-
205
+
207
206
  handle_itc_response(r.body)
208
207
  end
209
208
 
@@ -239,10 +238,10 @@ module Spaceship
239
238
  handle_itc_response(r.body)
240
239
  end
241
240
 
242
- def submit_testflight_build_for_review!(# Required:
243
- app_id: nil,
244
- train: nil,
245
- build_number: nil,
241
+ def submit_testflight_build_for_review!( # Required:
242
+ app_id: nil,
243
+ train: nil,
244
+ build_number: nil,
246
245
  cancel_other_submissions: false,
247
246
 
248
247
  # Required Metadata:
@@ -271,7 +270,7 @@ module Spaceship
271
270
 
272
271
  build_info = r.body['data']
273
272
  # Now fill in the values provided by the user
274
-
273
+
275
274
  # First the localised values:
276
275
  build_info['testInfo']['details'].each do |current|
277
276
  current['whatsNew']['value'] = changelog
@@ -310,11 +309,11 @@ module Spaceship
310
309
  handle_itc_response(r.body)
311
310
  end
312
311
  end
313
-
312
+
314
313
  #####################################################
315
314
  # @!group Submit for Review
316
315
  #####################################################
317
-
316
+
318
317
  def send_app_submission(app_id, data, stage)
319
318
  raise "app_id is required" unless app_id
320
319
 
@@ -323,7 +322,7 @@ module Spaceship
323
322
  req.body = data.to_json
324
323
  req.headers['Content-Type'] = 'application/json'
325
324
  end
326
-
325
+
327
326
  handle_itc_response(r.body)
328
327
  parse_response(r, 'data')
329
328
  end
@@ -337,20 +336,20 @@ module Spaceship
337
336
  parse_response(r, 'data')['testers']
338
337
  end
339
338
 
340
- def testers_by_app(tester, app_id)
339
+ def testers_by_app(tester, app_id)
341
340
  url = tester.url(app_id)[:index_by_app]
342
341
  r = request(:get, url)
343
342
  parse_response(r, 'data')['users']
344
343
  end
345
344
 
346
- def create_tester!(tester: nil, email: nil, first_name: nil, last_name: nil)
345
+ def create_tester!(tester: nil, email: nil, first_name: nil, last_name: nil)
347
346
  url = tester.url[:create]
348
347
  raise "Action not provided for this tester type." unless url
349
348
 
350
349
  tester_data = {
351
350
  emailAddress: {
352
351
  value: email
353
- },
352
+ },
354
353
  firstName: {
355
354
  value: first_name
356
355
  },
@@ -382,7 +381,7 @@ module Spaceship
382
381
  {
383
382
  emailAddress: {
384
383
  value: tester.email
385
- },
384
+ },
386
385
  firstName: {
387
386
  value: tester.first_name
388
387
  },
@@ -415,36 +414,37 @@ module Spaceship
415
414
  update_tester_from_app!(tester, app_id, false)
416
415
  end
417
416
 
418
- private
419
- def update_tester_from_app!(tester, app_id, testing)
420
- url = tester.class.url(app_id)[:update_by_app]
421
- data = {
422
- users: [
423
- {
424
- emailAddress: {
425
- value: tester.email
426
- },
427
- firstName: {
428
- value: tester.first_name
429
- },
430
- lastName: {
431
- value: tester.last_name
432
- },
433
- testing: {
434
- value: testing
435
- }
417
+ private
418
+
419
+ def update_tester_from_app!(tester, app_id, testing)
420
+ url = tester.class.url(app_id)[:update_by_app]
421
+ data = {
422
+ users: [
423
+ {
424
+ emailAddress: {
425
+ value: tester.email
426
+ },
427
+ firstName: {
428
+ value: tester.first_name
429
+ },
430
+ lastName: {
431
+ value: tester.last_name
432
+ },
433
+ testing: {
434
+ value: testing
436
435
  }
437
- ]
438
- }
436
+ }
437
+ ]
438
+ }
439
439
 
440
- r = request(:post) do |req|
441
- req.url url
442
- req.body = data.to_json
443
- req.headers['Content-Type'] = 'application/json'
444
- end
445
-
446
- data = parse_response(r, 'data')
447
- handle_itc_response(data)
440
+ r = request(:post) do |req|
441
+ req.url url
442
+ req.body = data.to_json
443
+ req.headers['Content-Type'] = 'application/json'
448
444
  end
445
+
446
+ data = parse_response(r, 'data')
447
+ handle_itc_response(data)
448
+ end
449
449
  end
450
- end
450
+ end
data/lib/spaceship/ui.rb CHANGED
@@ -4,7 +4,6 @@ paths.each do |file|
4
4
  require file
5
5
  end
6
6
 
7
-
8
7
  module Spaceship
9
8
  class Client
10
9
  # Public getter for all UI related code
@@ -25,4 +24,4 @@ module Spaceship
25
24
  end
26
25
  end
27
26
  end
28
- end
27
+ end
@@ -1,3 +1,3 @@
1
1
  module Spaceship
2
- VERSION = "0.3.4"
3
- end
2
+ VERSION = "0.4.0"
3
+ end
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.3.4
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Natchev
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-07-30 00:00:00.000000000 Z
12
+ date: 2015-08-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: credentials_manager
@@ -193,6 +193,20 @@ dependencies:
193
193
  - - ">="
194
194
  - !ruby/object:Gem::Version
195
195
  version: '0'
196
+ - !ruby/object:Gem::Dependency
197
+ name: rubocop
198
+ requirement: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - "~>"
201
+ - !ruby/object:Gem::Version
202
+ version: 0.32.1
203
+ type: :development
204
+ prerelease: false
205
+ version_requirements: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - "~>"
208
+ - !ruby/object:Gem::Version
209
+ version: 0.32.1
196
210
  description: Because you would rather spend your time building stuff than fighting
197
211
  provisioning
198
212
  email:
@@ -213,6 +227,8 @@ files:
213
227
  - lib/spaceship/helper/plist_middleware.rb
214
228
  - lib/spaceship/launcher.rb
215
229
  - lib/spaceship/portal/app.rb
230
+ - lib/spaceship/portal/app_group.rb
231
+ - lib/spaceship/portal/app_service.rb
216
232
  - lib/spaceship/portal/certificate.rb
217
233
  - lib/spaceship/portal/device.rb
218
234
  - lib/spaceship/portal/portal.rb