Class: Bubble::KnockKnock::Connection

Inherits:
Object
  • Object
show all
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

APP_NAME, VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#authObject (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

#emailObject

Returns the value of attribute email.



16
17
18
# File 'lib/bubble/knock_knock/connection.rb', line 16

def email
  @email
end

#passwordObject (readonly)

Returns the value of attribute password.



17
18
19
# File 'lib/bubble/knock_knock/connection.rb', line 17

def password
  @password
end

#serviceObject

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