Sha256: 119163c46e30f21c79eb31fc19cd1bfa4887e20679583d211e9164da8343bff8

Contents?: true

Size: 917 Bytes

Versions: 1

Compression:

Stored size: 917 Bytes

Contents

module Mollie
	module API
		module Resource
			class Base
				def initialize (client)
					@client = client
				end

				def getResourceName ()
					self.class.name.downcase.split("::").slice(3..-1).join "/"
				end

				def create (data = {})
					response = @client.performHttpCall "POST", getResourceName, nil, data
					getResourceObject.new response
				end

				def get (id)
					response = @client.performHttpCall "GET", getResourceName, id || 0
					getResourceObject.new response
				end

				def update (id, data = {})
					response = @client.performHttpCall "POST", getResourceName, id || 0, data
					getResourceObject.new response
				end

				def delete (id)
					@client.performHttpCall "DELETE", getResourceName, id || 0
				end

				def all ()
					response = @client.performHttpCall "GET", getResourceName
					Mollie::API::Object::List.new response, getResourceObject
				end
			end
		end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mollie-api-ruby-1.0.1 lib/Mollie/API/Resource/Base.rb