team_api 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09cb397221c7524d2b837eb6d94b5a980b589688
4
- data.tar.gz: 1310a085598f49a6ef07be1a6d126420745a471e
3
+ metadata.gz: 92beac432b5216c8507073f4ba3d815f65efbabb
4
+ data.tar.gz: 6b1a9d0fb5c19b7d4d510673c99ed514b020a4a3
5
5
  SHA512:
6
- metadata.gz: 7a74743fc65e50316b66dba13f061d9eef35cae2985be85ce2a87109a0649f9ef0e3898689c7a694e0fbe8b6cedfdc1f22f65d60c65b440aa7a840172d116a39
7
- data.tar.gz: 2bbe5b4ea8be6e3a7a2de7b89387e776a029d8bc08610dd06b78d2e03e5ff40c9eb955c7ccaec57996c9a29d5133b2be173324c56c4e43753315209c1c3f7c20
6
+ metadata.gz: b0e9d43b58f878f42500ea32a6a8f5c230b4bfccd0ad1090b2d930a63593e892c7f5eb75e3b57b13b40005faad1d1f4d0b8319e5e5a45ab4d54b14fd6198b8e8
7
+ data.tar.gz: 8dd4d5b9f88de7b1031bb6dddc8d4ea54b5da085d81260212b6971d1eb41a2e06bb9a2e5c84e5b0eae5f74b2ec6026d2e29f593248e63d680b964c0d9e29f827
@@ -20,6 +20,7 @@ module TeamApi
20
20
  def self.join_data(site)
21
21
  impl = JoinerImpl.new site
22
22
  site.data.merge! impl.collection_data
23
+ impl.create_indexes
23
24
  impl.promote_or_remove_data
24
25
  impl.join_project_data
25
26
  Api.add_self_links site
@@ -81,6 +82,11 @@ module TeamApi
81
82
  data['team'] ||= {}
82
83
  end
83
84
 
85
+ def create_indexes
86
+ team_by_email
87
+ team_by_github
88
+ end
89
+
84
90
  # Returns an index of team member usernames keyed by email address.
85
91
  def team_by_email
86
92
  @team_by_email ||= team_index_by_field 'email'
@@ -93,12 +99,21 @@ module TeamApi
93
99
 
94
100
  # Returns an index of team member usernames keyed by a particular field.
95
101
  def team_index_by_field(field)
96
- team.values.map do |member|
102
+ team_members.map do |member|
97
103
  value = member[field]
104
+ value = member['private'][field] if value.nil? && member['private']
98
105
  [value, member['name']] unless value.nil?
99
106
  end.compact.to_h
100
107
  end
101
108
 
109
+ # Returns the list of team members, with site.data['team']['private']
110
+ # members included.
111
+ def team_members
112
+ @team_members ||= team.map { |key, value| value unless key == 'private' }
113
+ .compact
114
+ .concat((team['private'] || {}).values)
115
+ end
116
+
102
117
  # Replaces each member of team_list with a key into the team hash.
103
118
  # Values can be:
104
119
  # - Strings that are already team hash keys
@@ -129,7 +144,9 @@ module TeamApi
129
144
  # from team members not appearing in +site.data[+'team'] or
130
145
  # +team_by_email+.
131
146
  def join_snippet_data
132
- data['snippets'] = data['snippets'].map do |timestamp, snippets|
147
+ raw_snippets = data['snippets']
148
+ return if raw_snippets.nil?
149
+ data['snippets'] = raw_snippets.map do |timestamp, snippets|
133
150
  joined = snippets.map { |snippet| join_snippet snippet }
134
151
  .compact.each { |i| i.delete 'username' }
135
152
  [timestamp, joined] unless joined.empty?
@@ -1,5 +1,5 @@
1
1
  # @author Mike Bland (michael.bland@gsa.gov)
2
2
 
3
3
  module TeamApi
4
- VERSION = '0.0.3'
4
+ VERSION = '0.0.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: team_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Bland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-18 00:00:00.000000000 Z
11
+ date: 2015-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler