osm 1.2.24 → 1.2.25
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +3 -1
- data/lib/osm.rb +2 -7
- data/lib/osm/activity.rb +1 -1
- data/lib/osm/api.rb +8 -4
- data/lib/osm/email.rb +392 -0
- data/lib/osm/myscout.rb +330 -0
- data/spec/osm/api_spec.rb +5 -0
- data/spec/osm/email_spec.rb +539 -0
- data/spec/osm/myscout_spec.rb +108 -0
- data/spec/osm/osm_spec.rb +0 -8
- data/version.rb +1 -1
- metadata +6 -2
@@ -0,0 +1,108 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe "My.SCOUT" do
|
5
|
+
|
6
|
+
describe "Parent login history" do
|
7
|
+
|
8
|
+
it "Get from OSM" do
|
9
|
+
@api.should_receive(:perform_query).with('ext/settings/parents/loginhistory/?action=getLoginHistory§ionid=1'){
|
10
|
+
{'items' => [
|
11
|
+
{"scoutid"=>"2","firstname"=>"John","lastname"=>"Smith","numlogins"=>271,"lastlogin"=>'16/04/2016 17:49'},
|
12
|
+
{"scoutid"=>"3","firstname"=>"Jane","lastname"=>"Jones","numlogins"=>1,"lastlogin"=>'10/11/2015 14:21'},
|
13
|
+
]}
|
14
|
+
}
|
15
|
+
|
16
|
+
histories = Osm::Myscout::ParentLoginHistory.get_for_section(@api, 1)
|
17
|
+
histories.size.should == 2
|
18
|
+
histories[0].member_id.should == 2
|
19
|
+
histories[0].first_name.should == 'John'
|
20
|
+
histories[0].last_name.should == 'Smith'
|
21
|
+
histories[0].logins.should == 271
|
22
|
+
histories[0].last_login.should == Time.new(2016, 4, 16, 17, 49)
|
23
|
+
histories[1].member_id.should == 3
|
24
|
+
histories[1].first_name.should == 'Jane'
|
25
|
+
histories[1].last_name.should == 'Jones'
|
26
|
+
histories[1].logins.should == 1
|
27
|
+
histories[1].last_login.should == Time.new(2015, 11, 10, 14, 21)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'Handles a last_login of "Invitation not sent"' do
|
31
|
+
@api.should_receive(:perform_query).with('ext/settings/parents/loginhistory/?action=getLoginHistory§ionid=1'){
|
32
|
+
{'items' => [
|
33
|
+
{"scoutid"=>"2","firstname"=>"John","lastname"=>"Smith","numlogins"=>271,"lastlogin"=>'Invitation not sent'},
|
34
|
+
]}
|
35
|
+
}
|
36
|
+
|
37
|
+
history = Osm::Myscout::ParentLoginHistory.get_for_section(@api, 1)[0]
|
38
|
+
history.last_login.should be_nil
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'Handles a nil last_login' do
|
42
|
+
@api.should_receive(:perform_query).with('ext/settings/parents/loginhistory/?action=getLoginHistory§ionid=1'){
|
43
|
+
{'items' => [
|
44
|
+
{"scoutid"=>"2","firstname"=>"John","lastname"=>"Smith","numlogins"=>271,"lastlogin"=>nil},
|
45
|
+
]}
|
46
|
+
}
|
47
|
+
|
48
|
+
history = Osm::Myscout::ParentLoginHistory.get_for_section(@api, 1)[0]
|
49
|
+
history.last_login.should be_nil
|
50
|
+
end
|
51
|
+
|
52
|
+
end # describe ParentLoginHistory
|
53
|
+
|
54
|
+
|
55
|
+
describe "Template" do
|
56
|
+
|
57
|
+
describe "Get" do
|
58
|
+
|
59
|
+
it "Success" do
|
60
|
+
@api.should_receive(:perform_query).with('ext/settings/parents/?action=getTemplate&key=email-first§ion_id=1'){ {"status"=>true, "error"=>nil, "data"=>"TEMPLATE GOES HERE", "meta"=>[]} }
|
61
|
+
Osm::Myscout::Template.get_template(@api, 1, 'email-first').should == 'TEMPLATE GOES HERE'
|
62
|
+
end
|
63
|
+
|
64
|
+
it "Failed" do
|
65
|
+
@api.should_receive(:perform_query).with('ext/settings/parents/?action=getTemplate&key=email-first§ion_id=1'){ {"status"=>false, "error"=>nil, "data"=>"", "meta"=>[]} }
|
66
|
+
Osm::Myscout::Template.get_template(@api, 1, 'email-first').should be_nil
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
describe "Update" do
|
72
|
+
|
73
|
+
it "Success" do
|
74
|
+
template = 'CONTENT WHICH CONTAINS [DIRECT_LINK].'
|
75
|
+
@api.should_receive(:perform_query).with('ext/settings/parents/?action=updateTemplate', {'section_id'=>1, 'key'=>'email-invitation', 'value'=>template}){ {"status"=>true, "error"=>nil, "data"=>true, "meta"=>[]} }
|
76
|
+
Osm::Myscout::Template.update_template(@api, 1, 'email-invitation', template).should be true
|
77
|
+
end
|
78
|
+
|
79
|
+
it "Failed" do
|
80
|
+
template = 'CONTENT WHICH CONTAINS [DIRECT_LINK].'
|
81
|
+
@api.should_receive(:perform_query).with('ext/settings/parents/?action=updateTemplate', {'section_id'=>1, 'key'=>'email-invitation', 'value'=>template}){ {"status"=>false, "error"=>nil, "data"=>false, "meta"=>[]} }
|
82
|
+
Osm::Myscout::Template.update_template(@api, 1, 'email-invitation', template).should be false
|
83
|
+
end
|
84
|
+
|
85
|
+
it "Missing a required tag" do
|
86
|
+
@api.should_not_receive(:perform_query)
|
87
|
+
expect{ Osm::Myscout::Template.update_template(@api, 1, 'email-invitation', 'CONTENT') }.to raise_error ArgumentError, 'Required tag [DIRECT_LINK] not found in template content.'
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
describe "Restore" do
|
93
|
+
|
94
|
+
it "Success" do
|
95
|
+
@api.should_receive(:perform_query).with('ext/settings/parents/?action=restoreTemplate', {'section_id'=>1, 'key'=>'email-first'}){ {"status"=>true, "error"=>nil, "data"=>"TEMPLATE GOES HERE", "meta"=>[]} }
|
96
|
+
Osm::Myscout::Template.restore_template(@api, 1, 'email-first').should == 'TEMPLATE GOES HERE'
|
97
|
+
end
|
98
|
+
|
99
|
+
it "Failed" do
|
100
|
+
@api.should_receive(:perform_query).with('ext/settings/parents/?action=restoreTemplate', {'section_id'=>1, 'key'=>'email-first'}){ {"status"=>false, "error"=>nil, "data"=>"TEMPLATE GOES HERE", "meta"=>[]} }
|
101
|
+
Osm::Myscout::Template.restore_template(@api, 1, 'email-first').should be_nil
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
end # describe Template
|
107
|
+
|
108
|
+
end
|
data/spec/osm/osm_spec.rb
CHANGED
@@ -4,14 +4,6 @@ require 'date'
|
|
4
4
|
|
5
5
|
describe "Online Scout Manager" do
|
6
6
|
|
7
|
-
describe "Make array of symbols" do
|
8
|
-
it "turns array of strings to an array of symbols" do
|
9
|
-
start = %w{first second third}
|
10
|
-
Osm::make_array_of_symbols(start).should == [:first, :second, :third]
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
|
15
7
|
describe "Make a DateTime" do
|
16
8
|
it "is given a date and a time" do
|
17
9
|
Osm::make_datetime('2001-02-03', '04:05:06').should == DateTime.new(2001, 02, 03, 04, 05, 06)
|
data/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: osm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Gauld
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -229,6 +229,7 @@ files:
|
|
229
229
|
- lib/osm/badge.rb
|
230
230
|
- lib/osm/badges.rb
|
231
231
|
- lib/osm/budget.rb
|
232
|
+
- lib/osm/email.rb
|
232
233
|
- lib/osm/event.rb
|
233
234
|
- lib/osm/flexi_record.rb
|
234
235
|
- lib/osm/giftaid.rb
|
@@ -237,6 +238,7 @@ files:
|
|
237
238
|
- lib/osm/meeting.rb
|
238
239
|
- lib/osm/member.rb
|
239
240
|
- lib/osm/model.rb
|
241
|
+
- lib/osm/myscout.rb
|
240
242
|
- lib/osm/register.rb
|
241
243
|
- lib/osm/section.rb
|
242
244
|
- lib/osm/sms.rb
|
@@ -251,6 +253,7 @@ files:
|
|
251
253
|
- spec/osm/badge_spec.rb
|
252
254
|
- spec/osm/badges_spec.rb
|
253
255
|
- spec/osm/budget_spec.rb
|
256
|
+
- spec/osm/email_spec.rb
|
254
257
|
- spec/osm/event_spec.rb
|
255
258
|
- spec/osm/flexi_record_spec.rb
|
256
259
|
- spec/osm/giftaid_spec.rb
|
@@ -259,6 +262,7 @@ files:
|
|
259
262
|
- spec/osm/meeting_spec.rb
|
260
263
|
- spec/osm/member_spec.rb
|
261
264
|
- spec/osm/model_spec.rb
|
265
|
+
- spec/osm/myscout_spec.rb
|
262
266
|
- spec/osm/osm_spec.rb
|
263
267
|
- spec/osm/register_spec.rb
|
264
268
|
- spec/osm/section_spec.rb
|