caren-api 0.4.32 → 0.4.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/caren-api.gemspec +5 -1
- data/lib/caren/employee.rb +19 -0
- data/lib/caren/event_slot.rb +1 -2
- data/lib/caren/event_slot_container.rb +17 -0
- data/lib/caren-api.rb +2 -0
- data/spec/employee_spec.rb +25 -0
- data/spec/event_slot_container_spec.rb +26 -0
- data/spec/event_slot_spec.rb +1 -1
- metadata +7 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.33
|
data/caren-api.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "caren-api"
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.33"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Andre Foeken"]
|
@@ -35,9 +35,11 @@ Gem::Specification.new do |s|
|
|
35
35
|
"lib/caren/care_provider.rb",
|
36
36
|
"lib/caren/caren.rb",
|
37
37
|
"lib/caren/client.rb",
|
38
|
+
"lib/caren/employee.rb",
|
38
39
|
"lib/caren/error.rb",
|
39
40
|
"lib/caren/event.rb",
|
40
41
|
"lib/caren/event_slot.rb",
|
42
|
+
"lib/caren/event_slot_container.rb",
|
41
43
|
"lib/caren/external_message.rb",
|
42
44
|
"lib/caren/link.rb",
|
43
45
|
"spec/.DS_Store",
|
@@ -46,6 +48,8 @@ Gem::Specification.new do |s|
|
|
46
48
|
"spec/care_provider_spec.rb",
|
47
49
|
"spec/caren_spec.rb",
|
48
50
|
"spec/client_spec.rb",
|
51
|
+
"spec/employee_spec.rb",
|
52
|
+
"spec/event_slot_container_spec.rb",
|
49
53
|
"spec/event_slot_spec.rb",
|
50
54
|
"spec/event_spec.rb",
|
51
55
|
"spec/external_message_spec.rb",
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class Caren::Employee < Caren::Base
|
2
|
+
|
3
|
+
def self.keys
|
4
|
+
[ :external_id, # String (Your client id)
|
5
|
+
:first_name, # String
|
6
|
+
:last_name, # String
|
7
|
+
:bio # Text
|
8
|
+
]
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.array_root
|
12
|
+
:employees
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.node_root
|
16
|
+
:employee
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
data/lib/caren/event_slot.rb
CHANGED
data/lib/caren-api.rb
CHANGED
@@ -11,7 +11,9 @@ require "caren/error"
|
|
11
11
|
require "caren/base"
|
12
12
|
require "caren/event"
|
13
13
|
require "caren/event_slot"
|
14
|
+
require "caren/event_slot_container"
|
14
15
|
require "caren/client"
|
16
|
+
require "caren/employee"
|
15
17
|
require "caren/care_provider"
|
16
18
|
require "caren/external_message"
|
17
19
|
require "caren/link"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Employee", "converting to xml" do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@employee_a = Caren::Employee.new( :external_id => 1,
|
7
|
+
:first_name => "Andre",
|
8
|
+
:last_name => "Foeken",
|
9
|
+
:bio => "Aap")
|
10
|
+
|
11
|
+
@employee_b = Caren::Employee.new( :external_id => 2,
|
12
|
+
:first_name => "Oscar",
|
13
|
+
:last_name => "Foeken",
|
14
|
+
:bio => "Noot")
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should be able to convert a employee to valid xml" do
|
18
|
+
@employee_a.should convert_to_valid_caren_xml
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should be able to convert an array of employee to valid xml" do
|
22
|
+
[@employee_a,@employee_b].should convert_to_valid_caren_array_xml
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "EventSlotContainer", "converting to xml" do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@employee = Caren::Employee.new( :first_name => "Andre", :last_name => "Foeken", :external_id => 3, :bio => "")
|
7
|
+
@slot_a = Caren::EventSlot.new( :date => Date.today, :start => "10:00", :duration => 3600)
|
8
|
+
@slot_b = Caren::EventSlot.new( :date => Date.today + 1, :start => "10:00", :duration => 7200)
|
9
|
+
@event_slot_container = Caren::EventSlotContainer.new( :employee => @employee, :event_slots => [@slot_a,@slot_b])
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should be able to convert an event to valid xml" do
|
13
|
+
hash = Hash.from_xml @event_slot_container.to_xml
|
14
|
+
hash["event_slot_container"]["event_slots"].should have(2).things
|
15
|
+
hash["event_slot_container"]["event_slots"].first["start"].should == "10:00"
|
16
|
+
hash["event_slot_container"]["employee"]["first_name"].should == "Andre"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should be able to convert an array of events to valid xml" do
|
20
|
+
hash = Hash.from_xml Caren::EventSlotContainer.to_xml([@event_slot_container])
|
21
|
+
hash["event_slot_containers"].first["event_slots"].should have(2).things
|
22
|
+
hash["event_slot_containers"].first["event_slots"].first["start"].should == "10:00"
|
23
|
+
hash["event_slot_containers"].first["employee"]["first_name"].should == "Andre"
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/spec/event_slot_spec.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caren-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 77
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 33
|
10
|
+
version: 0.4.33
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andre Foeken
|
@@ -173,9 +173,11 @@ files:
|
|
173
173
|
- lib/caren/care_provider.rb
|
174
174
|
- lib/caren/caren.rb
|
175
175
|
- lib/caren/client.rb
|
176
|
+
- lib/caren/employee.rb
|
176
177
|
- lib/caren/error.rb
|
177
178
|
- lib/caren/event.rb
|
178
179
|
- lib/caren/event_slot.rb
|
180
|
+
- lib/caren/event_slot_container.rb
|
179
181
|
- lib/caren/external_message.rb
|
180
182
|
- lib/caren/link.rb
|
181
183
|
- spec/.DS_Store
|
@@ -184,6 +186,8 @@ files:
|
|
184
186
|
- spec/care_provider_spec.rb
|
185
187
|
- spec/caren_spec.rb
|
186
188
|
- spec/client_spec.rb
|
189
|
+
- spec/employee_spec.rb
|
190
|
+
- spec/event_slot_container_spec.rb
|
187
191
|
- spec/event_slot_spec.rb
|
188
192
|
- spec/event_spec.rb
|
189
193
|
- spec/external_message_spec.rb
|