Sha256: dcb0e0fcc5d6e2800f0b795f90b37cffa233321b976a6f4cc36b918bde33dd25

Contents?: true

Size: 1.72 KB

Versions: 23

Compression:

Stored size: 1.72 KB

Contents

class <%=class_name%> < SourceAdapter
  def initialize(source,credential)
    super(source,credential)
  end
 
  def login
    # TODO: Login to your data source here if necessary
  end
 
  def query(params=nil)
    # TODO: Query your backend data source and assign the records 
    # to a nested hash structure called @result. For example:
    # @result = { 
    #   "1"=>{"name"=>"Acme", "industry"=>"Electronics"},
    #   "2"=>{"name"=>"Best", "industry"=>"Software"}
    # }
    raise SourceAdapterException.new("Please provide some code to read records from the backend data source")
  end
 
  def sync
    # Manipulate @result before it is saved, or save it 
    # yourself using the Rhosync::Store interface.
    # By default, super is called below which simply saves @result
    super
  end
 
  def create(create_hash,blob=nil)
    # TODO: Create a new record in your backend data source
    # If your rhodes rhom object contains image/binary data 
    # (has the image_uri attribute), then a blob will be provided
    raise "Please provide some code to create a single record in the backend data source using the create_hash"
  end
 
  def update(update_hash)
    # TODO: Update an existing record in your backend data source
    raise "Please provide some code to update a single record in the backend data source using the update_hash"
  end
 
  def delete(object_id)
    # TODO: write some code here if applicable
    # be sure to have a hash key and value for "object"
    # for now, we'll say that its OK to not have a delete operation
    # raise "Please provide some code to delete a single object in the backend application using the hash values in name_value_list"
  end
 
  def logoff
    # TODO: Logout from the data source if necessary
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
rhosync-2.1.0.beta.1 generators/templates/source/source_adapter.rb
rhosync-2.0.9 generators/templates/source/source_adapter.rb
rhosync-2.0.8 generators/templates/source/source_adapter.rb
rhosync-2.0.7 generators/templates/source/source_adapter.rb
rhosync-2.0.6 generators/templates/source/source_adapter.rb
rhosync-2.0.5 generators/templates/source/source_adapter.rb
rhosync-2.0.4 generators/templates/source/source_adapter.rb
rhosync-2.0.3 generators/templates/source/source_adapter.rb
rhosync-2.0.2 generators/templates/source/source_adapter.rb
rhosync-2.0.1 generators/templates/source/source_adapter.rb
rhosync-2.0.0 generators/templates/source/source_adapter.rb
rhosync-2.0.0.rc2 generators/templates/source/source_adapter.rb
rhosync-2.0.0.rc1 generators/templates/source/source_adapter.rb
rhosync-2.0.0.beta13 generators/templates/source/source_adapter.rb
rhosync-2.0.0.beta12 generators/templates/source/source_adapter.rb
rhosync-2.0.0.beta11 generators/templates/source/source_adapter.rb
rhosync-2.0.0.beta10 generators/templates/source/source_adapter.rb
rhosync-2.0.0.beta9 generators/templates/source/source_adapter.rb
rhosync-2.0.0.beta8 generators/templates/source/source_adapter.rb
rhosync-2.0.0.beta7 generators/templates/source/source_adapter.rb