osm 1.2.0 → 1.2.1
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/CHANGELOG.md +4 -0
- data/lib/osm.rb +9 -1
- data/lib/osm/term.rb +1 -1
- data/osm.gemspec +1 -0
- data/spec/osm/term_spec.rb +6 -2
- data/version.rb +1 -1
- metadata +4 -3
data/CHANGELOG.md
CHANGED
data/lib/osm.rb
CHANGED
@@ -14,7 +14,15 @@ module Osm
|
|
14
14
|
class Forbidden < Osm::Error; end
|
15
15
|
class ArgumentIsInvalid < ArgumentError; end
|
16
16
|
class ObjectIsInvalid < Error; end
|
17
|
-
class Osm::Error::NoCurrentTerm < Osm::Error
|
17
|
+
class Osm::Error::NoCurrentTerm < Osm::Error
|
18
|
+
# @!attribute [r] section_id
|
19
|
+
# @return [Fixnum] the id of the section causing the error
|
20
|
+
attr_reader :section_id
|
21
|
+
def initialize(message = nil, section_id = nil)
|
22
|
+
super(message)
|
23
|
+
@section_id = section_id
|
24
|
+
end
|
25
|
+
end
|
18
26
|
|
19
27
|
private
|
20
28
|
# Set constants
|
data/lib/osm/term.rb
CHANGED
@@ -114,7 +114,7 @@ module Osm
|
|
114
114
|
return term if term.current?
|
115
115
|
end
|
116
116
|
|
117
|
-
raise Osm::Error::NoCurrentTerm
|
117
|
+
raise Osm::Error::NoCurrentTerm.new('There is no current term for the section.', section_id)
|
118
118
|
end
|
119
119
|
|
120
120
|
# Create a term in OSM
|
data/osm.gemspec
CHANGED
data/spec/osm/term_spec.rb
CHANGED
@@ -190,8 +190,12 @@ describe "Term" do
|
|
190
190
|
body += '{"termid":"1","name":"Term 1","sectionid":"9","startdate":"' + (Date.today + 31).strftime('%Y-%m-%d') + '","enddate":"' + (Date.today + 90).strftime('%Y-%m-%d') + '"}'
|
191
191
|
body += ']}'
|
192
192
|
FakeWeb.register_uri(:post, "https://www.onlinescoutmanager.co.uk/api.php?action=getTerms", :body => body)
|
193
|
-
|
194
|
-
expect{ Osm::Term.get_current_term_for_section(@api, 9) }.to raise_error
|
193
|
+
|
194
|
+
expect{ Osm::Term.get_current_term_for_section(@api, 9) }.to raise_error do |error|
|
195
|
+
error.should be_a(Osm::Error::NoCurrentTerm)
|
196
|
+
error.message.should == 'There is no current term for the section.'
|
197
|
+
error.section_id.should == 9
|
198
|
+
end
|
195
199
|
end
|
196
200
|
end
|
197
201
|
|
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: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-09-
|
12
|
+
date: 2013-09-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -232,7 +232,8 @@ files:
|
|
232
232
|
- spec/spec_helper.rb
|
233
233
|
- version.rb
|
234
234
|
homepage: https://github.com/robertgauld/osm
|
235
|
-
licenses:
|
235
|
+
licenses:
|
236
|
+
- BSD 3 clause
|
236
237
|
post_install_message:
|
237
238
|
rdoc_options: []
|
238
239
|
require_paths:
|