fastlane 2.96.0.beta.20180517050058 → 2.96.0.beta.20180518050116

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: 21e67eb4419310790fe14bff2a0b517f17863273
4
- data.tar.gz: ad3370950fd3f80da1b4954d0d1944ffacbe0730
3
+ metadata.gz: 38cda5fadcfdb932a75e5d017956f66075ef68be
4
+ data.tar.gz: 14e384a8154d23e7e6b9d17417ce3698d7fd66b4
5
5
  SHA512:
6
- metadata.gz: dfd11a5b04ee7b195802c1d37b05312167499dcfd6e033d8a1674c12ff6d3e8ba69217fd7497d212b24bafbf1d5897a70f65a15fa189756c1904ad89a899bb05
7
- data.tar.gz: 73aad4e4fd964a92e3e5ec69a0f35c6870e16b633efd29b6d27073ddb53ef5c4fa04919c74ea9e521e9a4a750a00734046c6063c04460bc7fd1647a758a1e024
6
+ metadata.gz: c46071ed6a0d42cb2a36dccd0ea1c5ecb2993d79fa3b9100039e6a1702fa36a242b987dfe76d47e04025b06791f5336c5c58290605d307caead7a2dfaf7f8b3e
7
+ data.tar.gz: ea9c3b15af9c7ebe447815ea93946203973a63a304aeda1dc6d5521da2ced547fe35826abb9be989761c9c6c33c172fbbd4aedb2805287ef05275bfc117a8a10
@@ -60,7 +60,7 @@ module Fastlane
60
60
 
61
61
  def self.create_request(uri, params)
62
62
  if params[:url]
63
- req = Net::HTTP::Post.new(uri.request_uri, initheader: { 'Content-Type' => 'application/json' })
63
+ req = Net::HTTP::Post.new(uri.request_uri, { 'Content-Type' => 'application/json' })
64
64
  req.body = JSON.generate(params)
65
65
  else
66
66
  req = Net::HTTP::Post::Multipart.new(uri.path, params)
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
- VERSION = '2.96.0.beta.20180517050058'.freeze
2
+ VERSION = '2.96.0.beta.20180518050116'.freeze
3
3
  DESCRIPTION = "The easiest way to automate beta deployments and releases for your iOS and Android apps".freeze
4
4
  MINIMUM_XCODE_RELEASE = "7.0".freeze
5
5
  RUBOCOP_REQUIREMENT = '0.49.1'.freeze
@@ -1,5 +1,5 @@
1
1
  require_relative 'territory'
2
-
2
+ require_relative 'b2b_user'
3
3
  module Spaceship
4
4
  module Tunes
5
5
  class Availability < TunesBase
@@ -15,13 +15,29 @@ module Spaceship
15
15
  # @return (String) App available date in format of "YYYY-MM-DD"
16
16
  attr_accessor :app_available_date
17
17
 
18
+ # @return (Bool) app enabled for b2b users
19
+ attr_accessor :b2b_app_enabled
20
+
21
+ # @return (Bool) app enabled for educational discount
22
+ attr_accessor :educational_discount
23
+
24
+ # @return (Bool) b2b available for distribution
25
+ attr_accessor :b2b_unavailable
26
+
27
+ # @return (Array of Spaceship::Tunes::B2bUser objects) A list of users set by user - if not
28
+ # then the b2b user list that is currently set
29
+ attr_accessor :b2b_users
30
+
18
31
  attr_mapping(
19
32
  'theWorld' => :include_future_territories,
20
33
  'preOrder.clearedForPreOrder.value' => :cleared_for_preorder,
21
- 'preOrder.appAvailableDate.value' => :app_available_date
34
+ 'preOrder.appAvailableDate.value' => :app_available_date,
35
+ 'b2BAppFlagDisabled' => :b2b_unavailable
22
36
  )
23
37
 
24
38
  # Create a new object based on a set of territories.
39
+ # This will override any values already set for cleared_for_preorder, app_available_date, b2b_unavailable,
40
+ # b2b_app_enabled, and educational_discount
25
41
  # @param territories (Array of String or Spaceship::Tunes::Territory objects): A list of the territories
26
42
  # @param params (Hash): Optional parameters (include_future_territories (Bool, default: true) Are future territories included?)
27
43
  def self.from_territories(territories = [], params = {})
@@ -51,6 +67,9 @@ module Spaceship
51
67
  obj.include_future_territories = params.fetch(:include_future_territories, true)
52
68
  obj.cleared_for_preorder = params.fetch(:cleared_for_preorder, false)
53
69
  obj.app_available_date = params.fetch(:app_available_date, nil)
70
+ obj.b2b_unavailable = params.fetch(:b2b_unavailable, false)
71
+ obj.b2b_app_enabled = params.fetch(:b2b_app_enabled, false)
72
+ obj.educational_discount = params.fetch(:educational_discount, true)
54
73
  return obj
55
74
  end
56
75
 
@@ -58,9 +77,40 @@ module Spaceship
58
77
  @territories ||= raw_data['countries'].map { |info| Territory.new(info) }
59
78
  end
60
79
 
80
+ def b2b_users
81
+ @b2b_users ||= raw_data['b2bUsers'].map { |user| B2bUser.new(user) }
82
+ end
83
+
84
+ def b2b_app_enabled
85
+ @b2b_app_enabled.nil? ? raw_data['b2bAppEnabled'] : @b2b_app_enabled
86
+ end
87
+
88
+ def educational_discount
89
+ @educational_discount.nil? ? raw_data['educationalDiscount'] : @educational_discount
90
+ end
91
+
61
92
  def cleared_for_preorder
62
93
  super || false
63
94
  end
95
+
96
+ # Sets `b2b_app_enabled` to true and `educational_discount` to false
97
+ # Requires users to be added with `add_b2b_users` otherwise `update_availability` will error
98
+ def enable_b2b_app!
99
+ raise "Not possible to enable b2b on this app" if b2b_unavailable
100
+ @b2b_app_enabled = true
101
+ # need to set the educational discount to false
102
+ @educational_discount = false
103
+ self
104
+ end
105
+
106
+ # Adds users for b2b enabled apps
107
+ def add_b2b_users(user_list = [])
108
+ raise "Cannot add b2b users if b2b is not enabled" unless b2b_app_enabled
109
+ @b2b_users = user_list.map do |user|
110
+ B2bUser.from_username(user)
111
+ end
112
+ self
113
+ end
64
114
  end
65
115
  end
66
116
  end
@@ -0,0 +1,25 @@
1
+ require_relative 'tunes_base'
2
+ module Spaceship
3
+ module Tunes
4
+ class B2bUser < TunesBase
5
+ # @return (Bool) add the user to b2b list
6
+ attr_accessor :add
7
+
8
+ # @return (Bool) delete the user to b2b list
9
+ attr_accessor :delete
10
+
11
+ # @return (String) b2b username
12
+ attr_accessor :ds_username
13
+
14
+ attr_mapping(
15
+ 'value.add' => :add,
16
+ 'value.delete' => :delete,
17
+ 'value.dsUsername' => :ds_username
18
+ )
19
+
20
+ def self.from_username(username)
21
+ self.new({ 'value' => { 'add' => true, 'delete' => false, 'dsUsername' => username } })
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,5 +1,4 @@
1
1
  require "securerandom"
2
-
3
2
  require_relative '../client'
4
3
  require_relative '../du/du_client'
5
4
  require_relative '../du/upload_file'
@@ -11,7 +10,6 @@ require_relative 'iap_subscription_pricing_tier'
11
10
  require_relative 'pricing_tier'
12
11
  require_relative 'territory'
13
12
  require_relative 'user_detail'
14
-
15
13
  module Spaceship
16
14
  # rubocop:disable Metrics/ClassLength
17
15
  class TunesClient < Spaceship::Client
@@ -617,8 +615,11 @@ module Spaceship
617
615
  # API will error out if cleared_for_preorder is false and app_available_date has a date
618
616
  cleared_for_preorder = availability.cleared_for_preorder
619
617
  app_available_date = cleared_for_preorder ? availability.app_available_date : nil
618
+ data["b2bAppEnabled"] = availability.b2b_app_enabled
619
+ data["educationalDiscount"] = availability.educational_discount
620
620
  data["preOrder"]["clearedForPreOrder"] = { "value" => cleared_for_preorder, "isEditable" => true, "isRequired" => true, "errorKeys" => nil }
621
621
  data["preOrder"]["appAvailableDate"] = { "value" => app_available_date, "isEditable" => true, "isRequired" => true, "errorKeys" => nil }
622
+ data["b2bUsers"] = availability.b2b_app_enabled ? availability.b2b_users.map { |user| { "value" => { "add" => user.add, "delete" => user.delete, "dsUsername" => user.ds_username } } } : []
622
623
 
623
624
  # send the changes back to Apple
624
625
  r = request(:post) do |req|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.96.0.beta.20180517050058
4
+ version: 2.96.0.beta.20180518050116
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Natchev
@@ -27,7 +27,7 @@ authors:
27
27
  autorequire:
28
28
  bindir: bin
29
29
  cert_chain: []
30
- date: 2018-05-17 00:00:00.000000000 Z
30
+ date: 2018-05-18 00:00:00.000000000 Z
31
31
  dependencies:
32
32
  - !ruby/object:Gem::Dependency
33
33
  name: slack-notifier
@@ -1598,6 +1598,7 @@ files:
1598
1598
  - spaceship/lib/spaceship/tunes/app_version_states_history.rb
1599
1599
  - spaceship/lib/spaceship/tunes/application.rb
1600
1600
  - spaceship/lib/spaceship/tunes/availability.rb
1601
+ - spaceship/lib/spaceship/tunes/b2b_user.rb
1601
1602
  - spaceship/lib/spaceship/tunes/build.rb
1602
1603
  - spaceship/lib/spaceship/tunes/build_details.rb
1603
1604
  - spaceship/lib/spaceship/tunes/build_train.rb
@@ -1651,24 +1652,24 @@ metadata:
1651
1652
  post_install_message:
1652
1653
  rdoc_options: []
1653
1654
  require_paths:
1654
- - fastlane/lib
1655
- - frameit/lib
1655
+ - gym/lib
1656
1656
  - credentials_manager/lib
1657
- - scan/lib
1658
- - pilot/lib
1659
1657
  - cert/lib
1660
- - snapshot/lib
1661
- - deliver/lib
1658
+ - fastlane/lib
1662
1659
  - precheck/lib
1663
- - produce/lib
1664
- - gym/lib
1665
- - pem/lib
1666
- - sigh/lib
1660
+ - screengrab/lib
1667
1661
  - match/lib
1662
+ - produce/lib
1668
1663
  - spaceship/lib
1669
- - fastlane_core/lib
1670
- - screengrab/lib
1664
+ - deliver/lib
1665
+ - pilot/lib
1666
+ - snapshot/lib
1667
+ - sigh/lib
1668
+ - pem/lib
1669
+ - frameit/lib
1670
+ - scan/lib
1671
1671
  - supply/lib
1672
+ - fastlane_core/lib
1672
1673
  required_ruby_version: !ruby/object:Gem::Requirement
1673
1674
  requirements:
1674
1675
  - - ">="