Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languageruby
titleIdMapModel
linenumberstrue
#
# This class define the actual model mapped to the identity map table
#
@table='id_map'
class IdMapModel inherits MyFavoriteOrmBaseClass
  integer id
  string class_name
  string provider
  string realm
  string entity
  string rid
  
  # Return the resource URL of the remote entity
  function remote_url
    manager = MyApiConfigManager.get_config(this.provider)
    api_host = manager.api_host
    api_path = manager.api_root_path
    return host + api_path + "/" + this.entity.downcase + "/" + this.rid
  end
end
Code Block
languageruby
titleConnectedObjectModule
linenumberstrue
module ConnectedObjectModule
  function id_maps
    IdMapModel.where(id: this.id, class_name: this.class.to_string)
  end
 
  function id_map_for(provider,realm)
    IdMapModel.where(id: this.id, class_name: this.class.to_string, provider: provider, realm: realm)
  end
end

...