osm 0.1.16 → 0.1.17
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/README.md +3 -2
- data/lib/osm/evening.rb +25 -1
- data/lib/osm/term.rb +1 -1
- data/spec/osm/evening_spec.rb +13 -1
- data/version.rb +1 -1
- metadata +16 -16
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -134,9 +134,10 @@ however it should be noted that when the OSM API adds a feature it can be diffic
|
|
134
134
|
* Retreive [issue 21]
|
135
135
|
* Update [issue 22]
|
136
136
|
* Retrieve details for each badge (stock, short column names etc.) [issue 20]
|
137
|
+
* Update badge stock [issue 56]
|
137
138
|
* SMS:
|
138
|
-
*
|
139
|
-
* Sending a message
|
139
|
+
* Retrieval of delivery reports [issue 54]
|
140
|
+
* Sending a message [issue 54]
|
140
141
|
* Gift aid (Everything)
|
141
142
|
* Finances (Everything)
|
142
143
|
* MyScout (Everything) (Maybe)
|
data/lib/osm/evening.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# TODO with next version bump - rename to Meeting, also rename meeting_date to date
|
2
|
+
|
1
3
|
module Osm
|
2
4
|
|
3
5
|
class Evening < Osm::Model
|
@@ -64,7 +66,7 @@ module Osm
|
|
64
66
|
# @!macro options_get
|
65
67
|
# @return [Array<Osm::Evening>]
|
66
68
|
# TODO Change to get_all in next version bump
|
67
|
-
def self.get_programme(api, section, term, options={})
|
69
|
+
def self.get_programme(api, section, term=nil, options={})
|
68
70
|
section_id = section.to_i
|
69
71
|
term_id = term.nil? ? Osm::Term.get_current_term_for_section(api, section).id : term.to_i
|
70
72
|
cache_key = ['programme', section_id, term_id]
|
@@ -233,6 +235,28 @@ module Osm
|
|
233
235
|
end
|
234
236
|
|
235
237
|
|
238
|
+
def <=>(another)
|
239
|
+
begin
|
240
|
+
compare = self.section_id <=> another.section_id
|
241
|
+
return compare unless compare == 0
|
242
|
+
|
243
|
+
compare = self.meeting_date <=> another.meeting_date
|
244
|
+
return compare unless compare == 0
|
245
|
+
|
246
|
+
my_start_time = self.start_time.split(':').map{ |i| i.to_i }
|
247
|
+
another_start_time = another.start_time.split(':').map{ |i| i.to_i }
|
248
|
+
compare = my_start_time[0] <=> another_start_time[0]
|
249
|
+
return compare unless compare == 0
|
250
|
+
compare = my_start_time[1] <=> another_start_time[1]
|
251
|
+
return compare unless compare == 0
|
252
|
+
|
253
|
+
return self.id <=> another.id
|
254
|
+
rescue NoMethodError
|
255
|
+
return 0
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
|
236
260
|
private
|
237
261
|
class Activity
|
238
262
|
include ::ActiveAttr::MassAssignmentSecurity
|
data/lib/osm/term.rb
CHANGED
data/spec/osm/evening_spec.rb
CHANGED
@@ -34,7 +34,19 @@ describe "Evening" do
|
|
34
34
|
e.activities.should == []
|
35
35
|
e.valid?.should be_true
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
|
+
it "Sorts by Section ID, Meeting date, Start time and then Evening ID" do
|
39
|
+
evening1 = Osm::Evening.new(:section_id => 1, :id => 1, :meeting_date => (Date.today - 1), :start_time => '18:00')
|
40
|
+
evening2 = Osm::Evening.new(:section_id => 2, :id => 1, :meeting_date => (Date.today - 1), :start_time => '18:00')
|
41
|
+
evening3 = Osm::Evening.new(:section_id => 2, :id => 1, :meeting_date => (Date.today + 1), :start_time => '18:00')
|
42
|
+
evening4 = Osm::Evening.new(:section_id => 2, :id => 1, :meeting_date => (Date.today + 1), :start_time => '19:00')
|
43
|
+
evening5 = Osm::Evening.new(:section_id => 2, :id => 2, :meeting_date => (Date.today + 1), :start_time => '19:00')
|
44
|
+
|
45
|
+
data = [evening5, evening3, evening2, evening4, evening1]
|
46
|
+
data.sort.should == [evening1, evening2, evening3, evening4, evening5]
|
47
|
+
end
|
48
|
+
|
49
|
+
|
38
50
|
it "Create Evening::Activity" do
|
39
51
|
ea = Osm::Evening::Activity.new(
|
40
52
|
:activity_id => 2,
|
data/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: osm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.17
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-05 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement: &
|
16
|
+
requirement: &80603000 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3.2'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *80603000
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: httparty
|
27
|
-
requirement: &
|
27
|
+
requirement: &80601890 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0.9'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *80601890
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: active_attr
|
38
|
-
requirement: &
|
38
|
+
requirement: &80600900 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0.6'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *80600900
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: activemodel
|
49
|
-
requirement: &
|
49
|
+
requirement: &80599810 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '3.2'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *80599810
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rake
|
60
|
-
requirement: &
|
60
|
+
requirement: &80599380 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '10.0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *80599380
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
|
-
requirement: &
|
71
|
+
requirement: &80598830 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '2.11'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *80598830
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: fakeweb
|
82
|
-
requirement: &
|
82
|
+
requirement: &80596730 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: '1.3'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *80596730
|
91
91
|
description: Use the Online Scout Manager API (https://www.onlinescoutmanager.co.uk)
|
92
92
|
to retrieve and save data.
|
93
93
|
email:
|