Sha256: 2e6426143f07a8f1fee240fc7590f8013e492ccb1a12658f577be9eef97ece62

Contents?: true

Size: 817 Bytes

Versions: 23

Compression:

Stored size: 817 Bytes

Contents

class SimpleAdapter < SourceAdapter
  # initialize method created by source generator (Rhoconnect version < 2.2.0)
  def initialize(source)
    super(source)
  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

23 entries across 23 versions & 1 rubygems

Version Path
rhoconnect-7.6.0 spec/apps/rhotestapp/models/ruby/simple_adapter.rb
rhoconnect-7.5.1 spec/apps/rhotestapp/models/ruby/simple_adapter.rb
rhoconnect-7.4.1 spec/apps/rhotestapp/models/ruby/simple_adapter.rb
rhoconnect-7.1.17 spec/apps/rhotestapp/models/ruby/simple_adapter.rb
rhoconnect-6.2.0 spec/apps/rhotestapp/models/ruby/simple_adapter.rb
rhoconnect-6.0.11 spec/apps/rhotestapp/models/ruby/simple_adapter.rb
rhoconnect-5.5.18 spec/apps/rhotestapp/models/ruby/simple_adapter.rb
rhoconnect-5.5.17 spec/apps/rhotestapp/models/ruby/simple_adapter.rb
rhoconnect-5.5.15 spec/apps/rhotestapp/models/ruby/simple_adapter.rb
rhoconnect-5.5.0.22 spec/apps/rhotestapp/models/ruby/simple_adapter.rb
rhoconnect-5.5.2 spec/apps/rhotestapp/models/ruby/simple_adapter.rb
rhoconnect-5.5.0.7 spec/apps/rhotestapp/models/ruby/simple_adapter.rb
rhoconnect-5.5.0.3 spec/apps/rhotestapp/models/ruby/simple_adapter.rb
rhoconnect-5.5.0 spec/apps/rhotestapp/models/ruby/simple_adapter.rb
rhoconnect-5.1.1 spec/apps/rhotestapp/models/ruby/simple_adapter.rb
rhoconnect-4.0.4 spec/apps/rhotestapp/models/ruby/simple_adapter.rb
rhoconnect-4.0.3 spec/apps/rhotestapp/models/ruby/simple_adapter.rb
rhoconnect-4.0.2 spec/apps/rhotestapp/models/ruby/simple_adapter.rb
rhoconnect-4.0.1 spec/apps/rhotestapp/models/ruby/simple_adapter.rb
rhoconnect-4.0.0 spec/apps/rhotestapp/models/ruby/simple_adapter.rb