JFacebook #1605

Merged
merged 22 commits into from Mar 16, 2013

Projects

None yet

8 participants

@dianaprajescu
Contributor

This package is part of my GSoC project.

@ianmacl ianmacl and 1 other commented on an outdated diff Oct 16, 2012
.../suites/unit/joomla/facebook/JFacebookCommentTest.php
@@ -0,0 +1,500 @@
+<?php
+/**
+ * @package Joomla.UnitTest
+ * @subpackage Facebook
+ *
+ * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE
+ */
+
+require_once JPATH_PLATFORM . '/joomla/facebook/facebook.php';
ianmacl
ianmacl Oct 16, 2012 Contributor

You should rely on the autoloader where possible.

@ianmacl ianmacl and 1 other commented on an outdated diff Oct 16, 2012
libraries/joomla/facebook/album.php
+
+ /**
+ * Method to get the photos contained in this album.
+ *
+ * @param string $album The album id.
+ * @param JFacebookOauth $oauth The JFacebookOauth object for public photos and user_photos or friends_photos permission for private photos.
+ * @param integer $limit The number of objects per page.
+ * @param integer $offset The object's number on the page.
+ * @param string $until A unix timestamp or any date accepted by strtotime.
+ * @param string $since A unix timestamp or any date accepted by strtotime.
+ *
+ * @return mixed The decoded JSON response or false if the client is not authenticated.
+ *
+ * @since 12.3
+ */
+ public function getPhotos($album, $oauth, $limit = 0, $offset = 0, $until = null, $since = null)
ianmacl
ianmacl Oct 16, 2012 Contributor

I may be missing something but it seems you are passing $oauth into almost every single method. It would seem to make sense to put that into one of your base classes so that it doesn't have to be passed every time. Similar to the way that JGithubObject stores the credentials and then automatically uses them when sending requests.

dianaprajescu
dianaprajescu Oct 17, 2012 Contributor

Thanks for pointing this out, I've thought about it during the summer but haven't had time to change it then and after that I've forgotten. I started the package this way because most Facebook GET requests for public data don't require authentication. Anyway I think it's better to have the OAuth client in the base class. I'll commit the change soon.

Contributor

@dianaprajescu I'm excited about this addition to the platform. As such I've marked it for inclusion to 12.3. I haven't had an opportunity to really go over the contents, but will try to do that very soon. I do want us to re-think how we are using the OAuth client classes. It's something I'd like to revisit in the Google package as well actually. That being said, at first glance this looks very well put together. Hopefully others will chime in as well.

Contributor
elinw commented Oct 18, 2012

You might want to squash some commits.

Contributor

@dianaprajescu, quite simply I suck. I'm sorry I haven't found the time to dig into this, I promise I haven't forgotten about it. I've been beyond busy with work, moving house, and preparing for the Joomla World Conference. I really appreciate your patience, and the work you put in ... I just need a little more time before I can give you meaningful feedback. Hopefully we can get some others to look things over and give their thoughts.

Contributor

No worries @LouisLandry . I'm also going through a very busy period: university duties, diploma project, personal projects, some collaborations and conferences, so I'm not sure I would've had time to carefully go through the feedback. @elinw that's why I haven't squashed commits, I've tried but there are too many of them and it's quite hard to keep up while I'm already tired and under time pressure.

Contributor

If this is still a go for 12.3, it probably needs some further review.

Contributor

I have just updated this branch and solved the conflicts so that it's mergeable again. I'll also squash some commits soon and change the documentation file from facebook.xml to facebook.md, it probably needs some updating too as I made some changes since I've wrote it..

I would really appreciate some feedback on this package! I might have some time every now and then to refine it and maybe we can get it merged soon.

Contributor

I would like to see this merged as well. :) A lot of work here.

If I have time in the coming days, I'll try to take it for a spin.

On Thu, Jan 10, 2013 at 2:11 PM, Diana Prajescu notifications@github.comwrote:

I have just updated this branch and solved the conflicts so that it's
mergeable again. I'll also squash some commits soon and change the
documentation file from facebook.xml to facebook.md, it probably needs
some updating too as I made some changes since I've wrote it..

I would really appreciate some feedback on this package! I might have
some time every now and then to refine it and maybe we can get it merged
soon.


Reply to this email directly or view it on GitHubhttps://github.com/joomla/joomla-platform/pull/1605#issuecomment-12116180.

Contributor

Thanks very much. I really look forward to.

Member
elkuku commented Jan 10, 2013

This looks very nice and will be usefull for a lot of applications (including some of mine)

Hopefully this will be merged soon ;)

Contributor

@dianaprajescu This does look great, much appreciated.

A thought occurs to me as some of these new packages start to appear, it might be a good opportunity to start thinking about packages that are offered as JPlatform options. The same could be done with the github library. Eventually, as the subsystems are uncoupled, just about every subsystem could be packaged separately.

If we were to do so now with new packages, it could help create discussion/agreement as to what coupling is expected between packages, and, even think about how to package and distribute.

Eventually, it would help clarify the core JPlatform distribution, encourage more packages, and avoid bloating for those options that maybe aren't needed for everyone.

Contributor

@AmyStephen - I wouldn't be totally opposed to the idea, but I think for
now we should keep everything status quo with integrating packages into the
base platform. :) You know, not try to put the cart before the horse with
offering packages. We don't have PSR-0 autoloader yet. :P

On Thu, Jan 10, 2013 at 3:55 PM, AmyStephen notifications@github.comwrote:

@dianaprajescu https://github.com/dianaprajescu This does look great,
much appreciated.

A thought occurs to me, as some of these new packages start to appear, it
seems like an opportunity to start packaging these and offering them as
options. The same could be done with the github lbrary. Eventually, as the
subsystems are uncoupled, just about every subsystem could be packaged
separately.

Doing so now, with new packages might be a good way to get started
defining what coupling is to be expected between packages? And, even
thinking through a little o packaging. It would also help get down to a
clear picture of what is the core JPlatform set, encourage more packages,
and avoid bloating JPlatform.


Reply to this email directly or view it on GitHubhttps://github.com/joomla/joomla-platform/pull/1605#issuecomment-12120840.

Contributor

/me worried one of those "baby steps" lectures is next, but realizing @dongilbert is right, concedes the point. =)

Contributor

I just squashed some commits. Please let me know if there is anything else to do in order to get this merged.

dianaprajescu added some commits Mar 23, 2012
@dianaprajescu @dianaprajescu dianaprajescu Starting Facebook package.
Use JInput instead of $_REQUEST.

Coding style fixes.

JFacebookOAuth::getToken() fixes.

Add JFacebookTest

JFacebookTest()

Add JFacebookFriendsTest

Add JFacebookObjectTest

Remove unsed constants from JFacebookHttp.

Change fetchUrl method. (No need to set user and pass to the JUri
object)

Add scope property to JFacebookOAuth.
aa3bdd9
@dianaprajescu @dianaprajescu dianaprajescu Create JFacebookUser
Add getFriends() method to JFacebookUser.

Add getFeed() method to JFacebookUser.

Add hasFriend() method to JFacebookUser.

Add getPicture() method to JFacebookUser.

Add getFamily() method to JFacebookUser.

Add getNotifications() method to JFacebookUser.

getNotifications() method can get already read notifications too. Change
some unit tests (remove unnecessary stuff).

Add updateNotification() method to JFacebookUser.

Add deletePermission() method to JFacebookUser.

Add getAlbums() method to JFacebookUser.

Add createAlbum() method to JFacebookUser. Make some fixes.

Add getCheckins() method to JFacebookUser.

Add createCheckin() method to JFacebookUser. Modify the sendRequest()
method in order to specify the http request method.

Add getLikes() method to JFacebookUser.

Add likesPage() method to JFacebookUser.

Add getEvents() method to JFacebookUser.

Add createEvent() method to JFacebookUser

Add editEvent() method to JFacebookUser.

Add deleteEvent() method to JFacebookUser.

Add getGroups() method to JFacebookUser.

Add getLinks() method to JFacebookUser

Add createLink() method to JFacebookUser.

Add getNotes() method to JFacebookUser.

Add createNote() method to JFacebookUser.

Add getPhotos() method to JFacebookUser.

Testing createPhoto() method, JFacebookUser.

Finish createPhoto() method. Add $headers parameter to the sendRequest()
method.

Small fixes.

Add getPosts() method to JFacebookUser.

Add createPost() to JFacebookUser.

Add deletePost() method to JFacebookUser.

Add getStatuses() method to JFacebookUser.

Add createStatus() method to JFacebookUser. Fix some mistakes.

Add deleteStatus() method to JFacebookUser.

Add getVideos() method to JFacebookUser.

Add createVideo() method to JFacebookUser.

Add getTagged() method to JFacebookUser.

Add getActivities() method to JFacebookUser.

Add getBooks() method to JFacebookUser.

Add getInterests() method to JFacebookUser.

Add getMovies() method to JFacebookUser.

Add getTelevision() method to JFacebookUser.

Add getMusic() method to JFacebookUser.

Add getSubscribers() method to JFacebookUser.

Add getSubscribedTo() method to JFacebookUser.

Add getFriendLists() to JFacebookUser.

Fix Code Style errors.
7852fcb
@dianaprajescu @dianaprajescu dianaprajescu Create JFacebookStatus
Add getComments() method to JFacebookStatus.

Add createComment() method to JFacebookStatus.

Add deleteComment() method to JFacebookStatus.

Add getLikes() method to JFacebookStatus.

Add createLike() method to JFacebookStatus.

Add deleteLike() method to JFacebookStatus.
21143da
@dianaprajescu @dianaprajescu dianaprajescu Create JFacebookCheckin
Add getComments to JFacebookCheckin.

Add createComment() method to JFacebookStatus.

Add deleteComment() to JFacebookCheckin

Finish JFacebookCheckin class.
0055140
@dianaprajescu @dianaprajescu dianaprajescu Create JFacebookEvent
Add getFeed() method to JFacebookEvent.

Add createLink() method to JFacebookEvent.

Add deleteLink() method to JFacebookEvent.

Add delete() method to JFacebookUser.

Add createPost() method to JFacebookEvent.

Add deletePost() method to JFacebookEvent.

Add createStatus() method to JFacebookEvent.

Add deleteStatus() method to JFacebookEvent.

Add getInvited() method to JFacebookEvent.

Add isInvited() method to JFacebookEvent.

Add createInvite() method to JFacebookEvent.

Add deleteInvite() method to JFacebookEvent.

Add getAttending() method to JFacebookEvent.

Add createAttending() method to JFacebookEvent.

Add isAttending() method to JFacebookEvent.

Add method for maybe attending to JFacebookEvent.

Add methods for declined to JFacebookEvent.

Add methods for noreply to JFacebookEvent.

Add omitted $type parameter to getPicture() method in JFacebookUser.

Add getPicture() method to JFacebookEvent.

Add getPhotos() method to JFacebookEvent.

Add createPhoto() method to JFacebookEvent.

Add getVideos() and createVideo() methods to JFacebookEvent.
3eabc41
@dianaprajescu @dianaprajescu dianaprajescu Coding style and other fixes.
Fix some code style errors. Add tests for JFacebook::__get() method.

Add omitted parameter $actions to createPost() method in JFacebookUser.

Align comments.
1ae7f23
@dianaprajescu @dianaprajescu dianaprajescu Create JFacebookGroup
Fix @return line in methods' doc block.

Add getFeed() method to JFacebookGroup.

Add createLink() method to JFacebookGroup.

Add deleteLink() method to JFacebookGroup.

Add createPost() method to JFacebookGroup.

Add deletePost() method to JFacebookGroup.

Add createStatus() method to JFacebookGroup.

Add deleteStatus() method to JFacebookGroup.

Add omitted parameter for createPost() method in JFacebookUser.

Add getMembers() method to JFacebookGroup.

Add getDocs() method to JFacebookGroup.

Add getPicture() method to JFacebookGroup.
69d8b2f
@dianaprajescu @dianaprajescu dianaprajescu Create JFacebookLink
Add getComments() method to JFacebookLink.

Add createComment() method to JFacebookLink.

Add deleteComment() method to JFacebookLink.

Add getLikes() method to JFacebookLink.

Add createLike() method to JFacebookLink.

Add deleteLike() method to JFacebookLink.
e334891
@dianaprajescu @dianaprajescu dianaprajescu Remove duplicated code + refinements.
Remove blank lines between method and its doc block.

Add get, getConnection, createConnection and deleteConnection to
JFacebookObject in order to replace the duplicate code.
bc905fc
@dianaprajescu @dianaprajescu dianaprajescu Write tests for JFacebookObject. db15d45
@dianaprajescu @dianaprajescu dianaprajescu Add fetchUrl() test. a9ad482
@dianaprajescu @dianaprajescu dianaprajescu JFacebookNote class. f89ca37
@dianaprajescu @dianaprajescu dianaprajescu JFacebookPost class. 8f334a3
@dianaprajescu @dianaprajescu dianaprajescu Change JFacebookGroup to use new methods from JFacebookObject. 14ca687
@dianaprajescu @dianaprajescu dianaprajescu Add JFacebookNoteTest. 75ddceb
@dianaprajescu @dianaprajescu dianaprajescu Add JFacebookPostTest. 83067db
@dianaprajescu @dianaprajescu dianaprajescu Add unit tests + fixes.
Correct @covers doc lines and some other small mistakes.

Add some tests in JFacebookTest
56df66e
@dianaprajescu @dianaprajescu dianaprajescu Add JFacebookComment. 4f17ce4
@dianaprajescu @dianaprajescu dianaprajescu Create JFacebookPhoto
Add getComments() method to JFacebookPhoto.

Add createComment() method to JFacebookPhoto.

Add deleteComment() method to JFacebookPhoto.

Add getLikes(), createLike() and deleteLike() methods to JFacebookPhoto.

Add getTags() method to JFacebookPhoto.

Add createTag() method to JFacebookPhoto

Add updateTag() method to JFacebookPhoto.

Add getPicture() method to JFacebookPhoto + small fixes.
57a7030
@dianaprajescu @dianaprajescu dianaprajescu Add JFacebookVideo. 9024518
@dianaprajescu @dianaprajescu dianaprajescu Create JFacebookAlbum
Add getPhotos() method to JFacebookAlbum.

Add createPhoto() method to JFacebookAlbum

Add getComments(), createComment() and deleteComment() methods to
JFacebookAlbum.

Add getLikes(), createLike() and deleteLike() methods to JFacebookAlbum.

Add getPicture() method to JFacebookAlbum.
c75a5ae
@dianaprajescu @dianaprajescu dianaprajescu Updates. Fixes. Improvements.
Update event object.

Update status object.

Update user object. Make some fixes.

Add some @covers doc lines.

Facebook documentation.

Edit fb doc.

Add getHome() method to JFacebookUser.

Add @param lines to testGetHome() method in JFacebookUserTest.

Use limit, offset, until and since to filter data.

Fix code style errors

Use limit, offset, until and since with Album object.

Use limit, offset, until and since with Checkin object.

Use limit, offset, until and since with Comment object.

Use limit, offset, until and since with Event object.

User limit, offset, until and since with Group object.

Use limit, offset, until and since with Link object

Use limit, offset, until and since with Note object.

Use limit, offset, until and since with Photo object.

Use limit, offset, until and since with Post object.

Use limit, offset, until and since with Status object.

Use limit, offset, until and since with Video object.

Use limit, offset, until and since with User object.

Fix some code style errors.

JFacebookOAuth improvements.

JOauth

Remove print_r.

Change @since tag + spell check.

Testing Aaron's OAuth2client.

Make JFacebookUser work with JOauth2client.

JFacebook changes to include JOauth2client

Use Oauth client in unit test + refinements.

Split JOauth 1.0a client code.

Add JInput object to JOauth1aClient + Unit tests.

Get JHttp from Factory.

Session in tests

Fix test session

Destroy session when test ends

Move session destroy in teardown

Update strings to test ones

Change since tag to 12.2

Just for testing purpose

Add is_null in if condition

Update if condition with is_null

Change setToken method, throw $verifier for testing.

Set verifier to null

Use empty instead of isset.

Set input just before calling auth method.

Test input oauth_token value.

Update the input in test

Use strcmp

Add sprintf

Format string for testing.

Set input as value using reflection

Update test

Change 'key' to 'token'

Add if condition for throwing bad session

Remove empty from if condition.

Change DomainException message.

Rename file.

Add blank line before comment.

Update documentation.

Fix filename issue.

Set follow redirect to false if necessary.

Test curl.

Fix unit tests http problem. Remove http class.

Update the oauth 2 client. Use isAuth method.

Rename variable and some small fixes.

Use JRegistry def method.

Rename file to match oauth 2 client.

Rename test files too.

Change if condition.

Remove unnecessary condition.

Improve code coverage.

Remove unused method. Use 'scope' JRegistry option.

Rename auth method to authenticate.

Rename auth to atuhenicate and isAuth to isAuthenticated.

Revert "Rename auth to atuhenicate and isAuth to isAuthenticated."

This reverts commit 72aa0a87bf168dfe0025d7316b99aa148be9f3e0.

Remove file.

Rename method.

Add redirect parameter.

Use JApplication::redirect() instead of JResponse.

Rename files.

Fix unit tests.

Change since tag

Move the OAuth client object into JFacebookObject.

Fix CS errors.

Update since tag.

Fix CS errors.

Change facebook documentation file.

Update docs/manual/en-US/chapters/packages/facebook.md

Remove unecessary oauth.
c4caceb
Contributor

Does this rely on your oauth1 client?

Sent from my iPhone

On Jan 17, 2013, at 5:16 PM, Diana Prajescu notifications@github.com wrote:

I just squashed some commits. Please let me know if there is anything else to do in order to get this merged.


Reply to this email directly or view it on GitHub.

Contributor

No, this is using OAuth2 client which already is in the platform.

@eddieajau eddieajau merged commit 5caea36 into joomla:staging Mar 16, 2013
Contributor

Diana, let's have a talk someday about getting these package into the Framework too.

Contributor

I looked over JGoogle and it doesn't seem much to change, but I'm not sure of this. I'm going through a busy period since I'm about to finish the University and I'm also working on a start-up. I can't promise to get this done very soon, but I talked with @elinw and I think she wants to do it.

Contributor

There's no hurry Diana. In terms of time frame I'm thinking sometime before the end of the year. If you want, put an issue on the tracker and we can schedule if for Q2, Q3 or Q4.

See https://github.com/joomla/joomla-framework/issues/milestones

Contributor

Just opened an issue: joomla/joomla-framework#83

Schedule it for Q3 just in case, and I'll let you know if I finish it until Q2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment