Skip to content

Commit

Permalink
use 2.x client
Browse files Browse the repository at this point in the history
  • Loading branch information
tbarbugli committed Nov 11, 2014
1 parent afe3b0f commit a6bab87
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"php": ">=5.4.0",
"illuminate/support": "4.2.*",
"illuminate/database": "4.2.*",
"get-stream/stream": "1.3.8"
"get-stream/stream": "2.0.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
Expand Down
2 changes: 1 addition & 1 deletion src/GetStream/StreamLaravel/Eloquent/ActivityTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function createActivity()
if ($to !== null){
$activity['to'] = array();
foreach ($to as $feed) {
$activity['to'][] = $to->getFeedId();
$activity['to'][] = $to->getId();
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/GetStream/StreamLaravel/StreamLaravelManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ public function __construct($api_key, $api_secret, $config)

public function getUserFeed($user_id)
{
return $this->client->feed("$this->userFeed:$user_id");
return $this->client->feed($this->userFeed, $user_id);
}

public function getNotificationFeed($user_id)
{
$user_feed = $this->config->get("stream-laravel::notification_feed");
return $this->client->feed("$user_feed:$user_id");
return $this->client->feed($user_feed, $user_id);
}

public function getNewsFeeds($user_id)
{
$feeds = array();
$news_feeds = $this->config->get("stream-laravel::news_feeds");
foreach ($news_feeds as $feed) {
$feeds[$feed] = $this->client->feed("$feed:$user_id");
$feeds[$feed] = $this->client->feed($feed, $user_id);
}
return $feeds;
}
Expand All @@ -59,7 +59,7 @@ public function unfollowUser($user_id, $target_user_id)

public function getFeed($feed, $user_id)
{
return $this->client->feed("$feed:$user_id");
return $this->client->feed($feed, $user_id);
}

public function activityCreated($instance)
Expand Down
10 changes: 10 additions & 0 deletions stream-laravel.sublime-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"folders":
[
{
"follow_symlinks": true,
"folder_exclude_patterns": ["vendor"],
"path": "."
}
]
}
10 changes: 5 additions & 5 deletions tests/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ public function setUp(){

public function testGetUserFeed(){
$feed = $this->manager->getUserFeed(42);
$this->assertSame($feed->getFeedId(), 'user:42');
$this->assertSame($feed->getId(), 'user:42');
}

public function testGetNotificationFeed()
{
$feed = $this->manager->getNotificationFeed(42);
$this->assertSame($feed->getFeedId(), 'notification:42');
$this->assertSame($feed->getId(), 'notification:42');
}

public function testGetNewsFeeds()
{
$feeds = $this->manager->getNewsFeeds(42);
$this->assertSame($feeds['aggregated']->getFeedId(), 'aggregated:42');
$this->assertSame($feeds['flat']->getFeedId(), 'flat:42');
$this->assertSame($feeds['aggregated']->getId(), 'aggregated:42');
$this->assertSame($feeds['flat']->getId(), 'flat:42');
}

public function testFollowUser()
Expand All @@ -47,7 +47,7 @@ public function testUnfollowUser()
public function testGetFeed()
{
$feed = $this->manager->getFeed('myfeed', 42);
$this->assertSame($feed->getFeedId(), 'myfeed:42');
$this->assertSame($feed->getId(), 'myfeed:42');
}

public function testActivityCreated()
Expand Down

0 comments on commit a6bab87

Please sign in to comment.