<commit_before>module GoogleReader

  # the main api
  class Api
    
    BASE_URL = "http://www.google.com/reader/api/0/"
    
    require "api_helper"
    require "json"
    
    include GoogleReader::ApiHelper
    
    attr_accessor :email,:password
    
    def initialize(email,password)
      @email, @password = email, password
    end
    
    def unread(feed_url=nil)
      feed_url = "/state/com.google/reading-list" if ! feed_url
      feed = fetch_unread['unreadcounts'].find {|e| e['id'] =~ Regexp.new(feed_url)}
      feed ? feed['count'] : 0
    end

    def user_info<commit_msg>documentation<commit_after>module GoogleReader

  # the main api
  class Api
    
    BASE_URL = "http://www.google.com/reader/api/0/"
    
    require "api_helper"
    require "json"
    
    include GoogleReader::ApiHelper
    
    attr_accessor :email,:password
    
    def initialize(email,password)
      @email, @password = email, password
    end
    
    # get the number of unread items for a feed_url
    # feed_url can be a regular string (it will try to match it)
    # better will be to use the feed url, since this will match only one
    # this will only return the first one found. 
    def unread(feed_url=nil)
      feed_url = "/state/com.google/reading-list" if ! feed_url
      feed = fetch_unread['unreadcounts'].find {|e| e['id'] =~ Regexp.new(feed_url)}
      feed ? feed['count'] : 0
    end

    # this will return the user info as a hash
    # example:
    # "userId":"01723985652832499840",
    # "userName":"username",
    # "userProfileId":"123456789123456789123",
    # "userEmail":"<EMAIL>",
    # "isBloggerUser":true,
    # "signupTimeSec":1234515320
    def user_info
{'fraction_non_alphanumeric': 0.11196228638774308, 'fraction_numerical': 0.03241013553329405, 'mean_word_length': 2.7733333333333334, 'pattern_counts': {'":': 6, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '24701', 'n_tokens_mistral': 597, 'n_tokens_neox': 552, 'n_words': 140}