Class: TestingBot::Api

Overview

Ruby client for the TestingBot REST API (testingbot.com/support/api).

Credentials are resolved, in order, from: explicit arguments, the ~/.testingbot file, the TESTINGBOT_KEY/TESTINGBOT_SECRET environment variables, then TB_KEY/TB_SECRET.

Endpoint methods live in the TestingBot::Resources::* mixins (one per API category) and are included below; they call the private get/post/put/delete helpers and @connection. Transport (timeouts, retries, error handling) lives in TestingBot::Connection; a custom connection can be injected via options for testing.

Constant Summary collapse

API_URL =

Public API version used in the URL path (api.testingbot.com/v1/…).

Connection::API_URL
API_VERSION =
Connection::API_VERSION
VERSION =

Deprecated alias kept for backward compatibility (this is the API version, not the gem version — see TestingBot::VERSION for the gem version).

API_VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Resources::Sharing

#get_authentication_hash

Methods included from Resources::LabSuites

#add_lab_suite_tests, #create_lab_suite, #delete_lab_suite, #get_lab_suite, #get_lab_suite_browsers, #get_lab_suite_tests, #get_lab_suites, #remove_lab_suite_test, #set_lab_suite_browsers, #trigger_lab_suite

Methods included from Resources::Lab

#add_lab_test_alert, #create_lab_test, #create_lab_test_report, #delete_lab_test, #get_lab_test, #get_lab_test_browsers, #get_lab_test_steps, #get_lab_tests, #schedule_lab_test, #set_lab_test_browsers, #set_lab_test_steps, #stop_lab_test, #trigger_all_lab_tests, #trigger_lab_test, #update_lab_test, #update_lab_test_alert, #update_lab_test_report

Methods included from Resources::Jobs

#get_job

Methods included from Resources::Storage

#delete_uploaded_file, #get_uploaded_file, #get_uploaded_files, #update_local_file, #update_remote_file, #upload_local_file, #upload_remote_file

Methods included from Resources::Tunnels

#delete_tunnel, #get_tunnel, #get_tunnels

Methods included from Resources::Screenshots

#get_screenshots, #get_screenshots_history, #take_screenshots

Methods included from Resources::Builds

#delete_build, #get_build, #get_builds

Methods included from Resources::Tests

#delete_test, #get_test, #get_tests, #stop_test, #update_test

Methods included from Resources::Platform

#get_available_devices, #get_browsers, #get_device, #get_devices, #get_ip_ranges

Methods included from Resources::Team

#create_user_in_team, #get_team, #get_user_client_key, #get_user_in_team, #get_users_in_team, #reset_credentials, #update_user_in_team

Methods included from Resources::User

#get_user_info, #get_user_keys, #update_user_info

Constructor Details

#initialize(key = nil, secret = nil, options = {}) ⇒ Api

Returns a new instance of Api.



57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/testingbot/api.rb', line 57

def initialize(key = nil, secret = nil, options = {})
  @options = { :debug => false }.merge(options)
  @key     = key
  @secret  = secret
  resolve_credentials!

  raise "Please supply a TestingBot Key"    if @key.nil?
  raise "Please supply a TestingBot Secret" if @secret.nil?

  @connection = @options[:connection] ||
                Connection.new(key: @key, secret: @secret, options: @options)
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



55
56
57
# File 'lib/testingbot/api.rb', line 55

def key
  @key
end

#optionsObject (readonly)

Returns the value of attribute options.



55
56
57
# File 'lib/testingbot/api.rb', line 55

def options
  @options
end

#secretObject (readonly)

Returns the value of attribute secret.



55
56
57
# File 'lib/testingbot/api.rb', line 55

def secret
  @secret
end