class Testcloud::Devices::Client

Attributes

config[R]
api_token[RW]
category[RW]
raw_response[RW]
response[RW]
type[RW]

Public Class Methods

new(options = {}) click to toggle source
# File lib/testcloud/devices/client.rb, line 24
def initialize(options = {})
  @type, @category = options[:type], options[:category]
  self.class.debug_output if options[:debug]
  self.class.base_uri(options[:url] || config.url || Testcloud::Devices::Config::DEFAULT_URL)
  config.api_token = options[:api_token] if options[:api_token]
end
setup() { |config| ... } click to toggle source
# File lib/testcloud/devices/client.rb, line 18
def setup(&block)
  @config = Testcloud::Devices::Config.new
  yield(@config)
end

Public Instance Methods

errors?() click to toggle source
# File lib/testcloud/devices/client.rb, line 31
def errors?
  return true if raw_response.code >= 300
  return true if response.has_key?(:errors)
  false
end

Private Instance Methods

access_headers() click to toggle source
# File lib/testcloud/devices/client.rb, line 38
def access_headers
  @access_headers ||= { headers: { API_TOKEN_KEY => config.api_token, 'Content-Type' => 'application/json' } }
end