Module: BCG

Defined in:
lib/byul.rb

Class Method Summary collapse

Class Method Details

.all_tags_with_countsObject



37
38
39
# File 'lib/byul.rb', line 37

def self.all_tags_with_counts()
  Document.all_tags_with_counts
end

.all_with_tag(q) ⇒ Object



33
34
35
# File 'lib/byul.rb', line 33

def self.all_with_tag(q)
  Document.all_with_tag(q)    
end

.currentObject



15
16
17
18
19
# File 'lib/byul.rb', line 15

def self.current
  Twitter::Trends.current.each do |c|
    BCG.search(c) 
  end    
end

.dailyObject



27
28
29
30
31
# File 'lib/byul.rb', line 27

def self.daily
  Twitter::Trends.daily.each do |d|
    BCG.search(d) 
  end    
end

.most_tagged_with(q) ⇒ Object



41
42
43
# File 'lib/byul.rb', line 41

def self.most_tagged_with(q)
  Document.most_tagged_with(q)
end

.search(q = nil) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/byul.rb', line 49

def self.search(q=nil)
  if q 
    begin
      res = Twitter::Search.new(q.query)        
      res.each do |s|
        t = Document.new(:twit_id => s.id, :from_user => s.from_user, :from_user_id => s.from_user_id, 
                              :profile_image_url => s.profile_image_url, :text => s.text, :source => s.source,
                              :to_user_id => s.to_user_id)
        t.tag(q.name, t)
        t.save
      end                
    rescue Exception => e
      puts e
    end      
  end
end

.top_25_tagsObject



45
46
47
# File 'lib/byul.rb', line 45

def self.top_25_tags
  Document.top_25_tags
end

.weeklyObject



21
22
23
24
25
# File 'lib/byul.rb', line 21

def self.weekly
  Twitter::Trends.weekly.each do |w|
    BCG.search(w) 
  end
end