Skip to content

Instantly share code, notes, and snippets.

@AVGP
Created September 21, 2012 15:37
Show Gist options
  • Save AVGP/3762229 to your computer and use it in GitHub Desktop.
Save AVGP/3762229 to your computer and use it in GitHub Desktop.
Ruby sample code to access the sample library
require "java"
require "json.jar"
require "Sample.jar"
alice = Java::OrgAvgpSample::User.new("Alice")
bob = Java::OrgAvgpSample::User.new("Bob")
puts alice.getId()
puts bob.getId()
message = Java::OrgAvgpSample::Message.new(alice, bob, "Hello Bob!")
puts message.toJSONString()
$ ruby sample.rb
70f96309-1767-4ad3-a8f6-279bf4c10a3d
d07ad352-4186-487d-a1f3-8c0e0f2fa122
{sender: {name: "Alice", id: "70f96309-1767-4ad3-a8f6-279bf4c10a3d"}, receipient: {name: "Bob", id: "d07ad352-4186-487d-a1f3-8c0e0f2fa122"}, content: "Hello Bob!"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment