class Wykop::Operations::Add
Public Class Methods
new(client)
click to toggle source
Documentation: www.wykop.pl/dla-programistow/dokumentacja/#info6_9
# File lib/wykop/operations/add.rb, line 5 def initialize(client) @client = client @request = Wykop::Operations::Request.new(@client) end
Public Instance Methods
add_new(p = {})
click to toggle source
# File lib/wykop/operations/add.rb, line 10 def add_new(p = {}) # Adding new link p.delete(:group) @request.execute(replace_url( { :banana => 'add', :potato => 'index', :group => p[:group].gsub(/^\#/, '') } ), p) end
replace_url( p = {} )
click to toggle source
# File lib/wykop/operations/add.rb, line 16 def replace_url( p = {} ) standard_url = "#{@client.configuration.api_host}/banana/potato/appkey,#{@client.configuration.app_user_key}/userkey,#{@client.user_info['userkey']}/group,groupid" return standard_url.gsub(/banana/, p[:banana]).gsub(/potato/, p[:potato]).gsub(/groupid/, p[:group]) end