osm 1.2.11 → 1.2.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzVhNDE1ZTEwZGVlNDJkNjYzNjFlY2JjMGVmOThlNzExZDc0NWU1NA==
4
+ YTNjYzU0YTc4NDUxYTkwY2JiMmZhY2U3MTkxNDgyZTgwMWYyYmZmNg==
5
5
  data.tar.gz: !binary |-
6
- ZjI1YmNmOTEyMjFkMjJkYzUzZjI1YzUyNTUxYzRlN2E1ZmFlMzY0ZQ==
6
+ ZmE0YTNhOWM3MGRkZmEzNDk4ZmE4MzI2NTQ0M2E5OGU5ODNkNDg2Ng==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZGJhZjk3MDAyZTNhOTg0MjNkMTczMWE0MTc3ZDJlNmU4MDdkM2IyOTM2YTBi
10
- MGIzNDllMDU2MzViNjQzMzcwYzEyN2ZmZmM1NmM4MjVkNmE0ZDZhZGRmY2Q3
11
- MjkxNzE5ZDQwZTZlMzM0ZWU5NTIzZmRmNTA1N2RkZWUxN2JjYjA=
9
+ M2ZhMjBjNjVlYmY2YzY1MjBmZGVkMGQwNmQ1NjMyOGZhZGUyYmU0ODI3ZWU1
10
+ MTEzMmI0MDU0MTU1ODllODRiYWU4MjdjNGQ2MWM3NGQ3Mjk4NTFiYmRkMDU3
11
+ YTU2MTQ5YjM4MzExNDZjZWJmZDU2Y2U2NWJkMzdjOTdmMzgzOWI=
12
12
  data.tar.gz: !binary |-
13
- MzcyMjU0OTczNjc3YmVmNmVjODA4YjI1N2ViZTcwMmU0MTQwYzg1YTMxMjcz
14
- MDJhMjJkOTBlMDBmNTRkOTRkZWI4M2MwOGZiMzBmN2UyMzYzMDM1OTk4MWE3
15
- NjgzNTk3YTg3N2I5YTA4MGI5YmZhYmQxZDYyODA2NmVhNWVjY2I=
13
+ YmMwMjkwNTk2M2M3ZWUxOGMwMTNlNzZjZTAyMGRhZTg3OWVjMTI2NTM2Njlh
14
+ OTk2MDIyNGRjNDlhZWFlZTEwNDQzNjBlNzU1OGFlODcyOWUxODNiNzFjMTA2
15
+ NjY2NDI1ZmRiNjNiNDQ2NzAwMzRkYjI3N2JhNDMzMzBiNDk2YWI=
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## Version 1.2.12
2
+
3
+ * Add leader? method to member (true if member is in the leaders grouping)
4
+ * Add youth? method to member (true if member is in a non-leaders grouping)
5
+ * Adjust Osm::Event::BadgeLink attributes (label becomes requirement\_label, add badge\_label)
6
+
1
7
  ## Version 1.2.11
2
8
 
3
9
  * Fix handling blank event config from OSM (JSON parse error)
data/README.md CHANGED
@@ -176,3 +176,4 @@ See the [Roadmap page in the wiki](https://github.com/robertgauld/osm/wiki/Roadm
176
176
 
177
177
  * MyScout (Everything)
178
178
  * Adult Section Specific Stuff
179
+ * Quartmaster DB
data/lib/osm/event.rb CHANGED
@@ -245,7 +245,7 @@ module Osm
245
245
  'badge' => badge.badge_key,
246
246
  'columnname' => badge.requirement_key,
247
247
  'data' => badge.data,
248
- 'newcolumnname' => badge.label,
248
+ 'newcolumnname' => badge.requirement_label,
249
249
  })
250
250
  badges_created = false unless badge_data.is_a?(Hash) && badge_data['ok']
251
251
  end
@@ -329,7 +329,7 @@ module Osm
329
329
  'badge' => badge.badge_key,
330
330
  'columnname' => badge.requirement_key,
331
331
  'data' => badge.data,
332
- 'newcolumnname' => badge.label,
332
+ 'newcolumnname' => badge.requirement_label,
333
333
  'badgetype' => badge.badge_type,
334
334
  })
335
335
  end
@@ -350,7 +350,7 @@ module Osm
350
350
  'badge' => badge.badge_key,
351
351
  'columnname' => badge.requirement_key,
352
352
  'data' => badge.data,
353
- 'newcolumnname' => badge.label,
353
+ 'newcolumnname' => badge.requirement_label,
354
354
  'badgetype' => badge.badge_type,
355
355
  })
356
356
  end
@@ -563,7 +563,7 @@ module Osm
563
563
  badges_data = event_data['badgelinks']
564
564
  badges_data = [] unless badges_data.is_a?(Array)
565
565
  badges_data.each do |field|
566
- badges.push BadgeLink.new(badge_key: field['badge'], badge_type: field['badgetype'].to_sym, badge_section: field['section'].to_sym, requirement_key: field['columnname'], label: field['columnnameLongName'], data: field['data'])
566
+ badges.push BadgeLink.new(badge_key: field['badge'], badge_type: field['badgetype'].to_sym, badge_section: field['section'].to_sym, requirement_key: field['columnname'], badge_label: field['badgeLongName'], requirement_label: field['columnnameLongName'], data: field['data'])
567
567
  end
568
568
  event.badges = badges
569
569
 
@@ -571,7 +571,7 @@ module Osm
571
571
  end
572
572
 
573
573
 
574
- # When creating a BadgeLink for an existing column in a hikes/nights badge the label is optional
574
+ # When creating a BadgeLink for an existing column in a hikes/nights badge the requirement_label is optional
575
575
  # When creating a BadgeLink for a new column in a hikes/nights badge the requirement_key MUST be blank
576
576
  # TODO : Add validation for above statements
577
577
  class BadgeLink
@@ -582,12 +582,14 @@ module Osm
582
582
  # @return [String] the badge being done
583
583
  # @!attribute [rw] badge_type
584
584
  # @return [Symbol] the type of badge
585
+ # @!attribute [rw] badge_label
586
+ # @return [String] human friendly badge name
585
587
  # @!attribute [rw] requirement_key
586
588
  # @return [String] the requirement being done
587
589
  # @!attribute [rw] badge_section
588
590
  # @return [Symbol] the section type that the badge belongs to
589
- # @!attribute [rw] label
590
- # @return [String] human firendly label for the badge and requirement
591
+ # @!attribute [rw] requirement_label
592
+ # @return [String] human firendly requirement label
591
593
  # @!attribute [rw] data
592
594
  # @return [String] what to put in the column when the badge records are updated
593
595
 
@@ -595,11 +597,12 @@ module Osm
595
597
  attribute :badge_type, :type => Object
596
598
  attribute :requirement_key, :type => String
597
599
  attribute :badge_section, :type => Object
598
- attribute :label, :type => String
600
+ attribute :badge_label, :type => String
601
+ attribute :requirement_label, :type => String
599
602
  attribute :data, :type => String
600
603
 
601
604
  if ActiveModel::VERSION::MAJOR < 4
602
- attr_accessible :badge_key, :badge_type, :requirement_key, :badge_section, :label, :data
605
+ attr_accessible :badge_key, :badge_type, :requirement_key, :badge_section, :badge_label, :requirement_label, :data
603
606
  end
604
607
 
605
608
  validates_presence_of :badge_key
data/lib/osm/member.rb CHANGED
@@ -380,6 +380,18 @@ module Osm
380
380
  return "#{first_name}#{seperator.to_s}#{last_name}"
381
381
  end
382
382
 
383
+ # Check if the member is in the leaders grouping
384
+ # @return [Boolean]
385
+ def leader?
386
+ grouping_id.eql?(-2)
387
+ end
388
+
389
+ # Check if the member is in a non-leaders grouping
390
+ # @return [Boolean]
391
+ def youth?
392
+ grouping_id > 0
393
+ end
394
+
383
395
  # Get the Key to use in My.SCOUT links for this member
384
396
  # @param [Osm::Api] api The api to use to make the request
385
397
  # @return [String] the key
@@ -127,7 +127,8 @@ describe "Event" do
127
127
  :badge_type => :activity,
128
128
  :requirement_key => 'a_01',
129
129
  :badge_section => :cubs,
130
- :label => 'Cubs Artist Activity - A: Poster',
130
+ :requirement_label => 'A: Poster',
131
+ :badge_label => 'Artist',
131
132
  :data => 'abc'
132
133
  )
133
134
 
@@ -135,7 +136,8 @@ describe "Event" do
135
136
  bl.badge_type.should == :activity
136
137
  bl.requirement_key.should == 'a_01'
137
138
  bl.badge_section.should == :cubs
138
- bl.label.should == 'Cubs Artist Activity - A: Poster'
139
+ bl.badge_label.should == 'Artist'
140
+ bl.requirement_label.should == 'A: Poster'
139
141
  bl.data.should == 'abc'
140
142
  bl.valid?.should be_true
141
143
  end
@@ -236,11 +238,12 @@ describe "Event" do
236
238
  event.columns[0].label.should == 'Label'
237
239
  event.columns[0].parent_required.should be_true
238
240
  event.badges[0].badge_key.should == 'athletics'
241
+ event.badges[0].badge_label.should == 'Athletics'
239
242
  event.badges[0].badge_section.should == :cubs
240
243
  event.badges[0].badge_type.should == :activity
241
244
  event.badges[0].requirement_key.should == 'b_06'
242
245
  event.badges[0].data.should == ''
243
- event.badges[0].label.should == 'B: Run'
246
+ event.badges[0].requirement_label.should == 'B: Run'
244
247
  event.badges[1].badge_key.should == 'hikes'
245
248
  event.badges[1].badge_section.should == :staged
246
249
  event.badges[1].badge_type.should == :staged
@@ -624,7 +627,7 @@ describe "Event" do
624
627
  badge_type: :activity,
625
628
  requirement_key: 'a_01',
626
629
  badge_section: :beavers,
627
- label: '',
630
+ requirement_label: '',
628
631
  data: '',
629
632
  )]
630
633
  event = Osm::Event.create(@api, @attributes)
@@ -652,7 +655,7 @@ describe "Event" do
652
655
  badge_type: :staged,
653
656
  requirement_key: '',
654
657
  badge_section: :staged,
655
- label: 'Label for added column',
658
+ requirement_label: 'Label for added column',
656
659
  data: '1',
657
660
  )]
658
661
  event = Osm::Event.create(@api, @attributes)
@@ -680,7 +683,7 @@ describe "Event" do
680
683
  badge_type: :staged,
681
684
  requirement_key: 'custom_01234',
682
685
  badge_section: :staged,
683
- label: '',
686
+ requirement_label: '',
684
687
  data: '2',
685
688
  )]
686
689
  event = Osm::Event.create(@api, @attributes)
@@ -101,6 +101,17 @@ describe "Member" do
101
101
  member.name('_').should == 'First_Last'
102
102
  end
103
103
 
104
+ it "Tells if member is a leader" do
105
+ Osm::Member.new(grouping_id: -2).leader?.should be_true # In the leader grouping
106
+ Osm::Member.new(grouping_id: 2).leader?.should be_false # In a youth grouping
107
+ Osm::Member.new(grouping_id: 0).leader?.should be_false # Not in a grouping
108
+ end
109
+
110
+ it "Tells if member is a youth member" do
111
+ Osm::Member.new(grouping_id: -2).youth?.should be_false # In the leader grouping
112
+ Osm::Member.new(grouping_id: 2).youth?.should be_true # In a youth grouping
113
+ Osm::Member.new(grouping_id: 0).youth?.should be_false # Not in a grouping
114
+ end
104
115
 
105
116
  it "Provides each part of age" do
106
117
  data = {
data/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Osm
2
- VERSION = "1.2.11"
2
+ VERSION = "1.2.12"
3
3
  end
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.11
4
+ version: 1.2.12
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-04-27 00:00:00.000000000 Z
11
+ date: 2014-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport