rsvejo 0.1.0 → 0.2.0

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.
@@ -3,13 +3,13 @@ RSvejo - Svejo.net API ruby wrapper
3
3
 
4
4
  Информация
5
5
  ----------
6
- RSvejo е библиотека за комуникация със http://svejo.net/.
7
- Повече информация можете да намерите тук: http://groups.google.com/group/svejo/web/api
6
+ RSvejo е библиотека за комуникация със [Svejo.net](http://svejo.net/).
7
+ Повече информация можете да намерите [тук](http://groups.google.com/group/svejo/web/api).
8
8
 
9
9
  Инсталация
10
10
  ----------
11
11
  >> sudo gem install rsvejo
12
- #### Изисквания : http://github.com/jnunemaker/httparty/
12
+ #### Изисквания : [httparty](http://github.com/jnunemaker/httparty/)
13
13
 
14
14
 
15
15
  Описание на методите
@@ -30,10 +30,10 @@ RSvejo е библиотека за комуникация със http://svejo.n
30
30
  # Последните статии, за които е гласувал въпросният потребител
31
31
 
32
32
  >> RSvejo.published_by "username"
33
- # Последните статии, които е гласувал потребителят
33
+ # Последните статии, публикувани от въпросният потребител
34
34
 
35
35
  >> RSvejo.commented_by "username"
36
- # Последните статии, които е публикувал потребителят
36
+ # Последните статии, които е публикувал въпросният потребителят
37
37
 
38
38
  ### Етикети/Тагове
39
39
 
@@ -43,7 +43,10 @@ RSvejo е библиотека за комуникация със http://svejo.n
43
43
  ### Сайтове
44
44
 
45
45
  >> RSvejo.get_by_site "domain_name"
46
- # Най-новите публикации, които имат търсения етикет
46
+ # Най-новите публикации, които се отнасят до въпросният сайт
47
+
48
+ >> RSvejo.comments_for "url"
49
+ # Най-новите коментари, които се отнасят до въпросният сайт
47
50
 
48
51
  ### Коментари
49
52
 
@@ -53,4 +56,4 @@ RSvejo е библиотека за комуникация със http://svejo.n
53
56
 
54
57
  ## Относно
55
58
 
56
- * Автор : Митко Костов <> http://mitkokostov.info
59
+ * Автор : [Митко Костов](http://mitkokostov.info)
data/lib/rsvejo.rb CHANGED
@@ -7,11 +7,17 @@
7
7
  # LICENCE : MIT
8
8
  # svejo.net API : http://groups.google.com/group/svejo/web/api
9
9
 
10
- require 'rubygems'
11
- require 'httparty'
10
+ begin
11
+ require 'httparty'
12
+ rescue LoadError
13
+ require 'rubygems'
14
+ require 'httparty'
15
+ end
12
16
 
13
- $KCODE ='u'
17
+ $KCODE ='u' if RUBY_VERSION < '1.9'
14
18
 
19
+ # The main RSvejo module
20
+ # Usage: See the README.md
15
21
  module RSvejo
16
22
 
17
23
  extend self
@@ -19,34 +25,43 @@ module RSvejo
19
25
  API_URL = 'http://svejo.net/public_api/'
20
26
  FORMAT = 'xml'
21
27
 
28
+ # Returns 15 of the latest 'fresh' stories
22
29
  def fresh_stories
23
30
  get_data("stories/fresh")
24
31
  end
25
32
 
33
+ # Returns 15 of the latest 'green' stories'
26
34
  def green_stories
27
35
  get_data("stories/green")
28
36
  end
29
37
 
38
+ # Returns 15 of the latest stories of the specified user
30
39
  def voted_by(name)
31
40
  get_data("user/#{name}/voted")
32
41
  end
33
42
 
43
+ # Returns 15 of the latest stories published by the specified user
44
+ # @param [String] - name of the user
34
45
  def published_by(name)
35
46
  get_data("user/#{name}/published")
36
47
  end
37
48
 
49
+ # Returns 15 of the latest commented stories by the specified user
38
50
  def commented_by(name)
39
51
  get_data("user/#{name}/commented")
40
52
  end
41
53
 
54
+ # Returns 15 of the latest stories specified by the given tag
42
55
  def get_by_tag(tag)
43
56
  get_data("tag/#{tag}/new")
44
57
  end
45
58
 
59
+ # Returns 15 of the latest stories about the specified site
46
60
  def get_by_site(site)
47
61
  get_data("site/#{site}/new")
48
62
  end
49
63
 
64
+ # Returns 15 of the latest comments about the specified site
50
65
  def comments_for(url)
51
66
  get_data("comments/show/#{FORMAT}?url=#{url}")
52
67
  end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsvejo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
5
10
  platform: ruby
6
11
  authors:
7
12
  - Mitko Kostov
@@ -9,10 +14,22 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-01-02 00:00:00 +02:00
17
+ date: 2010-09-17 00:00:00 +03:00
13
18
  default_executable:
14
- dependencies: []
15
-
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: httparty
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :runtime
32
+ version_requirements: *id001
16
33
  description: Svejo.net API Ruby wrapper
17
34
  email: mitko.kostov@gmail.com
18
35
  executables: []
@@ -22,12 +39,10 @@ extensions: []
22
39
  extra_rdoc_files: []
23
40
 
24
41
  files:
25
- - lib/rsvejo.rb
26
- - test/test_rsvejo.rb
27
- - rsvejo.gemspec
28
- - README.markdown
29
42
  - LICENSE
30
- has_rdoc: false
43
+ - README.md
44
+ - lib/rsvejo.rb
45
+ has_rdoc: true
31
46
  homepage: http://github.com/mitkok/rsvejo
32
47
  licenses: []
33
48
 
@@ -37,23 +52,27 @@ rdoc_options: []
37
52
  require_paths:
38
53
  - lib
39
54
  required_ruby_version: !ruby/object:Gem::Requirement
55
+ none: false
40
56
  requirements:
41
57
  - - ">="
42
58
  - !ruby/object:Gem::Version
59
+ segments:
60
+ - 0
43
61
  version: "0"
44
- version:
45
62
  required_rubygems_version: !ruby/object:Gem::Requirement
63
+ none: false
46
64
  requirements:
47
65
  - - ">="
48
66
  - !ruby/object:Gem::Version
67
+ segments:
68
+ - 0
49
69
  version: "0"
50
- version:
51
70
  requirements: []
52
71
 
53
72
  rubyforge_project:
54
- rubygems_version: 1.3.5
73
+ rubygems_version: 1.3.7
55
74
  signing_key:
56
75
  specification_version: 3
57
- summary: Simple Ruby lib for Svejo.net
76
+ summary: RSvejo is Ruby wrapper for Svejo.net API
58
77
  test_files: []
59
78
 
data/rsvejo.gemspec DELETED
@@ -1,13 +0,0 @@
1
- Gem::Specification.new do |s|
2
- s.name = %q{rsvejo}
3
- s.version = "0.1.0"
4
- s.authors = ["Mitko Kostov"]
5
- s.date = %q{2010-01-02}
6
- s.description = %q{Svejo.net API Ruby wrapper}
7
- s.email = %q{mitko.kostov@gmail.com}
8
- s.files = ["lib/rsvejo.rb", "test/test_rsvejo.rb","rsvejo.gemspec", "README.markdown", "LICENSE"]
9
- s.has_rdoc = false
10
- s.homepage = %q{http://github.com/mitkok/rsvejo}
11
- s.require_paths = ["lib"]
12
- s.summary = %q{Simple Ruby lib for Svejo.net}
13
- end
data/test/test_rsvejo.rb DELETED
@@ -1,42 +0,0 @@
1
- $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
2
-
3
- require 'test/unit'
4
- require 'rsvejo'
5
-
6
- class TestRSvejo < Test::Unit::TestCase
7
-
8
-
9
- def test_stories
10
- fresh_stories = RSvejo.fresh_stories
11
- green_stories = RSvejo.green_stories
12
- assert_not_nil fresh_stories
13
- assert_not_nil green_stories
14
- end
15
-
16
- def test_user_calls
17
- name = 'stanislav'
18
- voted = RSvejo.voted_by name
19
- published = RSvejo.published_by name
20
- commented = RSvejo.commented_by name
21
-
22
- assert_not_nil voted
23
- assert_not_nil published
24
- assert_not_nil commented
25
- end
26
-
27
- def test_tag_method
28
- tag = RSvejo.get_by_tag("София")
29
- assert !tag.include?('nil_classes')
30
- end
31
-
32
- def test_site_method
33
- site = RSvejo.get_by_site('blog.svejo.net')
34
- assert_nil site["hash"]
35
- end
36
-
37
- def test_comments_for_method
38
- comments = RSvejo.comments_for('http://advance.bg/?pn=pamporovo')
39
- assert_not_nil comments
40
- end
41
-
42
- end