spaceship 0.22.0 → 0.23.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9dabed49c4d052da742b042c98736c63fafc03b5
4
- data.tar.gz: 40407f493497ce523fd4bdc84ab5924624582e7d
3
+ metadata.gz: a9452203d446ab2eb76810e8ee4a50d7b838ad91
4
+ data.tar.gz: f90ffe947881c20f13fc1186dede47bbeb26d2f2
5
5
  SHA512:
6
- metadata.gz: 2529e7e6f98a626626ce8036a20f94cc18843f79bfbe8d63b118ea2aacded8504d406b34ffd455481d537f15ebae708586e5c5a7cc9b7ff8f399a348790b33bb
7
- data.tar.gz: 119f3f29a9c16a7fbb5ebb6889658621abdf5e061c6674031c3f2508d8f54f6eada1e3879750b7dba87a159cae03bd2c8f0af7b925ecc26d1498f048c790488a
6
+ metadata.gz: 27ee1ad437139635ca1b28356482cd7127c9f4ef314c2822c5554518d1cc18dfba3ccf171eaaf9085609b13d6038a300b104628b13d53d2a857588132d9e4c63
7
+ data.tar.gz: 849de99bac3737816bf33ca79854786bfc5a21d7e57793f6f0f5d4ea69d2a52c520cca5dbd4f7901b53757e388f9700becbf758f2d12646401665216364f7cd9
data/README.md CHANGED
@@ -1,24 +1,24 @@
1
1
  <h3 align="center">
2
- <a href="https://github.com/fastlane/fastlane">
3
- <img src="assets/fastlane.png" width="100" />
2
+ <a href="https://github.com/fastlane/fastlane/tree/master/fastlane">
3
+ <img src="../fastlane/assets/fastlane.png" width="100" />
4
4
  <br />
5
5
  fastlane
6
6
  </a>
7
7
  </h3>
8
8
  <p align="center">
9
- <a href="https://github.com/fastlane/deliver">deliver</a> &bull;
10
- <a href="https://github.com/fastlane/snapshot">snapshot</a> &bull;
11
- <a href="https://github.com/fastlane/frameit">frameit</a> &bull;
12
- <a href="https://github.com/fastlane/pem">pem</a> &bull;
13
- <a href="https://github.com/fastlane/sigh">sigh</a> &bull;
14
- <a href="https://github.com/fastlane/produce">produce</a> &bull;
15
- <a href="https://github.com/fastlane/cert">cert</a> &bull;
9
+ <a href="https://github.com/fastlane/fastlane/tree/master/deliver">deliver</a> &bull;
10
+ <a href="https://github.com/fastlane/fastlane/tree/master/snapshot">snapshot</a> &bull;
11
+ <a href="https://github.com/fastlane/fastlane/tree/master/frameit">frameit</a> &bull;
12
+ <a href="https://github.com/fastlane/fastlane/tree/master/pem">pem</a> &bull;
13
+ <a href="https://github.com/fastlane/fastlane/tree/master/sigh">sigh</a> &bull;
14
+ <a href="https://github.com/fastlane/fastlane/tree/master/produce">produce</a> &bull;
15
+ <a href="https://github.com/fastlane/fastlane/tree/master/cert">cert</a> &bull;
16
16
  <b>spaceship</b> &bull;
17
- <a href="https://github.com/fastlane/pilot">pilot</a> &bull;
17
+ <a href="https://github.com/fastlane/fastlane/tree/master/pilot">pilot</a> &bull;
18
18
  <a href="https://github.com/fastlane/boarding">boarding</a> &bull;
19
- <a href="https://github.com/fastlane/gym">gym</a> &bull;
20
- <a href="https://github.com/fastlane/scan">scan</a> &bull;
21
- <a href="https://github.com/fastlane/match">match</a>
19
+ <a href="https://github.com/fastlane/fastlane/tree/master/gym">gym</a> &bull;
20
+ <a href="https://github.com/fastlane/fastlane/tree/master/scan">scan</a> &bull;
21
+ <a href="https://github.com/fastlane/fastlane/tree/master/match">match</a>
22
22
  </p>
23
23
  -------
24
24
 
@@ -28,10 +28,10 @@
28
28
  -------
29
29
 
30
30
  [![Twitter: @FastlaneTools](https://img.shields.io/badge/contact-@KrauseFx-blue.svg?style=flat)](https://twitter.com/KrauseFx)
31
- [![License](http://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/fastlane/spaceship/blob/master/LICENSE)
31
+ [![License](http://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/fastlane/fastlane/blob/master/spaceship/LICENSE)
32
32
  [![Coverage Status](https://coveralls.io/repos/fastlane/spaceship/badge.svg?branch=master&t=ldL8gg)](https://coveralls.io/r/fastlane/spaceship?branch=master)
33
33
  [![Gem](https://img.shields.io/gem/v/spaceship.svg?style=flat)](http://rubygems.org/gems/spaceship)
34
- [![Build Status](https://img.shields.io/travis/fastlane/spaceship/master.svg?style=flat)](https://travis-ci.org/fastlane/spaceship)
34
+ [![Build Status](https://img.shields.io/circleci/project/fastlane/fastlane/master.svg?style=flat)](https://circleci.com/gh/fastlane/fastlane)
35
35
 
36
36
 
37
37
  Get in contact with the developers on Twitter: [@KrauseFx](https://twitter.com/KrauseFx) and [@snatchev](https://twitter.com/snatchev)
@@ -56,7 +56,7 @@ spaceship is a Ruby library that exposes both the Apple Developer Center and the
56
56
 
57
57
  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
58
 
59
- Using spaceship, the execution time of [sigh](https://github.com/fastlane/sigh) was reduced from over 1 minute to less than 5 seconds.
59
+ 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.
60
60
 
61
61
  spaceship uses a combination of 3 different API endpoints, used by the Apple Developer Portal and Xcode. As no API offers everything we need, spaceship combines all APIs for you. [More details about the APIs](#technical-details).
62
62
 
@@ -102,6 +102,8 @@ To try `spaceship`, just run `spaceship`. It will automatically start the `space
102
102
 
103
103
  ![assets/docs/Playground.png](assets/docs/Playground.png)
104
104
 
105
+ This requires you to install `pry` using `sudo gem install pry`. `pry` is not installed by default, as most [fastlane](https://fastlane.tools) users won't need the `spaceship playground`. You can add the `pry` dependency to your `Gemfile`.
106
+
105
107
  ## Apple Developer Portal API
106
108
 
107
109
  ##### Open [DeveloperPortal.md](docs/DeveloperPortal.md) for code samples
@@ -187,7 +189,7 @@ The initial release was sponsored by [ZeroPush](https://zeropush.com).
187
189
  ##### [Like this tool? Be the first to know about updates and new fastlane tools](https://tinyletter.com/krausefx)
188
190
 
189
191
  # Code of Conduct
190
- Help us keep `fastlane` open and inclusive. Please read and follow our [Code of Conduct](https://github.com/fastlane/code-of-conduct).
192
+ Help us keep `fastlane` open and inclusive. Please read and follow our [Code of Conduct](https://github.com/fastlane/fastlane/blob/master/CODE_OF_CONDUCT.md).
191
193
 
192
194
  # License
193
195
  This project is licensed under the terms of the MIT license. See the LICENSE file.
data/bin/spaceship CHANGED
@@ -1,9 +1,29 @@
1
1
  #!/usr/bin/env ruby
2
2
  $LOAD_PATH.push File.expand_path("../../lib", __FILE__)
3
+ require "colored"
4
+
5
+ # First we have to check if the user has `pry` installed
6
+ # We don't want to add pry as a spaceship dependency, as
7
+ # it shouldn't really be added to production systems
8
+ gem_name = "pry"
9
+ begin
10
+ Gem::Specification.find_by_name(gem_name)
11
+ rescue Gem::LoadError
12
+ puts("Could not find gem '#{gem_name}'".red)
13
+ puts("")
14
+ puts("If you installed spaceship using `sudo gem install spaceship` run")
15
+ puts(" sudo gem install #{gem_name}".yellow)
16
+ puts("to install the missing gem")
17
+ puts("")
18
+ puts("If you use a Gemfile add this to your Gemfile:")
19
+ puts(" gem '#{gem_name}'".yellow)
20
+ puts("and run " + "`bundle install`".yellow)
21
+
22
+ abort
23
+ end
3
24
 
4
25
  require "spaceship"
5
26
  require "pry"
6
- require "colored"
7
27
  require "credentials_manager"
8
28
 
9
29
  def docs
@@ -320,11 +320,9 @@ module Spaceship
320
320
  end
321
321
 
322
322
  # @return (Bool): Is this certificate a push profile for apps?
323
- # rubocop:disable Style/PredicateName
324
323
  def is_push?
325
324
  self.kind_of? PushCertificate
326
325
  end
327
- # rubocop:enable Style/PredicateName
328
326
 
329
327
  # @return (Bool) Is this a Mac profile?
330
328
  def mac?
@@ -176,11 +176,9 @@ module Spaceship
176
176
  end
177
177
 
178
178
  # @return (Bool) Is that version currently available in the App Store?
179
- # rubocop:disable Style/PredicateName
180
179
  def is_live?
181
180
  is_live
182
181
  end
183
- # rubocop:enable Style/PredicateName
184
182
 
185
183
  # Call this method to make sure the given languages are available for this app
186
184
  # You should call this method before accessing the name, description and other localized values
@@ -454,6 +452,10 @@ module Spaceship
454
452
  end
455
453
  end
456
454
 
455
+ def release!
456
+ client.release!(self.application.apple_id, self.version_id)
457
+ end
458
+
457
459
  # These methods takes care of properly parsing values that
458
460
  # are not returned in the right format, e.g. boolean as string
459
461
  def release_on_approval
@@ -281,6 +281,18 @@ module Spaceship
281
281
  true
282
282
  end
283
283
 
284
+ #####################################################
285
+ # @!group release
286
+ #####################################################
287
+
288
+ def release!
289
+ version = self.edit_version
290
+ if version.nil?
291
+ raise "Could not find a valid version to release"
292
+ end
293
+ version.release!
294
+ end
295
+
284
296
  #####################################################
285
297
  # @!group General
286
298
  #####################################################
@@ -0,0 +1,81 @@
1
+ module Spaceship
2
+ module Tunes
3
+ class PricingTier < TunesBase
4
+ # @return (String) Number of the price Tier (e.g. "0" for Tier 0 aka Free)
5
+ attr_accessor :tier_stem
6
+
7
+ # @return (String) Name of the tier (e.g. "Free" for Tier 0)
8
+ attr_accessor :tier_name
9
+
10
+ # @return (Array of Spaceship::Tunes::PricingInfo objects) A list of all prices for the respective countries
11
+ attr_accessor :pricing_info
12
+
13
+ attr_mapping(
14
+ 'tierStem' => :tier_stem,
15
+ 'tierName' => :tier_name
16
+ )
17
+
18
+ class << self
19
+ # Create a new object based on a hash.
20
+ # This is used to create a new object based on the server response.
21
+ def factory(attrs)
22
+ obj = self.new(attrs)
23
+ obj.unfold_pricing_info(attrs['pricingInfo'])
24
+
25
+ return obj
26
+ end
27
+ end
28
+
29
+ def unfold_pricing_info(attrs)
30
+ unfolded_pricing_info = attrs.map { |info| PricingInfo.new(info) }
31
+ instance_variable_set(:@pricing_info, unfolded_pricing_info)
32
+ end
33
+ end
34
+
35
+ class PricingInfo < TunesBase
36
+ # @return (String) name of the country, e.g. "United States"
37
+ attr_accessor :country
38
+
39
+ # @return (String) country code, e.g. "US"
40
+ attr_accessor :country_code
41
+
42
+ # @return (String) currency symbol, e.g. "$"
43
+ attr_accessor :currency_symbol
44
+
45
+ # @return (String) currency code, e.g. "USD"
46
+ attr_accessor :currency_code
47
+
48
+ # @return (Number) net proceedings for the developer
49
+ attr_accessor :wholesale_price
50
+
51
+ # @return (Number) customer price
52
+ attr_accessor :retail_price
53
+
54
+ # @return (String) formatted customer price, e.g. "$0.00"
55
+ attr_accessor :f_retail_price
56
+
57
+ # @return (String) formatted net proceedings, e.g. "$0.00"
58
+ attr_accessor :f_wholesale_price
59
+
60
+ attr_mapping(
61
+ 'country' => :country,
62
+ 'countryCode' => :country_code,
63
+ 'currencySymbol' => :currency_symbol,
64
+ 'currencyCode' => :currency_code,
65
+ 'wholesalePrice' => :wholesale_price,
66
+ 'retailPrice' => :retail_price,
67
+ 'fRetailPrice' => :f_retail_price,
68
+ 'fWholesalePrice' => :f_wholesale_price
69
+ )
70
+
71
+ class << self
72
+ # Create a new object based on a hash.
73
+ # This is used to create a new object based on the server response.
74
+ def factory(attrs)
75
+ obj = self.new(attrs)
76
+ return obj
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -21,6 +21,7 @@ require 'spaceship/tunes/device_type'
21
21
  require 'spaceship/tunes/app_trailer'
22
22
  require 'spaceship/tunes/tester'
23
23
  require 'spaceship/tunes/app_details'
24
+ require 'spaceship/tunes/pricing_tier'
24
25
 
25
26
  # File Uploads
26
27
  require 'spaceship/du/utilities'
@@ -405,6 +405,33 @@ module Spaceship
405
405
  end
406
406
  end
407
407
 
408
+ # Returns an array of all available pricing tiers
409
+ #
410
+ # @note Although this information is publicly available, the current spaceship implementation requires you to have a logged in client to access it
411
+ #
412
+ # @return [Array] the PricingTier objects (Spaceship::Tunes::PricingTier)
413
+ # [{
414
+ # "tierStem": "0",
415
+ # "tierName": "Free",
416
+ # "pricingInfo": [{
417
+ # "country": "United States",
418
+ # "countryCode": "US",
419
+ # "currencySymbol": "$",
420
+ # "currencyCode": "USD",
421
+ # "wholesalePrice": 0.0,
422
+ # "retailPrice": 0.0,
423
+ # "fRetailPrice": "$0.00",
424
+ # "fWholesalePrice": "$0.00"
425
+ # }, {
426
+ # ...
427
+ # }, {
428
+ # ...
429
+ def pricing_tiers
430
+ r = request(:get, 'ra/apps/pricing/matrix')
431
+ data = parse_response(r, 'data')['pricingTiers']
432
+ data.map { |tier| Spaceship::Tunes::PricingTier.factory(tier) }
433
+ end
434
+
408
435
  # An array of supported countries
409
436
  # [{
410
437
  # "code": "AL",
@@ -703,6 +730,24 @@ module Spaceship
703
730
  parse_response(r, 'data')
704
731
  end
705
732
 
733
+ #####################################################
734
+ # @!group release
735
+ #####################################################
736
+
737
+ def release!(app_id, version)
738
+ raise "app_id is required" unless app_id
739
+ raise "version is required" unless version
740
+
741
+ r = request(:post) do |req|
742
+ req.url "ra/apps/#{app_id}/versions/#{version}/releaseToStore"
743
+ req.headers['Content-Type'] = 'application/json'
744
+ req.body = app_id.to_s
745
+ end
746
+
747
+ handle_itc_response(r.body)
748
+ parse_response(r, 'data')
749
+ end
750
+
706
751
  #####################################################
707
752
  # @!group Testers
708
753
  #####################################################
@@ -1,3 +1,3 @@
1
1
  module Spaceship
2
- VERSION = "0.22.0"
2
+ VERSION = "0.23.0"
3
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.22.0
4
+ version: 0.23.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-03-03 00:00:00.000000000 Z
12
+ date: 2016-03-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: credentials_manager
@@ -110,7 +110,7 @@ dependencies:
110
110
  - !ruby/object:Gem::Version
111
111
  version: '1.6'
112
112
  - !ruby/object:Gem::Dependency
113
- name: pry
113
+ name: colored
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
116
  - - ">="
@@ -124,13 +124,13 @@ dependencies:
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
126
  - !ruby/object:Gem::Dependency
127
- name: colored
127
+ name: pry
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - - ">="
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
- type: :runtime
133
+ type: :development
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
@@ -301,6 +301,7 @@ files:
301
301
  - lib/spaceship/tunes/device_type.rb
302
302
  - lib/spaceship/tunes/language_converter.rb
303
303
  - lib/spaceship/tunes/language_item.rb
304
+ - lib/spaceship/tunes/pricing_tier.rb
304
305
  - lib/spaceship/tunes/processing_build.rb
305
306
  - lib/spaceship/tunes/spaceship.rb
306
307
  - lib/spaceship/tunes/tester.rb
@@ -331,7 +332,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
331
332
  version: '0'
332
333
  requirements: []
333
334
  rubyforge_project:
334
- rubygems_version: 2.4.0
335
+ rubygems_version: 2.5.1
335
336
  signing_key:
336
337
  specification_version: 4
337
338
  summary: Because you would rather spend your time building stuff than fighting provisioning