spaceship/lib/spaceship/test_flight/client.rb in fastlane-2.67.0.beta.20171127010003 vs spaceship/lib/spaceship/test_flight/client.rb in fastlane-2.67.0.beta.20171128010003

- old
+ new

@@ -143,30 +143,29 @@ ## def testers_for_app(app_id: nil) assert_required_params(__method__, binding) page_size = 40 # that's enforced by the iTC servers - offset = nil resulting_array = [] initial_url = "providers/#{team_id}/apps/#{app_id}/testers?limit=#{page_size}&sort=email&order=asc" response = request(:get, initial_url) + link_from_response = proc do |r| + # I weep for Swift nil chaining + (l = r.headers['link']) && (m = l.match(/<(.*)>/)) && m.captures.first + end + next_link = link_from_response.call(response) result = Array(handle_response(response)) resulting_array += result return resulting_array if result.count == 0 - offset = result.last['id'] - loop do - url = "providers/#{team_id}/apps/#{app_id}/testers?offset=added,#{offset}&limit=#{page_size}&sort=status,default&order=asc" - url += "&offset=#{offset}" if offset - response = request(:get, url) + until next_link.nil? + response = request(:get, next_link) result = Array(handle_response(response)) + next_link = link_from_response.call(response) break if result.count == 0 - # If there are no more, the last response seems to be repeated - break if offset == result.last['id'] resulting_array += result - offset = result.last['id'] end return resulting_array.uniq end def delete_tester_from_app(app_id: nil, tester_id: nil)