Create new entry

 Example:

   entry = Atom::Entry.new
   entry.title = 'foo'
   author = Atom::Author.new
   author.name = 'Lyo Kato'
   author.email = 'lyo.kato@gmail.com'
   entry.author = author
   entry_uri = client.create_entry(post_uri, entry)
559683
def create_entry(post_uri, entry, slug=nil)
      unless entry.kind_of?(Atom::Entry)
        entry = Atom::Entry.new :stream => entry
      end
      service = @service_info.get(post_uri)
      unless entry.categories.all?{ |c| service.allows_category?(c) }
        raise RequestError, "Forbidden Category"
      end
      create_resource(post_uri, entry.to_s, Atom::MediaType::ENTRY.to_s, slug)
      @res['Location']
    end
562749
def create
      @script_author = Script::Author.new(script_author_params)
      @script_author.user_id = current_user.id
      @script_author.org_id = current_user.org_id
      if @script_author.save
        redirect_to script_authors_url, notice: 'Author was successfully created.'
        else
        render :new
      end
    end
191654
def same_as?(other_email)
      if other_email.is_a?(String)
        other_email = EmailAddress::Address.new(other_email)
      end

      self.canonical   == other_email.canonical ||
        self.redact    == other_email.canonical ||
        self.canonical == other_email.redact
    end
528428
def new(self, repo):
        
        #TODO: subclass Commit, pass parent as init param
        try:
            # create new commit instance and set metadata
            commit = Commit()
            author = os.environ.get('USER')
            commit.author = commit.committer = author
            commit.commit_time = commit.author_time = int(time())
            tz = parse_timezone('-0200')[0]
            commit.commit_timezone = commit.author_timezone = tz
            commit.encoding = "UTF-8"
            commit.message = ''

            # set previous version as parent to this one
            parent = repo.versions(-1)
            if parent:
                commit.parents = [parent.id]

            # create new tree, add entries from previous version
            tree = Tree()
            curr = repo.versions(-1)
            if curr:
                for item in curr.items():
                    tree.addItem(item)
            commit.tree = tree.id

            # create new version, and add tree
            version = Version(repo=repo, commit=commit, tree=tree)
            return version

        except Exception, e:
            traceback.print_exc()
            return VersionError(e)
309385
def create(cls, name, sandbox_data_center, portal_username=None, comment=None):
        
        json = {
            'name': name,
            'sandbox_data_center': element_resolver(sandbox_data_center),
            'portal_username': portal_username if portal_username else '',
            'comment': comment}
        return ElementCreator(cls, json)
1133133
def add_entry(opts)
      raise ArgumentError, "Expected Hash or Keepassx::Entry, got #{opts.class}" unless valid_entry?(opts)

      if opts.is_a?(Keepassx::Entry)
        # Add entry
        @entries << opts

        # Increment counter
        header.entries_count += 1

        # Return entry
        opts

      elsif opts.is_a?(Hash)
        opts = deep_copy(opts)
        opts = build_entry_options(opts)

        # Create entry
        entry = create_entry(opts)

        # Increment counter
        header.entries_count += 1

        # Return entry
        entry
      end
    end
94734
def create_key(self, title, key):
        
        assert isinstance(title, (str, unicode)), title
        assert isinstance(key, (str, unicode)), key
        post_parameters = {
            "title": title,
            "key": key,
        }
        headers, data = self._requester.requestJsonAndCheck(
            "POST",
            "/user/keys",
            input=post_parameters
        )
        return github.UserKey.UserKey(self._requester, headers, data, completed=True)
28139
def create
      @entry = @resource.model.new(resource_params)

      if @entry.save
        redirect_to polymorphic_path(@resource.model),
                    notice: t(
                      'adminable.resources.created',
                      resource: @resource.model.model_name.human
                    )
      else
        flash.now[:alert] = @entry.errors.full_messages.first
        render :new
      end
    end
810080
def entry(entry, options={})
      raise 'Error: Param entry is nil!' if entry.nil?

      begin
        url = url_for_resource(entry)
        url = append_query_params(url, options)
        client.get(url, options) do |response|
          a_hash = parse(response)
          Resource::Entry.from_coach a_hash
        end
      rescue => e
        raise e if debug
        false
      end
    end
711822
def generate(self):
        """"""
        # atom demands either an author element in every entry or a global one
        if not self.author:
            if False in map(lambda e: bool(e.author), self.entries):
                self.author = ({'name': u'unbekannter Autor'},)

        if not self.updated:
            dates = sorted([entry.updated for entry in self.entries])
            self.updated = dates and dates[-1] or datetime.utcnow()

        yield u'<?xml version="1.0" encoding="utf-8"?>\n'
        yield u'<feed xmlns="http://www.w3.org/2005/Atom">\n'
        yield '  ' + _make_text_block('title', self.title, self.title_type)
        yield u'  <id>%s</id>\n' % escape(self.id)
        yield u'  <updated>%s</updated>\n' % format_iso8601(self.updated, self.timezone)
        if self.url:
            yield u'  <link href="%s" />\n' % escape(self.url, True)
        if self.feed_url:
            yield u'  <link href="%s" rel="self" />\n' % \
                escape(self.feed_url, True)
        for link in self.links:
            yield u'  <link %s/>\n' % ''.join('%s="%s" ' % \
                (k, escape(link[k], True)) for k in link)
        for author in self.author:
            yield u'  <author>\n'
            yield u'    <name>%s</name>\n' % escape(author['name'])
            if 'uri' in author:
                yield u'    <uri>%s</uri>\n' % escape(author['uri'])
            if 'email' in author:
                yield '    <email>%s</email>\n' % escape(author['email'])
            yield '  </author>\n'
        if self.subtitle:
            yield '  ' + _make_text_block('subtitle', self.subtitle,
                                          self.subtitle_type)
        if self.icon:
            yield u'  <icon>%s</icon>\n' % escape(self.icon)
        if self.logo:
            yield u'  <logo>%s</logo>\n' % escape(self.logo)
        if self.rights:
            yield '  ' + _make_text_block('rights', self.rights,
                                          self.rights_type)
        generator_name, generator_url, generator_version = self.generator
        if generator_name or generator_url or generator_version:
            tmp = [u'  <generator']
            if generator_url:
                tmp.append(u' uri="%s"' % escape(generator_url, True))
            if generator_version:
                tmp.append(u' version="%s"' % escape(generator_version, True))
            tmp.append(u'>%s</generator>\n' % escape(generator_name))
            yield u''.join(tmp)
        for entry in self.entries:
            for line in entry.generate():
                yield u'  ' + line
        yield u'</feed>\n'
903448
def create_user(username, rsa_pub_key, rsa_pub_key_name)
      key_name = "#{username}@#{rsa_pub_key_name}"
      key_path = @configuration.user_key_path(key_name)

      if users_public_keys().include?(key_path)
        raise ::Gitolite::Duplicate, "Public key (#{rsa_pub_key_name}) already exists for user (#{username}) on gitolite server"
      end

      add_commit_file(key_path,rsa_pub_key, "Added public key (#{rsa_pub_key_name}) for user (#{username}) ")

      key_path
    end
411154
def new
      @user = User.new
  
      respond_to do |format|
        format.html # new.html.erb
        format.json { render json: @user }
      end
    end
234783
function atom(type, actionParams) {
  var getNewState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : assignData;

  if (typeof actionParams === 'function') {
    return (0, _createAtom2.default)({
      type: type,
      getNewState: actionParams
    });
  }

  return (0, _createAtom2.default)({
    type: type,
    actionParams: actionParams,
    getNewState: getNewState
  });
}
863506
function author($new = null, $return_entity = false)
    {
        if (isset($new)){
            if ($new instanceof Entity){
                $this->_author = $new;
                $new = $new->uri();
            }else{
                $this->_author = null; // for reloading
            }
            if ($new != $this->_attributes['author']){
                $this->change('author', $new);
            }
        }
        if ($return_entity){
            if (!isset($this->_author)){
                if (isset($this->_attributes['author'])){
                    $this->_author = Data::read($this->_attributes['author']);
                }else{
                    $this->_author = false;
                }
            }
            return $this->_author;
        }
        return $this->_attributes['author'];
    }
673694
def _create_entry(self, name, values, fbterm=False):
        ''' 
        '''
        if fbterm:
            attr = _PaletteEntryFBTerm(self, name.upper(), ';'.join(values))
        else:
            attr = _PaletteEntry(self, name.upper(), ';'.join(values))
        setattr(self, name, attr)  # now cached
        return attr
31800
def create_user(name, email, datum = nil)
      current_path = '/api/v1/users'
      payload = { name: name, mail: email }
      payload.merge!(datum) unless datum.nil?
      @conn.post(current_path, payload.to_json)
    end
577889
@Override
    void createEntry(int hash, K key, V value, int bucketIndex) {
	HashMapPro.Entry<K, V> old = table[bucketIndex];
	Entry<K, V> e = new Entry<K, V>(hash, key, value, old);
	table[bucketIndex] = e;
	e.addBefore(header);
	size++;
    }