<commit_before>require "env"
require "rubygems"
require "google_drive"

module GoogleFbAutoMsg
  # Your code goes here...

  class ConnectWithGoogleForm
    def initialize
      puts "hello"
      puts Env.user_name
    end

    def print_spreadsheet
      # Logs in.
      # You can also use OAuth. See document of
      # GoogleDrive.login_with_oauth for details.
      #Env['USER_NAME']
      session = GoogleDrive.login(Env.user_name, Env.user_password)

      # First worksheet of
      # https://docs.google.com/spreadsheet/ccc?key=<KEY>
      ws = session.spreadsheet_by_key(Env.spreadsheet_key).worksheets[0]

      # Gets content of A2 cell.
      p ws[2, 1]  #==> "hoge"
    end
  end
end

app = GoogleFbAutoMsg::ConnectWithGoogleForm.new
app.print_spreadsheet<commit_msg>Refactored Google connnection initialization for session and spreadsheet<commit_after>require "env"
require "rubygems"
require "google_drive"

module GoogleIntegration
  # Your code goes here...

  class ConnectWithGoogleSpreadsheet
    def initialize
      puts "hello"
      puts Env.user_name
      # Logs in.
      # You can also use OAuth. See document of
      # GoogleDrive.login_with_oauth for details.
      #Env['USER_NAME']
      session = GoogleDrive.login(Env.user_name, Env.user_password)
      # First worksheet of
      # https://docs.google.com/spreadsheet/ccc?key=<KEY>
      @spreadsheet = session.spreadsheet_by_key(Env.spreadsheet_key).worksheets[0]
    end

    def print_spreadsheet

      # Gets content of A2 cell.
      puts @spreadsheet[2, 1]  #==> "hoge"
    end
  end
end

app = GoogleIntegration::ConnectWithGoogleSpreadsheet.new
app.print_spreadsheet
{'fraction_non_alphanumeric': 0.08779314491882141, 'fraction_numerical': 0.004810583283223091, 'mean_word_length': 3.191435768261965, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2465067', 'n_tokens_mistral': 554, 'n_tokens_neox': 526, 'n_words': 128}