friendis 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog +5 -0
- data/README.md +4 -0
- data/lib/friendis.rb +1 -0
- data/lib/friendis/friendable.rb +14 -0
- data/lib/friendis/version.rb +1 -1
- data/spec/lib/friendable_spec.rb +25 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bfbf27325dc7aeb0b8d2f49f3aeecf49db19106
|
4
|
+
data.tar.gz: 0d8f9ee977a62be3f5134f63c7705c1d71f33104
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9d6f3a03d2628becef77db1da3fc01e6c388dddec80e57a4e1135d002c6134541fd61d9af5658bd3b9a6ec047ca996e04e79ed32d5857762fccde4bbbcac35f
|
7
|
+
data.tar.gz: 16432b72c2cbeb7514f0e63633abb0d038dc09e123a37e820ba0902b4156324cfdfc60d796c41b98e2e9264f5ade3e785a25c71c9fbae56c150ab50ec20ce839
|
data/Changelog
ADDED
data/README.md
CHANGED
@@ -82,6 +82,10 @@ The `id` attribute will automatically be cached.
|
|
82
82
|
|
83
83
|
@user2.approve_friend_request(@user1)
|
84
84
|
|
85
|
+
## Ignoring Friend Requests
|
86
|
+
|
87
|
+
@user2.ignore_friend_request(@user!) #=> @user1 will still see the sent friend request.
|
88
|
+
|
85
89
|
### Lisiting Friends
|
86
90
|
|
87
91
|
@user1.friends
|
data/lib/friendis.rb
CHANGED
data/lib/friendis/friendable.rb
CHANGED
@@ -66,6 +66,20 @@ module Friendis
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
+
def ignore_friend_request(friend)
|
70
|
+
if !(Friendis.redis.sismember(friendis_incoming_friend_requests_key, friend.id.to_s))
|
71
|
+
return false
|
72
|
+
else
|
73
|
+
|
74
|
+
# Ignoring a friend request, leaves the request in the requester queue, but removes
|
75
|
+
# it from the pending requests list of the recipient.
|
76
|
+
Friendis.redis.multi do
|
77
|
+
Friendis.redis.srem friendis_incoming_friend_requests_key, friend.id.to_s
|
78
|
+
end
|
79
|
+
return true
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
69
83
|
def unfriend(friend)
|
70
84
|
Friendis.redis.multi do
|
71
85
|
Friendis.redis.srem friendis_my_friends_key, friend.id
|
data/lib/friendis/version.rb
CHANGED
data/spec/lib/friendable_spec.rb
CHANGED
@@ -3,6 +3,12 @@ require 'models/user'
|
|
3
3
|
|
4
4
|
describe Friendis::Friendable do
|
5
5
|
|
6
|
+
# Configure Friendis, so it can be used
|
7
|
+
before(:all) do
|
8
|
+
Friendis.configure do |c|
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
6
12
|
describe "#send_friend_request" do
|
7
13
|
before(:each) do
|
8
14
|
@user1 = User.new(1)
|
@@ -44,6 +50,25 @@ describe Friendis::Friendable do
|
|
44
50
|
end
|
45
51
|
end
|
46
52
|
|
53
|
+
describe "#ignore_friend_request" do
|
54
|
+
before(:each) do
|
55
|
+
@user1 = User.new(1)
|
56
|
+
@user2 = User.new(2)
|
57
|
+
@user1.clear_friendis_data
|
58
|
+
@user2.clear_friendis_data
|
59
|
+
|
60
|
+
@user1.save
|
61
|
+
@user2.save
|
62
|
+
@user1.send_friend_request(@user2)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should show friend on friends list after approval" do
|
66
|
+
@user2.ignore_friend_request(@user1).should be_truthy
|
67
|
+
@user2.pending_friend_requests.should be_empty
|
68
|
+
@user1.sent_friend_requests.should_not be_empty
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
47
72
|
describe "#unfriend" do
|
48
73
|
before(:each) do
|
49
74
|
@user1 = User.new(1)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: friendis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elad Meidar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -75,6 +75,7 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- .gitignore
|
77
77
|
- .rspec
|
78
|
+
- Changelog
|
78
79
|
- Gemfile
|
79
80
|
- LICENSE.txt
|
80
81
|
- README.md
|