Class: Caren::Store::BillableCategory

Inherits:
Base
  • Object
show all
Defined in:
lib/caren/store/billable_category.rb

Instance Attribute Summary

Attributes inherited from Base

#attributes, #original_xml

Class Method Summary collapse

Methods inherited from Base

#as_xml, from_xml, hash_from_image, init_dependent_objects, #initialize, #node_root, resource_url, #resource_url, search_url, #to_xml, to_xml

Constructor Details

This class inherits a constructor from Caren::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Caren::Base

Class Method Details

.all(session) ⇒ Object



20
21
22
# File 'lib/caren/store/billable_category.rb', line 20

def self.all session
  from_xml session.get(self.resource_url)
end

.array_rootObject



24
25
26
# File 'lib/caren/store/billable_category.rb', line 24

def self.array_root
  :billable_categories
end

.find(id, session) ⇒ Object



16
17
18
# File 'lib/caren/store/billable_category.rb', line 16

def self.find id, session
  from_xml session.get(self.resource_url(id))
end

.keysObject



3
4
5
6
7
8
9
10
# File 'lib/caren/store/billable_category.rb', line 3

def self.keys
  [ :id,                    # Integer (Id of this category in Caren)
    :name,                  # String
    :description,           # Text
    :icon,                  # String
    :billable_category_id    # Integer (Parent category; Caren id; Nil for root node)
  ] + super
end

.node_rootObject



28
29
30
# File 'lib/caren/store/billable_category.rb', line 28

def self.node_root
  :billable_category
end

.resource_locationObject



32
33
34
# File 'lib/caren/store/billable_category.rb', line 32

def self.resource_location
  "/api/pro/store/billable_categories"
end

.search(key, value, session) ⇒ Object



12
13
14
# File 'lib/caren/store/billable_category.rb', line 12

def self.search key, value, session
  from_xml session.get( self.search_url(key,value) )
end