spaceship/lib/spaceship/tunes/tunes_client.rb in fastlane-2.65.0 vs spaceship/lib/spaceship/tunes/tunes_client.rb in fastlane-2.66.0

- old
+ new

@@ -1171,130 +1171,9 @@ end handle_itc_response(r.body) end ##################################################### - # @!group Testers - ##################################################### - def testers(tester) - url = tester.url[:index] - r = request(:get, url) - parse_response(r, 'data')['testers'] - end - - 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 - - # Returns a list of available testing groups - # e.g. - # {"b6f65dbd-c845-4d91-bc39-0b661d608970" => "Boarding", - # "70402368-9deb-409f-9a26-bb3f215dfee3" => "Automatic"} - def groups - return @cached_groups if @cached_groups - r = request(:get, '/WebObjects/iTunesConnect.woa/ra/users/pre/ext') - @cached_groups = parse_response(r, 'data')['groups'] - end - - def create_tester!(tester: nil, email: nil, first_name: nil, last_name: nil, groups: 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 - } - } - - if groups - tester_data[:groups] = groups.map do |group_name_or_group_id| - if self.groups.value?(group_name_or_group_id) - # This is an existing group, let's use that, the user specified the group name - group_name = group_name_or_group_id - group_id = self.groups.key(group_name_or_group_id) - elsif self.groups.key?(group_name_or_group_id) - # This is an existing group, let's use that, the user specified the group ID - group_name = self.groups[group_name_or_group_id] - group_id = group_name_or_group_id - else - group_name = group_name_or_group_id - group_id = nil # this is expected by the iTC API - end - - { - "id" => group_id, - "name" => { - "value" => group_name - } - } - end - end - - 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 - - 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 - - def add_tester_to_app!(tester, app_id) - update_tester_from_app!(tester, app_id, true) - end - - def remove_tester_from_app!(tester, app_id) - update_tester_from_app!(tester, app_id, false) - end - - ##################################################### # @!group Sandbox Testers ##################################################### def sandbox_testers(tester_class) url = tester_class.url[:index] r = request(:get, url)