Class: Spaceship::TunesClient

Inherits:
Client
  • Object
show all
Defined in:
lib/spaceship/tunes/tunes_client.rb

Overview

rubocop:disable Metrics/ClassLength

Defined Under Namespace

Classes: ITunesConnectError

Constant Summary

Constants inherited from Client

Client::PROTOCOL_VERSION

Instance Attribute Summary collapse

Attributes inherited from Client

#client, #cookie, #logger, #user

Init and Login collapse

Applications collapse

AppVersions collapse

Pricing collapse

App Icons collapse

CandiateBuilds collapse

Build Trains collapse

Submit for Review collapse

Testers collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Client

#UI, login, #login, #page_size, #paging, #session?, #with_retry

Constructor Details

#initializeTunesClient

Returns a new instance of TunesClient.



10
11
12
13
14
# File 'lib/spaceship/tunes/tunes_client.rb', line 10

def initialize
  super

  @du_client = DUClient.new
end

Instance Attribute Details

#du_clientObject (readonly)

Returns the value of attribute du_client.



8
9
10
# File 'lib/spaceship/tunes/tunes_client.rb', line 8

def du_client
  @du_client
end

Class Method Details

.hostnameObject



36
37
38
# File 'lib/spaceship/tunes/tunes_client.rb', line 36

def self.hostname
  "https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/"
end

.video_preview_resolution_for(device, is_portrait) ⇒ Object

trailer preview screenshots are required to have a specific size



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/spaceship/tunes/tunes_client.rb', line 18

def video_preview_resolution_for(device, is_portrait)
  resolutions = {
      'iphone4' => [1136, 640],
      'iphone6' => [1334, 750],
      'iphone6Plus' => [2208, 1242],
      'ipad' => [1024, 768]
  }

  r = resolutions[device]
  r = [r[1], r[0]] if is_portrait
  r
end

Instance Method Details

#add_tester_to_app!(tester, app_id) ⇒ Object



656
657
658
# File 'lib/spaceship/tunes/tunes_client.rb', line 656

def add_tester_to_app!(tester, app_id)
  update_tester_from_app!(tester, app_id, true)
end

#app_details(app_id) ⇒ Object



168
169
170
171
# File 'lib/spaceship/tunes/tunes_client.rb', line 168

def app_details(app_id)
  r = request(:get, "ra/apps/#{app_id}/details")
  parse_response(r, 'data')
end

#app_version(app_id, is_live) ⇒ Object



248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/spaceship/tunes/tunes_client.rb', line 248

def app_version(app_id, is_live)
  raise "app_id is required" unless app_id

  # First we need to fetch the IDs for the edit / live version
  r = request(:get, "ra/apps/#{app_id}/overview")
  platforms = parse_response(r, 'data')['platforms']

  # An app can only have either ios or mac, but we ignore apple tv right now
  platform = platforms.find do |p|
    p['platformString'] == 'ios' or p['platformString'] == 'osx'
  end

  version = platform[(is_live ? 'deliverableVersion' : 'inFlightVersion')]
  return nil unless version
  version_id = version['id']

  r = request(:get, "ra/apps/#{app_id}/platforms/ios/versions/#{version_id}")
  parse_response(r, 'data')
end

#applicationsObject



163
164
165
166
# File 'lib/spaceship/tunes/tunes_client.rb', line 163

def applications
  r = request(:get, 'ra/apps/manageyourapps/summary/v2')
  parse_response(r, 'data')['summaries']
end

#build_trains(app_id, testing_type) ⇒ Object

Parameters:

  • internal (testing_type)

    or external



440
441
442
443
444
# File 'lib/spaceship/tunes/tunes_client.rb', line 440

def build_trains(app_id, testing_type)
  raise "app_id is required" unless app_id
  r = request(:get, "ra/apps/#{app_id}/trains/?testingType=#{testing_type}")
  parse_response(r, 'data')
end

#candidate_builds(app_id, version_id) ⇒ Object



430
431
432
433
# File 'lib/spaceship/tunes/tunes_client.rb', line 430

def candidate_builds(app_id, version_id)
  r = request(:get, "ra/apps/#{app_id}/versions/#{version_id}/candidateBuilds")
  parse_response(r, 'data')['builds']
end

#create_application!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil) ⇒ Object

Creates a new application on iTunes Connect

Parameters:

  • name (String) (defaults to: nil)

    : The name of your app as it will appear on the App Store. This can’t be longer than 255 characters.

  • primary_language (String) (defaults to: nil)

    : If localized app information isn’t available in an App Store territory, the information from your primary language will be used instead.

  • version (String) (defaults to: nil)

    : The version number is shown on the App Store and should match the one you used in Xcode.

  • sku (String) (defaults to: nil)

    : A unique ID for your app that is not visible on the App Store.

  • bundle_id (String) (defaults to: nil)

    : The bundle ID must match the one you used in Xcode. It can’t be changed after you submit your first build.



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/spaceship/tunes/tunes_client.rb', line 193

def create_application!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil)
  # First, we need to fetch the data from Apple, which we then modify with the user's values
  app_type = 'ios'
  r = request(:get, "ra/apps/create/v2/?platformString=#{app_type}")
  data = parse_response(r, 'data')

  # Now fill in the values we have
  # some values are nil, that's why there is a hash
  data['versionString'] = { value: version }
  data['newApp']['name'] = { value: name }
  data['newApp']['bundleId']['value'] = bundle_id
  data['newApp']['primaryLanguage']['value'] = primary_language || 'English'
  data['newApp']['vendorId'] = { value: sku }
  data['newApp']['bundleIdSuffix']['value'] = bundle_id_suffix
  data['companyName']['value'] = company_name if company_name
  data['newApp']['appType'] = app_type

  data['initialPlatform'] = app_type
  data['enabledPlatformsForCreation']['value'] = [app_type]

  # Now send back the modified hash
  r = request(:post) do |req|
    req.url 'ra/apps/create/v2'
    req.body = data.to_json
    req.headers['Content-Type'] = 'application/json'
  end

  data = parse_response(r, 'data')
  handle_itc_response(data)
end

#create_tester!(tester: nil, email: nil, first_name: nil, last_name: nil) ⇒ Object



592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
# File 'lib/spaceship/tunes/tunes_client.rb', line 592

def create_tester!(tester: nil, email: nil, first_name: nil, last_name: nil)
  url = tester.url[:create]
  raise "Action not provided for this tester type." unless url

  tester_data = {
        emailAddress: {
          value: email
        },
        firstName: {
          value: first_name
        },
        lastName: {
          value: last_name
        },
        testing: {
          value: true
        }
      }

  data = { testers: [tester_data] }

  r = request(:post) do |req|
    req.url url
    req.body = data.to_json
    req.headers['Content-Type'] = 'application/json'
  end

  data = parse_response(r, 'data')['testers']
  handle_itc_response(data) || data[0]
end

#create_version!(app_id, version_number) ⇒ Object



224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/spaceship/tunes/tunes_client.rb', line 224

def create_version!(app_id, version_number)
  r = request(:post) do |req|
    req.url "ra/apps/#{app_id}/platforms/ios/versions/create/"
    req.body = {
      version: {
        value: version_number.to_s
      }
    }.to_json
    req.headers['Content-Type'] = 'application/json'
  end

  data = parse_response(r, 'data')
  handle_itc_response(data)
end

#delete_tester!(tester) ⇒ Object



623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
# File 'lib/spaceship/tunes/tunes_client.rb', line 623

def delete_tester!(tester)
  url = tester.class.url[:delete]
  raise "Action not provided for this tester type." unless url

  data = [
    {
      emailAddress: {
        value: tester.email
      },
      firstName: {
        value: tester.first_name
      },
      lastName: {
        value: tester.last_name
      },
      testing: {
        value: false
      },
      userName: tester.email,
      testerId: tester.tester_id
    }
  ]

  r = request(:post) do |req|
    req.url url
    req.body = data.to_json
    req.headers['Content-Type'] = 'application/json'
  end

  data = parse_response(r, 'data')['testers']
  handle_itc_response(data) || data[0]
end

#get_resolution_center(app_id) ⇒ Object



239
240
241
242
# File 'lib/spaceship/tunes/tunes_client.rb', line 239

def get_resolution_center(app_id)
  r = request(:get, "ra/apps/#{app_id}/resolutionCenter?v=latest")
  parse_response(r, 'data')
end

#handle_itc_response(raw) ⇒ Object

rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/PerceivedComplexity



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/spaceship/tunes/tunes_client.rb', line 103

def handle_itc_response(raw)
  return unless raw
  return unless raw.kind_of? Hash

  data = raw['data'] || raw # sometimes it's with data, sometimes it isn't

  if data.fetch('sectionErrorKeys', []).count == 0 and
     data.fetch('sectionInfoKeys', []).count == 0 and
     data.fetch('sectionWarningKeys', []).count == 0

    logger.debug("Request was successful")
  end

  handle_response_hash = lambda do |hash|
    errors = []
    if hash.kind_of? Hash
      hash.each do |key, value|
        errors += handle_response_hash.call(value)

        if key == 'errorKeys' and value.kind_of? Array and value.count > 0
          errors += value
        end
      end
    elsif hash.kind_of? Array
      hash.each do |value|
        errors += handle_response_hash.call(value)
      end
      # else: We don't care about simple values
    end
    return errors
  end

  errors = handle_response_hash.call(data)
  errors += data.fetch('sectionErrorKeys') if data['sectionErrorKeys']

  # Sometimes there is a different kind of error in the JSON response
  # e.g. {"warn"=>nil, "error"=>["operation_failed"], "info"=>nil}
  different_error = raw.fetch('messages', {}).fetch('error', nil)
  errors << different_error if different_error

  if errors.count > 0 # they are separated by `.` by default
    if errors.count == 1 and errors.first == "You haven't made any changes."
      # This is a special error which we really don't care about
    else
      raise ITunesConnectError.new, errors.join(' ')
    end
  end

  puts data['sectionInfoKeys'] if data['sectionInfoKeys']
  puts data['sectionWarningKeys'] if data['sectionWarningKeys']

  return data
end

#login_urlObject

Fetches the latest login URL from iTunes Connect



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/spaceship/tunes/tunes_client.rb', line 41

def 
  cache_path = "/tmp/spaceship_itc_login_url.txt"
  begin
    cached = File.read(cache_path)
  rescue Errno::ENOENT
  end
  return cached if cached

  host = "https://itunesconnect.apple.com"
  begin
    url = host + request(:get, self.class.hostname).body.match(%r{action="(/WebObjects/iTunesConnect.woa/wo/.*)"})[1]
    raise "" unless url.length > 0

    File.write(cache_path, url)
    return url
  rescue => ex
    puts ex
    raise "Could not fetch the login URL from iTunes Connect, the server might be down"
  end
end

#prepare_app_submissions(app_id, version) ⇒ Object



543
544
545
546
547
548
549
550
551
552
553
554
# File 'lib/spaceship/tunes/tunes_client.rb', line 543

def prepare_app_submissions(app_id, version)
  raise "app_id is required" unless app_id
  raise "version is required" unless version

  r = request(:get) do |req|
    req.url "ra/apps/#{app_id}/versions/#{version}/submit/summary"
    req.headers['Content-Type'] = 'application/json'
  end

  handle_itc_response(r.body)
  parse_response(r, 'data')
end

#price_tier(app_id) ⇒ Object



316
317
318
319
320
321
322
323
324
325
# File 'lib/spaceship/tunes/tunes_client.rb', line 316

def price_tier(app_id)
  r = request(:get, "ra/apps/#{app_id}/pricing/intervals")
  data = parse_response(r, 'data')

  begin
    data["pricingIntervalsFieldTO"]["value"].first["tierStem"]
  rescue
    nil
  end
end

#ref_dataAppVersionRef

Fetches the App Version Reference information from ITC

Returns:

  • (AppVersionRef)

    the response



412
413
414
415
416
# File 'lib/spaceship/tunes/tunes_client.rb', line 412

def ref_data
  r = request(:get, '/WebObjects/iTunesConnect.woa/ra/apps/version/ref')
  data = parse_response(r, 'data')
  Spaceship::Tunes::AppVersionRef.factory(data)
end

#remove_tester_from_app!(tester, app_id) ⇒ Object



660
661
662
# File 'lib/spaceship/tunes/tunes_client.rb', line 660

def remove_tester_from_app!(tester, app_id)
  update_tester_from_app!(tester, app_id, false)
end

#remove_testflight_build_from_review!(app_id: nil, train: nil, build_number: nil) ⇒ Object



458
459
460
461
462
463
464
465
# File 'lib/spaceship/tunes/tunes_client.rb', line 458

def remove_testflight_build_from_review!(app_id: nil, train: nil, build_number: nil)
  r = request(:post) do |req|
    req.url "ra/apps/#{app_id}/trains/#{train}/builds/#{build_number}/reject"
    req.body = {}.to_json
    req.headers['Content-Type'] = 'application/json'
  end
  handle_itc_response(r.body)
end

#send_app_submission(app_id, data) ⇒ Object



556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
# File 'lib/spaceship/tunes/tunes_client.rb', line 556

def send_app_submission(app_id, data)
  raise "app_id is required" unless app_id

  # ra/apps/1039164429/version/submit/complete
  r = request(:post) do |req|
    req.url "ra/apps/#{app_id}/version/submit/complete"
    req.body = data.to_json
    req.headers['Content-Type'] = 'application/json'
  end

  handle_itc_response(r.body)

  if r.body.fetch('messages').fetch('info').last == "Successful POST"
    # success
  else
    raise "Something went wrong when submitting the app for review. Make sure to pass valid options to submit your app for review"
  end

  parse_response(r, 'data')
end

#send_login_request(user, password) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/spaceship/tunes/tunes_client.rb', line 62

def (user, password)
  response = request(:post, , {
    theAccountName: user,
    theAccountPW: password
  })

  if response['Set-Cookie'] =~ /myacinfo=(\w+);/
    # To use the session properly we'll need the following cookies:
    #  - myacinfo
    #  - woinst
    #  - wosid
    #  - itctx
    begin
      re = response['Set-Cookie']

      to_use = [
        "myacinfo=" + re.match(/myacinfo=([^;]*)/)[1],
        "woinst=" + re.match(/woinst=([^;]*)/)[1],
        "itctx=" + re.match(/itctx=([^;]*)/)[1],
        "wosid=" + re.match(/wosid=([^;]*)/)[1]
      ]

      @cookie = to_use.join(';')
    rescue
      raise ITunesConnectError.new, [response.body, response['Set-Cookie']].join("\n")
    end

    return @client
  else
    if (response.body || "").include?("Your Apple ID or password was entered incorrectly")
      # User Credentials are wrong
      raise InvalidUserCredentialsError.new, "Invalid username and password combination. Used '#{user}' as the username."
    else
      info = [response.body, response['Set-Cookie']]
      raise ITunesConnectError.new, info.join("\n")
    end
  end
end

#submit_testflight_build_for_review!(app_id: nil, train: nil, build_number: nil, changelog: nil, description: nil, feedback_email: nil, marketing_url: nil, first_name: nil, last_name: nil, review_email: nil, phone_number: nil, privacy_policy_url: nil, review_user_name: nil, review_password: nil, encryption: false) ⇒ Object

rubocop:disable Metrics/AbcSize



468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
# File 'lib/spaceship/tunes/tunes_client.rb', line 468

def submit_testflight_build_for_review!( # Required:
                                        app_id: nil,
                                        train: nil,
                                        build_number: nil,

                                        # Required Metadata:
                                        changelog: nil,
                                        description: nil,
                                        feedback_email: nil,
                                        marketing_url: nil,
                                        first_name: nil,
                                        last_name: nil,
                                        review_email: nil,
                                        phone_number: nil,

                                        # Optional Metadata:
                                        privacy_policy_url: nil,
                                        review_user_name: nil,
                                        review_password: nil,
                                        encryption: false)

  start_url = "ra/apps/#{app_id}/trains/#{train}/builds/#{build_number}/submit/start"
  r = request(:get) do |req|
    req.url start_url
    req.headers['Content-Type'] = 'application/json'
  end
  handle_itc_response(r.body)

  build_info = r.body['data']
  # Now fill in the values provided by the user

  # First the localised values:
  build_info['testInfo']['details'].each do |current|
    current['whatsNew']['value'] = changelog
    current['description']['value'] = description
    current['feedbackEmail']['value'] = feedback_email
    current['marketingUrl']['value'] = marketing_url
    current['privacyPolicyUrl']['value'] = privacy_policy_url
    current['pageLanguageValue'] = current['language'] # There is no valid reason why we need this, only iTC being iTC
  end
  build_info['testInfo']['reviewFirstName']['value'] = first_name
  build_info['testInfo']['reviewLastName']['value'] = last_name
  build_info['testInfo']['reviewPhone']['value'] = phone_number
  build_info['testInfo']['reviewEmail']['value'] = review_email
  build_info['testInfo']['reviewUserName']['value'] = review_user_name
  build_info['testInfo']['reviewPassword']['value'] = review_password

  r = request(:post) do |req| # same URL, but a POST request
    req.url start_url
    req.body = build_info.to_json
    req.headers['Content-Type'] = 'application/json'
  end
  handle_itc_response(r.body)

  encryption_info = r.body['data']
  if encryption_info['exportComplianceRequired']
    # only sometimes this is required

    encryption_info['usesEncryption']['value'] = encryption

    r = request(:post) do |req|
      req.url "ra/apps/#{app_id}/trains/#{train}/builds/#{build_number}/submit/complete"
      req.body = encryption_info.to_json
      req.headers['Content-Type'] = 'application/json'
    end

    handle_itc_response(r.body)
  end
end

#supported_countriesObject

An array of supported countries [

"code": "AL",
"name": "Albania",
"region": "Europe"

, { …



334
335
336
337
# File 'lib/spaceship/tunes/tunes_client.rb', line 334

def supported_countries
  r = request(:get, "ra/apps/pricing/supportedCountries")
  parse_response(r, 'data')
end

#testers(tester) ⇒ Object



580
581
582
583
584
# File 'lib/spaceship/tunes/tunes_client.rb', line 580

def testers(tester)
  url = tester.url[:index]
  r = request(:get, url)
  parse_response(r, 'data')['testers']
end

#testers_by_app(tester, app_id) ⇒ Object



586
587
588
589
590
# File 'lib/spaceship/tunes/tunes_client.rb', line 586

def testers_by_app(tester, app_id)
  url = tester.url(app_id)[:index_by_app]
  r = request(:get, url)
  parse_response(r, 'data')['users']
end

#update_app_details!(app_id, data) ⇒ Object



173
174
175
176
177
178
179
180
181
# File 'lib/spaceship/tunes/tunes_client.rb', line 173

def update_app_details!(app_id, data)
  r = request(:post) do |req|
    req.url "ra/apps/#{app_id}/details"
    req.body = data.to_json
    req.headers['Content-Type'] = 'application/json'
  end

  handle_itc_response(r.body)
end

#update_app_version!(app_id, version_id, data) ⇒ Object



268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/spaceship/tunes/tunes_client.rb', line 268

def update_app_version!(app_id, version_id, data)
  raise "app_id is required" unless app_id
  raise "version_id is required" unless version_id.to_i > 0

  r = request(:post) do |req|
    req.url "ra/apps/#{app_id}/platforms/ios/versions/#{version_id}"
    req.body = data.to_json
    req.headers['Content-Type'] = 'application/json'
  end

  handle_itc_response(r.body)
end

#update_build_trains!(app_id, testing_type, data) ⇒ Object



446
447
448
449
450
451
452
453
454
455
456
# File 'lib/spaceship/tunes/tunes_client.rb', line 446

def update_build_trains!(app_id, testing_type, data)
  raise "app_id is required" unless app_id

  r = request(:post) do |req|
    req.url "ra/apps/#{app_id}/testingTypes/#{testing_type}/trains/"
    req.body = data.to_json
    req.headers['Content-Type'] = 'application/json'
  end

  handle_itc_response(r.body)
end

#update_price_tier!(app_id, price_tier) ⇒ Object



285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/spaceship/tunes/tunes_client.rb', line 285

def update_price_tier!(app_id, price_tier)
  r = request(:get, "ra/apps/#{app_id}/pricing/intervals")
  data = parse_response(r, 'data')

  first_price = (data["pricingIntervalsFieldTO"]["value"] || []).count == 0 # first price
  data["pricingIntervalsFieldTO"]["value"] ||= []
  data["pricingIntervalsFieldTO"]["value"] << {} if data["pricingIntervalsFieldTO"]["value"].count == 0
  data["pricingIntervalsFieldTO"]["value"].first["tierStem"] = price_tier.to_s

  effective_date = (first_price ? nil : Time.now.to_i * 1000)
  data["pricingIntervalsFieldTO"]["value"].first["priceTierEffectiveDate"] = effective_date
  data["pricingIntervalsFieldTO"]["value"].first["priceTierEndDate"] = nil
  data["countriesChanged"] = first_price
  data["theWorld"] = true

  if first_price # first price, need to set all countries
    data["countries"] = supported_countries.collect do |c|
      c.delete('region') # we don't care about le region
      c
    end
  end

  # send the changes back to Apple
  r = request(:post) do |req|
    req.url "ra/apps/#{app_id}/pricing/intervals"
    req.body = data.to_json
    req.headers['Content-Type'] = 'application/json'
  end
  handle_itc_response(r.body)
end

#upload_geojson(app_version, upload_file) ⇒ JSON

Uploads the transit app file

Parameters:

  • app_version (AppVersion)

    : The version of your app

  • upload_file (UploadFile)

    : The image to upload

Returns:

  • (JSON)

    the response



381
382
383
384
385
386
# File 'lib/spaceship/tunes/tunes_client.rb', line 381

def upload_geojson(app_version, upload_file)
  raise "app_version is required" unless app_version
  raise "upload_file is required" unless upload_file

  du_client.upload_geojson(app_version, upload_file, content_provider_id, sso_token_for_image)
end

#upload_large_icon(app_version, upload_image) ⇒ JSON

Uploads a large icon

Parameters:

  • app_version (AppVersion)

    : The version of your app

  • upload_image (UploadFile)

    : The icon to upload

Returns:

  • (JSON)

    the response



346
347
348
349
350
351
# File 'lib/spaceship/tunes/tunes_client.rb', line 346

def upload_large_icon(app_version, upload_image)
  raise "app_version is required" unless app_version
  raise "upload_image is required" unless upload_image

  du_client.upload_large_icon(app_version, upload_image, content_provider_id, sso_token_for_image)
end

#upload_screenshot(app_version, upload_image, device) ⇒ JSON

Uploads a screenshot

Parameters:

  • app_version (AppVersion)

    : The version of your app

  • upload_image (UploadFile)

    : The image to upload

  • device (string)

    : The target device

Returns:

  • (JSON)

    the response



369
370
371
372
373
374
375
# File 'lib/spaceship/tunes/tunes_client.rb', line 369

def upload_screenshot(app_version, upload_image, device)
  raise "app_version is required" unless app_version
  raise "upload_image is required" unless upload_image
  raise "device is required" unless device

  du_client.upload_screenshot(app_version, upload_image, content_provider_id, sso_token_for_image, device)
end

#upload_trailer(app_version, upload_trailer) ⇒ JSON

Uploads the transit app file

Parameters:

  • app_version (AppVersion)

    : The version of your app

  • upload_trailer (UploadFile)

    : The trailer to upload

Returns:

  • (JSON)

    the response



392
393
394
395
396
397
# File 'lib/spaceship/tunes/tunes_client.rb', line 392

def upload_trailer(app_version, upload_trailer)
  raise "app_version is required" unless app_version
  raise "upload_trailer is required" unless upload_trailer

  du_client.upload_trailer(app_version, upload_trailer, content_provider_id, sso_token_for_video)
end

#upload_trailer_preview(app_version, upload_trailer_preview) ⇒ JSON

Uploads the trailer preview

Parameters:

  • app_version (AppVersion)

    : The version of your app

  • upload_trailer_preview (UploadFile)

    : The trailer preview to upload

Returns:

  • (JSON)

    the response



403
404
405
406
407
408
# File 'lib/spaceship/tunes/tunes_client.rb', line 403

def upload_trailer_preview(app_version, upload_trailer_preview)
  raise "app_version is required" unless app_version
  raise "upload_trailer_preview is required" unless upload_trailer_preview

  du_client.upload_trailer_preview(app_version, upload_trailer_preview, content_provider_id, sso_token_for_image)
end

#upload_watch_icon(app_version, upload_image) ⇒ JSON

Uploads a watch icon

Parameters:

  • app_version (AppVersion)

    : The version of your app

  • upload_image (UploadFile)

    : The icon to upload

Returns:

  • (JSON)

    the response



357
358
359
360
361
362
# File 'lib/spaceship/tunes/tunes_client.rb', line 357

def upload_watch_icon(app_version, upload_image)
  raise "app_version is required" unless app_version
  raise "upload_image is required" unless upload_image

  du_client.upload_watch_icon(app_version, upload_image, content_provider_id, sso_token_for_image)
end

#user_detail_dataUserDetail

Fetches the User Detail information from ITC

Returns:

  • (UserDetail)

    the response



420
421
422
423
424
# File 'lib/spaceship/tunes/tunes_client.rb', line 420

def user_detail_data
  r = request(:get, '/WebObjects/iTunesConnect.woa/ra/user/detail')
  data = parse_response(r, 'data')
  Spaceship::Tunes::UserDetail.factory(data)
end