Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

orientdb4r

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

orientdb4r

  • 0.5.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source
          _            _      _ _     _  _
___  _ __(_) ___ _ __ | |_ __| | |__ | || |  _ __

/ _ | '| |/ _ \ '_ | / ` | ' | || |_| '| | () | | | | __/ | | | || (| | |_) | | | ___/|| ||___|| ||__,|.__/ || |_|

= Ruby binding for Orient DB

A Ruby client for the NoSQL Graph/Document database Orient DB (http://orientdb.org).

{Gem Version}[http://badge.fury.io/rb/orientdb4r] {Build Status}[http://travis-ci.org/veny/orientdb4r] {Coverage Status}[https://coveralls.io/r/veny/orientdb4r?branch=master]

== USAGE

see Wiki page for more sample at https://github.com/veny/orientdb4r/wiki

require 'orientdb4r'

DB = 'foo' CLASS = 'myclass'

client = Orientdb4r.client # equivalent for :host => 'localhost', :port => 2480, :ssl => false

client.database_exists? :database => DB, :user => 'admin', :password => 'admin' => false

client.create_database :database => DB, :storage => :memory, :user => 'root', :password => 'root' => false

client.connect :database => DB, :user => 'admin', :password => 'admin' => true

unless client.class_exists? CLASS client.create_class(CLASS) do |c| c.property 'prop1', :integer, :notnull => true, :min => 1, :max => 99 c.property 'prop2', :string, :mandatory => true c.link 'users', :linkset, 'OUser' # by default: :mandatory => false, :notnull => false end end

admin = client.query("SELECT FROM OUser WHERE name = 'admin'")[0] 1.upto(5) do |i| # insert link to admin only to first two client.command "INSERT INTO #{CLASS} (prop1, prop2, users) VALUES (#{i}, 'text#{i}', [#{admin['@rid'] if i<3}])" end

puts client.query "SELECT FROM #{CLASS}" => {"@type"=>"d", "@rid"=>"#6:0", "@version"=>0, "@class"=>"myclass", "prop1"=>1, "prop2"=>"text1", "users"=>["#4:0"]} => {"@type"=>"d", "@rid"=>"#6:1", "@version"=>0, "@class"=>"myclass", "prop1"=>2, "prop2"=>"text2", "users"=>["#4:0"]} => {"@type"=>"d", "@rid"=>"#6:2", "@version"=>0, "@class"=>"myclass", "prop1"=>3, "prop2"=>"text3", "users"=>[]} => {"@type"=>"d", "@rid"=>"#6:3", "@version"=>0, "@class"=>"myclass", "prop1"=>4, "prop2"=>"text4", "users"=>[]} => {"@type"=>"d", "@rid"=>"#6:4", "@version"=>0, "@class"=>"myclass", "prop1"=>5, "prop2"=>"text5", "users"=>[]}

puts client.query "SELECT count(*) FROM #{CLASS}" => {"@type"=>"d", "@version"=>0, "count"=>5, "@fieldTypes"=>"count=l"}

puts client.query "SELECT max(prop1) FROM #{CLASS}" => {"@type"=>"d", "@version"=>0, "max"=>5}

puts client.query "TRAVERSE any() FROM (SELECT FROM #{CLASS} WHERE prop1 = 1)" => {"@type"=>"d", "@rid"=>"#6:0", "@version"=>0, "@class"=>"myclass", "prop1"=>1, "prop2"=>"text1", "users"=>["#4:0"]} => {"@type"=>"d", "@rid"=>"#4:0", "@version"=>0, "@class"=>"OUser", "name"=>"admin", "password"=>"{SHA-256}8C6976E5B5410415BDE908BD4DEE15DFB167A9C873FC4BB8A81F6F2AB448A918", "status"=>"ACTIVE", "roles"=>["#3:0"]} => {"@type"=>"d", "@rid"=>"#3:0", "@version"=>0, "@class"=>"ORole", "name"=>"admin", "mode"=>1, "rules"=>{}, "@fieldTypes"=>"mode=b"}

client.drop_class CLASS client.disconnect => ["401 Unauthorized: Logged out", 401]

== INSTALL

sudo gem install orientdb4r

=== Important Upgrade Notice

  • see +changelog.txt+

== FEATURES/PROBLEMS

  • Supports only REST API right now

== REQUIREMENTS

  • Ruby 1.9.x+
  • OrientDB 1.0.x-1.3.x for v0.3.x
  • OrientDB 1.4.0+ for v0.4.x
  • OrientDB 1.6.0+ for v0.5.x

== TESTS

cd /path/to/repository bundle exec rake db:setup4test # to create the temp DB which doesn't seem to be a default since v1.5 bundle exec rake test

Make sure before starting the tests:

  • database server is running on localhost:2480
  • there is a root account with username=root and password=root; if your password is different, specify it with an ORIENTDB_ROOT_PASS environment variable

== AUTHOR

== LICENSE

== CONTRIBUTING

  1. Fork it ( https://github.com/veny/orientdb4r/fork )
  2. Create your feature branch ( git checkout -b my-new-feature )
  3. Commit your changes ( git commit -am 'Add some feature' )
  4. Push to the branch ( git push origin my-new-feature )
  5. Create a new Pull Request

FAQs

Package last updated on 26 Mar 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc