Sha256: ec0d8b6f5fa3759145be7137bd7207cc78aa7b52e32e289d08255db7e372e3ad

Contents?: true

Size: 839 Bytes

Versions: 35

Compression:

Stored size: 839 Bytes

Contents

class SimpleAdapter < SourceAdapter
  # initialize method created by source generator (Rhoconnect version < 2.2.0)
  def initialize(source,credential)
    super(source,credential)
  end
 
  def login
    unless _is_empty?(current_user.login)
      true
    else
      raise SourceAdapterLoginException.new('Error logging in')
    end
  end
 
  def query(params=nil)
    @result
  end
  
  def search(params=nil,txt='')
    params[:foo] = 'bar' # this is for 'chaining' test
    if params['search'] == 'bar'
      @result = {'obj'=>{'foo'=>'bar'}} 
      # this is for 'chaining' test, addind 'iPhone' to trogger Sample adapter search result
      params['name'] = 'iPhone'  
    end
    @result
  end
 
  def sync
    super
  end
 
  def create(create_hash)
    'obj4'
  end
  
  private
  def _is_empty?(str)
    str.length <= 0
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
rhoconnect-3.4.5 spec/apps/rhotestapp/sources/simple_adapter.rb
rhoconnect-3.4.4 spec/apps/rhotestapp/sources/simple_adapter.rb
rhoconnect-3.4.3 spec/apps/rhotestapp/sources/simple_adapter.rb
rhoconnect-3.4.2 spec/apps/rhotestapp/sources/simple_adapter.rb
rhoconnect-3.3.6 spec/apps/rhotestapp/sources/simple_adapter.rb
rhoconnect-3.3.5 spec/apps/rhotestapp/sources/simple_adapter.rb
rhoconnect-3.3.4 spec/apps/rhotestapp/sources/simple_adapter.rb
rhoconnect-3.3.3 spec/apps/rhotestapp/sources/simple_adapter.rb
rhoconnect-3.3.2 spec/apps/rhotestapp/sources/simple_adapter.rb
rhoconnect-3.3.1 spec/apps/rhotestapp/sources/simple_adapter.rb
rhoconnect-3.3.1.beta4 spec/apps/rhotestapp/sources/simple_adapter.rb
rhoconnect-3.3.1.beta3 spec/apps/rhotestapp/sources/simple_adapter.rb
rhoconnect-3.3.1.beta2 spec/apps/rhotestapp/sources/simple_adapter.rb
rhoconnect-3.2.1 spec/apps/rhotestapp/sources/simple_adapter.rb
rhoconnect-3.2.0 spec/apps/rhotestapp/sources/simple_adapter.rb
rhoconnect-3.2.0.beta5 spec/apps/rhotestapp/sources/simple_adapter.rb
rhoconnect-3.2.0.beta4 spec/apps/rhotestapp/sources/simple_adapter.rb
rhoconnect-3.2.0.beta3 spec/apps/rhotestapp/sources/simple_adapter.rb
rhoconnect-3.2.0.beta2 spec/apps/rhotestapp/sources/simple_adapter.rb
rhoconnect-3.2.0.beta1 spec/apps/rhotestapp/sources/simple_adapter.rb