Class: Caren::Person

Inherits:
Base
  • Object
show all
Defined in:
lib/caren/person.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



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

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

.array_rootObject



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

def self.array_root
  :people
end

.find(id, session) ⇒ Object



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

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
# File 'lib/caren/person.rb', line 3

def self.keys
  [:id,                       # Integer (Caren id)
   :first_name,               # String
   :last_name,                # String
   :male,                     # Boolean
   :email,                    # String
   :photo,                    # String
   :link_id,                  # Integer
   :external_id,              # String
   :citizen_service_number    # String
  ] + super
end

.node_rootObject



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

def self.node_root
  :person
end

.resource_locationObject



36
37
38
# File 'lib/caren/person.rb', line 36

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

.search(key, value, session) ⇒ Object



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

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