spaceship 0.35.0 → 0.36.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: f6e196e1baa469a54ac174956340461c7de400ef
4
- data.tar.gz: 6045182579d60750159c0c89770e6d17520cf5f4
3
+ metadata.gz: a7b5189c7d4d7c799d6627a99a2ed50813f2543f
4
+ data.tar.gz: 0616e07763d76c59d9c85bedf0a24b5c1a14f720
5
5
  SHA512:
6
- metadata.gz: b170cd42e3aa6798499273c39084fa7568b8bc0372d037078add1ec088e6873d1b0f94c751753d190976db38b2929ab2c24af6ed9b53f71760b10b1c3331d393
7
- data.tar.gz: bce68dcebd6777dc984e661078a5e0bd4ec11f0746aa6b0d23009739e39593c4cd419f58581db5f48a4545e7807bc93768164d618fd08bdd3334ea6f14a52f95
6
+ metadata.gz: e2123061b94aa2545845a39731d6a5a2dd895b9264124ee1acf12638a9944dc640f0ea9003e4a694a237707084f441a3bd5d16d0ad0a4104aa5d9fe914a8a6d7
7
+ data.tar.gz: aa301f95bfa87dd9bea5506ccaf672bd89433f22cebc6638f5475ed98b66b6c3adf27351be05b7c68edd583ff5c779395c29551b0c66c18957d309c2184b644e
@@ -369,25 +369,6 @@ module Spaceship
369
369
  @csrf_tokens || {}
370
370
  end
371
371
 
372
- private
373
-
374
- def do_login(user, password)
375
- @loggedin = false
376
- ret = send_login_request(user, password) # different in subclasses
377
- @loggedin = true
378
- ret
379
- end
380
-
381
- # Is called from `parse_response` to store the latest csrf_token (if available)
382
- def store_csrf_tokens(response)
383
- if response and response.headers
384
- tokens = response.headers.select { |k, v| %w(csrf csrf_ts).include?(k) }
385
- if tokens and !tokens.empty?
386
- @csrf_tokens = tokens
387
- end
388
- end
389
- end
390
-
391
372
  def request(method, url_or_path = nil, params = nil, headers = {}, &block)
392
373
  headers.merge!(csrf_tokens)
393
374
  headers['User-Agent'] = USER_AGENT
@@ -408,6 +389,40 @@ module Spaceship
408
389
  return response
409
390
  end
410
391
 
392
+ def parse_response(response, expected_key = nil)
393
+ if response.body
394
+ # If we have an `expected_key`, select that from response.body Hash
395
+ # Else, don't.
396
+ content = expected_key ? response.body[expected_key] : response.body
397
+ end
398
+
399
+ if content.nil?
400
+ raise UnexpectedResponse, response.body
401
+ else
402
+ store_csrf_tokens(response)
403
+ content
404
+ end
405
+ end
406
+
407
+ private
408
+
409
+ def do_login(user, password)
410
+ @loggedin = false
411
+ ret = send_login_request(user, password) # different in subclasses
412
+ @loggedin = true
413
+ ret
414
+ end
415
+
416
+ # Is called from `parse_response` to store the latest csrf_token (if available)
417
+ def store_csrf_tokens(response)
418
+ if response and response.headers
419
+ tokens = response.headers.select { |k, v| %w(csrf csrf_ts).include?(k) }
420
+ if tokens and !tokens.empty?
421
+ @csrf_tokens = tokens
422
+ end
423
+ end
424
+ end
425
+
411
426
  def log_request(method, url, params)
412
427
  params_to_log = Hash(params).dup # to also work with nil
413
428
  params_to_log.delete(:accountPassword) # Dev Portal
@@ -442,21 +457,6 @@ module Spaceship
442
457
  end
443
458
  end
444
459
 
445
- def parse_response(response, expected_key = nil)
446
- if response.body
447
- # If we have an `expected_key`, select that from response.body Hash
448
- # Else, don't.
449
- content = expected_key ? response.body[expected_key] : response.body
450
- end
451
-
452
- if content.nil?
453
- raise UnexpectedResponse, response.body
454
- else
455
- store_csrf_tokens(response)
456
- content
457
- end
458
- end
459
-
460
460
  def encode_params(params, headers)
461
461
  params = Faraday::Utils::ParamsHash[params].to_query
462
462
  headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }.merge(headers)
@@ -1,4 +1,4 @@
1
1
  module Spaceship
2
- VERSION = "0.35.0".freeze
2
+ VERSION = "0.36.0".freeze
3
3
  DESCRIPTION = "Ruby library to access the Apple Dev Center and iTunes Connect".freeze
4
4
  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.35.0
4
+ version: 0.36.0
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-10-10 00:00:00.000000000 Z
12
+ date: 2016-10-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: credentials_manager
@@ -400,7 +400,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
400
400
  version: '0'
401
401
  requirements: []
402
402
  rubyforge_project:
403
- rubygems_version: 2.6.6
403
+ rubygems_version: 2.5.1
404
404
  signing_key:
405
405
  specification_version: 4
406
406
  summary: Ruby library to access the Apple Dev Center and iTunes Connect