Class: Bubble::KnockKnock::Connection
- Inherits:
-
Object
- Object
- Bubble::KnockKnock::Connection
- Includes:
- Bubble::KnockKnock, Exceptions, Singleton
- Defined in:
- lib/bubble/knock_knock/connection.rb
Overview
This class make the connection between Ruby and Google. It’s a Singleton class, turning the management of the connection easier. Just one connection will be created during all your script.
Constant Summary
Constants included from Bubble::KnockKnock
Instance Attribute Summary collapse
-
#auth ⇒ Object
readonly
Retrieve the Auth Token required for authentications on all Google Services.
-
#email ⇒ Object
Returns the value of attribute email.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#service ⇒ Object
Returns the value of attribute service.
Instance Method Summary collapse
-
#connect(email, password, service) ⇒ Object
This method creates the connection.
Instance Attribute Details
#auth ⇒ Object (readonly)
Retrieve the Auth Token required for authentications on all Google Services.
39 40 41 |
# File 'lib/bubble/knock_knock/connection.rb', line 39 def auth @auth end |
#email ⇒ Object
Returns the value of attribute email.
16 17 18 |
# File 'lib/bubble/knock_knock/connection.rb', line 16 def email @email end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
17 18 19 |
# File 'lib/bubble/knock_knock/connection.rb', line 17 def password @password end |
#service ⇒ Object
Returns the value of attribute service.
16 17 18 |
# File 'lib/bubble/knock_knock/connection.rb', line 16 def service @service end |
Instance Method Details
#connect(email, password, service) ⇒ Object
This method creates the connection. First of all it set up the environment to make the connection and after it stablish the connection with Google The service should be (i.e.):
- cp
-
Google Mail Contact Book
- analytics
-
Google Analytics
Example
require 'rubygems'
require 'knock_knock'
Bubble::KnockKnock::Connection.connect('[email protected]', 'password', 'cp')
29 30 31 32 33 34 35 36 |
# File 'lib/bubble/knock_knock/connection.rb', line 29 def connect(email, password, service) @email = email @password = password @service = service setup stablish end |