title: TypeError: gapi.client.plus is undefined
body: <p>I want to post message to google plus when a user logged in my Ruby on Rails application with his google plus credentials.</p>
  
  <p>I have tried the following code.</p>
  
  <pre><code> &lt;script src="/../assets/plusone.js"&gt;&lt;/script&gt;
   &lt;script type="text/javascript"&gt;
   function writeAddActivity(url){
  
  var payload = {
    "type":"http:\/\/schema.org\/AddAction",
    "startDate": "2012-10-31T23:59:59.999Z"
  };
  if (url != undefined){
    payload.object = {
      'url' : "https://plus.google.com/js/client:plusone.js"
    };
  }else{
  payload.object = {
    "id" : "replacewithuniqueidforaddtarget",
    "image" : "http:\/\/www.google.com\/s2\/static\/images\/GoogleyEyes.png",
    "type" : "http:\/\/schema.org\/CreativeWork",
    "description" : "The description for the action",
    "name":"An example of AddAction",
    "src" : "https://plus.google.com/js/client:plusone.js"
  };
  }
   gapi.client.plus.moments.insert(
    {  'userId' : 'me',
       'collection' : 'vault',
       'resource' : payload
    }).execute(function(result){
        console.log(result);
    });
  </code></pre>
  
  <p>}
  </p>
  
  <p>But it's giving "TypeError: gapi.client.plus is undefined" . Could you explain what is the error and how to resolve it? Thanks in advance.</p>