Module: SocialPoster
- Defined in:
- lib/social_poster.rb,
lib/social_poster/helper.rb,
lib/social_poster/version.rb,
lib/social_poster/poster/twitter.rb,
lib/social_poster/poster/facebook.rb,
lib/social_poster/poster/vkontakte.rb,
lib/social_poster/poster/live_journal.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.0.6"
- @@fb =
@@lj = @@twitter = @@vk = {}
Class Method Summary collapse
- .fb=(value) ⇒ Object
- .get_config(name) ⇒ Object
- .lj=(value) ⇒ Object
- .setup {|_self| ... } ⇒ Object
- .twitter=(value) ⇒ Object
- .vk=(value) ⇒ Object
- .write(network, text, title = '', options = {}) ⇒ Object
Class Method Details
.fb=(value) ⇒ Object
28 29 30 |
# File 'lib/social_poster.rb', line 28 def self.fb= value @@fb = value end |
.get_config(name) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/social_poster.rb', line 19 def self.get_config(name) { facebook: @@fb, livejournal: @@lj, vkontakte: @@vk, twitter: @@twitter }[name.to_sym] end |
.lj=(value) ⇒ Object
32 33 34 |
# File 'lib/social_poster.rb', line 32 def self.lj= value @@lj = value end |
.setup {|_self| ... } ⇒ Object
15 16 17 |
# File 'lib/social_poster.rb', line 15 def self.setup yield self end |
.twitter=(value) ⇒ Object
40 41 42 |
# File 'lib/social_poster.rb', line 40 def self.twitter= value @@twitter = value end |
.vk=(value) ⇒ Object
36 37 38 |
# File 'lib/social_poster.rb', line 36 def self.vk= value @@vk = value end |
.write(network, text, title = '', options = {}) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/social_poster.rb', line 44 def self.write(network, text, title = '', = {}) site = case network.to_sym when :fb site = Poster::Facebook.new() when :vk site = Poster::Vkontakte.new() when :twitter site = Poster::Twitter.new when :lj site = Poster::LiveJournal.new else raise "Unknown network #{network}" end site.write(text, title) end |