gitcontacts 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gitcontacts.rb +192 -173
- data/lib/gitcontacts/Contacts.rb +22 -11
- data/lib/gitcontacts/Request.rb +3 -1
- data/lib/gitcontacts/User.rb +22 -6
- data/lib/gitcontacts/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: 70a7b11e301760f9ef08d0f91888d14029eef928
|
4
|
+
data.tar.gz: 7d791fa4c6acfc337eeb1a7671471ee32fd94838
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6572d28e0a798198777b7bb10819c16ed652da55b48989b17d5a844edf893d756a2c792c997563cad19ff25ab247304262e3885d0258a18bdc122a33954ee1d
|
7
|
+
data.tar.gz: 5d951e20902a33584144294c870f27696b82ee07eef4510fb287ad07c2df9c7f942fad33c8ab2ae0ce4d1bf1a305b561f85c351ed548392ca307d490545fb049
|
data/lib/gitcontacts.rb
CHANGED
@@ -12,288 +12,307 @@ require "gitdb"
|
|
12
12
|
|
13
13
|
module GitContacts
|
14
14
|
|
15
|
+
@@errno = :ok
|
16
|
+
|
15
17
|
class << self
|
18
|
+
|
19
|
+
def errsym
|
20
|
+
@@errno
|
21
|
+
end
|
22
|
+
|
16
23
|
def user_exist? uid
|
17
24
|
User::exist? uid
|
18
25
|
end
|
19
26
|
|
20
|
-
def create_user hash
|
21
|
-
User::create hash
|
22
|
-
end
|
23
27
|
# code review: @abbshr
|
24
28
|
def password_valid? email, password
|
25
|
-
|
26
|
-
user if user.password_correct? Digest::MD5.hexdigest(password)
|
27
|
-
end
|
29
|
+
User.new(email).password_correct? Digest::MD5.hexdigest(password)
|
28
30
|
end
|
29
|
-
|
31
|
+
|
32
|
+
# code review: @AustinChou, @abbshr
|
33
|
+
# if operator belongs to contacts gid
|
30
34
|
def relation_valid? operator, gid
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
35
|
+
Contacts::exist?(gid) &&
|
36
|
+
Contacts.new(gid).getusers.include?(operator) &&
|
37
|
+
User.new(operator).getcontacts.include?(gid)
|
38
|
+
end
|
39
|
+
|
40
|
+
def create_user hash
|
41
|
+
return @@errno = :miss_args unless hash.include?(:email) && hash.include?(:password)
|
42
|
+
return @@errno = :exist if user_exist?(hash[:email])
|
43
|
+
User::create hash
|
44
|
+
@@errno = :ok
|
36
45
|
end
|
37
46
|
|
38
47
|
def get_a_user operator, uid
|
39
|
-
return unless
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
}
|
49
|
-
end
|
48
|
+
return @@errno = :non_exist unless user_exist? uid
|
49
|
+
@@errno = :ok
|
50
|
+
User.new(uid).getinfo
|
51
|
+
end
|
52
|
+
|
53
|
+
# => [ uid ]
|
54
|
+
def get_users operator
|
55
|
+
@errno = :ok
|
56
|
+
User::all
|
50
57
|
end
|
51
58
|
|
52
59
|
# code review: @abbshr
|
60
|
+
# e.g.: 获取联系人数量大于200的uid群组
|
53
61
|
# meta => :owner, :gid, :count, :name
|
54
|
-
|
55
|
-
|
62
|
+
# get_contacts_if operator { |contacts| contacts.count > 200 }
|
63
|
+
def get_contacts_if operator, &condition
|
64
|
+
@@errno = :ok
|
56
65
|
user = User.new operator
|
57
66
|
contacts = Gitdb::Contacts.new operator
|
58
|
-
user.getcontacts.
|
59
|
-
break unless GitContacts::relation_valid? operator, gid
|
60
|
-
contacts.access gid
|
61
|
-
contacts_arr << contacts.getmeta
|
62
|
-
end
|
63
|
-
contacts_arr
|
64
|
-
end
|
65
|
-
# code review: @abbshr
|
66
|
-
# e.g.: 获取联系人数量大于200的uid群组
|
67
|
-
# get_contacts_if { |contacts| contacts.count > 200 }
|
68
|
-
def get_contacts_if uid, &condition
|
69
|
-
GitContacts::get_all_contacts(uid).select &condition
|
67
|
+
user.getcontacts.map { |gid| contacts.access(gid).getmeta }.select &condition
|
70
68
|
end
|
69
|
+
|
71
70
|
# code review: @abbshr
|
72
71
|
def add_contacts operator, name
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
gid = git_contacts.getmeta[:gid]
|
77
|
-
Contacts.create gid, { :name => name }
|
72
|
+
return @@errno = :miss_args unless name
|
73
|
+
@@errno = :ok
|
74
|
+
gid = Contacts.create operator, :name => name
|
78
75
|
contacts = Contacts.new gid
|
79
|
-
|
80
|
-
contacts.add_admin operator
|
81
|
-
user = User.new operator
|
82
|
-
user.add_contacts gid
|
76
|
+
User.new(operator).add_contacts gid
|
83
77
|
gid
|
84
78
|
end
|
79
|
+
|
85
80
|
# code review: @abbshr
|
86
|
-
def edit_contacts_meta operator, gid,
|
87
|
-
return unless
|
88
|
-
|
81
|
+
def edit_contacts_meta operator, gid, meta
|
82
|
+
return @@errno = :forbidden unless relation_valid? operator, gid
|
83
|
+
return @@errno = :miss_args unless meta
|
84
|
+
@@errno = :ok
|
89
85
|
contacts = Gitdb::Contacts.new operator
|
90
|
-
contacts.access
|
91
|
-
|
92
|
-
true
|
86
|
+
contacts.access(gid).setmeta meta
|
87
|
+
# TODO: check meta
|
93
88
|
end
|
89
|
+
|
94
90
|
# code review: @abbshr
|
95
|
-
def get_contacts_card operator, gid,
|
96
|
-
return unless
|
97
|
-
contacts = Gitdb::Contacts.new
|
98
|
-
contacts.
|
99
|
-
|
91
|
+
def get_contacts_card operator, gid, cid
|
92
|
+
return @@errno = :forbidden unless relation_valid? operator, gid
|
93
|
+
contacts = Gitdb::Contacts.new(operator).access(gid)
|
94
|
+
card = contacts.get_card_by_id cid
|
95
|
+
return @@errno = :non_exist unless card
|
96
|
+
@@errno = :ok
|
97
|
+
card.getdata.merge! card.getmeta
|
100
98
|
end
|
99
|
+
|
101
100
|
# code review: @abbshr
|
102
101
|
def get_contacts_cards_by_related operator, gid, keyword
|
103
|
-
return unless
|
102
|
+
return @@errno = :forbidden unless relation_valid? operator, gid
|
103
|
+
@@errno = :ok
|
104
104
|
contacts = Gitdb::Contacts.new operator
|
105
|
-
contacts.access
|
106
|
-
|
107
|
-
|
108
|
-
|
105
|
+
contacts.access(gid).get_cards do |card|
|
106
|
+
if card.getmeta[:owner].include?(keyword) || card.getdata.find { |k,v| v.include? keyword }
|
107
|
+
card.getdata.merge! card.getmeta
|
108
|
+
end
|
109
109
|
end
|
110
110
|
end
|
111
|
+
|
111
112
|
# code review: @abbshr
|
112
113
|
def get_contacts_history operator, gid
|
114
|
+
return @@errno = :forbidden unless relation_valid? operator, gid
|
115
|
+
@@errno = :ok
|
113
116
|
contacts = Gitdb::Contacts.new operator
|
114
|
-
contacts.access
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
commit_obj
|
117
|
+
contacts.access(gid).read_change_history do |commit|
|
118
|
+
{
|
119
|
+
:author => commit.author,
|
120
|
+
:operator => commit.committer,
|
121
|
+
:mtime => commit.time,
|
122
|
+
:oid => commit.oid,
|
123
|
+
:message => commit.message
|
124
|
+
}
|
123
125
|
end
|
124
126
|
end
|
127
|
+
|
125
128
|
# code review: @abbshr
|
126
129
|
def revert_to operator, gid, oid
|
127
|
-
|
128
|
-
|
129
|
-
contacts.access gid
|
130
|
+
return @@errno = :forbidden unless relation_valid? operator, gid
|
131
|
+
return @@errno = :miss_args unless oid
|
132
|
+
contacts = Gitdb::Contacts.new(operator).access gid
|
133
|
+
return @@errno = :non_exist unless contacts.read_change_history { |commit| commit.oid }.include?(oid)
|
134
|
+
@@errno = :ok
|
130
135
|
operator = {
|
131
136
|
:name => operator,
|
132
137
|
:email => User.new(operator).getemail,
|
133
138
|
:time => Time.now
|
134
139
|
}
|
135
|
-
|
140
|
+
commit = {
|
141
|
+
:author => operator,
|
142
|
+
:committer => operator,
|
143
|
+
:message => "revert to revision #{oid}"
|
144
|
+
}
|
145
|
+
contacts.revert_to oid, commit
|
136
146
|
end
|
147
|
+
|
137
148
|
# code review: @abbshr
|
138
149
|
def add_contacts_card operator, gid, payload
|
139
|
-
return
|
140
|
-
user = result.first
|
150
|
+
return @@errno = :forbidden unless relation_valid? operator, gid
|
141
151
|
# request id
|
142
152
|
qid = Request::create :uid => operator, :gid => gid, :action => "create"
|
143
|
-
# create a request
|
144
153
|
req = Request.new qid
|
145
154
|
if req.auto_merge? operator
|
146
155
|
# here should return card_id if success
|
147
156
|
cid = req.allow operator
|
148
157
|
Request::delete qid
|
158
|
+
@@errno = :ok
|
149
159
|
return cid
|
150
160
|
else
|
151
|
-
|
161
|
+
@@errno = :pend
|
162
|
+
User.new(operator).add_request qid
|
163
|
+
Contacts.new(gid).add_request qid
|
152
164
|
end
|
153
|
-
true
|
154
165
|
end
|
166
|
+
|
155
167
|
# code review: @abbshr
|
156
|
-
def edit_contacts_card operator, gid,
|
157
|
-
return
|
158
|
-
|
159
|
-
|
168
|
+
def edit_contacts_card operator, gid, cid, payload
|
169
|
+
return @@errno = :forbidden unless relation_valid? operator, gid
|
170
|
+
return @@errno = :non_exist unless Gitdb::Contacts.new(operator).access(gid).get_card_by_id cid
|
171
|
+
hash = {
|
172
|
+
:uid => operator,
|
173
|
+
:gid => gid,
|
174
|
+
:action => "setdata",
|
175
|
+
:card_id => cid,
|
176
|
+
:content => JSON.generate(payload)
|
177
|
+
}
|
178
|
+
qid = Request::create hash
|
160
179
|
req = Request.new qid
|
161
180
|
if req.auto_merge? operator
|
162
181
|
req.allow operator
|
163
182
|
Request::delete qid
|
183
|
+
@@errno = :ok
|
164
184
|
else
|
165
|
-
|
185
|
+
@@errno = :pend
|
186
|
+
User.new(operator).add_request qid
|
187
|
+
Contacts.new(gid).add_request qid
|
166
188
|
end
|
167
|
-
true
|
168
189
|
end
|
190
|
+
|
169
191
|
# code review: @abbshr
|
170
|
-
def delete_contacts_card operator, gid,
|
171
|
-
return
|
172
|
-
|
173
|
-
|
192
|
+
def delete_contacts_card operator, gid, cid
|
193
|
+
return @@errno = :forbidden unless relation_valid? operator, gid
|
194
|
+
return @@errno = :non_exist unless Gitdb::Contacts.new(operator).access(gid).get_card_by_id cid
|
195
|
+
hash = {
|
196
|
+
:uid => operator,
|
197
|
+
:gid => gid,
|
198
|
+
:action => "delete",
|
199
|
+
:card_id => cid
|
200
|
+
}
|
201
|
+
qid = Request::create hash
|
174
202
|
req = Request.new qid
|
175
203
|
if req.auto_merge? operator
|
176
204
|
req.allow operator
|
177
205
|
Request::delete qid
|
206
|
+
@@errno = :ok
|
178
207
|
else
|
179
|
-
|
208
|
+
@errno = :pend
|
209
|
+
User.new(operator).add_request qid
|
210
|
+
Contacts.new(gid).add_request qid
|
180
211
|
end
|
181
|
-
true
|
182
212
|
end
|
213
|
+
|
183
214
|
# code review: @abbshr
|
184
215
|
def get_contacts_users operator, gid
|
185
|
-
return
|
186
|
-
|
187
|
-
|
216
|
+
return @@errno = :forbidden unless relation_valid? operator, gid
|
217
|
+
@@errno = :ok
|
218
|
+
Contacts.new(gid).getusers
|
188
219
|
end
|
220
|
+
|
189
221
|
def get_contacts_user operator, gid, uid
|
190
|
-
return unless
|
191
|
-
|
222
|
+
return @@errno = :forbidden unless relation_valid? operator, gid
|
223
|
+
return @@errno = :non_exist unless user_exist? operator
|
224
|
+
@@errno = :ok
|
225
|
+
User.new(uid).getinfo
|
192
226
|
end
|
227
|
+
|
193
228
|
# code review: @abbshr
|
194
229
|
def add_contacts_user operator, gid, uid
|
195
|
-
return
|
196
|
-
|
197
|
-
contacts =
|
198
|
-
if contacts.getadmins.include?(
|
199
|
-
|
200
|
-
|
230
|
+
return @@errno = :forbidden unless relation_valid? operator, gid
|
231
|
+
return @@errno = :non_exist unless user_exist? uid
|
232
|
+
contacts = Contacts.new(gid)
|
233
|
+
if contacts.getadmins.include?(operator)
|
234
|
+
@@errno = :ok
|
235
|
+
contacts.add_user uid unless contacts.getusers.include? uid
|
236
|
+
User.new(uid).add_contacts gid
|
237
|
+
else
|
238
|
+
@@errno = :forbidden
|
201
239
|
end
|
202
240
|
end
|
241
|
+
|
203
242
|
def remove_contacts_user operator, gid, uid
|
204
|
-
return
|
205
|
-
|
206
|
-
|
207
|
-
|
243
|
+
return @@errno = :forbidden unless relation_valid? operator, gid
|
244
|
+
contacts = Contacts.new(gid)
|
245
|
+
admins = contacts.getadmins
|
246
|
+
@@errno = :ok
|
247
|
+
if admins.include?(operator)
|
248
|
+
return @@errno = :forbidden if admins.length < 2 && operator == uid
|
249
|
+
contacts.remove_admin uid
|
208
250
|
contacts.remove_user uid
|
209
|
-
|
251
|
+
elsif operator == uid
|
252
|
+
contacts.remove_user uid
|
253
|
+
else
|
254
|
+
@@errno = :forbidden
|
210
255
|
end
|
211
256
|
end
|
212
257
|
|
213
258
|
def get_contacts_user_privileges operator, gid, uid
|
214
|
-
return unless
|
215
|
-
|
216
|
-
|
259
|
+
return @@errno = :forbidden unless relation_valid? operator, gid
|
260
|
+
@@errno = :ok
|
261
|
+
Contacts.new(gid).getadmins.include?(uid) ? 'admin' : 'user'
|
217
262
|
end
|
218
263
|
|
219
264
|
# code review: @AustinChou
|
220
|
-
def edit_contacts_user_privileges operator, gid, uid,
|
221
|
-
return
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
265
|
+
def edit_contacts_user_privileges operator, gid, uid, role
|
266
|
+
return @@errno = :forbidden unless relation_valid? operator, gid
|
267
|
+
contacts = Contacts.new gid
|
268
|
+
admins = contacts.getadmins
|
269
|
+
@@errno = :ok
|
270
|
+
if admins.include?(operator)
|
271
|
+
return @@errno = :forbidden if admins.length < 2 && operator == uid
|
272
|
+
case role
|
226
273
|
when "admin"
|
227
|
-
contacts.add_admin uid
|
228
|
-
|
229
|
-
when "users"
|
274
|
+
contacts.add_admin uid unless contacts.getadmins.include? uid
|
275
|
+
when "user"
|
230
276
|
contacts.remove_admin uid
|
231
|
-
|
277
|
+
else
|
278
|
+
@@errno = :bad_args
|
232
279
|
end
|
280
|
+
else
|
281
|
+
@@errno = :forbidden
|
233
282
|
end
|
234
283
|
end
|
235
|
-
=begin
|
236
|
-
def invite_contacts_user operator, gid, payload
|
237
|
-
return unless result = GitContacts::relation_valid?(operator, gid)
|
238
|
-
user = result.first
|
239
|
-
contacts = result.last
|
240
|
-
if contacts.getadmins.include?(user.getuid)
|
241
|
-
Inviation::create :uid => User::email_to_uid(payload[:email]), :contacts => gid
|
242
|
-
end
|
243
|
-
end
|
244
|
-
|
245
|
-
def edit_invitation_status operator, payload
|
246
|
-
invitation = Inviation.new payload[:invite_id]
|
247
|
-
if invitation.accept? operator
|
248
|
-
user = User.new operator
|
249
|
-
gid = invitation.getcontacts
|
250
|
-
user.add_contacts gid
|
251
|
-
contacts = GCContacts.new gid
|
252
|
-
contacts.adduser user.getuid
|
253
|
-
Inviation::delete payload[:invite_id]
|
254
|
-
true
|
255
|
-
end
|
256
|
-
end
|
257
|
-
=end
|
258
284
|
|
259
285
|
# code review: @AustinChou
|
260
286
|
def get_all_requests operator
|
261
|
-
|
262
|
-
|
263
|
-
user.getrequests.each do |qid|
|
264
|
-
requests << Request.new(qid)
|
265
|
-
end
|
266
|
-
end
|
267
|
-
requests
|
287
|
+
@@errno = :ok
|
288
|
+
Contacts.new(gid).getrequests.map { |qid| Request.new qid }
|
268
289
|
end
|
269
290
|
|
270
291
|
def get_a_request operator, qid
|
271
|
-
|
272
|
-
|
273
|
-
end
|
292
|
+
@@errno = :ok
|
293
|
+
Request.exist?(qid) ? Request.new(qid) : @@errno = :non_exist
|
274
294
|
end
|
275
295
|
|
276
296
|
# code review: @AustinChou
|
277
|
-
def edit_request_status operator, qid,
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
297
|
+
def edit_request_status operator, gid, qid, action
|
298
|
+
return @@errno = :non_exist unless Request.exist? qid
|
299
|
+
return @@errno = :forbidden unless relation_valid?(operator, gid)
|
300
|
+
return @@errno = :forbidden unless Contacts.new(gid).getadmins.include? operator
|
301
|
+
@@errno = :ok
|
302
|
+
req = Request.new(qid)
|
303
|
+
case action
|
304
|
+
when "permit"
|
305
|
+
req.allow operator
|
306
|
+
Request::delete qid
|
307
|
+
User.new(req.getuid).remove_request qid
|
308
|
+
Contacts.new(gid).remove_request qid
|
309
|
+
when "reject"
|
310
|
+
Request::delete qid
|
311
|
+
User.new(req.getuid).remove_request qid
|
312
|
+
Contacts.new(gid).remove_request qid
|
313
|
+
else
|
314
|
+
@@errno = :bad_args
|
295
315
|
end
|
296
316
|
end
|
297
|
-
|
298
317
|
end
|
299
318
|
end
|
data/lib/gitcontacts/Contacts.rb
CHANGED
@@ -6,17 +6,16 @@ module GitContacts
|
|
6
6
|
true if ContactsObject::exist?(gid)
|
7
7
|
end
|
8
8
|
|
9
|
-
def self::create
|
10
|
-
# some keys are optional
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
9
|
+
def self::create uid, hash
|
10
|
+
# some keys are optional
|
11
|
+
gid = Gitdb::Contacts.new(uid).create(hash[:name]).getmeta[:gid]
|
12
|
+
obj = ContactsObject.new
|
13
|
+
obj.set_gid gid
|
14
|
+
obj.name = hash[:name]
|
15
|
+
obj.note = hash[:note] if hash.has_key?(:note)
|
16
|
+
obj.users << uid
|
17
|
+
obj.admins << uid
|
18
|
+
gid
|
20
19
|
end
|
21
20
|
|
22
21
|
def initialize gid
|
@@ -35,6 +34,10 @@ module GitContacts
|
|
35
34
|
@obj.admins if @obj
|
36
35
|
end
|
37
36
|
|
37
|
+
def getrequests
|
38
|
+
@obj.requests if @obj
|
39
|
+
end
|
40
|
+
|
38
41
|
def add_user uid
|
39
42
|
@obj.users << uid if @obj
|
40
43
|
end
|
@@ -43,6 +46,10 @@ module GitContacts
|
|
43
46
|
@obj.admins << uid if @obj
|
44
47
|
end
|
45
48
|
|
49
|
+
def add_request request_id
|
50
|
+
@obj.requests << request_id if @obj
|
51
|
+
end
|
52
|
+
|
46
53
|
def remove_user uid
|
47
54
|
@obj.users.delete(uid) if @obj
|
48
55
|
end
|
@@ -50,6 +57,10 @@ module GitContacts
|
|
50
57
|
def remove_admin uid
|
51
58
|
@obj.admins.delete(uid) if @obj
|
52
59
|
end
|
60
|
+
|
61
|
+
def remove_request request_id
|
62
|
+
@obj.requests.delete request_id if @obj
|
63
|
+
end
|
53
64
|
|
54
65
|
end
|
55
66
|
|
data/lib/gitcontacts/Request.rb
CHANGED
data/lib/gitcontacts/User.rb
CHANGED
@@ -3,16 +3,18 @@ module GitContacts
|
|
3
3
|
class User
|
4
4
|
|
5
5
|
def self::exist? email
|
6
|
-
|
6
|
+
UserObject::exist?(email)
|
7
7
|
end
|
8
8
|
|
9
9
|
def self::create hash
|
10
10
|
# some keys are optional
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
obj = UserObject.new
|
12
|
+
obj.set_email hash[:email]
|
13
|
+
obj.password = Digest::MD5.hexdigest(hash[:password])
|
14
|
+
end
|
15
|
+
|
16
|
+
def self::all
|
17
|
+
UserObject::all
|
16
18
|
end
|
17
19
|
|
18
20
|
def initialize email
|
@@ -45,6 +47,15 @@ module GitContacts
|
|
45
47
|
@obj.requests.members if @obj
|
46
48
|
end
|
47
49
|
|
50
|
+
def getinfo
|
51
|
+
{
|
52
|
+
:uid => getuid,
|
53
|
+
:email => getemail,
|
54
|
+
:contacts => getcontacts,
|
55
|
+
:request => getrequests
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
48
59
|
def password_correct? sha
|
49
60
|
sha == getpassword && sha != nil && sha != ""
|
50
61
|
end
|
@@ -88,6 +99,11 @@ module GitContacts
|
|
88
99
|
true if redis.keys(key_prefix+email+':*').count > 0
|
89
100
|
end
|
90
101
|
|
102
|
+
def self::all
|
103
|
+
keys = redis.keys %(#{key_prefix}*:password)
|
104
|
+
keys.map { |key| key.split(":")[1] }
|
105
|
+
end
|
106
|
+
|
91
107
|
def self::access email
|
92
108
|
obj = allocate
|
93
109
|
obj.set_email email
|
data/lib/gitcontacts/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitcontacts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AustinChou
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|