Building Social Enterprise with Ruby and Salesforce

Arya MirEnterprise Applications

Oct 6, 2011 (6 years and 1 month ago)

1,872 views

Dallas Ruby Brigade, Oct 4th, 2011 Presented by Raymond Gao

Growth of Cloud Computing & Social
Enterprise

Growth of Cloud
Computing

Cloud Computing will be a

$ 241 billion
mkt

by 2020

Market Cap of Top Cloud
Computing Companies

Name (Ticker)

Market Cap
(Billions )

Stock Price ($)

Key Product(s)

Google (GOOG)

$160 B

$495.52

G Ap
p Engine

Amazon

(AMZN)

$96.23

B

$211.98

AWS

Vmware

(VMW)

$33.31 B

$78.89

Server
Virtualization

Salesforce

(CRM)

$15.16 B

$111.91

Force Platform

NetApp

(NTAP)

$12.39 B

$33.64

Storage

RackSpace

(RAX)

$31.49 B

$31.49

Cloud Services

2010

2011

Web Usage

4 hours

per month

Rest of the Web

Sources: Ben Elowitz, Wetpaint / comScore

Social
Revolution

Facebook Members (Growth
of Social Networking)

More than 500
million active users

over 900 million
objects (pages,
groups, events and
community pages)

About 70% of
Facebook users are
outside the United
States

9 Novembre, 2010

2010 IUT Cloud Computing Seminar

7

Architecture for the Real World

Your Data Model


Your business logic



Data


Layer

Application


Logic

User


Interface

Screens exposed to the end users


Idealized Situation

How are your opinions?

What do you like most?

What do you like least?

What kinds of difficulties have you had?

What do you think the real world is like?

Small Problem


Easy Fix

Just lift the car out of water

Initial Disappointment

Bring on Heavier
E
quipment

Whoops, That too was a surprise!

Guess what’s next?

An Example DB Schema

Source: from Internet

Another Example

Source: from Internet

More Examples

Source: from Internet

1
st

attempt at reinventing
the wheel

Reinvent the wheel is
tougher than you think

Classic Approach Meets
Classic Problems

Too Simplistic

Linear model

Inflexible

Static Input / Output

Either Quality, Time, or Cost

Read my blog
-

http://www.are4.us/?p=815


Lean Approach


Smart
Learning

Data Store is everywhere

Browsers (Chrome, Firefox, IE, Opera)

Mobile devices (
Iphone
, Android, Blackberry, Windows CE,
Symbian)

Adobe Flash Applications

Desktop Applications

Game Consoles,

Everywhere !!!


Meshed Architecture
(Macro View )

Community
Data Models

Growth of No
-
SQL DBs

Some Causes

SW developers are not natural born DBAs

Developing a good data scheme is pretty tough

Convince your partner to use your DB scheme is tougher!

DB administration could be a full time job

Backup

Security

Profiles

Etc



Mesh Architecture

(Micro view)

High
Perf

Data Services

(
No
-
SQL, In
-
Memory

Cached Objects
)

Additional Data Sources

Benefits of Ruby on SF

There are lots of incentive to use Ruby

Tools for building web
-
apps (ERB, HAML, Markdowns)

Methodology (BDD


Cucumbe
,
Rspec
,
Shoulda
)

Testing (
Webrat
, Capybara, Unit Testing)

Ease of Deployment & code version & collaboration (
Git
)

Extensive Code libraries


Github

&
RubyGems

Many more



History of Ruby on
Salesforce

Version 0


API era

Version 1 + 2 (REST + SOAP)


Force.com

Era

Version 3


(Pure REST)
Database.com

era

Salesforce

Social Platform

Example App


Ruby Social
Network Updater

The
Datbase.Com

GEM

Covers both
Sobject

& Chatter API

Full CRUD on DDL side

Support:

User
-
name password

Security token

Oauth

Flow

Basic Steps

Use the GEMs

Create a client with Consumer key + secret

Authenticate (3 options)

Materialize an
Sobject

+ set Namespace (module
name)

CRUD operation on the object

Form
-
building attributes

Use the Gem

Add

GEMs

to

Gemfile

gem
'
databasedotcom
'

gem '
databasedotcom
-
rails
’ (
optional
)


R
un
bundle

install

Initialize
the client

#
configure client id/secret explicitly

#

client
=
Databasedotcom
::
Client.new

:
client_id

=> "xxx",
:
client_secret

=> "
yyy
"

#
configure client id/secret from a YAML file

#

client
=
Databasedotcom
::
Client.new

"
databasedotcom.yml
"

#
configure client id/secret from the environment

#

client
=
Databasedotcom
::
Client.new



Authenticate


# authenticate with a username and password

client.authenticate
(:username =>
"
wayne@manor.com
", :password => "
arkham
")

#
authenticate with a callback hash from
Omniauth


client.authenticate
(
hash_from_omniauth
)

#
authenticate with an externally
-
acquired OAuth2
access token

client.authenticate
(:token => "whoa
-
that
-
is
-
long")

client.materialize
("Contact")

Contact.attributes

#=
> ["Name", "Company", "Phone"]

ron

=
Contact.find
("
rons_id
")

puts
ron
["Company"]

#=> "The
Olde

Company, Inc."

ron
["Company"] = "Some New
Gig, LLC"

ron.reload
["Company"]

#
=> "The
Olde

Company, Inc."

ron
["Company"] = "Some New Gig, LLC"

ron.save


ron.reload
["Company"]


#
=> "Some New Gig, LLC"

Materialize a
SObject

Class

CRUD operations

Form
-
building attributes

Contact.label_for
("
Phone”)

#=> "Phone
Number”

Contact.picklist_values
("Honorific")

#
=> ["Mr.", "Ms.", "Dr."]



Get More Info

Presentation
-

http://dreamforce
-
demo.heroku.com/slides#
slide17

API doc
-

http://rubydoc.info/gems/databasedotcom/
frame
s

Join the Google Group
ActiveSalesforce

http://groups.google.com/group/
activesalesforce



Q & A

The End

Blog:
http://raysblog.are4.us

Twitter:
raygao

Github
:
raygao

Email:
raygao@verizon.net