osm 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## Version 1.2.1
2
+
3
+ * Add section\_id read-only attribute to Osm::Error::NoCurrentTerm
4
+
1
5
  ## Version 1.2.0
2
6
 
3
7
  * Trying to fetch the currrent Term for a Section which doesn;t have one now raises an Osm::Error::NoCurrentTerm instead of an Osm::Error
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; end
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, 'There is no current term for the section.'
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
@@ -4,6 +4,7 @@ require File.join(File.dirname(__FILE__), 'version')
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "osm"
7
+ s.license = 'BSD 3 clause'
7
8
  s.version = Osm::VERSION
8
9
  s.authors = ['Robert Gauld']
9
10
  s.email = ['robert@robertgauld.co.uk']
@@ -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(Osm::Error::NoCurrentTerm, 'There is no current term for the section.')
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
@@ -1,3 +1,3 @@
1
1
  module Osm
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
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.0
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-02 00:00:00.000000000 Z
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: