spaceship 0.27.2 → 0.28.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: eb86ecbc3bf6e9f2e5b650b7d9a72a24470d70d1
4
- data.tar.gz: be4aea0f365fd23ca90d35dce63b846f6adf5f1f
3
+ metadata.gz: b42bd9f6a910c25ea6c6ef27d9894f05fd7cc965
4
+ data.tar.gz: cad77851c906d20e2f67795e3c869e69c1f87835
5
5
  SHA512:
6
- metadata.gz: 5ddcb9b20fdd00e0bad724294baff273dd23dabe63b6cfe4beb6fa2818919536478e61794b5d603e26f4a2e8c076e6d3f36ffdfd4e468d4ee8701393676e86ab
7
- data.tar.gz: 72431d334d296d2f1c202da2f2fdd8bb196aa9014b9cc29f559be1b690f7ac31c806eed5399ae48f73db307d5f8cce7728a7a2210f3d5768617996a65acf5997
6
+ metadata.gz: addd2db721db37ec21d77350976a70d060e6276585ea5e2247bc46a020d5486de39458108838fccf5dd3741d678a4fc83c7c8d66c92213b942ca4116a7d5df86
7
+ data.tar.gz: d507f75e1fdd08c9826373b9bf0e401af70bcee1f3a7e6f66db6c9c53ee0845f60ead4b53137465bf5b1133659d5deec55bc8d1b0f758f8ab64561b699ffd472
data/README.md CHANGED
@@ -33,8 +33,9 @@
33
33
  [![Gem](https://img.shields.io/gem/v/spaceship.svg?style=flat)](http://rubygems.org/gems/spaceship)
34
34
  [![Build Status](https://img.shields.io/circleci/project/fastlane/fastlane/master.svg?style=flat)](https://circleci.com/gh/fastlane/fastlane)
35
35
 
36
+ `spaceship` exposes both the Apple Developer Center and the iTunes Connect API. This fast and powerful API powers parts of fastlane, and can be leveraged for more advanced fastlane features. Scripting your Developer Center workflow has never been easier!
36
37
 
37
- Get in contact with the developers on Twitter: [@KrauseFx](https://twitter.com/KrauseFx) and [@snatchev](https://twitter.com/snatchev)
38
+ Get in contact with the creators on Twitter: [@FastlaneTools](https://twitter.com/fastlanetools)
38
39
 
39
40
 
40
41
  -------
@@ -52,8 +53,6 @@ Get in contact with the developers on Twitter: [@KrauseFx](https://twitter.com/K
52
53
 
53
54
  # What's spaceship?
54
55
 
55
- spaceship is a Ruby library that exposes both the Apple Developer Center and the iTunes Connect API. It’s super fast, well tested and supports all of the operations you can do via the browser. Scripting your Developer Center workflow has never been easier!
56
-
57
56
  Up until now, the [fastlane tools](https://fastlane.tools) used web scraping to interact with Apple's web services. With spaceship it is possible to directly access the underlying APIs using a simple HTTP client only.
58
57
 
59
58
  Using spaceship, the execution time of [sigh](https://github.com/fastlane/fastlane/tree/master/sigh) was reduced from over 1 minute to less than 5 seconds.
@@ -32,6 +32,10 @@ module Spaceship
32
32
 
33
33
  attr_accessor :secondary_second_sub_category
34
34
 
35
+ attr_accessor :primary_locale_code
36
+
37
+ attr_accessor :available_primary_locale_codes
38
+
35
39
  attr_mapping(
36
40
  'localizedMetadata.value' => :languages,
37
41
  'primaryCategory.value' => :primary_category,
@@ -39,7 +43,9 @@ module Spaceship
39
43
  'primarySecondSubCategory.value' => :primary_second_sub_category,
40
44
  'secondaryCategory.value' => :secondary_category,
41
45
  'secondaryFirstSubCategory.value' => :secondary_first_sub_category,
42
- 'secondarySecondSubCategory.value' => :secondary_second_sub_category
46
+ 'secondarySecondSubCategory.value' => :secondary_second_sub_category,
47
+ 'primaryLocaleCode.value' => :primary_locale_code,
48
+ 'availablePrimaryLocaleCodes' => :available_primary_locale_codes
43
49
  )
44
50
 
45
51
  class << self
@@ -36,12 +36,42 @@ module Spaceship
36
36
  device_id = result.match(/.*\t.*\t\((.*)\)/)[1]
37
37
  select_device(r, device_id)
38
38
  elsif r.body.kind_of?(Hash) && r.body["phoneNumberVerification"].kind_of?(Hash)
39
- raise "spaceship currently doesn't support the push based 2 step verification, please switch to SMS based 2 factor auth in the mean-time"
39
+ puts "Two Fator Authentication for account '#{self.user}' is enabled"
40
+ handle_two_fator(r)
40
41
  else
41
42
  raise "Invalid 2 step response #{r.body}"
42
43
  end
43
44
  end
44
45
 
46
+ def handle_two_fator(response)
47
+ security_code = response.body["phoneNumberVerification"]["securityCode"]
48
+ # {"length"=>6,
49
+ # "tooManyCodesSent"=>false,
50
+ # "tooManyCodesValidated"=>false,
51
+ # "securityCodeLocked"=>false}
52
+ code_length = security_code["length"]
53
+ code = ask("Please enter the #{code_length} digit code: ")
54
+ puts "Requesting session..."
55
+
56
+ # Send securityCode back to server to get a valid session
57
+ r = request(:post) do |req|
58
+ req.url "https://idmsa.apple.com/appleauth/auth/verify/trusteddevice/securitycode"
59
+ req.headers["Accept"] = "application/json"
60
+ req.headers['Content-Type'] = 'application/json'
61
+ req.headers["scnt"] = @scnt
62
+ req.headers["X-Apple-Id-Session-Id"] = @x_apple_id_session_id
63
+ req.body = { "securityCode" => { "code" => code.to_s } }.to_json
64
+ end
65
+
66
+ # we use `Spaceship::TunesClient.new.handle_itc_response`
67
+ # since this might be from the Dev Portal, but for 2 step
68
+ Spaceship::TunesClient.new.handle_itc_response(r.body)
69
+
70
+ store_session
71
+
72
+ return true
73
+ end
74
+
45
75
  # Only needed for 2 step
46
76
  def load_session_from_file
47
77
  if File.exist?(persistent_cookie_path)
@@ -128,6 +158,12 @@ module Spaceship
128
158
  raise ex
129
159
  end
130
160
 
161
+ store_session
162
+
163
+ return true
164
+ end
165
+
166
+ def store_session
131
167
  # If the request was successful, r.body is actually nil
132
168
  # The previous request will fail if the user isn't on a team
133
169
  # on iTunes Connect, but it still works, so we're good
@@ -150,8 +186,6 @@ module Spaceship
150
186
  # correct DES... cookie
151
187
 
152
188
  self.store_cookie
153
-
154
- return true
155
189
  end
156
190
  end
157
191
  end
@@ -1,4 +1,4 @@
1
1
  module Spaceship
2
- VERSION = "0.27.2".freeze
2
+ VERSION = "0.28.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.27.2
4
+ version: 0.28.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-06-09 00:00:00.000000000 Z
12
+ date: 2016-07-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: credentials_manager
@@ -391,7 +391,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
391
391
  version: '0'
392
392
  requirements: []
393
393
  rubyforge_project:
394
- rubygems_version: 2.4.8
394
+ rubygems_version: 2.5.1
395
395
  signing_key:
396
396
  specification_version: 4
397
397
  summary: Ruby library to access the Apple Dev Center and iTunes Connect