social_poster 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -4,6 +4,7 @@ SocialPoster is a gem that allows you easily post to different social networks.
4
4
  * Facebook
5
5
  * Twitter
6
6
  * Livejournal
7
+ * Vkontakte
7
8
 
8
9
 
9
10
  Installation
@@ -31,6 +32,10 @@ SocialPoster.setup do |config|
31
32
  access_token: 'ACCESS_TOKEN'
32
33
  }
33
34
 
35
+ config.vk = {
36
+ access_token: 'ACCESS_TOKEN'
37
+ }
38
+
34
39
  config.twitter = {
35
40
  consumer_key: 'CONSUMER_KEY',
36
41
  consumer_secret: 'CONSUMER_SECRET',
@@ -54,6 +59,7 @@ In controller or model you can post to different social networks like this:
54
59
 
55
60
  ```ruby
56
61
  SocialPoster.write(:fb, 'Something that will appear on your Facebook Wall...')
62
+ SocialPoster.write(:vk, 'Something that will appear on your Vkontakte Wall...')
57
63
  SocialPoster.write(:twitter, 'Tweet tweet tweet')
58
64
  SocialPoster.write(:lj, 'A long text of the post...', 'A short title of it')
59
65
  ```
@@ -4,13 +4,13 @@ $:.push File.expand_path("../lib", __FILE__)
4
4
 
5
5
  require_relative 'social_poster/version'
6
6
  require_relative 'social_poster/helper'
7
- require_relative 'social_poster/poster/facebook'
8
- require_relative 'social_poster/poster/twitter'
9
- require_relative 'social_poster/poster/live_journal'
7
+ [:vkontakte, :facebook, :live_journal, :twitter].each do |p|
8
+ require_relative "social_poster/poster/#{p}"
9
+ end
10
10
 
11
11
  module SocialPoster
12
12
 
13
- @@fb = @@lj = @@twitter = {}
13
+ @@fb = @@lj = @@twitter = @@vk = {}
14
14
 
15
15
  def self.setup
16
16
  yield self
@@ -20,6 +20,7 @@ module SocialPoster
20
20
  {
21
21
  facebook: @@fb,
22
22
  livejournal: @@lj,
23
+ vkontakte: @@vk,
23
24
  twitter: @@twitter
24
25
  }[name.to_sym]
25
26
  end
@@ -32,6 +33,10 @@ module SocialPoster
32
33
  @@lj = value
33
34
  end
34
35
 
36
+ def self.vk= value
37
+ @@vk = value
38
+ end
39
+
35
40
  def self.twitter= value
36
41
  @@twitter = value
37
42
  end
@@ -40,6 +45,8 @@ module SocialPoster
40
45
  site = case network.to_sym
41
46
  when :fb
42
47
  site = Poster::Facebook.new
48
+ when :vk
49
+ site = Poster::Vkontakte.new
43
50
  when :twitter
44
51
  site = Poster::Twitter.new
45
52
  when :lj
@@ -0,0 +1,19 @@
1
+ require 'vk-ruby'
2
+
3
+ module SocialPoster
4
+ module Poster
5
+
6
+ class Vkontakte
7
+ include SocialPoster::Helper
8
+
9
+ def initialize
10
+ @app = VK::Application.new(access_token: (config_key :access_token))
11
+ end
12
+
13
+ def write(text, title)
14
+ @app.wall.post(message: text)
15
+ end
16
+ end
17
+
18
+ end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module SocialPoster
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -9,7 +9,7 @@ Gem::Specification.new do |gem|
9
9
  gem.authors = ["HeeL"]
10
10
  gem.email = ["parizhskiy@gmail.com"]
11
11
  gem.description = %q{SocialPoster is a gem that allows you easily post to different social networks.}
12
- gem.summary = %q{Post to social networks}
12
+ gem.summary = %q{Post to social networks: Facebook, Vkontakte, LiveJournal, Twitter}
13
13
  gem.homepage = "https://github.com/HeeL/social_poster"
14
14
  gem.license = "MIT"
15
15
 
@@ -25,5 +25,6 @@ Gem::Specification.new do |gem|
25
25
  gem.add_dependency('fb_graph', '~> 2.7.7')
26
26
  gem.add_dependency('twitter', '~> 4.0')
27
27
  gem.add_dependency('livejournal', '~> 0.3.8')
28
+ gem.add_dependency('vk-ruby', '~> 0.9.3')
28
29
 
29
30
  end
@@ -10,10 +10,10 @@ class SocialPosterTest < Test::Unit::TestCase
10
10
  end
11
11
 
12
12
  should "post to fb and twitter" do
13
- [Facebook, Twitter].each do |network|
13
+ [Facebook, Twitter, Vkontakte].each do |network|
14
14
  network.any_instance.stubs(:write).returns(true)
15
15
  end
16
- %w(fb twitter).each{|network| SocialPoster::write(network, 'test', 'test')}
16
+ %w(fb twitter vk).each{|network| SocialPoster::write(network, 'test', 'test')}
17
17
  end
18
18
 
19
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_poster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-12 00:00:00.000000000 Z
12
+ date: 2013-07-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-unit
@@ -123,6 +123,22 @@ dependencies:
123
123
  - - ~>
124
124
  - !ruby/object:Gem::Version
125
125
  version: 0.3.8
126
+ - !ruby/object:Gem::Dependency
127
+ name: vk-ruby
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ~>
132
+ - !ruby/object:Gem::Version
133
+ version: 0.9.3
134
+ type: :runtime
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: 0.9.3
126
142
  description: SocialPoster is a gem that allows you easily post to different social
127
143
  networks.
128
144
  email:
@@ -141,6 +157,7 @@ files:
141
157
  - lib/social_poster/poster/facebook.rb
142
158
  - lib/social_poster/poster/live_journal.rb
143
159
  - lib/social_poster/poster/twitter.rb
160
+ - lib/social_poster/poster/vkontakte.rb
144
161
  - lib/social_poster/version.rb
145
162
  - social_poster.gemspec
146
163
  - test/test_helper.rb
@@ -169,7 +186,7 @@ rubyforge_project:
169
186
  rubygems_version: 1.8.23
170
187
  signing_key:
171
188
  specification_version: 3
172
- summary: Post to social networks
189
+ summary: ! 'Post to social networks: Facebook, Vkontakte, LiveJournal, Twitter'
173
190
  test_files:
174
191
  - test/test_helper.rb
175
192
  - test/unit/social_poster_test.rb