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 +4 -4
- data/lib/team_api/joiner.rb +19 -2
- data/lib/team_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92beac432b5216c8507073f4ba3d815f65efbabb
|
4
|
+
data.tar.gz: 6b1a9d0fb5c19b7d4d510673c99ed514b020a4a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0e9d43b58f878f42500ea32a6a8f5c230b4bfccd0ad1090b2d930a63593e892c7f5eb75e3b57b13b40005faad1d1f4d0b8319e5e5a45ab4d54b14fd6198b8e8
|
7
|
+
data.tar.gz: 8dd4d5b9f88de7b1031bb6dddc8d4ea54b5da085d81260212b6971d1eb41a2e06bb9a2e5c84e5b0eae5f74b2ec6026d2e29f593248e63d680b964c0d9e29f827
|
data/lib/team_api/joiner.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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?
|
data/lib/team_api/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2015-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|