osm 1.2.8 → 1.2.9
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -0
- data/CHANGELOG.md +4 -0
- data/lib/osm/badge.rb +6 -1
- data/spec/osm/badge_spec.rb +6 -0
- data/version.rb +1 -1
- metadata +2 -2
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/lib/osm/badge.rb
CHANGED
@@ -9,6 +9,8 @@ module Osm
|
|
9
9
|
# @return [String] a description of the badge
|
10
10
|
# @!attribute [rw] osm_key
|
11
11
|
# @return [String] the key for the badge in OSM
|
12
|
+
# @!attribute [rw] osm_long_key
|
13
|
+
# @return [String] the long key for the badge in osm (used for getting stock)
|
12
14
|
# @!attribute [rw] sections_needed
|
13
15
|
# @return [Fixnum]
|
14
16
|
# @!attribute [rw] total_needed
|
@@ -21,13 +23,14 @@ module Osm
|
|
21
23
|
attribute :name, :type => String
|
22
24
|
attribute :requirement_notes, :type => String
|
23
25
|
attribute :osm_key, :type => String
|
26
|
+
attribute :osm_long_key, :type => String
|
24
27
|
attribute :sections_needed, :type => Integer
|
25
28
|
attribute :total_needed, :type => Integer
|
26
29
|
attribute :needed_from_section, :type => Object
|
27
30
|
attribute :requirements, :type => Object
|
28
31
|
|
29
32
|
if ActiveModel::VERSION::MAJOR < 4
|
30
|
-
attr_accessible :name, :requirement_notes, :osm_key, :sections_needed, :total_needed, :needed_from_section, :requirements
|
33
|
+
attr_accessible :name, :requirement_notes, :osm_key, :osm_long_key, :sections_needed, :total_needed, :needed_from_section, :requirements
|
31
34
|
end
|
32
35
|
|
33
36
|
validates_numericality_of :sections_needed, :only_integer=>true, :greater_than_or_equal_to=>-1
|
@@ -35,6 +38,7 @@ module Osm
|
|
35
38
|
validates_presence_of :name
|
36
39
|
validates_presence_of :requirement_notes
|
37
40
|
validates_presence_of :osm_key
|
41
|
+
validates_presence_of :osm_long_key
|
38
42
|
validates :needed_from_section, :hash => {:key_type => String, :value_type => Fixnum}
|
39
43
|
validates :requirements, :array_of => {:item_type => Osm::Badge::Requirement, :item_valid => true}
|
40
44
|
|
@@ -77,6 +81,7 @@ module Osm
|
|
77
81
|
:name => detail['name'],
|
78
82
|
:requirement_notes => detail['description'],
|
79
83
|
:osm_key => detail['shortname'],
|
84
|
+
:osm_long_key => detail['table'],
|
80
85
|
:sections_needed => config['sectionsneeded'].to_i,
|
81
86
|
:total_needed => config['totalneeded'].to_i,
|
82
87
|
:needed_from_section => (config['sections'] || {}).inject({}) { |h,(k,v)| h[k] = v.to_i; h },
|
data/spec/osm/badge_spec.rb
CHANGED
@@ -8,6 +8,7 @@ describe "Badge" do
|
|
8
8
|
:name => 'name',
|
9
9
|
:requirement_notes => 'notes',
|
10
10
|
:osm_key => 'key',
|
11
|
+
:osm_long_key => 'long_key',
|
11
12
|
:sections_needed => 1,
|
12
13
|
:total_needed => 2,
|
13
14
|
:needed_from_section => {'a' => 1},
|
@@ -17,6 +18,7 @@ describe "Badge" do
|
|
17
18
|
badge.name.should == 'name'
|
18
19
|
badge.requirement_notes.should == 'notes'
|
19
20
|
badge.osm_key.should == 'key'
|
21
|
+
badge.osm_long_key.should == 'long_key'
|
20
22
|
badge.sections_needed.should == 1
|
21
23
|
badge.total_needed.should == 2
|
22
24
|
badge.needed_from_section.should == {'a' => 1}
|
@@ -415,6 +417,7 @@ describe "Badge" do
|
|
415
417
|
badge.name.should == 'b_name'
|
416
418
|
badge.requirement_notes.should == 'b_req_notes'
|
417
419
|
badge.osm_key.should == 'badge'
|
420
|
+
badge.osm_long_key.should == 'table'
|
418
421
|
badge.sections_needed.should == 1
|
419
422
|
badge.total_needed.should == 2
|
420
423
|
badge.needed_from_section.should == {'a' => 1}
|
@@ -437,6 +440,7 @@ describe "Badge" do
|
|
437
440
|
badge.name.should == 'b_name'
|
438
441
|
badge.requirement_notes.should == 'b_req_notes'
|
439
442
|
badge.osm_key.should == 'badge'
|
443
|
+
badge.osm_long_key.should == 'table'
|
440
444
|
badge.sections_needed.should == 1
|
441
445
|
badge.total_needed.should == 2
|
442
446
|
badge.needed_from_section.should == {'a' => 1}
|
@@ -459,6 +463,7 @@ describe "Badge" do
|
|
459
463
|
badge.name.should == 'b_name'
|
460
464
|
badge.requirement_notes.should == 'b_req_notes'
|
461
465
|
badge.osm_key.should == 'badge'
|
466
|
+
badge.osm_long_key.should == 'table'
|
462
467
|
badge.sections_needed.should == 1
|
463
468
|
badge.total_needed.should == 2
|
464
469
|
badge.needed_from_section.should == {'a' => 1}
|
@@ -481,6 +486,7 @@ describe "Badge" do
|
|
481
486
|
badge.name.should == 'b_name'
|
482
487
|
badge.requirement_notes.should == 'b_req_notes'
|
483
488
|
badge.osm_key.should == 'badge'
|
489
|
+
badge.osm_long_key.should == 'table'
|
484
490
|
badge.sections_needed.should == 1
|
485
491
|
badge.total_needed.should == 2
|
486
492
|
badge.needed_from_section.should == {'a' => 1}
|
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: 1.2.
|
4
|
+
version: 1.2.9
|
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: 2014-03-
|
12
|
+
date: 2014-03-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|