Tip:
Highlight text to annotate it
X
Hey everybody this is Chris Cera, I'm the CTO of Vuzit. I'm going to quickly show you
how a developer would integrate Vuzit into their own web application. So we'll upload
a document using one of our open source client libraries, and view it using some Javascript.
Specifically, we're going to use the vuzitruby client library, and integrate it into a simple
Ruby on Rails application. So here we go.
Right now we're in the Vuzit Dashboard. As you can see down here I have an Enterprise
On-Demand account which gives us access to the batch upload capabilities as well as a
number of other benefits which we're going to use in this demo. It's a brand new account,
so I don't have any documents in this account. And one last thing I'll show you in the dashboard
is we're going to get your public and private keys from the Settings section, and you can
see you can just copy and paste those which we're gonna do later.
Now as a developer, I have plenty of resources in the developer community section of the
vuzit.com website. I might navigate over to the vuzitruby section, but rather than walk
you through the documentation I'm going to show you a really quick demonstration.
So we have our open source client library as a gem, it's on the main gem servers, so
you can just do a gem install ruby and it knows where to pull that down from the internet.
So now we're going to create a very basic rails application using some of the rails
code generation facilities. And we're going to call this vuzit_rails. We're going to change
into the directory. We're going to use some more of the code generation facilities to
create one of the controllers. So there, we're going to create a controller called document.
The two actions that we're gonna use are called index and show. And the index method is where
we're gonna, the index action is where we're gonna upload the document to and then we're
going to show it just moments later.
And so now I'm going to run our rails server, and then I'm going to just load up these files
in my favorite text editor, and we'll be ready to go.
So here's the simple code that it generates, so we're going to navigate over to our rails
server. And you can see you go into the document action and there is our very simple code so
I'm going to modify this code. Now I have a test application I've already built, it's
really simple, and rather than bore you with typing it out I'm going to just paste it in
here. So we have an upload form that I've created, which you can see, you can browse
locally for a file, and then upload it. The important thing to note here is we're going
to do an HTTP POST, and it's gonna send that file to the show action.
So now let's go into our document controller code and we'll replace that with the code
that I've written. We'll notice that this code is using the vuzitruby client library.
So the first thing that it does is it requires the vuzitruby library. The show action as
you can see here, is just very basic, it's gonna accept the uploaded file, it's gonna
put it into the public folder of the rails application which has special meaning in a
rails app. We're just going to write the file there for the sake of example. We pass in
our public and private keys into the vuztiruby library, and then we use the document upload
method and pass it the file name that we just saved. And this will pass us back a document
object, and that object is gonna have the id number that the vuzit.com server has assigned
to it which we'll use to later recall it and view it. And we're going to do that in the
show action so here's our basic code and I'm going to replace that with the code that I
have here.
And I got this code from the developer section of the, of the javascript, the javascript
section of the developer page. And we have an example called the full screen example
which I've modified very slightly here. A couple things to note we pass in our public
key using the api key set function and we're gonna use the viewer fromid() method and pass
it the document.id that got passed back from the document upload function of the vuzitruby
library. And that, that's essentially it, so let's, let's get started.
So I'm gonna pick a file locally, it's gonna upload it to the vuzit.com server, Vuzit's
gonna assign an id number to it, pass it back to us, and then we're now displaying it. It
takes a couple seconds, and the document has now been processed. So now if I go back to
our Dashboard, we can see that the document's now been uploaded into our account, and, as
part of the Dashboard, a business user can can use the Dashboard to share, look at analytics,
and and it doesn't require a developer from this point onward.
So that's it for this simple demonstration. I really appreciate you taking the time to
take a look it. If you have any questions, please let us know. Take care.