Module: BadBill::Resource

Included in:
BaseResource, BaseResource
Defined in:
lib/badbill/resource.rb

Overview

Forward requests to the underlying connection object.

This module is included in BadBill::BaseResource.

Instance Method Summary collapse

Instance Method Details

#call(resource, id = '', options = nil, method = :get) ⇒ Object


29
30
31
32
# File 'lib/badbill/resource.rb', line 29

def call resource, id='', options=nil, method=:get
  raise BadBill::NoConnection, "No connection. Use BadBill.new first." if BadBill.connection.nil?
  BadBill.connection.call resource, id, options, method
end

#delete(resource, id = '', options = nil) ⇒ Object


24
25
26
# File 'lib/badbill/resource.rb', line 24

def delete resource, id='', options=nil
  call resource, id, options, :delete
end

#get(resource, id = '', options = nil) ⇒ Object


9
10
11
# File 'lib/badbill/resource.rb', line 9

def get resource, id='', options=nil
  call resource, id, options, :get
end

#post(resource, id = '', options = nil) ⇒ Object


14
15
16
# File 'lib/badbill/resource.rb', line 14

def post resource, id='', options=nil
  call resource, id, options, :post
end

#put(resource, id = '', options = nil) ⇒ Object


19
20
21
# File 'lib/badbill/resource.rb', line 19

def put resource, id='', options=nil
  call resource, id, options, :put
end