ue-ruby-sdk

A UnificationEngine client SDK for Ruby/Rails

Installation

$ gem install ue-ruby-sdk

Usage

var app = UEApp.new("APP_KEY","APP_SECRET");

Creating User

user = app.create_user
#user is an instance of UEUser

Listing Users

users = app.list_users
#users is an array of User objects

Deleting User

user = app.create_user
app.delete_user(user) #true

Adding a connection to a user

connection = user.add_connection "myconnectionname", "facebook", "facebook_access_token")
#connection is an instance of UEConnection
  • connection_name must be unique per connection.
  • access_token has to be valid and working from the provider side

Listing User connections

connections = user.list_connections
# connections is an array of UEConnection objects

Removing a User Connection

user.remove_connection(connection_name) #true | false

Testing a connection

#return true if working, false otherwise
user.test_connection(service_url) #eg: facebook://[email protected]

Sending a message using a connection

options = {
    receivers:[
        {
            name:"me"
        },
        {
            name:"Page",
            id:"122"
        }
    ],
    message:{
        subject:"test",
        body: "ABC",
        image:"http://politibits.blogs.tuscaloosanews.com/files/2010/07/sanford_big_dummy_navy_shirt.jpg",
        link:{
            uri: "http://google.com",
            description: "link desc",
            title:"link title"
        }
    }
}

#uris will hold the uris for the sent messages
uris = app.list_connections[0].send_message options