Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
= Leanmodel
Simple ORM for CouchDB. This a work in progress...
==Installation gem install leanmodel
==Usage
require 'leanback' require 'leanmodel'
Name of the class must be singular to a Couchdb database name .
The class below represents a document in the database called movies
class Movie < LeanModel::Base
attributes :title, :year, :story
end
movie = Movie.new({:title => 'Jurassic Park',:year => '1993', :story => 'Raptors brought back in time'})
movie.attributes #=> {"title"=>"Jurassic Park", "year"=>"1993", "story"=>"Raptors brought back in time"}
Configure couchDB @couchdb_username = "obi" @couchdb_password = "trusted"
token = lambda { hash = Couchdb.login(@couchdb_username,@couchdb_password) hash["AuthSession"] } movie.config(token)
CouchDB Authsession token movie.token #=> b2JpOjRGQTIxODA4Oq42xHwvvoK9ASvtB55ODSdEpEgB
Database name movie.database #=> movies
Write this model to the database movie.save #=> true Returns true if the model was written successfully. This method creates a new couchDB document with the model's attribute values
Delete this model from database movie.destroy #=>{"ok"=>true, "id"=>"eb9ecefa-afdd-426a-a21d-f8307fa2b156", "rev"=>"2-98bc85346eff4a663e39395163aaa194"} This deletes the document that represents this model from the database
Find a movie using it's document id movie.service.find('9da82f5a-0ce4-46a0-863c-7d8f2ed84439') #=> {"_id"=>"9da82f5a-0ce4-46a0-863c-7d8f2ed84439", "_rev"=>"6-6367dc24342f1590935a99087a57d8c5", "title"=>"Jurassic Park", "year"=>"1996", "story"=>"Raptors brought back in time"}
Update a model on the database, data = {:id => '9da82f5a-0ce4-46a0-863c-7d8f2ed84439', :year => '1993' } movie.service.update_attributes(data) #=> true Returns true if successful, requires that the document ID is included in the data
Retrieve all movies from database movie.service.all #=> [{"_id"=>"0fb32571-44c4-48c4-9423-55ea7c95c192", "_rev"=>"1-f76f5d4f431cafbdb3f4d43388a03c89", "title"=>"Hugo", "year"=>"2011", "story"=>"Film history"}, {"_id"=>"9da82f5a-0ce4-46a0-863c-7d8f2ed84439", "_rev"=>"10-60e258f605801a31e64b928bb81f7ea6", "title"=>"Jurassic Park", "year"=>"1993", "story"=>"Raptors brought back in time"}]
== Copyright
Copyright (c) 2012 obi-a. See LICENSE.txt for further details.
FAQs
Unknown package
We found that leanmodel demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.