osm 1.2.15.dev → 1.2.15.dev.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +3 -0
- data/lib/osm.rb +2 -1
- data/lib/osm/badge.rb +47 -17
- data/lib/osm/badges.rb +1 -1
- data/lib/osm/meeting.rb +23 -4
- data/spec/osm/badge_spec.rb +85 -19
- data/spec/osm/badges_spec.rb +3 -3
- data/spec/osm/meeting_spec.rb +10 -60
- data/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjFmYjY4MTk2NDUyYzEyNDJhNGE1ZTVhOGZhZTBiOWZhOTUwYzM3Zg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmVjMjkwMDUwOWU3NzMzZGZiMmM3ZWI3MmFmYTVlMDA1ZjVlNTBkNw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDI5NzA5NzMxY2FhYmFmZDYxMTAwY2Y0MTBkMTZkYjhkZjUzZTMzYjJjZTU0
|
10
|
+
N2RhOTU1OTViMTFiZGY5YzNjMjE4MWE0ZDFlMzIxZTUwNjE3OTI2YzBiYzll
|
11
|
+
ODZjMmY3MjdkNjIzZDA5MGNmMjQyNTVhMWNhMWZkOTM5ODJhZTg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTczZjNmMDc1M2E3ZGJkYTVmZDJhM2VjYmFhOGVhODk5Y2E0ZWQwM2FlZTYx
|
14
|
+
ZTM0MzJhMDZlY2VlZjM1ZmYwNzZkNjI1NzNjYmI0ZGRhZjQwZTlkNTUxODQ0
|
15
|
+
YjVlYTU5ZGE3NDg0MTU1NTE4MTAxY2I4YjI1ZDQzMGU0NWRjZmY=
|
data/CHANGELOG.md
CHANGED
@@ -16,6 +16,7 @@
|
|
16
16
|
* id, version, identifier, group\_name, latest, user\_id, levels, sharing attributes added
|
17
17
|
* OSM Changed how completion criteria are retrieved (this gem now uses a special peice of OSM's API just for this purpose) so:
|
18
18
|
* Osm::Badge attributes sections\_needed, total\_needed and needed\_from\_section are gone
|
19
|
+
* New methods modules, module_letters and module_ids
|
19
20
|
* Osm::Badge::Data
|
20
21
|
* mark\_awarded method now only marks as awarded (the optional mark\_as parameter is gone)
|
21
22
|
* mark\_not\_awarded method added
|
@@ -29,6 +30,8 @@
|
|
29
30
|
* Attributes untouched: badge\_type, badge\_section, data, requirement\_label
|
30
31
|
* Osm::Activity::Badge attributes now match Osm::Event::BadgeLink
|
31
32
|
* Osm::Meeting::BadgeLink attributes now match Osm::Event::badgeLink
|
33
|
+
* Osm::Badges.get_badge_stock returns a Hash, keys are now "#{badge_id}_#{level}"
|
34
|
+
* Osm::Badge::Data instance method requirement_met?(field_id) method made public
|
32
35
|
|
33
36
|
## Version 1.2.14
|
34
37
|
|
data/lib/osm.rb
CHANGED
@@ -34,7 +34,8 @@ module Osm
|
|
34
34
|
OSM_DATE_FORMAT_HUMAN = '%d/%m/%Y'
|
35
35
|
OSM_DATETIME_FORMAT_HUMAN = '%d/%m/%Y %H:%M:%S'
|
36
36
|
OSM_TIME_REGEX = /\A(?:[0-1][0-9]|2[0-3]):[0-5][0-9]\Z/
|
37
|
-
|
37
|
+
OSM_DATE_REGEX_UNANCHORED = /(?:[1-9]\d{3}-(?: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}|[1-9]\d{3}))/
|
38
|
+
OSM_DATE_REGEX = /\A#{Osm::OSM_DATE_REGEX_UNANCHORED.to_s}\Z/
|
38
39
|
SUBSCRIPTION_LEVEL_NAMES = ['Unknown', 'Bronze', 'Silver', 'Gold', 'Gold+']
|
39
40
|
SUBSCRIPTION_LEVELS = [nil, :bronze, :silver, :gold, :gold_plus]
|
40
41
|
end
|
data/lib/osm/badge.rb
CHANGED
@@ -170,14 +170,29 @@ module Osm
|
|
170
170
|
badge_data = Hash[item.to_a.select{ |k,v| !!k.match(/\d+_\d+/) }]
|
171
171
|
badge_data.each do |badge_identifier, status|
|
172
172
|
if status.is_a?(String)
|
173
|
-
# Possible statuses:
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
173
|
+
# Possible statuses:
|
174
|
+
# 'Started',
|
175
|
+
# 'Due', 'Due Lvl 2'
|
176
|
+
# 'Awarded', 'Awarded Lvl 2', '01/02/2003', '02/03/2004 (Lvl 2)'
|
177
|
+
if status.eql?('Started')
|
178
|
+
new_item[badge_identifier] = :started
|
179
|
+
elsif status.eql?('Due')
|
180
|
+
new_item[badge_identifier] = :due
|
181
|
+
elsif match_data = status.match(/\ADue Lvl (\d+)\Z/)
|
182
|
+
new_item[badge_identifier] = :due
|
183
|
+
new_item["#{badge_identifier}_level"] = match_data[1].to_i
|
184
|
+
elsif status.eql?('Awarded')
|
185
|
+
new_item[badge_identifier] = :awarded
|
186
|
+
elsif match_data = status.match(/\AAwarded Lvl (\d+)\Z/)
|
187
|
+
new_item[badge_identifier] = :awarded
|
188
|
+
new_item["#{badge_identifier}_level"] = match_data[1].to_i
|
189
|
+
elsif match_data = status.match(Osm::OSM_DATE_REGEX)
|
190
|
+
new_item[badge_identifier] = :awarded
|
191
|
+
new_item["#{badge_identifier}_date"] = Osm.parse_date(match_data[0])
|
192
|
+
elsif match_data = status.match(/\A(#{Osm::OSM_DATE_REGEX_UNANCHORED.to_s}) \(Lvl (\d+)\)\Z/)
|
193
|
+
new_item[badge_identifier] = :awarded
|
194
|
+
new_item["#{badge_identifier}_date"] = Osm.parse_date(match_data[1])
|
195
|
+
new_item["#{badge_identifier}_level"] = match_data[2].to_i
|
181
196
|
end
|
182
197
|
end
|
183
198
|
end
|
@@ -246,6 +261,18 @@ module Osm
|
|
246
261
|
}.flatten].except('z')
|
247
262
|
end
|
248
263
|
|
264
|
+
def module_letters
|
265
|
+
@module_letters ||= completion_criteria[:modules].map{ |m| m[:module_letter] }.sort
|
266
|
+
end
|
267
|
+
|
268
|
+
def module_ids
|
269
|
+
@module_ids ||= completion_criteria[:modules].map{ |m| m[:module_id] }.sort
|
270
|
+
end
|
271
|
+
|
272
|
+
def modules
|
273
|
+
completion_criteria[:modules] || []
|
274
|
+
end
|
275
|
+
|
249
276
|
|
250
277
|
# Compare Badge based on name then id then version (desc)
|
251
278
|
def <=>(another)
|
@@ -443,8 +470,8 @@ module Osm
|
|
443
470
|
# @return [Fixnum] the total number of requirements considered gained
|
444
471
|
def total_gained
|
445
472
|
count = 0
|
446
|
-
requirements.each do |
|
447
|
-
next unless requirement_met?(
|
473
|
+
badge.requirements.each do |requirement|
|
474
|
+
next unless requirement_met?(requirement.field)
|
448
475
|
count += 1
|
449
476
|
end
|
450
477
|
return count
|
@@ -472,7 +499,7 @@ module Osm
|
|
472
499
|
count = {}
|
473
500
|
badge.requirements.each do |requirement|
|
474
501
|
count[requirement.module_letter] ||= 0
|
475
|
-
next unless requirement_met?(
|
502
|
+
next unless requirement_met?(requirement.field)
|
476
503
|
count[requirement.module_letter] += 1
|
477
504
|
end
|
478
505
|
Hash[*count.map{ |k,v| [badge.module_map[k], v, k, v] }.flatten]
|
@@ -549,7 +576,7 @@ module Osm
|
|
549
576
|
end
|
550
577
|
return false if due?
|
551
578
|
requirements.each do |key, value|
|
552
|
-
return true if requirement_met?(
|
579
|
+
return true if requirement_met?(key)
|
553
580
|
end
|
554
581
|
return false
|
555
582
|
end
|
@@ -581,7 +608,7 @@ module Osm
|
|
581
608
|
((due + 1)..top_level).reverse_each do |level|
|
582
609
|
badge.requirements.each do |requirement|
|
583
610
|
next unless requirement.module_letter.eql?(letters[level - 1]) # Not interested in other levels
|
584
|
-
return level if requirement_met?(
|
611
|
+
return level if requirement_met?(requirement.field)
|
585
612
|
end
|
586
613
|
end
|
587
614
|
return 0 # No levels started
|
@@ -726,10 +753,13 @@ module Osm
|
|
726
753
|
Osm.inspect_instance(self, options={:replace_with => {'badge' => :name}})
|
727
754
|
end
|
728
755
|
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
756
|
+
# Work out if the requirmeent has been met
|
757
|
+
# @param [Fixnum, #to_i] field_id The id of the field to evaluate (e.g. "12", "xSomething", "Yes" or "")
|
758
|
+
# @return [Boolean] whether the requirmeent has been met
|
759
|
+
def requirement_met?(field_id)
|
760
|
+
data = requirements[field_id.to_i].to_s
|
761
|
+
return false if data == '0'
|
762
|
+
!(data.blank? || data[0].downcase.eql?('x'))
|
733
763
|
end
|
734
764
|
|
735
765
|
end # Class Data
|
data/lib/osm/badges.rb
CHANGED
@@ -19,7 +19,7 @@ module Osm
|
|
19
19
|
|
20
20
|
data = api.perform_query("ext/badges/stock/?action=getBadgeStock§ion=#{section.type}§ion_id=#{section.id}&term_id=#{term_id}")
|
21
21
|
data = (data['items'] || [])
|
22
|
-
data.map!{ |i| [i['
|
22
|
+
data.map!{ |i| [i['badge_id_level'], i['stock']] }
|
23
23
|
data = Hash[data]
|
24
24
|
|
25
25
|
Osm::Model.cache_write(api, cache_key, data)
|
data/lib/osm/meeting.rb
CHANGED
@@ -283,12 +283,31 @@ module Osm
|
|
283
283
|
else
|
284
284
|
# We'll have to iterate through the activities
|
285
285
|
require_ability_to(api, :read, :programme, section_id, options)
|
286
|
-
|
286
|
+
|
287
|
+
links = badge_links
|
287
288
|
activities.each do |activity|
|
288
289
|
activity = Osm::Activity.get(api, activity.activity_id, nil, options)
|
289
|
-
activity.badges
|
290
|
-
|
291
|
-
|
290
|
+
links += activity.badges
|
291
|
+
end
|
292
|
+
|
293
|
+
badges = []
|
294
|
+
links.each do |badge|
|
295
|
+
badges.push({
|
296
|
+
"badge" => nil,#"activity_animalcarer",
|
297
|
+
"badge_id" => badge.badge_id,
|
298
|
+
"badge_version" => badge.badge_version,
|
299
|
+
"column_id" => badge.requirement_id,
|
300
|
+
"badgeName" => badge.badge_name,
|
301
|
+
"badgetype" => badge.badge_type,
|
302
|
+
"columngroup" => nil,#"A",
|
303
|
+
"columnname" => nil,#"a",
|
304
|
+
"data" => badge.data,
|
305
|
+
"eveningid" => id,
|
306
|
+
"meetingdate" => date,
|
307
|
+
"name" => badge.requirement_label,
|
308
|
+
"section" => badge.badge_section,
|
309
|
+
"sectionid" => section_id
|
310
|
+
})
|
292
311
|
end
|
293
312
|
end
|
294
313
|
|
data/spec/osm/badge_spec.rb
CHANGED
@@ -64,6 +64,38 @@ describe "Badge" do
|
|
64
64
|
requirement.valid?.should be_true
|
65
65
|
end
|
66
66
|
|
67
|
+
it "Produces a map of module letter <-> module id" do
|
68
|
+
badge = Osm::Badge.new(completion_criteria:{ modules: [
|
69
|
+
{module_id: 2, module_letter: 'c'},
|
70
|
+
{module_id: 10, module_letter: 'b'},
|
71
|
+
{module_id: 1, module_letter: 'a'}
|
72
|
+
]})
|
73
|
+
|
74
|
+
badge.module_map.should == {1=>'a', 10=>'b', 2=>'c', 'a'=>1, 'b'=>10, 'c'=>2}
|
75
|
+
end
|
76
|
+
|
77
|
+
it "Gets the number of requirements needed per module" do
|
78
|
+
badge = Osm::Badge.new(completion_criteria:{ modules: [
|
79
|
+
{module_id: 2, module_letter: 'c', min_required: 5},
|
80
|
+
{module_id: 10, module_letter: 'b', min_required: 4},
|
81
|
+
{module_id: 1, module_letter: 'a', min_required: 3}
|
82
|
+
]})
|
83
|
+
|
84
|
+
badge.needed_per_module.should == {'a'=>3, 'b'=>4, 'c'=>5, 2=>5, 10=>4, 1=>3}
|
85
|
+
end
|
86
|
+
|
87
|
+
it "Produces a list of modules" do
|
88
|
+
badge = Osm::Badge.new(completion_criteria:{ modules: [
|
89
|
+
{module_id: 2, module_letter: 'c'},
|
90
|
+
{module_id: 10, module_letter: 'b'},
|
91
|
+
{module_id: 1, module_letter: 'a'}
|
92
|
+
]})
|
93
|
+
|
94
|
+
badge.module_letters.should == ['a', 'b', 'c']
|
95
|
+
badge.module_ids.should == [1, 2, 10]
|
96
|
+
end
|
97
|
+
|
98
|
+
|
67
99
|
it "Create Data" do
|
68
100
|
data = Osm::Badge::Data.new(
|
69
101
|
:member_id => 1,
|
@@ -117,18 +149,43 @@ describe "Badge" do
|
|
117
149
|
end
|
118
150
|
|
119
151
|
|
152
|
+
it "Works out if a requirement has been met" do
|
153
|
+
data = Osm::Badge::Data.new(requirements: {1 => ''}).requirement_met?(1).should be_false
|
154
|
+
data = Osm::Badge::Data.new(requirements: {1 => 'xStuff'}).requirement_met?(1).should be_false
|
155
|
+
data = Osm::Badge::Data.new(requirements: {1 => '0'}).requirement_met?(1).should be_false
|
156
|
+
data = Osm::Badge::Data.new(requirements: {1 => 0}).requirement_met?(1).should be_false
|
157
|
+
data = Osm::Badge::Data.new(requirements: {}).requirement_met?(1).should be_false
|
158
|
+
data = Osm::Badge::Data.new(requirements: {1 => 'Stuff'}).requirement_met?(1).should be_true
|
159
|
+
data = Osm::Badge::Data.new(requirements: {1 => '1'}).requirement_met?(1).should be_true
|
160
|
+
data = Osm::Badge::Data.new(requirements: {1 => 1}).requirement_met?(1).should be_true
|
161
|
+
end
|
162
|
+
|
163
|
+
|
120
164
|
it "Get total requirements gained for a member" do
|
121
165
|
data = Osm::Badge::Data.new(
|
166
|
+
:badge => Osm::Badge.new(
|
167
|
+
:requirements => [
|
168
|
+
Osm::Badge::Requirement.new(field: 1),
|
169
|
+
Osm::Badge::Requirement.new(field: 2),
|
170
|
+
Osm::Badge::Requirement.new(field: 3),
|
171
|
+
Osm::Badge::Requirement.new(field: 4),
|
172
|
+
Osm::Badge::Requirement.new(field: 5),
|
173
|
+
Osm::Badge::Requirement.new(field: 6),
|
174
|
+
Osm::Badge::Requirement.new(field: 7),
|
175
|
+
Osm::Badge::Requirement.new(field: 8),
|
176
|
+
Osm::Badge::Requirement.new(field: 9),
|
177
|
+
]
|
178
|
+
),
|
122
179
|
:requirements => {
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
180
|
+
1 => 'a',
|
181
|
+
2 => 'yes',
|
182
|
+
3 => '2000-01-02',
|
183
|
+
4 => 1,
|
184
|
+
5 => 'x',
|
185
|
+
6 => 'xYES',
|
186
|
+
7 => '',
|
187
|
+
8 => nil,
|
188
|
+
9 => 0,
|
132
189
|
}
|
133
190
|
)
|
134
191
|
data.total_gained.should == 4
|
@@ -789,13 +846,15 @@ describe "Badge" do
|
|
789
846
|
'firstname' => 'First',
|
790
847
|
'lastname' => 'Last',
|
791
848
|
'scout_id' => 1,
|
792
|
-
'
|
793
|
-
'
|
794
|
-
'
|
795
|
-
'
|
796
|
-
'
|
797
|
-
'
|
798
|
-
'
|
849
|
+
'90_0' => nil,
|
850
|
+
'91_0' => '',
|
851
|
+
'92_0' => 'Started',
|
852
|
+
'93_0' => 'Due',
|
853
|
+
'94_0' => 'Due Lvl 3',
|
854
|
+
'95_0' => 'Awarded',
|
855
|
+
'96_0' => 'Awarded Lvl 2',
|
856
|
+
'97_0' => '01/02/2003',
|
857
|
+
'98_0' => '02/03/2004 (Lvl 1)',
|
799
858
|
}
|
800
859
|
]
|
801
860
|
}
|
@@ -809,11 +868,18 @@ describe "Badge" do
|
|
809
868
|
:last_name => 'Last',
|
810
869
|
:name => 'First Last',
|
811
870
|
:member_id => 1,
|
812
|
-
'
|
813
|
-
'
|
871
|
+
'92_0' => :started,
|
872
|
+
'93_0' => :due,
|
873
|
+
'94_0' => :due,
|
874
|
+
'94_0_level' => 3,
|
875
|
+
'95_0' => :awarded,
|
814
876
|
'96_0' => :awarded,
|
877
|
+
'96_0_level' => 2,
|
815
878
|
'97_0' => :awarded,
|
816
|
-
'
|
879
|
+
'97_0_date' => Date.new(2003, 2, 1),
|
880
|
+
'98_0' => :awarded,
|
881
|
+
'98_0_date' => Date.new(2004, 3, 2),
|
882
|
+
'98_0_level' => 1,
|
817
883
|
}
|
818
884
|
end
|
819
885
|
|
data/spec/osm/badges_spec.rb
CHANGED
@@ -109,15 +109,15 @@ describe "Badges" do
|
|
109
109
|
badges_body = {
|
110
110
|
'identifier' => 'badge_id_level',
|
111
111
|
'items' => [
|
112
|
-
{ 'shortname' => 'badge_1', 'stock' => 1, 'desired' => 0, 'due' => 0 },
|
113
|
-
{ 'shortname' => 'badge_2', 'stock' => 2, 'desired' => 0, 'due' => 0 },
|
112
|
+
{ 'shortname' => 'badge_1', 'stock' => 1, 'desired' => 0, 'due' => 0, 'badge_id_level' => '100_1' },
|
113
|
+
{ 'shortname' => 'badge_2', 'stock' => 2, 'desired' => 0, 'due' => 0, 'badge_id_level' => '200_2' },
|
114
114
|
]
|
115
115
|
}
|
116
116
|
FakeWeb.register_uri(:post, "https://www.onlinescoutmanager.co.uk/ext/badges/stock/?action=getBadgeStock§ion=beavers§ion_id=1&term_id=2", :body => badges_body.to_json, :content_type => 'application/json')
|
117
117
|
Osm::Term.stub(:get_current_term_for_section) { Osm::Term.new(:id => 2) }
|
118
118
|
|
119
119
|
section = Osm::Section.new(:id => 1, :type => :beavers)
|
120
|
-
Osm::Badges.get_stock(@api, section).should == {'
|
120
|
+
Osm::Badges.get_stock(@api, section).should == {'100_1' => 1, '200_2' => 2}
|
121
121
|
end
|
122
122
|
|
123
123
|
describe "Update badge stock levels" do
|
data/spec/osm/meeting_spec.rb
CHANGED
@@ -155,74 +155,24 @@ describe "Meeting" do
|
|
155
155
|
]
|
156
156
|
FakeWeb.register_uri(:post, "https://www.onlinescoutmanager.co.uk/api.php?action=getUserRoles", :body => roles_body.to_json, :content_type => 'application/json')
|
157
157
|
|
158
|
-
|
159
|
-
'
|
160
|
-
|
161
|
-
'version' => '0',
|
162
|
-
'groupid' => '2',
|
163
|
-
'userid' => '3',
|
164
|
-
'title' => 'Activity Name',
|
165
|
-
'description' => 'Description',
|
166
|
-
'resources' => 'Resources',
|
167
|
-
'instructions' => 'Instructions',
|
168
|
-
'runningtime' => '15',
|
169
|
-
'location' => 'indoors',
|
170
|
-
'shared' => '0',
|
171
|
-
'rating' => '4',
|
172
|
-
'facebook' => ''
|
173
|
-
},
|
174
|
-
'editable' => true,
|
175
|
-
'deletable' => false,
|
176
|
-
'used' => 3,
|
177
|
-
'versions' => [
|
178
|
-
{
|
179
|
-
'value' => '0',
|
180
|
-
'userid' => '1',
|
181
|
-
'firstname' => 'Alice',
|
182
|
-
'label' => 'Current version - Alice',
|
183
|
-
'selected' => 'selected'
|
184
|
-
}
|
185
|
-
],
|
186
|
-
'sections' => ['beavers', 'cubs'],
|
187
|
-
'tags' => ['Tag 1', 'Tag2'],
|
188
|
-
'files' => [
|
189
|
-
{
|
190
|
-
'fileid' => '6',
|
191
|
-
'activityid' => '4',
|
192
|
-
'filename' => 'File Name',
|
193
|
-
'name' => 'Name',
|
194
|
-
}
|
195
|
-
],
|
196
|
-
'badges' => [
|
197
|
-
{
|
198
|
-
'badge' => 'activity_firesafety',
|
199
|
-
'badgeLongName' => 'Fire Safety',
|
200
|
-
'badge_id' => '181',
|
201
|
-
'badge_version' => '0',
|
202
|
-
'badgetype' => 'activity',
|
203
|
-
'badgetypeLongName' => 'Activity',
|
204
|
-
'column_id' => '12345',
|
205
|
-
'columnname' => 'b_01',
|
206
|
-
'columnnameLongName' => 'B: Fire drill',
|
207
|
-
'data' => 'Yes',
|
208
|
-
'section' => 'cubs',
|
209
|
-
'sectionLongName' => 'Cubs',
|
210
|
-
}
|
211
|
-
]
|
212
|
-
}
|
213
|
-
|
214
|
-
FakeWeb.register_uri(:post, "https://www.onlinescoutmanager.co.uk/programme.php?action=getActivity&id=4", :body => activity_body.to_json, :content_type => 'application/json')
|
215
|
-
Osm::Activity.stub(:get) { Osm::Activity.new(:badges => [3]) }
|
158
|
+
Osm::Activity.stub(:get) { Osm::Activity.new(:badges => [
|
159
|
+
Osm::Activity::Badge.new(badge_type: :activity, badge_section: :beavers, requirement_label: 'label', data: 'data', badge_name: 'badge', badge_id: 2, badge_version: 0, requirement_id: 200)
|
160
|
+
]) }
|
216
161
|
|
217
162
|
meeting = Osm::Meeting.new(
|
218
163
|
:id => 2,
|
219
164
|
:date => Date.new(2000, 1, 2),
|
220
165
|
:section_id => 3,
|
221
166
|
:activities => [Osm::Meeting::Activity.new(:activity_id => 4)],
|
222
|
-
:badge_links => [
|
167
|
+
:badge_links => [
|
168
|
+
Osm::Activity::Badge.new(badge_type: :activity, badge_section: :beavers, requirement_label: 'label 2', data: 'data 2', badge_name: 'badge 2', badge_id: 4, badge_version: 1, requirement_id: 400)
|
169
|
+
],
|
223
170
|
)
|
224
171
|
|
225
|
-
meeting.get_badge_requirements(@api).should == [
|
172
|
+
meeting.get_badge_requirements(@api).should == [
|
173
|
+
{"badge"=>nil, "badge_id"=>4, "badge_version"=>1, "column_id"=>400, "badgeName"=>"badge 2", "badgetype"=>:activity, "columngroup"=>nil, "columnname"=>nil, "data"=>"data 2", "eveningid"=>2, "meetingdate"=>Date.new(2000, 1, 2), "name"=>"label 2", "section"=>:beavers, "sectionid"=>3},
|
174
|
+
{"badge"=>nil, "badge_id"=>2, "badge_version"=>0, "column_id"=>200, "badgeName"=>"badge", "badgetype"=>:activity, "columngroup"=>nil, "columnname"=>nil, "data"=>"data", "eveningid"=>2, "meetingdate"=>Date.new(2000, 1, 2), "name"=>"label", "section"=>:beavers, "sectionid"=>3}
|
175
|
+
]
|
226
176
|
end
|
227
177
|
|
228
178
|
it "Create a meeting (succeded)" 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.2.15.dev
|
4
|
+
version: 1.2.15.dev.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: 2014-10-
|
11
|
+
date: 2014-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|