Class: Caren::Employee

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

Instance Attribute Summary

Attributes inherited from Base

#attributes, #original_xml

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

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



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

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

.array_rootObject



40
41
42
# File 'lib/caren/employee.rb', line 40

def self.array_root
  :employees
end

.find(id, session) ⇒ Object



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

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

.keysObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/caren/employee.rb', line 3

def self.keys
  [ :id,               # Integer (Caren id, if applicable)
    :external_id,      # String (Your employee id)
    :first_name,       # String
    :last_name,        # String
    :role,             # String
    :agb_code,         # String
    :edi_address,      # String
    :male,             # Boolean
    :care_provider_id, # Integer
    :bio,              # Text
    :photo,            # String
    :created_at,       # Datetime
    :updated_at        # Datetime
  ]
end

.node_rootObject



44
45
46
# File 'lib/caren/employee.rb', line 44

def self.node_root
  :employee
end

.resource_locationObject



48
49
50
# File 'lib/caren/employee.rb', line 48

def self.resource_location
  "/api/pro/employees"
end

.search(key, value, session) ⇒ Object



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

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

Instance Method Details

#as_xmlObject



32
33
34
35
36
37
38
# File 'lib/caren/employee.rb', line 32

def as_xml
  { :external_id => self.external_id,
    :first_name => self.first_name,
    :last_name => self.last_name,
    :bio => self.bio,
    :photo => self.photo }
end