Class: Caren::Event
Overview
This class is just an intermediate for exporting events to Caren. It has the correct format for exports.
Instance Attribute Summary
Attributes inherited from Base
#attributes, #original_xml
Class Method Summary
collapse
Instance 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
28
29
30
|
# File 'lib/caren/event.rb', line 28
def self.all session
from_xml session.get(self.resource_url)
end
|
.array_root ⇒ Object
52
53
54
|
# File 'lib/caren/event.rb', line 52
def self.array_root
:events
end
|
.charge_url(id = nil) ⇒ Object
60
61
62
|
# File 'lib/caren/event.rb', line 60
def self.charge_url id=nil
"#{resource_location}/#{id}/charge"
end
|
.find(id, session) ⇒ Object
32
33
34
|
# File 'lib/caren/event.rb', line 32
def self.find id, session
from_xml session.get(self.resource_url(id))
end
|
.keys ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/caren/event.rb', line 5
def self.keys
[ :id, :external_id, :name, :comment, :start, :duration, :reservation, :valid_from, :valid_to, :person_first_name, :charged, :person_last_name, :person_male, :billable_id, :billable_amount, :cancel_before, :subject_id, :external_person_id, :source ] + super
end
|
.node_root ⇒ Object
56
57
58
|
# File 'lib/caren/event.rb', line 56
def self.node_root
:event
end
|
Instance Method Details
#charge(session) ⇒ Object
40
41
42
|
# File 'lib/caren/event.rb', line 40
def charge session
self.class.from_xml session.post self.class.charge_url(self.id), self.to_xml
end
|
#create(session) ⇒ Object
36
37
38
|
# File 'lib/caren/event.rb', line 36
def create session
self.class.from_xml session.post self.class.resource_url, self.to_xml
end
|
#delete(session) ⇒ Object
48
49
50
|
# File 'lib/caren/event.rb', line 48
def delete session
session.delete self.class.resource_url(self.id)
end
|
#update(session) ⇒ Object
44
45
46
|
# File 'lib/caren/event.rb', line 44
def update session
self.class.from_xml session.put self.class.resource_url(self.id), self.to_xml
end
|