DataVirtuality Ruby REST Client: Fast and RESTful connection to DataVirtuality

 

RESTful connection to DataVirtuality Logical Data Warehouse:

Today we have an exciting update. Data Virtuality now offers a Ruby REST client. It connects you to DataVirtuality via REST (Representational State Transfer) service to consume data in any Ruby applications!

We already improved our REST API based on customer requests for DataVirtuality 2.0. This Ruby client is an additional lightweight approach to expose data to users. Our commitment is to enable you to connect to DataVirtuality not only via front-end tools like Tableau, but also to retrieve and process data from DataVirtuality in your custom application!

Our DataVirtuality Ruby REST client come with many benefits like our REST API:

• Fast and easy query and manipulation of data on the web using HTTP
• Use our REST API to build web services on top of DataVirtuality

But it has some additional benefits:

• Save time and no more need to read our REST API documentation
• Less code and less implementation work
• Consume data with any Ruby application you have

Since some of our clients have communicated the need for such a service, we wrote this REST client for you in Ruby, one of the most popular programming languages for web applications, and it’s available on Github with easy setup instructions. Better yet, you can use it as a template to tweak around for your needs.

What kind of use cases are possible?

Use cases for our REST client could involve:
1.) Use Ruby to query data quickly and easily from DataVirtuality via REST and then integrate the data as KPIs into emails for your company’s daily updates
2.) Push data from DataVirtuality directly to your backoffice system for your use in dashboards, data analysis, and any business processes

How can I use the Ruby client for my DataVirtuality Logical Warehouse?

Now, we will walk through the setup of this Ruby client with you. The instruction can be found in the README.md on our Github repository at: https://github.com/DataVirtuality/datavirtuality_rest-ruby

Before we install the DataVirtuality REST Client, you should make sure that you have Ruby installed on your current device. You can check it by typing either one of the following lines in your terminal:
$ ruby –v
$ ruby –version

If the terminal returns “command not found”, then you do not have Ruby installed. Please visit the official Ruby website and follow the instruction to install Ruby.

Then, you would want to install Bundler, which helps you to manage gems, the format to package Ruby programs and libraries, with the following:
$ gem install bundler

Next, in your project’s root directory, find out if you have a Gemfile yet. If not, create a Gemfile either manually in your GUI environment or type the following in your terminal:
$ touch Gemfile

Now you are ready to install DataVirtuality REST Client. Add the following line in your project’s Gemfile with a text editor:
gem ‘datavirtuality_rest’

or type the following shell command in your terminal:
$ echo “gem ‘datavirtuality_rest’” >> Gemfile

Then execute:
$ bundle

Or install it manually:
$ gem install datavirtuality_rest

And that’s it! Now you have DataVirtuality REST Client installed and ready to use.

Want some usage examples?

First instantiate your client by specifying the server URL, username, and password:
> client = DataVirtuality::Rest.new(‘http://127.0.0.1:8080’, ”, ”)

Now you can retrieve data in two ways:

1.) Read a full table or view by specifying the full schema and path, separated by a slash:
> client.get(‘views/demo_view’)
=> [{:id=>”438256″, :date=>”2017-04-01″, :hits=>331}, {:id=>”438918″, :date=>”2017-04-01″, :hits=>314}]

2.) Specify a customer SQL query to gain full flexibility:
> client.query(‘SELECT * FROM views.demo_view’)
=> [{:id=>”438918″, :date=>”2017-04-01″, :hits=>886}, {:id=>”431936″, :date=>”2017-02-02″, :hits=>389}])

Now you know how to use our DataVirtuality REST client.

If you have any feedback or wishes for specific functionality, get in touch with us under info@datavirtuality.com!