Class: Rubervu::UbervuReaction

Inherits:
Ubervu
  • Object
show all
Defined in:
lib/rubervu/ubervu_reaction.rb

Overview

This class creates API calls for different Reaction functions. How to Use:

ubervu = Rubervu::Ubervu.new('API_KEY')
result = ubervu.reactions.show(url, {:page => 1, :perpage => 25})

Instance Method Summary collapse

Methods inherited from Ubervu

#reactions, #request, #resources

Constructor Details

#initialize(api_key, api_url = 'http://api.ubervu.com') ⇒ UbervuReaction

Initializes the UbervuReaction Class.



15
16
17
18
19
# File 'lib/rubervu/ubervu_reaction.rb', line 15

def initialize(api_key, api_url = 'http://api.ubervu.com')
  @api_key    = api_key
  @api_url    = api_url
  @resource   = 'reactions'
end

Instance Method Details

#show(url, options = {}) ⇒ Object

Get reactions about a specific URL.

See: developer.contextvoice.com/docs/api_methods_11/Get_reactions_for_URL

Requires - url:String

- options:Array (:since, :include, :exclude, :filter, :page, :perpage, :order (asc or desc) supported)


27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/rubervu/ubervu_reaction.rb', line 27

def show url, options = {}
  function = ''

  options ||= {}
 
  params = {}
  params[:url] = url

  options ||= {}
  options.each { |key,value| params[key] = value.to_s }
  
  request(@resource, function, params)
end