Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
Envolve API module to create signed commands and javascript tags to interact with Envolve chat service. http://envolve.com Accepting pull requests! ----------------------------------------------------------------- *Usage* To use in a Rails app, make sure you have the hmac-sha1 gem and add this module to your /lib folder. Then call EnvolveChat::ChatRenderer.get_html from a view or helper with the appropriate keywords specified. The function will return javascript that you can use in your page's HTML. This ruby code: #in Gemfile gem "ruby-hmac" #in view or helper EnvolveChat::ChatRenderer.get_html("123-abcdefghijklmnopqrs", :first_name => user.first_name, :last_name => user.last_name, :is_admin => user.admin, :pic => user.avatar(:itty_bitty), :people_list_header_text => "Chat with site visitors", :people_here_text => "People online", :groups => [{:id => "forum_sec", :name => "Forum Chat"}] ) will produce javascript similar to: <script type="text/javascript"> envoSn=123; env_commandString="{ command string }"; envoOptions={peopleHereText : 'People online',peopleListHeaderText : 'Chat with site visitors',groups : [{id : 'forum_sec', name : 'Forum Chat'}]}; </script> <script type="text/javascript" src="http://d.envolve.com/env.nocache.js"></script> ----------------------------------------------------------------- *Options* envolve_api_key -- your site's Envolve API key as a string Command arguments: first_name -- optional string for the user's first name. Default value: None. last_name -- optional string for the user's last name. Default value: None. pic -- optional string of the absolute URL to the user's avatar. Default value: None. is_admin -- optional boolean for the user's admin status. Default value: False. Option arguments: people_here_text -- optional text used to customize the "X People Here" message Default value: none people_list_header_text -- optional text used to customize the "Chat with people on this site" message Default value: none enable_socialgo -- optional boolean to enable login for SocialGo Default value: false groups -- array of hashes containing values for :id and :name For more information on options: http://www.envolve.com/api/developer-api-options.html If first_name is not passed in, the user will be anonymous. ----------------------------------------------------------------- This is free software intended for integrating your custom ruby software with Envolve's website chat software. You may do with this software as you wish. # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Created by Lail Brown <http://github.com/lailbrown> Borrows heavily from the Python module originaly created by Matt Wood <http://github.com/mattwood>