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
Returns the value of attribute auth.
-
#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.
Class Method Summary collapse
-
.auth ⇒ Object
Retrieve the Auth Token required for authentications on all Google Services.
-
.connect(email, password, service) ⇒ Object
This method creates the connection.
Instance Method Summary collapse
-
#connect(email, password, service) ⇒ Object
This method creates the connection, but internally.
Instance Attribute Details
#auth ⇒ Object (readonly)
Returns the value of attribute auth.
17 18 19 |
# File 'lib/bubble/knock_knock/connection.rb', line 17 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 |
Class Method Details
.auth ⇒ Object
Retrieve the Auth Token required for authentications on all Google Services.
34 35 36 |
# File 'lib/bubble/knock_knock/connection.rb', line 34 def self.auth instance.auth end |
.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 |
# File 'lib/bubble/knock_knock/connection.rb', line 29 def self.connect(email, password, service) instance.connect(email, password, service) end |
Instance Method Details
#connect(email, password, service) ⇒ Object
This method creates the connection, but internally. To create the connection you must use Connection.connect() method.
39 40 41 42 43 44 45 46 |
# File 'lib/bubble/knock_knock/connection.rb', line 39 def connect(email, password, service) @email = email @password = password @service = service setup stablish end |