rubervu 0.1 → 0.2

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/README CHANGED
@@ -1,8 +1,8 @@
1
- = Rubervu: Gem for accessing the UberVU.com API.
1
+ = Rubervu: Gem for accessing the UberVU.com and ContextVoice.com API.
2
2
 
3
3
  See http://rubervu.rubyforge.org/ for more information.
4
4
 
5
- Version 0.1.
5
+ Version 0.2.
6
6
 
7
7
  == Basic Usage
8
8
 
data/lib/rubervu.rb CHANGED
@@ -12,8 +12,9 @@ require 'json/ext'
12
12
  # Rubervu module contains a Rubervu connection class and different Rubervu Classes
13
13
  module Rubervu
14
14
  FORMAT = "json"
15
- API_VER = "1.0"
15
+ API_VER = "1.1"
16
16
  end
17
17
 
18
18
  require 'rubervu/ubervu'
19
19
  require 'rubervu/ubervu_resource'
20
+ require 'rubervu/ubervu_reaction'
@@ -13,7 +13,7 @@ module Rubervu
13
13
  #
14
14
  class Ubervu
15
15
  # Initializes the Ubervu Class.
16
- def initialize(api_key, api_url = 'http://api.ubervu.com')
16
+ def initialize(api_key, api_url = 'http://api.contextvoice.com')
17
17
  @api_key = api_key
18
18
  @api_url = api_url
19
19
  end
@@ -23,6 +23,11 @@ module Rubervu
23
23
  UbervuResource.new(@api_key, @api_url)
24
24
  end
25
25
 
26
+ # Maps UbervuReaction. See UbervuReaction for more information about methods
27
+ def reactions
28
+ UbervuReaction.new(@api_key, @api_url)
29
+ end
30
+
26
31
  # Processes the request. Creates the API call and returns a JSON parsed result.
27
32
  def request(resource, function, params, method = 'get', post_data = nil, api_key = @api_key, api_url = @api_url)
28
33
  rq = "#{api_url}/#{API_VER}/#{resource}/#{function}?apikey=#{CGI.escape api_key}&format=#{CGI.escape FORMAT}"
@@ -0,0 +1,42 @@
1
+ # Copyright (c) 2009 Radu Spineanu
2
+ # You can redistribute it and/or modify it under the same terms as Ruby.
3
+ #
4
+
5
+ module Rubervu
6
+
7
+ # This class creates API calls for different Reaction functions.
8
+ # How to Use:
9
+ # ubervu = Rubervu::Ubervu.new('API_KEY')
10
+ # result = ubervu.reactions.show(url, {:page => 1, :perpage => 25})
11
+ #
12
+ class UbervuReaction < Ubervu
13
+
14
+ # Initializes the UbervuReaction Class.
15
+ def initialize(api_key, api_url = 'http://api.ubervu.com')
16
+ @api_key = api_key
17
+ @api_url = api_url
18
+ @resource = 'reactions'
19
+ end
20
+
21
+ # Get reactions about a specific URL.
22
+ #
23
+ # See: http://developer.contextvoice.com/docs/api_methods_11/Get_reactions_for_URL
24
+ #
25
+ # Requires - url:String
26
+ # - options:Array (:since, :include, :exclude, :filter, :page, :perpage, :order (asc or desc) supported)
27
+ def show url, options = {}
28
+ function = ''
29
+
30
+ options ||= {}
31
+
32
+ params = {}
33
+ params[:url] = url
34
+
35
+ options ||= {}
36
+ options.each { |key,value| params[key] = value.to_s }
37
+
38
+ request(@resource, function, params)
39
+ end
40
+
41
+ end
42
+ end
@@ -18,9 +18,11 @@ module Rubervu
18
18
  @resource = 'resources'
19
19
  end
20
20
 
21
- # Get information about a specific URL
22
- # http://developer.ubervu.com/docs/api_methods/Get_information_about_a_specific_URL
23
- # url:String
21
+ # Get meta-data for URL
22
+ #
23
+ # See: http://developer.contextvoice.com/docs/api_methods_11/Get_metadata_for_URL
24
+ #
25
+ # Requires - url:String
24
26
  def show url
25
27
  function = ''
26
28
 
@@ -30,9 +32,11 @@ module Rubervu
30
32
  request(@resource, function, params)
31
33
  end
32
34
 
33
- # Add a new resource
34
- # http://developer.ubervu.com/docs/api_methods/Add_a_new_resource
35
- # url:String
35
+ # Add a new resource.
36
+ #
37
+ # See: http://developer.ubervu.com/docs/api_methods/Add_a_new_resource
38
+ #
39
+ # Requires - url:String
36
40
  def create url
37
41
  function = ''
38
42
 
@@ -42,9 +46,11 @@ module Rubervu
42
46
  request(@resource, function, nil, 'post', post_data)
43
47
  end
44
48
 
45
- # Add a batch of new resources
46
- # http://developer.ubervu.com/docs/api_methods/Add_a_batch_of_new_resources
47
- # urls:Array of urls
49
+ # Add a batch of new resources.
50
+ #
51
+ # See: http://developer.ubervu.com/docs/api_methods/Add_a_batch_of_new_resources
52
+ #
53
+ # Requires - urls:Array of urls
48
54
  def create_batch urls
49
55
  function = 'batch/'
50
56
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubervu
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.1"
4
+ version: "0.2"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Radu Spineanu
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-08 00:00:00 +03:00
12
+ date: 2009-06-18 00:00:00 +03:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -34,6 +34,7 @@ files:
34
34
  - lib/rubervu.rb
35
35
  - lib/rubervu/ubervu.rb
36
36
  - lib/rubervu/ubervu_resource.rb
37
+ - lib/rubervu/ubervu_reaction.rb
37
38
  - README
38
39
  has_rdoc: true
39
40
  homepage:
@@ -60,6 +61,6 @@ rubyforge_project:
60
61
  rubygems_version: 1.3.1
61
62
  signing_key:
62
63
  specification_version: 2
63
- summary: Gem for accessing the UberVU.com API.
64
+ summary: Gem for accessing the UberVU.com and ContextVoice.com API.
64
65
  test_files: []
65
66