RGigya

RGigya is an sdk wrapper around the Gigya Rest Api.

Install

gem install rgigya

Getting started

Please read the documentation at gigya for best practices. developers.gigya.com/037_API_reference. You may need to create a developers account to access the documentation.

Get your api key and secret.

You will need to setup your own dev site on the gigya platform for testing.

  • Go to platform.gigya.com/login.aspx to login.

  • Once you have logged into the platform. Click “add site”

  • Enter a domain and description and click add site

  • Remember the api key and secret for later

Without Rails (Standalone)

require 'RGigya'

RGigya.config({
  :api_key => "<add api key here>",
  :api_secret => "<add api secret here>",
  :use_ssl => false,
  :domain => "us1"
})

RGigya.socialize_notifyLogin({:siteUID => '1'})

With Rails

Edit your config/environments/development.rb file and add the following constants

RGigya.config({
  :api_key => "<add api key here>",
  :api_secret => "<add api secret here>",
  :use_ssl => false,
  :domain => "us1"
})

Then add your api calls in your controllers, models, libraries, etc.

RGigya.socialize_notifyLogin({:siteUID => '1'})

Examples

socialize.notifyLogin

developers.gigya.com/037_API_reference/010_Socialize/socialize.notifyLogin

userInfo = {
  'nickname' => 'Gigems', 
  'email' => '[email protected]',
  'firstName' => 'Ralph', 
  'lastName' => 'Masterson'
}

RGigya.socialize_notifyLogin({:siteUID => '1', :userInfo => userInfo.to_json} )

gm.notifyAction

developers.gigya.com/037_API_reference/040_GM/gm.notifyAction

RGigya.gm_notifyAction(:uid => '1',:action => 'comment_upvote')

comments.flagComment

developers.gigya.com/037_API_reference/030_Comments/comments.flagComment

gigya_params = {
  :commentID => params[:commentID],
  :categoryID => params[:categoryID],
  :streamID => params[:streamID]
}

RGigya.comments_flagComment(gigya_params)

Rspec Tests

We have included rspec unit tests.

Configuration

Edit spec/spec_helper.rb

Replace <add api key here> with your api key
Replace <add api secret here> with your api secret

Running tests

cd <root of the project>
rspec

Rails dummy site

We have included a rails dummy site to give you an idea of how to integrate the gem within rails. It just peforms a simple login.

Configuration

  • Edit app/views/layouts/application.html.erb

    • replace <add api key here> with your api key. You do NOT need a secret on this page.

    • replace the callback to be appropriate to your dev site.

      • In my case I added dev.rgigya.com to my hosts file and pointed it to localhost (127.0.0.1)

      • I then made the callback dev.rgigya.com/welcome.html in application.html.erb

  • Edit config/environments/development.rb and add the following constants

    • GIGYA_API_KEY = “<add api key here>”

    • GIGYA_API_SECRET = “<add api secret here>”

Running the rails app

cd test/dummy
bundle
sudo rails s -p80

New Feature Ideas

  • Rake tasks that help manage the data in gigya such as removing test users.

Contributing to RGigya

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2013 Cloudspace. See LICENSE.txt for further details.