the-city-admin 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +8 -8
  2. data/.gitignore +2 -0
  3. data/.pryrc +3 -0
  4. data/.rspec +1 -1
  5. data/.ruby-gemset +1 -0
  6. data/.ruby-version +1 -0
  7. data/.travis.yml +12 -0
  8. data/Gemfile +6 -3
  9. data/Gemfile.lock +58 -28
  10. data/README.rdoc +4 -1
  11. data/examples/barcodes_checkins.rb +37 -14
  12. data/lib/api/checkin.rb +1 -1
  13. data/lib/api/checkin_list.rb +0 -1
  14. data/lib/api/checkin_list_by_callboard_number.rb +61 -0
  15. data/lib/api/checkin_list_by_pager_number.rb +61 -0
  16. data/lib/api/group_checkin.rb +13 -2
  17. data/lib/api/group_checkin_event.rb +24 -0
  18. data/lib/api/group_checkin_events_list.rb +64 -0
  19. data/lib/api/group_checkin_list.rb +2 -2
  20. data/lib/readers/api_reader.rb +9 -2
  21. data/lib/readers/checkin_list_by_callboard_number_reader.rb +27 -0
  22. data/lib/readers/checkin_list_by_pager_number_reader.rb +27 -0
  23. data/lib/readers/checkin_list_reader.rb +2 -2
  24. data/lib/readers/group_checkin_events_list_reader.rb +28 -0
  25. data/lib/readers/group_checkin_reader.rb +32 -0
  26. data/lib/readers/group_list_reader.rb +0 -1
  27. data/spec/api/checkin_list_by_callboard_number_spec.rb +91 -0
  28. data/spec/api/checkin_list_by_pager_number_spec.rb +98 -0
  29. data/spec/api/checkin_list_spec.rb +91 -0
  30. data/spec/api/group_address_list_spec.rb +1 -1
  31. data/spec/api/group_address_spec.rb +2 -3
  32. data/spec/api/group_checkin_events_list_spec.rb +91 -0
  33. data/spec/api/group_checkin_list_spec.rb +1 -1
  34. data/spec/api/group_checkin_spec.rb +12 -0
  35. data/spec/api/group_event_attendance_list_spec.rb +1 -1
  36. data/spec/api/group_export_spec.rb +1 -5
  37. data/spec/api/group_invitation_list_spec.rb +6 -6
  38. data/spec/api/group_invitation_spec.rb +1 -5
  39. data/spec/api/group_list_spec.rb +72 -7
  40. data/spec/api/group_role_list_spec.rb +6 -6
  41. data/spec/api/group_role_spec.rb +1 -5
  42. data/spec/api/group_spec.rb +1 -5
  43. data/spec/api/group_tag_list_spec.rb +6 -6
  44. data/spec/api/group_tag_spec.rb +1 -5
  45. data/spec/api/metric_list_spec.rb +6 -6
  46. data/spec/api/metric_measurement_list_spec.rb +6 -6
  47. data/spec/api/metric_measurement_spec.rb +2 -2
  48. data/spec/api/metric_spec.rb +2 -2
  49. data/spec/api/role_list_spec.rb +1 -1
  50. data/spec/api/role_spec.rb +2 -2
  51. data/spec/api/skill_list_spec.rb +1 -1
  52. data/spec/api/skilled_user_id_list_spec.rb +1 -1
  53. data/spec/api/skilled_user_list_spec.rb +1 -1
  54. data/spec/api/tag_group_list_spec.rb +1 -1
  55. data/spec/api/tag_list_spec.rb +1 -1
  56. data/spec/api/tag_spec.rb +2 -2
  57. data/spec/api/terminology_list_spec.rb +1 -1
  58. data/spec/api/terminology_spec.rb +2 -2
  59. data/spec/api/user_address_list_spec.rb +1 -1
  60. data/spec/api/user_address_spec.rb +2 -2
  61. data/spec/api/user_admin_privilege_list_spec.rb +1 -1
  62. data/spec/api/user_admin_privilege_spec.rb +2 -2
  63. data/spec/api/user_barcode_spec.rb +2 -2
  64. data/spec/api/user_family_list_spec.rb +1 -1
  65. data/spec/api/user_family_member_spec.rb +2 -2
  66. data/spec/api/user_invitation_list_spec.rb +1 -1
  67. data/spec/api/user_invitation_spec.rb +2 -2
  68. data/spec/api/user_list_spec.rb +1 -1
  69. data/spec/api/user_note_list_spec.rb +1 -1
  70. data/spec/api/user_note_spec.rb +2 -2
  71. data/spec/api/user_process_answer_list_spec.rb +1 -1
  72. data/spec/api/user_process_list_spec.rb +1 -1
  73. data/spec/api/user_process_spec.rb +2 -2
  74. data/spec/api/user_role_list_spec.rb +1 -1
  75. data/spec/api/user_role_spec.rb +2 -2
  76. data/spec/api/user_skill_list_spec.rb +1 -1
  77. data/spec/api/user_skill_spec.rb +2 -2
  78. data/spec/api/user_spec.rb +1 -2
  79. data/spec/api/web_hook_list_spec.rb +1 -1
  80. data/spec/api/web_hook_spec.rb +2 -2
  81. data/spec/factories/group_checkin_event.rb +20 -0
  82. data/spec/factories/group_checkin_events_list.rb +14 -0
  83. data/spec/factories/group_list.rb +13 -0
  84. data/spec/functional/the_city_admin_spec.rb +5 -5
  85. data/spec/readers/api_reader_spec.rb +3 -5
  86. data/spec/readers/user_reader_spec.rb +1 -1
  87. data/spec/spec_helper.rb +9 -7
  88. data/thecity_admin_api.gemspec +6 -5
  89. metadata +51 -8
  90. data/.autotest +0 -9
  91. data/.rvmrc +0 -1
@@ -0,0 +1,91 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe 'CheckinList' do
4
+
5
+ before do
6
+ #simulate_connection_to_server
7
+ end
8
+
9
+ after do
10
+
11
+ end
12
+
13
+ it 'should pass if group checkin list attribute is not specified' do
14
+ group_id = 123
15
+ request_data = FactoryGirl.attributes_for(:checkin_list, {
16
+ :total_entries => 1,
17
+ :total_pages => 1,
18
+ :checkins => [FactoryGirl.attributes_for(:group_checkin)]
19
+ }).to_json
20
+ TheCity.stub(:admin_request).and_return( TheCityResponse.new(200, request_data) )
21
+ checkin_list = TheCity::CheckinList.new()
22
+ checkin = checkin_list[0]
23
+ checkin.parent_group_name.should == "Ballard Childrens ministry"
24
+ end
25
+
26
+
27
+ it 'should pass if group checkin list is empty' do
28
+ group_id = 123
29
+ page = 2
30
+ request_data = FactoryGirl.attributes_for(:checkin_list, {
31
+ :total_entries => 1,
32
+ :total_pages => 1,
33
+ :checkins => []
34
+ }).to_json
35
+ TheCity.stub(:admin_request).and_return( TheCityResponse.new(200, request_data) )
36
+ checkin_list = TheCity::CheckinList.new()
37
+
38
+ checkin_list.empty?.should be_true
39
+ end
40
+
41
+
42
+ it 'should return a valid list of group checkins' do
43
+ group_id = 123
44
+ page = 2
45
+ request_data = FactoryGirl.attributes_for(:checkin_list, {
46
+ :total_entries => 1,
47
+ :total_pages => 1,
48
+ :checkins => [FactoryGirl.attributes_for(:group_checkin)]
49
+ }).to_json
50
+ TheCity.stub(:admin_request).and_return( TheCityResponse.new(200, request_data) )
51
+ checkin_list = TheCity::CheckinList.new()
52
+
53
+ checkin = checkin_list[0]
54
+ checkin.parent_group_name.should == "Ballard Childrens ministry"
55
+ end
56
+
57
+
58
+ it 'should iterate using *each* method' do
59
+ group_id = 123
60
+ request_data = FactoryGirl.attributes_for(:checkin_list, {
61
+ :total_entries => 1,
62
+ :total_pages => 1,
63
+ :checkins => [FactoryGirl.attributes_for(:group_checkin)]
64
+ }).to_json
65
+ TheCity.stub(:admin_request).and_return( TheCityResponse.new(200, request_data) )
66
+ checkin_list = TheCity::CheckinList.new()
67
+
68
+ checkins = []
69
+ checkin_list.each { |checkin| checkins << checkin.parent_group_name }
70
+ checkins.should == ["Ballard Childrens ministry"]
71
+ end
72
+
73
+
74
+ it 'should iterate using *collect* method' do
75
+ group_id = 123
76
+ request_data = FactoryGirl.attributes_for(:checkin_list, {
77
+ :total_entries => 1,
78
+ :total_pages => 1,
79
+ :checkins => [FactoryGirl.attributes_for(:group_checkin)]
80
+ }).to_json
81
+ TheCity.stub(:admin_request).and_return( TheCityResponse.new(200, request_data) )
82
+ checkin_list = TheCity::CheckinList.new()
83
+
84
+ checkins = checkin_list.collect { |checkin| checkin.parent_group_name }
85
+ checkins.should == ["Ballard Childrens ministry"]
86
+ end
87
+
88
+
89
+ end
90
+
91
+
@@ -3,7 +3,7 @@ require File.join(Dir.pwd, 'spec', 'spec_helper')
3
3
  describe 'GroupAddressList' do
4
4
 
5
5
  before do
6
- simulate_connection_to_server
6
+ #simulate_connection_to_server
7
7
  end
8
8
 
9
9
  after do
@@ -3,7 +3,7 @@ require File.join(Dir.pwd, 'spec', 'spec_helper')
3
3
  describe 'GroupAddress' do
4
4
 
5
5
  before do
6
- simulate_connection_to_server
6
+ #simulate_connection_to_server
7
7
  end
8
8
 
9
9
  after do
@@ -11,8 +11,7 @@ describe 'GroupAddress' do
11
11
  end
12
12
 
13
13
 
14
- it 'should pass if ....'
15
-
14
+ #
16
15
 
17
16
  end
18
17
 
@@ -0,0 +1,91 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe 'GroupCheckinEventsList' do
4
+
5
+ before do
6
+ #simulate_connection_to_server
7
+ end
8
+
9
+ after do
10
+
11
+ end
12
+
13
+
14
+ it 'should pass if group checkin list attribute is not specified' do
15
+ group_id = 123
16
+ request_data = FactoryGirl.attributes_for(:group_checkin_events_list, {
17
+ :total_entries => 1,
18
+ :total_pages => 1,
19
+ :checkin_events => [FactoryGirl.attributes_for(:group_checkin_event)]
20
+ }).to_json
21
+ TheCity.stub(:admin_request).and_return( TheCityResponse.new(200, request_data) )
22
+ checkin_events_list = TheCity::GroupCheckinEventsList.new({:group_id => group_id})
23
+ checkin_event = checkin_events_list[0]
24
+ checkin_event.title.should == "5 PM Service"
25
+ end
26
+
27
+
28
+ it 'should pass if group checkin list is empty' do
29
+ group_id = 123
30
+ page = 2
31
+ request_data = FactoryGirl.attributes_for(:group_checkin_events_list, {
32
+ :total_entries => 1,
33
+ :total_pages => 1,
34
+ :checkin_events => []
35
+ }).to_json
36
+ TheCity.stub(:admin_request).and_return( TheCityResponse.new(200, request_data) )
37
+ checkin_events_list = TheCity::GroupCheckinEventsList.new({:group_id => group_id})
38
+
39
+ checkin_events_list.empty?.should be_true
40
+ end
41
+
42
+
43
+ it 'should return a valid list of group checkins' do
44
+ group_id = 123
45
+ page = 2
46
+ request_data = FactoryGirl.attributes_for(:group_checkin_events_list, {
47
+ :total_entries => 1,
48
+ :total_pages => 1,
49
+ :checkin_events => [FactoryGirl.attributes_for(:group_checkin_event)]
50
+ }).to_json
51
+ TheCity.stub(:admin_request).and_return( TheCityResponse.new(200, request_data) )
52
+ checkin_events_list = TheCity::GroupCheckinEventsList.new({:group_id => group_id, :page => 2})
53
+
54
+ checkin_event = checkin_events_list[0]
55
+ checkin_event.title.should == "5 PM Service"
56
+ end
57
+
58
+
59
+ it 'should iterate using *each* method' do
60
+ group_id = 123
61
+ request_data = FactoryGirl.attributes_for(:group_checkin_events_list, {
62
+ :total_entries => 1,
63
+ :total_pages => 1,
64
+ :checkin_events => [FactoryGirl.attributes_for(:group_checkin_event)]
65
+ }).to_json
66
+ TheCity.stub(:admin_request).and_return( TheCityResponse.new(200, request_data) )
67
+ checkin_events_list = TheCity::GroupCheckinEventsList.new({:group_id => group_id})
68
+
69
+ checkin_events = []
70
+ checkin_events_list.each { |checkin_event| checkin_events << checkin_event.title }
71
+ checkin_events.should == ["5 PM Service"]
72
+ end
73
+
74
+
75
+ it 'should iterate using *collect* method' do
76
+ group_id = 123
77
+ request_data = FactoryGirl.attributes_for(:group_checkin_events_list, {
78
+ :total_entries => 1,
79
+ :total_pages => 1,
80
+ :checkin_events => [FactoryGirl.attributes_for(:group_checkin_event)]
81
+ }).to_json
82
+ TheCity.stub(:admin_request).and_return( TheCityResponse.new(200, request_data) )
83
+ checkin_events_list = TheCity::GroupCheckinEventsList.new({:group_id => group_id})
84
+
85
+ checkin_events = []
86
+ checkin_events_list.collect { |checkin_event| checkin_events << checkin_event.title }
87
+ checkin_events.should == ["5 PM Service"]
88
+ end
89
+ end
90
+
91
+
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../spec_helper'
3
3
  describe 'GroupCheckinList' do
4
4
 
5
5
  before do
6
- simulate_connection_to_server
6
+ #simulate_connection_to_server
7
7
  end
8
8
 
9
9
  after do
@@ -0,0 +1,12 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe 'GroupCheckin' do
4
+
5
+ let(:request_data) { (FactoryGirl.attributes_for(:group_checkin)).to_json }
6
+
7
+ it 'loads by id' do
8
+ TheCity.stub(:admin_request).and_return( TheCityResponse.new(200, request_data) )
9
+ group_checkin = TheCity::GroupCheckin.load_by_id(12345, 12345)
10
+ group_checkin.should_not be_nil
11
+ end
12
+ end
@@ -3,7 +3,7 @@ require File.join(Dir.pwd, 'spec', 'spec_helper')
3
3
  describe 'GroupEventAttendanceList' do
4
4
 
5
5
  before do
6
- simulate_connection_to_server
6
+ #simulate_connection_to_server
7
7
  end
8
8
 
9
9
  after do
@@ -3,17 +3,13 @@ require File.join(Dir.pwd, 'spec', 'spec_helper')
3
3
  describe 'GroupExport' do
4
4
 
5
5
  before do
6
- simulate_connection_to_server
6
+ #simulate_connection_to_server
7
7
  end
8
8
 
9
9
  after do
10
10
 
11
11
  end
12
12
 
13
-
14
- it 'should pass if ....'
15
-
16
-
17
13
  end
18
14
 
19
15
 
@@ -3,7 +3,7 @@ require File.join(Dir.pwd, 'spec', 'spec_helper')
3
3
  describe 'GroupInvitationList' do
4
4
 
5
5
  before do
6
- simulate_connection_to_server
6
+ #simulate_connection_to_server
7
7
  end
8
8
 
9
9
  after do
@@ -11,11 +11,11 @@ describe 'GroupInvitationList' do
11
11
  end
12
12
 
13
13
 
14
- it 'should pass if group invitation list attribute is not specifed'
15
- it 'should pass if group invitation list is empty'
16
- it 'should return a valid list of group invitations'
17
- it 'should iterate using *each* method'
18
- it 'should iterate using *collect* method'
14
+ # it 'should pass if group invitation list attribute is not specifed'
15
+ # it 'should pass if group invitation list is empty'
16
+ # it 'should return a valid list of group invitations'
17
+ # it 'should iterate using *each* method'
18
+ # it 'should iterate using *collect* method'
19
19
 
20
20
 
21
21
  end
@@ -3,17 +3,13 @@ require File.join(Dir.pwd, 'spec', 'spec_helper')
3
3
  describe 'GroupInvitation' do
4
4
 
5
5
  before do
6
- simulate_connection_to_server
6
+ #simulate_connection_to_server
7
7
  end
8
8
 
9
9
  after do
10
10
 
11
11
  end
12
12
 
13
-
14
- it 'should pass if ....'
15
-
16
-
17
13
  end
18
14
 
19
15
 
@@ -1,9 +1,9 @@
1
- require File.join(Dir.pwd, 'spec', 'spec_helper')
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
2
 
3
3
  describe 'GroupList' do
4
4
 
5
5
  before do
6
- simulate_connection_to_server
6
+ #simulate_connection_to_server
7
7
  end
8
8
 
9
9
  after do
@@ -11,13 +11,78 @@ describe 'GroupList' do
11
11
  end
12
12
 
13
13
 
14
- it 'should pass if group list attribute is not specifed'
15
- it 'should pass if group list is empty'
16
- it 'should return a valid list of groups'
17
- it 'should iterate using *each* method'
18
- it 'should iterate using *collect* method'
14
+ it 'should pass if group group list attribute is not specified' do
15
+ request_data = FactoryGirl.attributes_for(:group_list, {
16
+ :total_entries => 1,
17
+ :total_pages => 1,
18
+ :groups => [FactoryGirl.attributes_for(:group)]
19
+ }).to_json
20
+ TheCity.stub(:admin_request).and_return( TheCityResponse.new(200, request_data) )
21
+ group_list = TheCity::GroupList.new()
22
+
23
+ group = group_list[0]
24
+ group.name.should == "The Group"
25
+ end
26
+
27
+
28
+ it 'should pass if group group list is empty' do
29
+ request_data = FactoryGirl.attributes_for(:group_list, {
30
+ :total_entries => 1,
31
+ :total_pages => 1,
32
+ :groups => []
33
+ }).to_json
34
+ TheCity.stub(:admin_request).and_return( TheCityResponse.new(200, request_data) )
35
+ group_list = TheCity::GroupList.new()
36
+
37
+ group_list.empty?.should be_true
38
+ end
39
+
40
+
41
+ it 'should return a valid list of group groups' do
42
+ request_data = FactoryGirl.attributes_for(:group_list, {
43
+ :total_entries => 1,
44
+ :total_pages => 1,
45
+ :groups => [FactoryGirl.attributes_for(:group)]
46
+ }).to_json
47
+ TheCity.stub(:admin_request).and_return( TheCityResponse.new(200, request_data) )
48
+ group_list = TheCity::GroupList.new({:page => 2})
49
+
50
+ group = group_list[0]
51
+ group.name.should == "The Group"
52
+ end
53
+
54
+ it 'should iterate using *each* method' do
55
+ request_data = FactoryGirl.attributes_for(:group_list, {
56
+ :total_entries => 1,
57
+ :total_pages => 1,
58
+ :groups => [FactoryGirl.attributes_for(:group)]
59
+ }).to_json
60
+ TheCity.stub(:admin_request).and_return( TheCityResponse.new(200, request_data) )
61
+ group_list = TheCity::GroupList.new()
62
+
63
+ groups = []
64
+ group_list.each { |group| groups << group.name }
65
+ groups.should == ["The Group"]
66
+ end
67
+
68
+
69
+ it 'should iterate using *collect* method' do
70
+ request_data = FactoryGirl.attributes_for(:group_list, {
71
+ :total_entries => 1,
72
+ :total_pages => 1,
73
+ :groups => [FactoryGirl.attributes_for(:group)]
74
+ }).to_json
75
+ TheCity.stub(:admin_request).and_return( TheCityResponse.new(200, request_data) )
76
+ group_list = TheCity::GroupList.new()
77
+
78
+ groups = group_list.collect { |group| group.name }
79
+ groups.should == ["The Group"]
80
+ end
19
81
 
20
82
 
21
83
  end
22
84
 
23
85
 
86
+
87
+
88
+
@@ -3,7 +3,7 @@ require File.join(Dir.pwd, 'spec', 'spec_helper')
3
3
  describe 'GroupRoleList' do
4
4
 
5
5
  before do
6
- simulate_connection_to_server
6
+ #simulate_connection_to_server
7
7
  end
8
8
 
9
9
  after do
@@ -11,11 +11,11 @@ describe 'GroupRoleList' do
11
11
  end
12
12
 
13
13
 
14
- it 'should pass if group role list attribute is not specifed'
15
- it 'should pass if group role list is empty'
16
- it 'should return a valid list of group roles'
17
- it 'should iterate using *each* method'
18
- it 'should iterate using *collect* method'
14
+ # it 'should pass if group role list attribute is not specifed'
15
+ # it 'should pass if group role list is empty'
16
+ # it 'should return a valid list of group roles'
17
+ # it 'should iterate using *each* method'
18
+ # it 'should iterate using *collect* method'
19
19
 
20
20
 
21
21
  end
@@ -3,17 +3,13 @@ require File.join(Dir.pwd, 'spec', 'spec_helper')
3
3
  describe 'GroupRole' do
4
4
 
5
5
  before do
6
- simulate_connection_to_server
6
+ #simulate_connection_to_server
7
7
  end
8
8
 
9
9
  after do
10
10
 
11
11
  end
12
12
 
13
-
14
- it 'should pass if ....'
15
-
16
-
17
13
  end
18
14
 
19
15