Class: Trackinator::Google

Inherits:
Object
  • Object
show all
Defined in:
lib/trackinator/google.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Google

Returns a new instance of Google.



3
4
5
# File 'lib/trackinator/google.rb', line 3

def initialize client
  @client = client
end

Instance Method Details

#get_tickets(file_name) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/trackinator/google.rb', line 19

def get_tickets file_name
  puts "reading document..."

  spreadsheet_list_data = get_spreadsheet_list_data file_name
  tickets = []

  spreadsheet_list_data.elements.each('entry') do |entry|
    tickets << get_ticket_data(entry)
  end

  tickets
end

#is_logged_in?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/trackinator/google.rb', line 15

def is_logged_in?
  !@token.nil?
end

#login(opts) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/trackinator/google.rb', line 7

def  opts
  begin
    @token = @client.clientlogin(opts[:google_username], opts[:google_password])
  rescue Exception => e
    @token = nil
  end
end