social-bee 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ .idea
data/.idea/workspace.xml CHANGED
@@ -2,7 +2,16 @@
2
2
  <project version="4">
3
3
  <component name="ChangeListManager">
4
4
  <list default="true" id="9b567d4b-4a32-4942-80d0-6d4c30dd9b8a" name="Default" comment="">
5
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/README.md" />
6
+ <change type="DELETED" beforePath="$PROJECT_DIR$/README" afterPath="" />
7
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.gitignore" afterPath="$PROJECT_DIR$/.gitignore" />
5
8
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
9
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/Gemfile" afterPath="$PROJECT_DIR$/Gemfile" />
10
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/social-bee/facebook.rb" afterPath="$PROJECT_DIR$/lib/social-bee/facebook.rb" />
11
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/social-bee/twi.rb" afterPath="$PROJECT_DIR$/lib/social-bee/twi.rb" />
12
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/social-bee/version.rb" afterPath="$PROJECT_DIR$/lib/social-bee/version.rb" />
13
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/social-bee/vkontakte.rb" afterPath="$PROJECT_DIR$/lib/social-bee/vkontakte.rb" />
14
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/social-bee.gemspec" afterPath="$PROJECT_DIR$/social-bee.gemspec" />
6
15
  </list>
7
16
  <ignored path="social-bee.iws" />
8
17
  <ignored path=".idea/workspace.xml" />
@@ -25,19 +34,28 @@
25
34
  </component>
26
35
  <component name="FileEditorManager">
27
36
  <leaf>
28
- <file leaf-file-name="social-bee.rb" pinned="false" current="true" current-in-tab="true">
37
+ <file leaf-file-name="social-bee.rb" pinned="false" current="false" current-in-tab="false">
29
38
  <entry file="file://$PROJECT_DIR$/lib/social-bee.rb">
30
39
  <provider selected="true" editor-type-id="text-editor">
31
- <state line="11" column="53" selection-start="179" selection-end="179" vertical-scroll-proportion="0.22335026">
40
+ <state line="9" column="7" selection-start="158" selection-end="158" vertical-scroll-proportion="0.0">
32
41
  <folding />
33
42
  </state>
34
43
  </provider>
35
44
  </entry>
36
45
  </file>
37
- <file leaf-file-name="Gemfile" pinned="false" current="false" current-in-tab="false">
38
- <entry file="file://$PROJECT_DIR$/Gemfile">
46
+ <file leaf-file-name="social-bee.gemspec" pinned="false" current="false" current-in-tab="false">
47
+ <entry file="file://$PROJECT_DIR$/social-bee.gemspec">
39
48
  <provider selected="true" editor-type-id="text-editor">
40
- <state line="4" column="13" selection-start="69" selection-end="69" vertical-scroll-proportion="0.0">
49
+ <state line="11" column="78" selection-start="397" selection-end="454" vertical-scroll-proportion="0.0">
50
+ <folding />
51
+ </state>
52
+ </provider>
53
+ </entry>
54
+ </file>
55
+ <file leaf-file-name="README.md" pinned="false" current="true" current-in-tab="true">
56
+ <entry file="file://$PROJECT_DIR$/README.md">
57
+ <provider selected="true" editor-type-id="text-editor">
58
+ <state line="15" column="114" selection-start="344" selection-end="344" vertical-scroll-proportion="0.30456853">
41
59
  <folding />
42
60
  </state>
43
61
  </provider>
@@ -46,7 +64,7 @@
46
64
  <file leaf-file-name="twi.rb" pinned="false" current="false" current-in-tab="false">
47
65
  <entry file="file://$PROJECT_DIR$/lib/social-bee/twi.rb">
48
66
  <provider selected="true" editor-type-id="text-editor">
49
- <state line="17" column="35" selection-start="487" selection-end="487" vertical-scroll-proportion="0.0">
67
+ <state line="16" column="34" selection-start="411" selection-end="411" vertical-scroll-proportion="0.0">
50
68
  <folding />
51
69
  </state>
52
70
  </provider>
@@ -55,7 +73,7 @@
55
73
  <file leaf-file-name="facebook.rb" pinned="false" current="false" current-in-tab="false">
56
74
  <entry file="file://$PROJECT_DIR$/lib/social-bee/facebook.rb">
57
75
  <provider selected="true" editor-type-id="text-editor">
58
- <state line="6" column="4" selection-start="59" selection-end="293" vertical-scroll-proportion="0.0">
76
+ <state line="10" column="102" selection-start="201" selection-end="201" vertical-scroll-proportion="0.0">
59
77
  <folding />
60
78
  </state>
61
79
  </provider>
@@ -64,7 +82,16 @@
64
82
  <file leaf-file-name="vkontakte.rb" pinned="false" current="false" current-in-tab="false">
65
83
  <entry file="file://$PROJECT_DIR$/lib/social-bee/vkontakte.rb">
66
84
  <provider selected="true" editor-type-id="text-editor">
67
- <state line="12" column="74" selection-start="335" selection-end="335" vertical-scroll-proportion="0.0">
85
+ <state line="18" column="39" selection-start="432" selection-end="432" vertical-scroll-proportion="0.0">
86
+ <folding />
87
+ </state>
88
+ </provider>
89
+ </entry>
90
+ </file>
91
+ <file leaf-file-name="version.rb" pinned="false" current="false" current-in-tab="false">
92
+ <entry file="file://$PROJECT_DIR$/lib/social-bee/version.rb">
93
+ <provider selected="true" editor-type-id="text-editor">
94
+ <state line="1" column="2" selection-start="19" selection-end="19" vertical-scroll-proportion="0.0">
68
95
  <folding />
69
96
  </state>
70
97
  </provider>
@@ -85,10 +112,15 @@
85
112
  <option name="changedFiles">
86
113
  <list>
87
114
  <option value="$PROJECT_DIR$/lib/social-bee/twitter.rb" />
88
- <option value="$PROJECT_DIR$/lib/social-bee/facebook.rb" />
89
- <option value="$PROJECT_DIR$/Gemfile" />
90
115
  <option value="$PROJECT_DIR$/lib/social-bee.rb" />
116
+ <option value="$PROJECT_DIR$/.gitignore" />
117
+ <option value="$PROJECT_DIR$/Gemfile" />
118
+ <option value="$PROJECT_DIR$/lib/social-bee/twi.rb" />
119
+ <option value="$PROJECT_DIR$/lib/social-bee/facebook.rb" />
91
120
  <option value="$PROJECT_DIR$/lib/social-bee/vkontakte.rb" />
121
+ <option value="$PROJECT_DIR$/social-bee.gemspec" />
122
+ <option value="$PROJECT_DIR$/lib/social-bee/version.rb" />
123
+ <option value="$PROJECT_DIR$/README.md" />
92
124
  </list>
93
125
  </option>
94
126
  </component>
@@ -138,6 +170,34 @@
138
170
  <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
139
171
  </PATH_ELEMENT>
140
172
  </PATH>
173
+ <PATH>
174
+ <PATH_ELEMENT>
175
+ <option name="myItemId" value="social-bee" />
176
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
177
+ </PATH_ELEMENT>
178
+ <PATH_ELEMENT>
179
+ <option name="myItemId" value="social-bee" />
180
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
181
+ </PATH_ELEMENT>
182
+ <PATH_ELEMENT>
183
+ <option name="myItemId" value="pkg" />
184
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
185
+ </PATH_ELEMENT>
186
+ </PATH>
187
+ <PATH>
188
+ <PATH_ELEMENT>
189
+ <option name="myItemId" value="social-bee" />
190
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
191
+ </PATH_ELEMENT>
192
+ <PATH_ELEMENT>
193
+ <option name="myItemId" value="social-bee" />
194
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
195
+ </PATH_ELEMENT>
196
+ <PATH_ELEMENT>
197
+ <option name="myItemId" value="lib" />
198
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
199
+ </PATH_ELEMENT>
200
+ </PATH>
141
201
  <PATH>
142
202
  <PATH_ELEMENT>
143
203
  <option name="myItemId" value="social-bee" />
@@ -151,6 +211,10 @@
151
211
  <option name="myItemId" value="lib" />
152
212
  <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
153
213
  </PATH_ELEMENT>
214
+ <PATH_ELEMENT>
215
+ <option name="myItemId" value="social-bee" />
216
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
217
+ </PATH_ELEMENT>
154
218
  </PATH>
155
219
  </subPane>
156
220
  </pane>
@@ -360,37 +424,72 @@
360
424
  <breakpoint-manager />
361
425
  </component>
362
426
  <component name="editorHistoryManager">
427
+ <entry file="file://$PROJECT_DIR$/.gitignore">
428
+ <provider selected="true" editor-type-id="text-editor">
429
+ <state line="4" column="5" selection-start="38" selection-end="38" vertical-scroll-proportion="0.08121827">
430
+ <folding />
431
+ </state>
432
+ </provider>
433
+ </entry>
363
434
  <entry file="file://$PROJECT_DIR$/Gemfile">
364
435
  <provider selected="true" editor-type-id="text-editor">
365
- <state line="4" column="13" selection-start="69" selection-end="69" vertical-scroll-proportion="0.0">
436
+ <state line="6" column="14" selection-start="85" selection-end="85" vertical-scroll-proportion="0.12182741">
366
437
  <folding />
367
438
  </state>
368
439
  </provider>
369
440
  </entry>
370
- <entry file="file://$PROJECT_DIR$/lib/social-bee/twi.rb">
441
+ <entry file="file://$PROJECT_DIR$/Rakefile">
442
+ <provider selected="true" editor-type-id="text-editor">
443
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
444
+ <folding />
445
+ </state>
446
+ </provider>
447
+ </entry>
448
+ <entry file="file://$PROJECT_DIR$/lib/social-bee.rb">
449
+ <provider selected="true" editor-type-id="text-editor">
450
+ <state line="9" column="7" selection-start="158" selection-end="158" vertical-scroll-proportion="0.0">
451
+ <folding />
452
+ </state>
453
+ </provider>
454
+ </entry>
455
+ <entry file="file://$PROJECT_DIR$/lib/social-bee/version.rb">
371
456
  <provider selected="true" editor-type-id="text-editor">
372
- <state line="17" column="35" selection-start="487" selection-end="487" vertical-scroll-proportion="0.0">
457
+ <state line="1" column="2" selection-start="19" selection-end="19" vertical-scroll-proportion="0.0">
373
458
  <folding />
374
459
  </state>
375
460
  </provider>
376
461
  </entry>
377
462
  <entry file="file://$PROJECT_DIR$/lib/social-bee/facebook.rb">
378
463
  <provider selected="true" editor-type-id="text-editor">
379
- <state line="6" column="4" selection-start="59" selection-end="293" vertical-scroll-proportion="0.0">
464
+ <state line="10" column="102" selection-start="201" selection-end="201" vertical-scroll-proportion="0.0">
380
465
  <folding />
381
466
  </state>
382
467
  </provider>
383
468
  </entry>
384
469
  <entry file="file://$PROJECT_DIR$/lib/social-bee/vkontakte.rb">
385
470
  <provider selected="true" editor-type-id="text-editor">
386
- <state line="12" column="74" selection-start="335" selection-end="335" vertical-scroll-proportion="0.0">
471
+ <state line="18" column="39" selection-start="432" selection-end="432" vertical-scroll-proportion="0.0">
387
472
  <folding />
388
473
  </state>
389
474
  </provider>
390
475
  </entry>
391
- <entry file="file://$PROJECT_DIR$/lib/social-bee.rb">
476
+ <entry file="file://$PROJECT_DIR$/lib/social-bee/twi.rb">
477
+ <provider selected="true" editor-type-id="text-editor">
478
+ <state line="16" column="34" selection-start="411" selection-end="411" vertical-scroll-proportion="0.0">
479
+ <folding />
480
+ </state>
481
+ </provider>
482
+ </entry>
483
+ <entry file="file://$PROJECT_DIR$/social-bee.gemspec">
484
+ <provider selected="true" editor-type-id="text-editor">
485
+ <state line="11" column="78" selection-start="397" selection-end="454" vertical-scroll-proportion="0.0">
486
+ <folding />
487
+ </state>
488
+ </provider>
489
+ </entry>
490
+ <entry file="file://$PROJECT_DIR$/README.md">
392
491
  <provider selected="true" editor-type-id="text-editor">
393
- <state line="11" column="53" selection-start="179" selection-end="179" vertical-scroll-proportion="0.22335026">
492
+ <state line="15" column="114" selection-start="344" selection-end="344" vertical-scroll-proportion="0.30456853">
394
493
  <folding />
395
494
  </state>
396
495
  </provider>
data/Gemfile CHANGED
@@ -4,5 +4,4 @@ gem 'twitter'
4
4
  gem 'koala'
5
5
  gem 'vk-ruby'
6
6
 
7
- # Specify your gem's dependencies in social-bee.gemspec
8
- gemspec
7
+ require 'yaml'
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ #social-bee
2
+ Simple messaging wrapper for Facebook, Twitter, Vkontakte
3
+
4
+
5
+ ## Installation
6
+ `gem install social-bee`
7
+
8
+
9
+ ## Usage Example
10
+
11
+ ```.ruby
12
+ # message_controller.rb
13
+
14
+ class MessageController < ApplicationController
15
+ def create
16
+ SocialBee::Facebook.new( :config => "config/social/facebook.yml" ).say_public( 'Beep!', params[:user_token] )
17
+ end
18
+ end
19
+
20
+ ```
21
+
22
+ ```.yml
23
+ # config/social/facebook.yml
24
+
25
+ development:
26
+ app_id: [YOUR APP ID]
27
+ app_key: [YOUR APP KEY]
28
+ callback_url: http://localhost:3000/
29
+ production:
30
+ app_id: [YOUR APP ID]
31
+ app_key: [YOUR APP KEY]
32
+ callback_url: http://www.host.name
33
+ ```
@@ -3,20 +3,21 @@ module SocialBee
3
3
  class Facebook
4
4
 
5
5
  include Koala
6
+ include YAML
7
+
6
8
 
7
9
  def initialize(p={})
8
- raise 'Undefined application id' unless @app_id = p[:app_id]
9
- raise 'Undefined application key' unless @app_key = p[:app_key]
10
- raise 'Undefined callback url' unless @callback = p[:callback]
11
- end
12
10
 
13
- def say_public( message, token )
11
+ raise 'Undefined config file' unless config = YAML.load_file(Rails.root + p[:config])[Rails.env]
12
+ raise 'Undefined application id' unless @app_id = config['app_id']
13
+ raise 'Undefined application key' unless @app_key = config['app_key']
14
+ raise 'Undefined callback url' unless @callback = config['callback_url']
14
15
 
15
16
  Koala::Facebook::OAuth.class_eval do
16
17
  def initialize_with_default_settings(*args)
17
18
  case args.size
18
19
  when 0, 1
19
- raise "application id and/or secret are not specified in the config" unless @app_id && @app_key
20
+ raise "Application id and/or secret are not specified in the config" unless @app_id && @app_key
20
21
  initialize_without_default_settings(@app_id.to_s, @app_key.to_s, @callback.to_s)
21
22
  when 2, 3
22
23
  initialize_without_default_settings(*args)
@@ -25,9 +26,14 @@ module SocialBee
25
26
  alias_method_chain :initialize, :default_settings
26
27
  end
27
28
 
29
+ end
30
+
31
+
32
+ def say_public( message, token )
28
33
  Koala::Facebook::GraphAPI.new( token ).put_wall_post( message )
29
34
  end
30
35
 
36
+
31
37
  end
32
38
 
33
39
  end
@@ -3,22 +3,25 @@ module SocialBee
3
3
  class Twi
4
4
 
5
5
  include Twitter
6
+ include YAML
7
+
6
8
 
7
9
  def initialize(p={})
8
- raise 'Undefined application key' unless @app_key = p[:app_key]
9
- raise 'Undefined application secret' unless @app_secret = p[:app_secret]
10
+ raise 'Undefined config file' unless @config = YAML.load_file(Rails.root + p[:config])[Rails.env]
10
11
  end
11
12
 
13
+
12
14
  def say_public( message, token, secret )
13
15
  Twitter.configure do |config|
14
- config.consumer_key = @app_key
15
- config.consumer_secret = @app_secret
16
- config.oauth_token = token
17
- config.oauth_token_secret = secret
16
+ raise 'Undefined consumer key' unless config.consumer_key = @config['app_key']
17
+ raise 'Undefined consumer secret' unless config.consumer_secret = @config['app_secret']
18
+ raise 'Undefined user token' unless config.oauth_token = token
19
+ raise 'Undefined user secret' unless config.oauth_token_secret = secret
18
20
  end
19
21
  Twitter.update( message )
20
22
  end
21
23
 
24
+
22
25
  end
23
26
 
24
27
  end
@@ -1,5 +1,3 @@
1
- module Social
2
- module Bee
3
- VERSION = "0.0.2"
4
- end
1
+ module SocialBee
2
+ VERSION = "0.0.3"
5
3
  end
@@ -3,18 +3,26 @@ module SocialBee
3
3
  class Vkontakte
4
4
 
5
5
  include VK
6
+ include YAML
7
+
6
8
 
7
9
  def initialize(p={})
8
- raise 'Undefined application id' unless @app_id = p[:app_id]
9
- raise 'Undefined application key' unless @app_key = p[:app_key]
10
+
11
+ raise 'Undefined config file' unless config = YAML.load_file(Rails.root + p[:config])[Rails.env]
12
+ raise 'Undefined application id' unless app_id = config['app_id']
13
+ raise 'Undefined application key' unless app_key = config['app_key']
14
+
15
+ @app = VK::Standalone.new :app_id => app_id, :app_secret => app_key
16
+
10
17
  end
11
18
 
19
+
12
20
  def say_public( message, token )
13
- app = VK::Standalone.new :app_id => @app_id, :app_secret => @app_key
14
- app.access_token = token
15
- app.wall.post( :message => CGI::escape(message) )
21
+ @app.access_token = token
22
+ @app.wall.post( :message => CGI::escape(message) )
16
23
  end
17
24
 
25
+
18
26
  end
19
27
 
20
28
  end
data/social-bee.gemspec CHANGED
@@ -4,12 +4,12 @@ require "social-bee/version"
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "social-bee"
7
- s.version = Social::Bee::VERSION
7
+ s.version = SocialBee::VERSION
8
8
  s.authors = ["Alexander Timofeev"]
9
9
  s.email = ["atimofeev@reactant.ru"]
10
- s.homepage = "http://www.atimofeev.ru"
10
+ s.homepage = "https://github.com/ATimofeev/Social-Bee"
11
11
  s.summary = %q{Be social}
12
- s.description = %q{Easy messaging in Facebook, Twitter, Vkontakte}
12
+ s.description = %q{Simple messaging wrapper for Facebook, Twitter, Vkontakte}
13
13
 
14
14
  s.rubyforge_project = "social-bee"
15
15
 
@@ -20,5 +20,7 @@ Gem::Specification.new do |s|
20
20
 
21
21
  # specify any dependencies here; for example:
22
22
  # s.add_development_dependency "rspec"
23
- # s.add_runtime_dependency "rest-client"
23
+ s.add_runtime_dependency "twitter"
24
+ s.add_runtime_dependency "koala"
25
+ s.add_runtime_dependency "vk-ruby"
24
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social-bee
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,9 +9,42 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-02 00:00:00.000000000 Z
13
- dependencies: []
14
- description: Easy messaging in Facebook, Twitter, Vkontakte
12
+ date: 2011-10-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: twitter
16
+ requirement: &70237501277600 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70237501277600
25
+ - !ruby/object:Gem::Dependency
26
+ name: koala
27
+ requirement: &70237501277180 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70237501277180
36
+ - !ruby/object:Gem::Dependency
37
+ name: vk-ruby
38
+ requirement: &70237501276620 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70237501276620
47
+ description: Simple messaging wrapper for Facebook, Twitter, Vkontakte
15
48
  email:
16
49
  - atimofeev@reactant.ru
17
50
  executables: []
@@ -28,7 +61,7 @@ files:
28
61
  - .idea/vcs.xml
29
62
  - .idea/workspace.xml
30
63
  - Gemfile
31
- - README
64
+ - README.md
32
65
  - Rakefile
33
66
  - lib/social-bee.rb
34
67
  - lib/social-bee/facebook.rb
@@ -36,7 +69,7 @@ files:
36
69
  - lib/social-bee/version.rb
37
70
  - lib/social-bee/vkontakte.rb
38
71
  - social-bee.gemspec
39
- homepage: http://www.atimofeev.ru
72
+ homepage: https://github.com/ATimofeev/Social-Bee
40
73
  licenses: []
41
74
  post_install_message:
42
75
  rdoc_options: []
data/README DELETED
File without changes