Class: Twitterland::FollerMe

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/twitterland/foller_me.rb

Class Method Summary collapse

Class Method Details

.hashtags(username, options = {}) ⇒ Object

Get hashtags for a specific user

Twitterland::FollerMe.hashtags('pengwynn', options)
   options: 
      exclude   => 'rails,ruby'
      render    =>  true|false
      font_min  =>  12
      font_max  =>  20


16
17
18
# File 'lib/twitterland/foller_me.rb', line 16

def self.hashtags(username, options={})
  terms(username, {:terms => 'hashtags'}.merge(options))
end

.mentions(username, options = {}) ⇒ Object

Get mentions for a specific user

Twitterland::FollerMe.mentions('pengwynn', options)
   options: 
      exclude   => 'mully,jdirt'
      render    =>  true|false
      font_min  =>  12
      font_max  =>  20


40
41
42
# File 'lib/twitterland/foller_me.rb', line 40

def self.mentions(username, options={})
  terms(username, {:terms => 'mentions'}.merge(options))
end

.terms(username, options = {}) ⇒ Object

Get terms for a specific user

Twitterland::FollerMe.terms('pengwynn', options)
   options: 
      terms      => 'all|hashtags|topics|mentions}
      exclude   => 'rails,ruby'
      render    =>  true|false
      font_min  =>  12
      font_max  =>  20


53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/twitterland/foller_me.rb', line 53

def self.terms(username, options={})
  options = options.to_hash.to_mash
  terms = options.delete('terms')
  terms ||= 'all'
  result = Hashie::Mash.new get("/#{username}/#{terms}.json", :query => options)
  case terms
  when 'all'
    result.topics ||= result.delete('terms_topics')
    result.mentions ||= result.delete('terms_mentions')
    result.hashtags ||= result.delete('terms_hashtags')
  when 'hashtags'
    result.hashtags ||= result.delete('terms')
  when 'topics'
    result.topics ||= result.delete('terms')
  when 'mentions'
    result.mentions ||= result.delete('terms')
  end
  result
end

.topics(username, options = {}) ⇒ Object

Get topics for a specific user

Twitterland::FollerMe.topics('pengwynn', options)
   options: 
      exclude   => 'rails,ruby'
      render    =>  true|false
      font_min  =>  12
      font_max  =>  20


28
29
30
# File 'lib/twitterland/foller_me.rb', line 28

def self.topics(username, options={})
  terms(username, {:terms => 'topics'}.merge(options))
end