57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/orkut/client/scraps.rb', line 57
def send_scrap(token, secret, friend_social_id, msg)
consumer = initialize_consumer
token_hash = { :oauth_token => token, :oauth_token_secret => secret }
access_token = OAuth::AccessToken.from_hash(consumer, token_hash )
data = "
{
'method' : 'messages.create',
'id' : 'myself',
'params' :
{
'userId' : '#{friend_social_id}',
'groupId' : '@self',
'message' :
{
'recipients' : '#{friend_social_id}',
'body' : '#{msg}',
'title' : 'Chip',
},
'messageType' : 'public_message'
}
}"
result = access_token.post(RPC_ENDPOINT, data, { 'Content-Type' => 'application/json' }).body
MultiJson.decode(result)
end
|