Class: ZohoInvoice::Collection

Inherits:
Object
  • Object
show all
Defined in:
lib/zoho_invoice/collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource, client) ⇒ Collection

Returns a new instance of Collection.



6
7
8
9
10
# File 'lib/zoho_invoice/collection.rb', line 6

def initialize(resource, client)
  @resource = resource
  @klass    = "ZohoInvoice::#{resource[0..-2].capitalize}".split('::').reduce(Module, :const_get)
  @client   = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



4
5
6
# File 'lib/zoho_invoice/collection.rb', line 4

def client
  @client
end

#klassObject (readonly)

Returns the value of attribute klass.



4
5
6
# File 'lib/zoho_invoice/collection.rb', line 4

def klass
  @klass
end

#resourceObject (readonly)

Returns the value of attribute resource.



4
5
6
# File 'lib/zoho_invoice/collection.rb', line 4

def resource
  @resource
end

Instance Method Details

#create(*args, &block) ⇒ Object



20
21
22
# File 'lib/zoho_invoice/collection.rb', line 20

def create(*args, &block)
  @klass.create(@client, *args, &block)
end

#new(*args, &block) ⇒ Object



16
17
18
# File 'lib/zoho_invoice/collection.rb', line 16

def new(*args, &block)
  @klass.new(@client, *args, &block)
end

#search(*args, &block) ⇒ Object



12
13
14
# File 'lib/zoho_invoice/collection.rb', line 12

def search(*args, &block)
  @klass.search(@client, *args, &block)
end