class Givepulse::Resource

Attributes

client[R]
path[RW]

Public Class Methods

new(client, path, supported_methods) click to toggle source
# File lib/givepulse/resource.rb, line 7
def initialize(client, path, supported_methods)
    @client ||= client
    @path ||= path
    @supported_methods ||= supported_methods.clone
end

Public Instance Methods

create(data) click to toggle source
# File lib/givepulse/resource.rb, line 18
def create(data)
    raise Givepulse::UnsupportedMethod, self.class unless @supported_methods.include?(__method__)
    @client.connection.post(@path, data)
end
delete(id) click to toggle source
# File lib/givepulse/resource.rb, line 28
def delete(id)
    raise Givepulse::UnsupportedMethod, self.class unless @supported_methods.include?(__method__)
    @client.connection.delete("#{@path}/#{id}")
end
get(options = nil) click to toggle source
# File lib/givepulse/resource.rb, line 13
def get(options = nil)
    raise Givepulse::UnsupportedMethod, self.class unless @supported_methods.include?(__method__)
    @client.connection.get(@path, options)
end
update(id, data) click to toggle source
# File lib/givepulse/resource.rb, line 23
def update(id, data)
    raise Givepulse::UnsupportedMethod, self.class unless @supported_methods.include?(__method__)
    @client.connection.put("#{@path}/#{id}", data)
end