class Feedlrop::Feedlrop
Public Class Methods
new( token , kind, hs )
click to toggle source
# File lib/feedlrop/feedlrop.rb, line 11 def initialize( token , kind, hs ) @oauth_access_token = token @dbmgr = Arxutils::Store.init(kind , hs ){ | register_time | Dbutil::DbMgr.new( register_time ) } @client = Feedlr::Client.new(sandbox: false , oauth_access_token: @oauth_access_token) @profile = @client.user_profile @categories = @client.user_categories end
Public Instance Methods
csv_add(category_id , id , count)
click to toggle source
# File lib/feedlrop/feedlrop.rb, line 68 def csv_add(category_id , id , count) @csv << [category_id , id , count ] end
csv_close()
click to toggle source
# File lib/feedlrop/feedlrop.rb, line 72 def csv_close @csv.close end
csv_open()
click to toggle source
# File lib/feedlrop/feedlrop.rb, line 61 def csv_open @csv = CSV.new(get_output_file("csv") , { :headers => %w!category_id id count!, :write_headers => true } ) end
get_all_unread_count()
click to toggle source
# File lib/feedlrop/feedlrop.rb, line 28 def get_all_unread_count @categories.each do | x | f = true if x.class != String category_id = x.id.split('/')[-1] else f = false end next unless f en = @client.user_unread_counts( {:streamId => x.id } ) en.unreadcounts.each do |y| if y.id =~ /^feed\/(.+)/ url = $1 csv_add( category_id , url , y[:count] ) @dbmgr.add( category_id , url , y[:count] ) end end end end
get_output_file( ext )
click to toggle source
# File lib/feedlrop/feedlrop.rb, line 22 def get_output_file( ext ) n = Time.now fname = %Q!#{n.year}-#{n.month}-#{n.day}-#{n.hour}-#{n.min}-#{n.sec}.#{ext}! File.open( fname , "w") end
print_subscription()
click to toggle source
# File lib/feedlrop/feedlrop.rb, line 53 def print_subscription option = {:plain => true } puts @client.user_subscriptions.size @client.user_subscriptions.map{|m| puts m.id} puts "===============" @client.user_subscriptions.map{|m| ap m , option } end
print_user_profile()
click to toggle source
# File lib/feedlrop/feedlrop.rb, line 49 def print_user_profile pp @profile end