Connection information from member.data.connection (in account profile)
{
connection: {
login: {
timestamp: '2017-03-29T02:54:26.750Z',
siteId: 'iMmv-tD9dswv71XMEBeJgQ',
device: {
os: 'Macintosh 10.11.6',
browser: 'Chrome',
type: 'Desktop'
},
url: 'http://localhost:3000/',
ipAddress: '127.0.0.1'
}
}
}
The code that writes it to data store:
def account_updated # webhook for account updated
....
uids.each do |uid|
GigyaMember.find(uid, nil).tap do |member|
store_connection_information(member)
end
end
.....
end
def store_connection_information(member)
connection_information = member.data[:connection]
return unless connection_information
::Gigya::DataStore.store(apiKey: APP_CONFIG['gigya_default_api_key'],
data: { connection: connection_information }.to_json,
oid: 'auto',
type: 'connections',
UID: member.uid)
end
I set the type to connections (plural) similar to Rails convention (but can be changed to singular). oid is auto as per recommendation.
To retrieve the data, we'll do it like this:
::Gigya::DataStore.search(query: "SELECT * FROM connections WHERE UID = '#{member.uid}'", apiKey: APP_CONFIG['gigya_default_api_key'])