osm 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/osm/grouping.rb +2 -1
- data/lib/osm/member.rb +4 -5
- data/spec/osm/grouping_spec.rb +3 -1
- data/spec/osm/member_spec.rb +3 -2
- data/version.rb +1 -1
- metadata +13 -13
data/lib/osm/grouping.rb
CHANGED
@@ -2,7 +2,7 @@ module Osm
|
|
2
2
|
|
3
3
|
class Grouping
|
4
4
|
|
5
|
-
attr_reader :id, :name, :active
|
5
|
+
attr_reader :id, :name, :active, :points
|
6
6
|
|
7
7
|
# Initialize a new Grouping using the hash returned by the API call
|
8
8
|
# @param data the hash of data for the object returned by the API
|
@@ -10,6 +10,7 @@ module Osm
|
|
10
10
|
@id = Osm::to_i_or_nil(data['patrolid'])
|
11
11
|
@name = data['name']
|
12
12
|
@active = (data['active'] == 1)
|
13
|
+
@points = Osm::to_i_or_nil(data['points'])
|
13
14
|
end
|
14
15
|
|
15
16
|
end
|
data/lib/osm/member.rb
CHANGED
@@ -2,13 +2,13 @@ module Osm
|
|
2
2
|
|
3
3
|
class Member
|
4
4
|
|
5
|
-
attr_reader :id, :section_id, :type, :first_name, :last_name, :email1, :email2, :email3, :email4, :phone1, :phone2, :phone3, :phone4, :address, :address2, :date_of_birth, :started, :joined_in_years, :parents, :notes, :medical, :religion, :school, :ethnicity, :subs, :grouping_id, :grouping_leader, :joined, :age, :joined_years
|
5
|
+
attr_reader :id, :section_id, :type, :first_name, :last_name, :email1, :email2, :email3, :email4, :phone1, :phone2, :phone3, :phone4, :address, :address2, :date_of_birth, :started, :joined_in_years, :parents, :notes, :medical, :religion, :school, :ethnicity, :subs, :grouping_id, :grouping_leader, :joined, :age, :joined_years
|
6
6
|
|
7
7
|
# Initialize a new Member using the hash returned by the API call
|
8
8
|
# @param data the hash of data for the object returned by the API
|
9
9
|
def initialize(data)
|
10
10
|
@id = Osm::to_i_or_nil(data['scoutid'])
|
11
|
-
@section_id = Osm::to_i_or_nil(data['
|
11
|
+
@section_id = Osm::to_i_or_nil(data['sectionid0'])
|
12
12
|
@type = data['type']
|
13
13
|
@first_name = data['firstname']
|
14
14
|
@last_name = data['lastname']
|
@@ -32,12 +32,11 @@ module Osm
|
|
32
32
|
@school = data['school']
|
33
33
|
@ethnicity = data['ethnicity']
|
34
34
|
@subs = data['subs']
|
35
|
-
@grouping_id = Osm::to_i_or_nil(data['
|
36
|
-
@grouping_leader = data['
|
35
|
+
@grouping_id = Osm::to_i_or_nil(data['patrolid0'])
|
36
|
+
@grouping_leader = data['patrolleader0'] # 0 - No, 1 = seconder, 2 = sixer
|
37
37
|
@joined = Osm::parse_date(data['joined'])
|
38
38
|
@age = data['age'] # 'yy / mm'
|
39
39
|
@joined_years = data['yrs'].to_i
|
40
|
-
@patrol = data['patrol']
|
41
40
|
end
|
42
41
|
|
43
42
|
# Get the years element of this scout's age
|
data/spec/osm/grouping_spec.rb
CHANGED
@@ -7,13 +7,15 @@ describe "Grouping" do
|
|
7
7
|
data = {
|
8
8
|
'patrolid' => 1,
|
9
9
|
'name' => 'Patrol Name',
|
10
|
-
'active' => 1
|
10
|
+
'active' => 1,
|
11
|
+
'points' => '2',
|
11
12
|
}
|
12
13
|
patrol = Osm::Grouping.new(data)
|
13
14
|
|
14
15
|
patrol.id.should == 1
|
15
16
|
patrol.name.should == 'Patrol Name'
|
16
17
|
patrol.active.should == true
|
18
|
+
patrol.points.should == 2
|
17
19
|
end
|
18
20
|
|
19
21
|
end
|
data/spec/osm/member_spec.rb
CHANGED
@@ -6,7 +6,7 @@ describe "Member" do
|
|
6
6
|
it "Create" do
|
7
7
|
data = {
|
8
8
|
'scoutid' => 1,
|
9
|
-
'
|
9
|
+
'sectionid0' => 2,
|
10
10
|
'type' => '',
|
11
11
|
'firstname' => 'First',
|
12
12
|
'lastname' => 'Last',
|
@@ -36,6 +36,8 @@ describe "Member" do
|
|
36
36
|
'age' => '06/07',
|
37
37
|
'yrs' => 1,
|
38
38
|
'patrol' => 'Blue',
|
39
|
+
'patrolid0' => '3',
|
40
|
+
'patrolleader0' => 0,
|
39
41
|
}
|
40
42
|
member = Osm::Member.new(data)
|
41
43
|
|
@@ -69,7 +71,6 @@ describe "Member" do
|
|
69
71
|
member.joined.should == Date.new(2006, 1, 7)
|
70
72
|
member.age.should == '06/07'
|
71
73
|
member.joined_years.should == 1
|
72
|
-
member.patrol.should == 'Blue'
|
73
74
|
end
|
74
75
|
|
75
76
|
|
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.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-07-31 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &76964710 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.2.5
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *76964710
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activesupport
|
27
|
-
requirement: &
|
27
|
+
requirement: &76964200 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '3.2'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *76964200
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: httparty
|
38
|
-
requirement: &
|
38
|
+
requirement: &76963780 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *76963780
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rake
|
49
|
-
requirement: &
|
49
|
+
requirement: &76962870 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *76962870
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rspec
|
60
|
-
requirement: &
|
60
|
+
requirement: &76961400 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *76961400
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: fakeweb
|
71
|
-
requirement: &
|
71
|
+
requirement: &76960050 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *76960050
|
80
80
|
description: Use the Online Scout Manager API (https://www.onlinescoutmanager.co.uk)
|
81
81
|
to retrieve and save data.
|
82
82
|
email:
|