osm 0.4.0 → 0.4.1
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 +4 -4
- data/lib/osm.rb +7 -1
- data/lib/osm/event.rb +3 -1
- data/spec/osm/event_spec.rb +40 -0
- data/version.rb +1 -1
- metadata +73 -23
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/osm.png)](http://badge.fury.io/rb/osm)
|
2
|
+
[![Dependency Status](https://gemnasium.com/robertgauld/osm.png)](https://gemnasium.com/robertgauld/osm)
|
3
|
+
|
4
|
+
|
1
5
|
##Build State
|
2
6
|
This project uses continuous integration to help ensure that a quality product is delivered.
|
3
7
|
Travis CI monitors two branches (versions) of the code - Master (which is what gets released)
|
@@ -7,10 +11,6 @@ Master [![Build Status](https://secure.travis-ci.org/robertgauld/osm.png?branch=
|
|
7
11
|
|
8
12
|
Staging [![Build Status](https://secure.travis-ci.org/robertgauld/osm.png?branch=staging)](http://travis-ci.org/robertgauld/osm)
|
9
13
|
|
10
|
-
This project also uses gemnasium to help ensure that the current version of libraries are being used.
|
11
|
-
|
12
|
-
Master [![Dependency Status](https://gemnasium.com/robertgauld/osm.png)](https://gemnasium.com/robertgauld/osm)
|
13
|
-
|
14
14
|
|
15
15
|
## OSM
|
16
16
|
|
data/lib/osm.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# Require gems
|
1
2
|
require 'active_attr'
|
2
3
|
require 'active_support'
|
3
4
|
require 'active_model'
|
@@ -7,6 +8,7 @@ require 'dirty_hashy'
|
|
7
8
|
|
8
9
|
|
9
10
|
module Osm
|
11
|
+
# Declare exceptions
|
10
12
|
class Error < Exception; end
|
11
13
|
class ConnectionError < Error; end
|
12
14
|
class Forbidden < Error; end
|
@@ -14,6 +16,7 @@ module Osm
|
|
14
16
|
class ObjectIsInvalid < Error; end
|
15
17
|
|
16
18
|
private
|
19
|
+
# Set constants
|
17
20
|
OSM_EPOCH = '1970-01-01'
|
18
21
|
OSM_EPOCH_HUMAN = '1970-01-01'
|
19
22
|
OSM_DATE_FORMAT = '%Y-%m-%d'
|
@@ -25,9 +28,12 @@ module Osm
|
|
25
28
|
OSM_DATE_REGEX = /\A(?:\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1]))|(?:(?:0?[1-9]|[1-2][0-9]|3[0-1])\/(?:0?[1-9]|1[0-2])\/\d{2}|\d{4})\Z/
|
26
29
|
end
|
27
30
|
|
31
|
+
# Require file for this gem
|
28
32
|
require File.join(File.dirname(__FILE__), '..', 'version')
|
29
33
|
Dir[File.join(File.dirname(__FILE__) , '*_validator.rb')].each {|file| require file }
|
30
|
-
|
34
|
+
['model', 'flexi_record'].each do |file| # These must be included before the rest
|
35
|
+
require File.join(File.dirname(__FILE__), 'osm', file)
|
36
|
+
end
|
31
37
|
Dir[File.join(File.dirname(__FILE__) , 'osm', '*.rb')].each {|file| require file }
|
32
38
|
|
33
39
|
|
data/lib/osm/event.rb
CHANGED
@@ -373,7 +373,9 @@ module Osm
|
|
373
373
|
)
|
374
374
|
|
375
375
|
columns = []
|
376
|
-
ActiveSupport::JSON.decode(event_data['config']
|
376
|
+
column_data = ActiveSupport::JSON.decode(event_data['config'] || '[]')
|
377
|
+
column_data = [] unless column_data.is_a?(Array)
|
378
|
+
column_data.each do |field|
|
377
379
|
columns.push Column.new(:id => field['id'], :name => field['name'], :label => field['pL'], :event => event)
|
378
380
|
end
|
379
381
|
event.columns = columns
|
data/spec/osm/event_spec.rb
CHANGED
@@ -732,11 +732,51 @@ describe "Event" do
|
|
732
732
|
|
733
733
|
|
734
734
|
describe "API Strangeness" do
|
735
|
+
|
735
736
|
it "handles a non existant array when no events" do
|
736
737
|
data = '{"identifier":"eventid","label":"name"}'
|
737
738
|
FakeWeb.register_uri(:post, "https://www.onlinescoutmanager.co.uk/events.php?action=getEvents§ionid=1&showArchived=true", :body => data)
|
738
739
|
events = Osm::Event.get_for_section(@api, 1).should == []
|
739
740
|
end
|
741
|
+
|
742
|
+
it "handles missing config from OSM" do
|
743
|
+
events_body = '{"identifier":"eventid","label":"name","items":[{"eventid":"2","name":"An Event","startdate":"2001-02-03","enddate":"2001-02-05","starttime":"00:00:00","endtime":"12:00:00","cost":"0.00","location":"Somewhere","notes":"Notes","sectionid":1,"googlecalendar":null,"archived":"0","confdate":null,"allowchanges":"1","disablereminders":"1","attendancelimit":"3","limitincludesleaders":"1"}]}'
|
744
|
+
|
745
|
+
event_body = {
|
746
|
+
'eventid' => '2',
|
747
|
+
'name' => 'An Event',
|
748
|
+
'startdate' => '2001-01-02',
|
749
|
+
'enddate' => '2001-02-05',
|
750
|
+
'starttime' => '00:00:00',
|
751
|
+
'endtime' => '12:00:00',
|
752
|
+
'cost' => '0.00',
|
753
|
+
'location' => 'Somewhere',
|
754
|
+
'notes' => 'Notes',
|
755
|
+
'notepad' => 'notepad',
|
756
|
+
'publicnotes' => 'public notepad',
|
757
|
+
'sectionid' => '1',
|
758
|
+
'googlecalendar' => nil,
|
759
|
+
'archived' => '0',
|
760
|
+
'confdate' => '2002-01-02',
|
761
|
+
'allowchanges' => '1',
|
762
|
+
'disablereminders' => '1',
|
763
|
+
'pnnotepad' => '',
|
764
|
+
'structure' => [],
|
765
|
+
'attendancelimit' => '3',
|
766
|
+
'limitincludesleaders' => '1',
|
767
|
+
}
|
768
|
+
|
769
|
+
FakeWeb.register_uri(:post, "https://www.onlinescoutmanager.co.uk/events.php?action=getEvents§ionid=1&showArchived=true", :body => events_body)
|
770
|
+
FakeWeb.register_uri(:post, "https://www.onlinescoutmanager.co.uk/events.php?action=getEvent§ionid=1&eventid=2", :body => event_body.to_json)
|
771
|
+
|
772
|
+
Osm::Model.stub(:get_user_permissions) { {:events => [:read, :write]} }
|
773
|
+
|
774
|
+
event = Osm::Event.get(@api, 1, 2)
|
775
|
+
event.should_not be_nil
|
776
|
+
event.id.should == 2
|
777
|
+
event.columns.should == []
|
778
|
+
end
|
779
|
+
|
740
780
|
end
|
741
781
|
|
742
782
|
end
|
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.4.
|
4
|
+
version: 0.4.1
|
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-03-
|
12
|
+
date: 2013-03-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '3.2'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.2'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: httparty
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0.9'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0.9'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: active_attr
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ~>
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: '0.6'
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.6'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: activemodel
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ~>
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: '3.2'
|
55
70
|
type: :runtime
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '3.2'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: dirty_hashy
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ~>
|
@@ -65,10 +85,15 @@ dependencies:
|
|
65
85
|
version: 0.2.1
|
66
86
|
type: :runtime
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.2.1
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: rake
|
71
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
99
|
- - ~>
|
@@ -76,10 +101,15 @@ dependencies:
|
|
76
101
|
version: '10.0'
|
77
102
|
type: :development
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '10.0'
|
80
110
|
- !ruby/object:Gem::Dependency
|
81
111
|
name: rspec
|
82
|
-
requirement:
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
83
113
|
none: false
|
84
114
|
requirements:
|
85
115
|
- - ~>
|
@@ -87,10 +117,15 @@ dependencies:
|
|
87
117
|
version: '2.11'
|
88
118
|
type: :development
|
89
119
|
prerelease: false
|
90
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '2.11'
|
91
126
|
- !ruby/object:Gem::Dependency
|
92
127
|
name: fakeweb
|
93
|
-
requirement:
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
94
129
|
none: false
|
95
130
|
requirements:
|
96
131
|
- - ~>
|
@@ -98,10 +133,15 @@ dependencies:
|
|
98
133
|
version: '1.3'
|
99
134
|
type: :development
|
100
135
|
prerelease: false
|
101
|
-
version_requirements:
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ~>
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '1.3'
|
102
142
|
- !ruby/object:Gem::Dependency
|
103
143
|
name: guard-rspec
|
104
|
-
requirement:
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
105
145
|
none: false
|
106
146
|
requirements:
|
107
147
|
- - ~>
|
@@ -109,10 +149,15 @@ dependencies:
|
|
109
149
|
version: '2.4'
|
110
150
|
type: :development
|
111
151
|
prerelease: false
|
112
|
-
version_requirements:
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ~>
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '2.4'
|
113
158
|
- !ruby/object:Gem::Dependency
|
114
159
|
name: rb-inotify
|
115
|
-
requirement:
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
116
161
|
none: false
|
117
162
|
requirements:
|
118
163
|
- - ~>
|
@@ -120,7 +165,12 @@ dependencies:
|
|
120
165
|
version: '0.9'
|
121
166
|
type: :development
|
122
167
|
prerelease: false
|
123
|
-
version_requirements:
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ~>
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0.9'
|
124
174
|
description: Use the Online Scout Manager API (https://www.onlinescoutmanager.co.uk)
|
125
175
|
to retrieve and save data.
|
126
176
|
email:
|
@@ -193,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
243
|
version: '0'
|
194
244
|
requirements: []
|
195
245
|
rubyforge_project: osm
|
196
|
-
rubygems_version: 1.8.
|
246
|
+
rubygems_version: 1.8.25
|
197
247
|
signing_key:
|
198
248
|
specification_version: 3
|
199
249
|
summary: Use the Online Scout Manager API
|