osm 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Guardfile +1 -1
- data/lib/osm/member.rb +7 -4
- data/osm.gemspec +1 -1
- data/spec/osm/member_spec.rb +44 -20
- data/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67e1f0345412482f0042df2e2c01cfcfcf3b4898
|
4
|
+
data.tar.gz: bc3cdb62a5cc7f084c4c47d299ea075a6651456f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 439ce355dcb274fca820926190d6cb82d2f32296ceeb038784e10ed674db4661ce0fff618f99ad108bacdd30e31ce6ed65e1dd47737ac77fcd625284482e7dda
|
7
|
+
data.tar.gz: 68a847aea26f457ce6625e40d6acbd11256a3291b1447fc00735cfc6927e14d675343939cfd0d2e36fe2c0ed2d39047df33ec664e18797c7ba27072bbb4e253c
|
data/CHANGELOG.md
CHANGED
data/Guardfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# A sample Guardfile
|
2
2
|
# More info at https://github.com/guard/guard#readme
|
3
3
|
|
4
|
-
guard 'rspec', all_on_start: true, all_after_pass: true do
|
4
|
+
guard 'rspec', all_on_start: true, all_after_pass: true, cmd: 'bundle exec rspec' do
|
5
5
|
watch(%r{^spec/.+_spec\.rb$})
|
6
6
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
7
7
|
watch(%r{^lib/([^/]+)/(.+)\.rb$}) { |m| "spec/#{m[1]}/#{m[2]}_spec.rb" }
|
data/lib/osm/member.rb
CHANGED
@@ -452,13 +452,16 @@ module Osm
|
|
452
452
|
end
|
453
453
|
|
454
454
|
# Check if this is a current member of the section they were retrieved for
|
455
|
-
# @param [Date]
|
456
|
-
# @return
|
455
|
+
# @param date [Date] The date to check membership status for
|
456
|
+
# @return true, false
|
457
457
|
def current?(date=Date.today)
|
458
|
+
return nil if started_section.nil? and finished_section.nil?
|
458
459
|
if finished_section.nil?
|
459
|
-
|
460
|
+
started_section <= date
|
461
|
+
elsif started_section.nil?
|
462
|
+
finished_section >= date
|
460
463
|
else
|
461
|
-
|
464
|
+
(started_section <= date) && (finished_section >= date)
|
462
465
|
end
|
463
466
|
end
|
464
467
|
|
data/osm.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
|
22
22
|
s.add_runtime_dependency 'activesupport', '>= 3.2', '< 5' # Used to parse JSON from OSM
|
23
|
-
s.add_runtime_dependency 'httparty', '~> 0.
|
23
|
+
s.add_runtime_dependency 'httparty', '~> 0.10' # Used to make web requests to the API
|
24
24
|
s.add_runtime_dependency 'active_attr', '~> 0.8'
|
25
25
|
s.add_runtime_dependency 'activemodel', '>= 3.2', '< 5'
|
26
26
|
s.add_runtime_dependency 'dirty_hashy', '~> 0.2.1' # Used to track changed data in Badge::Data and FlexiRecord::Data
|
data/spec/osm/member_spec.rb
CHANGED
@@ -112,28 +112,52 @@ describe "Member" do
|
|
112
112
|
end
|
113
113
|
|
114
114
|
|
115
|
-
describe
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
115
|
+
describe 'Tells if the member is currently in the section' do
|
116
|
+
context 'Using the current date' do
|
117
|
+
it 'Has a started_section and a finished_section date' do
|
118
|
+
expect(Osm::Member.new(started_section: Date.yesterday, finished_section: Date.yesterday).current?).to eq(false)
|
119
|
+
expect(Osm::Member.new(started_section: Date.yesterday, finished_section: Date.today).current?).to eq(true)
|
120
|
+
expect(Osm::Member.new(started_section: Date.yesterday, finished_section: Date.tomorrow).current?).to eq(true)
|
121
|
+
end
|
122
|
+
it 'Only has a started_section date' do
|
123
|
+
expect(Osm::Member.new(started_section: Date.yesterday).current?).to eq(true)
|
124
|
+
expect(Osm::Member.new(started_section: Date.today).current?).to eq(true)
|
125
|
+
expect(Osm::Member.new(started_section: Date.tomorrow).current?).to eq(false)
|
126
|
+
end
|
127
|
+
it 'Only has a finished_section date' do
|
128
|
+
expect(Osm::Member.new(finished_section: Date.yesterday).current?).to eq(false)
|
129
|
+
expect(Osm::Member.new(finished_section: Date.today).current?).to eq(true)
|
130
|
+
expect(Osm::Member.new(finished_section: Date.tomorrow).current?).to eq(true)
|
131
|
+
end
|
132
|
+
it 'Has neither a started_section or finished_section date' do
|
133
|
+
expect(Osm::Member.new().current?).to be_nil
|
134
|
+
end
|
123
135
|
end
|
124
136
|
|
125
|
-
|
126
|
-
yesterday
|
127
|
-
today
|
128
|
-
tomorrow
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
+
context 'Using another date' do
|
138
|
+
let(:yesterday) { Date.new(2014, 10, 15) }
|
139
|
+
let(:today) { Date.new(2014, 10, 16) }
|
140
|
+
let(:tomorrow) { Date.new(2014, 10, 17) }
|
141
|
+
it 'Has a started_section and a finished_section date' do
|
142
|
+
expect(Osm::Member.new(started_section: yesterday, finished_section: yesterday).current?(today)).to eq(false)
|
143
|
+
expect(Osm::Member.new(started_section: yesterday, finished_section: today).current?(today)).to eq(true)
|
144
|
+
expect(Osm::Member.new(started_section: yesterday, finished_section: tomorrow).current?(today)).to eq(true)
|
145
|
+
end
|
146
|
+
it 'Only has a started_section date' do
|
147
|
+
expect(Osm::Member.new(started_section: yesterday).current?(today)).to eq(true)
|
148
|
+
expect(Osm::Member.new(started_section: today).current?(today)).to eq(true)
|
149
|
+
expect(Osm::Member.new(started_section: tomorrow).current?(today)).to eq(false)
|
150
|
+
end
|
151
|
+
it 'Only has a finished_section date' do
|
152
|
+
expect(Osm::Member.new(finished_section: yesterday).current?(today)).to eq(false)
|
153
|
+
expect(Osm::Member.new(finished_section: today).current?(today)).to eq(true)
|
154
|
+
expect(Osm::Member.new(finished_section: tomorrow).current?(today)).to eq(true)
|
155
|
+
end
|
156
|
+
it 'Has neither a started_section or finished_section date' do
|
157
|
+
expect(Osm::Member.new().current?(today)).to be_nil
|
158
|
+
end
|
159
|
+
end # context Using another date
|
160
|
+
end # describe Tells if the member is currently in the section
|
137
161
|
|
138
162
|
|
139
163
|
it "Sorts by section_id, grouping_id, grouping_leader (descending), last_name then first_name" do
|
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.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Gauld
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0.
|
39
|
+
version: '0.10'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '0.
|
46
|
+
version: '0.10'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: active_attr
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -307,7 +307,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
307
307
|
version: '0'
|
308
308
|
requirements: []
|
309
309
|
rubyforge_project: osm
|
310
|
-
rubygems_version: 2.
|
310
|
+
rubygems_version: 2.6.13
|
311
311
|
signing_key:
|
312
312
|
specification_version: 4
|
313
313
|
summary: Use the Online Scout Manager API
|