Class: Spaceship::Tunes::Build

Inherits:
TunesBase show all
Defined in:
spaceship/lib/spaceship/tunes/build.rb

Overview

Represents a build which is inside the build train

General metadata collapse

Analytics collapse

Attributes inherited from Base

#client, #raw_data

Analytics collapse

Methods inherited from TunesBase

client

Methods inherited from Base

attr_accessor, attr_mapping, attributes, #attributes, factory, #initialize, #inspect, mapping_module, method_missing, set_client, #to_s

Constructor Details

This class inherits a constructor from Spaceship::Base

Instance Attribute Details

#app_nameString

Returns The name of the app this build is for.

Returns:

  • (String)

    The name of the app this build is for


46
47
48
# File 'spaceship/lib/spaceship/tunes/build.rb', line 46

def app_name
  @app_name
end

#apple_idString

Returns The App identifier of this app, provided by App Store Connect.

Examples:

"1013943394"

Returns:

  • (String)

    The App identifier of this app, provided by App Store Connect


14
15
16
# File 'spaceship/lib/spaceship/tunes/build.rb', line 14

def apple_id
  @apple_id
end

#build_trainSpaceship::Tunes::BuildTrain

Returns A reference to the build train this build is contained in.

Returns:


17
18
19
# File 'spaceship/lib/spaceship/tunes/build.rb', line 17

def build_train
  @build_train
end

#build_versionString

Returns The build version (not the version number), but also is named `build number`.

Returns:

  • (String)

    The build version (not the version number), but also is named `build number`


26
27
28
# File 'spaceship/lib/spaceship/tunes/build.rb', line 26

def build_version
  @build_version
end

#crash_countInteger

Returns Might be nil. The number of crashes of this build.

Returns:

  • (Integer)

    Might be nil. The number of crashes of this build


89
90
91
# File 'spaceship/lib/spaceship/tunes/build.rb', line 89

def crash_count
  @crash_count
end

#external_expiry_dateInteger

Returns : When is the external build going to expire?.

Returns:

  • (Integer)

    : When is the external build going to expire?


55
56
57
# File 'spaceship/lib/spaceship/tunes/build.rb', line 55

def external_expiry_date
  @external_expiry_date
end

#external_install_countInteger

Returns Number of installs for this build that come from external users.

Returns:

  • (Integer)

    Number of installs for this build that come from external users


83
84
85
# File 'spaceship/lib/spaceship/tunes/build.rb', line 83

def external_install_count
  @external_install_count
end

#external_testing_enabledBool (readonly)

Returns Is external beta testing enabled for this train? Only one train can have enabled testing.

Returns:

  • (Bool)

    Is external beta testing enabled for this train? Only one train can have enabled testing.


58
59
60
# File 'spaceship/lib/spaceship/tunes/build.rb', line 58

def external_testing_enabled
  @external_testing_enabled
end

#external_testing_statusString (readonly)

Returns The status of internal testflight testing for this build. One of active, submitForReview, approvedInactive, waiting.

Returns:

  • (String)

    The status of internal testflight testing for this build. One of active, submitForReview, approvedInactive, waiting


64
65
66
# File 'spaceship/lib/spaceship/tunes/build.rb', line 64

def external_testing_status
  @external_testing_status
end

#icon_urlString

Returns URL to the app icon of this build (150x150px).

Returns:

  • (String)

    URL to the app icon of this build (150x150px)


43
44
45
# File 'spaceship/lib/spaceship/tunes/build.rb', line 43

def icon_url
  @icon_url
end

#idInteger

Returns The ID generated by App Store Connect.

Returns:

  • (Integer)

    The ID generated by App Store Connect


20
21
22
# File 'spaceship/lib/spaceship/tunes/build.rb', line 20

def id
  @id
end

#install_countInteger

Returns Number of installs of this build.

Returns:

  • (Integer)

    Number of installs of this build


77
78
79
# File 'spaceship/lib/spaceship/tunes/build.rb', line 77

def install_count
  @install_count
end

#internal_expiry_dateInteger

Returns When is this build going to be invalid.

Returns:

  • (Integer)

    When is this build going to be invalid


52
53
54
# File 'spaceship/lib/spaceship/tunes/build.rb', line 52

def internal_expiry_date
  @internal_expiry_date
end

#internal_install_countInteger

Returns Number of installs for this build that come from internal users.

Returns:

  • (Integer)

    Number of installs for this build that come from internal users


80
81
82
# File 'spaceship/lib/spaceship/tunes/build.rb', line 80

def internal_install_count
  @internal_install_count
end

#internal_testing_enabledBool (readonly)

Returns Is internal beta testing enabled for this train? Only one train can have enabled testing.

Returns:

  • (Bool)

    Is internal beta testing enabled for this train? Only one train can have enabled testing.


61
62
63
# File 'spaceship/lib/spaceship/tunes/build.rb', line 61

def internal_testing_enabled
  @internal_testing_enabled
end

#platformString

Returns The platform of this build (e.g. 'ios').

Returns:

  • (String)

    The platform of this build (e.g. 'ios')


49
50
51
# File 'spaceship/lib/spaceship/tunes/build.rb', line 49

def platform
  @platform
end

#processingBoolean

Returns Is this build currently processing?.

Returns:

  • (Boolean)

    Is this build currently processing?


32
33
34
# File 'spaceship/lib/spaceship/tunes/build.rb', line 32

def processing
  @processing
end

#processing_stateString

Returns The build processing state, may be nil.

Examples:

“invalidBinary”

“processingFailed”

Returns:

  • (String)

    The build processing state, may be nil


37
38
39
# File 'spaceship/lib/spaceship/tunes/build.rb', line 37

def processing_state
  @processing_state
end

#ready_to_installBool

Returns :.

Returns:

  • (Bool)

    :


70
71
72
# File 'spaceship/lib/spaceship/tunes/build.rb', line 70

def ready_to_install
  @ready_to_install
end

#session_countInteger

Returns Might be nil. The number of sessions for this build.

Returns:

  • (Integer)

    Might be nil. The number of sessions for this build


86
87
88
# File 'spaceship/lib/spaceship/tunes/build.rb', line 86

def session_count
  @session_count
end

#train_versionString

Returns The version number (e.g. 1.3).

Returns:

  • (String)

    The version number (e.g. 1.3)


29
30
31
# File 'spaceship/lib/spaceship/tunes/build.rb', line 29

def train_version
  @train_version
end

#upload_dateInteger

Returns The number of ticks since 1970 (e.g. 1413966436000).

Returns:

  • (Integer)

    The number of ticks since 1970 (e.g. 1413966436000)


40
41
42
# File 'spaceship/lib/spaceship/tunes/build.rb', line 40

def upload_date
  @upload_date
end

#validBoolean

Returns:

  • (Boolean)

23
24
25
# File 'spaceship/lib/spaceship/tunes/build.rb', line 23

def valid
  @valid
end

#watch_kit_enabledBool

Returns Does this build support WatchKit?.

Returns:

  • (Bool)

    Does this build support WatchKit?


67
68
69
# File 'spaceship/lib/spaceship/tunes/build.rb', line 67

def watch_kit_enabled
  @watch_kit_enabled
end

Instance Method Details

#cancel_beta_review!Object

This will cancel the review process for this TestFlight build


207
208
209
210
211
212
# File 'spaceship/lib/spaceship/tunes/build.rb', line 207

def cancel_beta_review!
  client.remove_testflight_build_from_review!(app_id: self.apple_id,
                                               train: self.train_version,
                                        build_number: self.build_version,
                                            platform: self.platform)
end

#detailsObject


124
125
126
127
128
129
130
131
# File 'spaceship/lib/spaceship/tunes/build.rb', line 124

def details
  response = client.build_details(app_id: self.apple_id,
                                   train: self.train_version,
                            build_number: self.build_version,
                                platform: self.platform)
  response['apple_id'] = self.apple_id
  BuildDetails.factory(response)
end

#setupObject


117
118
119
120
121
122
# File 'spaceship/lib/spaceship/tunes/build.rb', line 117

def setup
  super

  self.external_expiry_date ||= 0
  self.internal_expiry_date ||= 0
end

#submit_for_beta_review!(metadata) ⇒ Object

This will submit this build for TestFlight beta review Note that iTC will pull a lot of this information from previous builds or the app store information, all of the required values must be set either in this hash or automatically for this to work

Parameters:

  • metadata (Hash)

    A hash containing the following information (keys must be symbols):

     # Required Metadata:
      changelog: "Changelog",
      description: "Your Description",
      feedback_email: "Email Address for Feedback",
      marketing_url: "https://marketing.com",
      first_name: "Felix",
      last_name: "Krause",
      review_email: "Contact email address for Apple",
      phone_number: "0128383383",
      review_notes: "Review notes"
    
    # Optional Metadata:
      privacy_policy_url: nil,
      review_notes: nil,
      review_user_name: nil,
      review_password: nil,
      encryption: false
    


177
178
179
180
181
182
183
184
185
186
187
188
# File 'spaceship/lib/spaceship/tunes/build.rb', line 177

def submit_for_beta_review!()
  parameters = {
    app_id: self.apple_id,
    train: self.train_version,
    build_number: self.build_version,
    platform: self.platform
  }.merge()

  client.submit_testflight_build_for_review!(parameters)

  return parameters
end

#testing_statusString

@examples:

External, Internal, Inactive, Expired

Returns:

  • (String)

    A nicely formatted string about the state of this build


193
194
195
196
197
198
199
200
201
202
203
204
# File 'spaceship/lib/spaceship/tunes/build.rb', line 193

def testing_status
  testing ||= "External" if self.external_testing_enabled
  testing ||= "Internal" if self.internal_testing_enabled

  if Time.at(self.internal_expiry_date / 1000) > Time.now
    testing ||= "Inactive"
  else
    testing = "Expired"
  end

  return testing
end

#update_build_information!(whats_new: nil, description: nil, feedback_email: nil) ⇒ Object


138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'spaceship/lib/spaceship/tunes/build.rb', line 138

def update_build_information!(whats_new: nil,
                              description: nil,
                              feedback_email: nil)
  parameters = {
    app_id: self.apple_id,
    train: self.train_version,
    build_number: self.build_version,
    platform: self.platform
  }.merge({
    whats_new: whats_new,
    description: description,
    feedback_email: feedback_email
  })
  client.update_build_information!(parameters)
end