# File lib/rainforest_cli/remote_tests.rb, line 15 def primary_ids @primary_ids ||= tests.map { |t| t['id'] } end
class RainforestCli::RemoteTests
Public Class Methods
new(options)
click to toggle source
# File lib/rainforest_cli/remote_tests.rb, line 3 def initialize(options) @options = options end
Public Instance Methods
fetch_tests()
click to toggle source
# File lib/rainforest_cli/remote_tests.rb, line 31 def fetch_tests if http_client.api_token_set? logger.info 'Fetching test data from server...' test_list = http_client.get('/tests/rfml_ids', filters) logger.info 'Fetch complete.' test_list else logger.info 'No API Token set. Using local tests only...' [] end end
make_test_dictionary()
click to toggle source
# File lib/rainforest_cli/remote_tests.rb, line 23 def make_test_dictionary primary_key_dictionary = {} tests.each do |rf_test| primary_key_dictionary[rf_test['rfml_id']] = rf_test['id'] end primary_key_dictionary end
primary_ids()
click to toggle source
primary_key_dictionary()
click to toggle source
# File lib/rainforest_cli/remote_tests.rb, line 19 def primary_key_dictionary @primary_key_dictionary ||= make_test_dictionary end
rfml_ids()
click to toggle source
# File lib/rainforest_cli/remote_tests.rb, line 11 def rfml_ids @rfml_ids ||= tests.map { |t| t['rfml_id'] } end
tests()
click to toggle source
# File lib/rainforest_cli/remote_tests.rb, line 7 def tests @tests ||= fetch_tests end
Private Instance Methods
filters()
click to toggle source
# File lib/rainforest_cli/remote_tests.rb, line 45 def filters {}.tap do |f| f[:tags] = @options.tags if @options.tags.any? f[:smart_folder_id] = @options.folder if @options.folder f[:site_id] = @options.site_id if @options.site_id end end
http_client()
click to toggle source
# File lib/rainforest_cli/remote_tests.rb, line 57 def http_client RainforestCli.http_client end
logger()
click to toggle source
# File lib/rainforest_cli/remote_tests.rb, line 53 def logger RainforestCli.logger end