Class: Spaceship::Tunes::Build

Inherits:
TunesBase show all
Defined in:
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, #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



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

def app_name
  @app_name
end

#apple_idString

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

Examples:

"1013943394"


12
13
14
# File 'lib/spaceship/tunes/build.rb', line 12

def apple_id
  @apple_id
end

#build_trainSpaceship::Tunes::BuildTrain



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

def build_train
  @build_train
end

#build_versionString



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

def build_version
  @build_version
end

#crash_countInteger



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

def crash_count
  @crash_count
end

#external_expiry_dateInteger



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

def external_expiry_date
  @external_expiry_date
end

#external_install_countInteger



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

def external_install_count
  @external_install_count
end

#external_testing_enabledBool (readonly)



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

def external_testing_enabled
  @external_testing_enabled
end

#external_testing_statusString (readonly)



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

def external_testing_status
  @external_testing_status
end

#icon_urlString



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

def icon_url
  @icon_url
end

#idInteger



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

def id
  @id
end

#install_countInteger



75
76
77
# File 'lib/spaceship/tunes/build.rb', line 75

def install_count
  @install_count
end

#internal_expiry_dateInteger



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

def internal_expiry_date
  @internal_expiry_date
end

#internal_install_countInteger



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

def internal_install_count
  @internal_install_count
end

#internal_testing_enabledBool (readonly)



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

def internal_testing_enabled
  @internal_testing_enabled
end

#platformString



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

def platform
  @platform
end

#processingBoolean



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

def processing
  @processing
end

#processing_stateString

Returns The build processing state, may be nil.

Examples:

“invalidBinary”


“processingFailed”




35
36
37
# File 'lib/spaceship/tunes/build.rb', line 35

def processing_state
  @processing_state
end

#ready_to_installBool



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

def ready_to_install
  @ready_to_install
end

#session_countInteger



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

def session_count
  @session_count
end

#train_versionString



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

def train_version
  @train_version
end

#upload_dateInteger



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

def upload_date
  @upload_date
end

#validBoolean



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

def valid
  @valid
end

#watch_kit_enabledBool



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

def watch_kit_enabled
  @watch_kit_enabled
end

Class Method Details

.factory(attrs) ⇒ Object

Create a new object based on a hash. This is used to create a new object based on the server response.



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

def factory(attrs)
  self.new(attrs)
end

Instance Method Details

#cancel_beta_review!Object

This will cancel the review process for this TestFlight build



212
213
214
215
216
217
# File 'lib/spaceship/tunes/build.rb', line 212

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



130
131
132
133
134
135
136
# File 'lib/spaceship/tunes/build.rb', line 130

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

#setupObject



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

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



182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/spaceship/tunes/build.rb', line 182

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


198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/spaceship/tunes/build.rb', line 198

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



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/spaceship/tunes/build.rb', line 143

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