Module: Socialyzer
- Defined in:
- lib/socialyzer.rb,
lib/socialyzer/engine.rb,
lib/socialyzer/version.rb
Defined Under Namespace
Classes: Engine
Constant Summary collapse
- API_KEY =
SOCIALYZER_API_KEY
- VERSION =
"0.0.9"
Class Method Summary collapse
- .add_twitter_user(screen_name, options = {}) ⇒ Object
- .api_action(action, env = :production) ⇒ Object
- .api_request(action, options = {}) ⇒ Object
- .bitly_links(screen_name) ⇒ Object
-
.bulk_add_twitter_account(options = {}) ⇒ Object
Not really supported yet.
- .daily_best(screen_name) ⇒ Object
- .optimize(screen_name, options = {}) ⇒ Object
- .optimize_facebook(options = {}) ⇒ Object
- .optimize_twitter(screen_name, options = {}) ⇒ Object
- .twitter_user(screen_name) ⇒ Object
Class Method Details
.add_twitter_user(screen_name, options = {}) ⇒ Object
12 13 14 |
# File 'lib/socialyzer.rb', line 12 def self.add_twitter_user(screen_name, ={}) api_request(:add_twitter_account, .merge(:user => screen_name)) end |
.api_action(action, env = :production) ⇒ Object
53 54 55 |
# File 'lib/socialyzer.rb', line 53 def self.api_action(action, env=:production) "#{Socialyzer::BASE_URL}/api/#{action}.json" end |
.api_request(action, options = {}) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/socialyzer.rb', line 46 def self.api_request(action, ={}) env = .delete(:env) || :production .merge!(:key => API_KEY) res = RestClient.post api_action(action, env), .to_json, :content_type => :json, :accept => :json JSON.parse(res) end |
.bitly_links(screen_name) ⇒ Object
36 37 38 |
# File 'lib/socialyzer.rb', line 36 def self.bitly_links(screen_name) api_request(:bitly_links, :user => screen_name) end |
.bulk_add_twitter_account(options = {}) ⇒ Object
Not really supported yet
42 43 44 |
# File 'lib/socialyzer.rb', line 42 def self.bulk_add_twitter_account(={}) api_request(:bulk_add_twitter_account, ) end |
.daily_best(screen_name) ⇒ Object
32 33 34 |
# File 'lib/socialyzer.rb', line 32 def self.daily_best(screen_name) api_request(:daily_best, :user => screen_name)["schedule"] end |
.optimize(screen_name, options = {}) ⇒ Object
16 17 18 |
# File 'lib/socialyzer.rb', line 16 def self.optimize(screen_name, ={}) api_request(:optimize, .merge(:user => screen_name)) end |
.optimize_facebook(options = {}) ⇒ Object
24 25 26 |
# File 'lib/socialyzer.rb', line 24 def self.optimize_facebook(={}) api_request(:optimize_facebook, ) end |
.optimize_twitter(screen_name, options = {}) ⇒ Object
20 21 22 |
# File 'lib/socialyzer.rb', line 20 def self.optimize_twitter(screen_name, ={}) optimize(screen_name, ) end |
.twitter_user(screen_name) ⇒ Object
28 29 30 |
# File 'lib/socialyzer.rb', line 28 def self.twitter_user(screen_name) api_request(:twitter_user, :user => screen_name)["twitter_user"] end |