Class: TestLink::Adapters::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/test_link/adapters/base.rb

Direct Known Subclasses

NodeAdapter, ProjectAdapter, StatusAdapter

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#responseObject

Returns the value of attribute response.



23
24
25
# File 'lib/test_link/adapters/base.rb', line 23

def response
  @response
end

Instance Method Details

#adaptObject



25
26
27
28
29
30
31
32
# File 'lib/test_link/adapters/base.rb', line 25

def adapt
  raise TestLink::Exceptions::EmptyResponseException.new if response.nil? || response.empty?
  raise TestLink::Exceptions::CommandFailedException.new response['msg'] if (response.instance_of? Hash) && (response['status_ok'] == 0)
  response.map do |row|
    raise TestLink::Exceptions::ErrorResponseException.new row['message'], row['code'] if row.keys.include? 'code'
    adapt_row row
  end
end