Skip to content

Commit

Permalink
Recycling API Steein
Browse files Browse the repository at this point in the history
  • Loading branch information
SteeinSource committed Jul 8, 2017
1 parent 41c1d6f commit d28d2b3
Show file tree
Hide file tree
Showing 11 changed files with 125 additions and 544 deletions.
53 changes: 42 additions & 11 deletions src/Steein/SDK/SteeinResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
use Steein\SDK\Exceptions\SteeinSDKException;
use Steein\SDK\Interfaces\SteeinResponseInterface;
use Steein\SDK\Support\ModelFactory;
use Steein\SDK\Support\Models\MediaModel;
use Steein\SDK\Support\Models\FollowersModel;
use Steein\SDK\Support\Models\FollowingModel;
use Steein\SDK\Support\Models\PostModel;
use Steein\SDK\Support\Models\PostsModel;
use Steein\SDK\Support\Models\UserModel;

/**
Expand Down Expand Up @@ -287,18 +289,37 @@ public function getApiObject($subclassName = null)
}

/**
* Удобный способ для создания коллекции ApiUser.
* Инициализация коллекции UserModel.
*
* @return Support\Model|UserModel
* @throws SteeinSDKException
*/
public function getUserModel()
{
return $this->factory->makeModel(UserModel::class);
}

/**
* Удобный способ для создания коллекции ApiPost.
/***
* Инициализация коллекции FollowersModel.
*
* @return Support\Model|FollowersModel
*/
public function getFollowersModel()
{
return $this->factory->makeModel(FollowersModel::class);
}

/***
* Инициализация коллекции FollowingModel.
*
* @return Support\Model|FollowingModel
*/
public function getFollowingModel()
{
return $this->factory->makeModel(FollowingModel::class);
}

/***
* Инициализация коллекции PostModel.
*
* @return Support\Model|PostModel
*/
Expand All @@ -307,14 +328,24 @@ public function getPostModel()
return $this->factory->makeModel(PostModel::class);
}

/**
* Удобный способ для создания коллекции MediaModel.
/***
* Инициализация коллекции PostsModel.
*
* @return Support\Model|MediaModel
* @throws SteeinSDKException
* @return Support\Model|PostsModel
*/
public function getPostsModel()
{
return $this->factory->makeModel(PostsModel::class);
}

/***
* Инициализация коллекции CommentModel.
*
* @return Support\Model|CommentModel
*/
public function getMediaModel()
public function getCommentModel()
{
return $this->factory->makeModel(MediaModel::class);
return $this->factory->makeModel(CommentModel::class);
}

}
4 changes: 2 additions & 2 deletions src/Steein/SDK/Support/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ public function isIso8601DateString($string)
public function shouldCastAsDateTime($key)
{
return in_array($key, [
'created_at',
'updated_at',
'created_',
'updated',
'start_time',
'end_time',
'backdated_time',
Expand Down
68 changes: 0 additions & 68 deletions src/Steein/SDK/Support/Models/MediaFinally.php

This file was deleted.

58 changes: 0 additions & 58 deletions src/Steein/SDK/Support/Models/MediaModel.php

This file was deleted.

50 changes: 0 additions & 50 deletions src/Steein/SDK/Support/Models/PostHashTag.php

This file was deleted.

29 changes: 0 additions & 29 deletions src/Steein/SDK/Support/Models/PostMedia.php

This file was deleted.

91 changes: 0 additions & 91 deletions src/Steein/SDK/Support/Models/PostModel.php

This file was deleted.

Loading

0 comments on commit d28d2b3

Please sign in to comment.