{"action":"created","comment":{"url":"https://api.github.com/repos/namely/connect/pulls/comments/23184054","id":23184054,"diff_hunk":"@@ -0,0 +1,9 @@\n+module Connect \n+  module Users\n+    class TokenExpiry","path":"app/connect/users/token_expiry.rb","position":3,"original_position":3,"commit_id":"1d052abff97bc3c88b028d3d68d4c5efae755f0e","original_commit_id":"1d052abff97bc3c88b028d3d68d4c5efae755f0e","user":{"login":"cored","id":11719,"avatar_url":"https://avatars.githubusercontent.com/u/11719?v=3","gravatar_id":"","url":"https://api.github.com/users/cored","html_url":"https://github.com/cored","followers_url":"https://api.github.com/users/cored/followers","following_url":"https://api.github.com/users/cored/following{/other_user}","gists_url":"https://api.github.com/users/cored/gists{/gist_id}","starred_url":"https://api.github.com/users/cored/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cored/subscriptions","organizations_url":"https://api.github.com/users/cored/orgs","repos_url":"https://api.github.com/users/cored/repos","events_url":"https://api.github.com/users/cored/events{/privacy}","received_events_url":"https://api.github.com/users/cored/received_events","type":"User","site_admin":false},"body":"@naush From my point of view ```app/connect``` suggest more business logic than ```app/lib``` because it's catch the attention of the developer faster ``lib`` can make some confusion with ```/lib```. Also trying to make things explicit in which we have the business logic by just looking at the directory structure. \r\n\r\n-> https://www.youtube.com/watch?v=WpkDN78P884","created_at":"2015-01-19T20:18:16Z","updated_at":"2015-01-19T20:18:16Z","html_url":"https://github.com/namely/connect/pull/41#discussion_r23184054","pull_request_url":"https://api.github.com/repos/namely/connect/pulls/41","_links":{"self":{"href":"https://api.github.com/repos/namely/connect/pulls/comments/23184054"},"html":{"href":"https://github.com/namely/connect/pull/41#discussion_r23184054"},"pull_request":{"href":"https://api.github.com/repos/namely/connect/pulls/41"}}},"pull_request":{"url":"https://api.github.com/repos/namely/connect/pulls/41","id":27131117,"html_url":"https://github.com/namely/connect/pull/41","diff_url":"https://github.com/namely/connect/pull/41.diff","patch_url":"https://github.com/namely/connect/pull/41.patch","issue_url":"https://api.github.com/repos/namely/connect/issues/41","number":41,"state":"open","locked":false,"title":"Hotfix/directory restructure","user":{"login":"cored","id":11719,"avatar_url":"https://avatars.githubusercontent.com/u/11719?v=3","gravatar_id":"","url":"https://api.github.com/users/cored","html_url":"https://github.com/cored","followers_url":"https://api.github.com/users/cored/followers","following_url":"https://api.github.com/users/cored/following{/other_user}","gists_url":"https://api.github.com/users/cored/gists{/gist_id}","starred_url":"https://api.github.com/users/cored/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cored/subscriptions","organizations_url":"https://api.github.com/users/cored/orgs","repos_url":"https://api.github.com/users/cored/repos","events_url":"https://api.github.com/users/cored/events{/privacy}","received_events_url":"https://api.github.com/users/cored/received_events","type":"User","site_admin":false},"body":"This is an experiment and open for discussion; my intention is to extract as much business logic that is couple to some entities in the system for instance ```User``` model. I got into this path of thought due to an error that the current test suite was hiding from us because of the mocking. If we start to use more isolated classes that iterate with each other we are going to be able to test this type of edge without mocking and reduce the brittleness of the specs. \r\n\r\nThis is the list I would like to experiment with in this branch for this project: \r\n- [x] Directory for putting business logic ```/app/connect```\r\n- [x] Directory for putting generic code which can then be extracted to be use as open source library ```/lib/connect```\r\n- [x] Always use the ```Connect``` namespace; advantage of this would be to reuse common names for value or service objects. \r\n- [x] Namespace for use cases classes example ```Connect::Users```\r\n- [ ] Remove business logic from models and use services instead; just put persistence logic inside AR models\r\n- [ ] Test in isolation the business logic do integration test for AR models and feature specs\r\n- [x] Decorate objects for adding new behavior - example ```Connect::Users::UserWithFullName```\r\n- [x] For isolation testing use ```spec_helper``` for integration testing use ```rails_helper```","created_at":"2015-01-09T21:36:34Z","updated_at":"2015-01-19T20:18:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3a0e2f0c07cbc2c3307782a706012e03f7f05c08","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/namely/connect/pulls/41/commits","review_comments_url":"https://api.github.com/repos/namely/connect/pulls/41/comments","review_comment_url":"https://api.github.com/repos/namely/connect/pulls/comments/{number}","comments_url":"https://api.github.com/repos/namely/connect/issues/41/comments","statuses_url":"https://api.github.com/repos/namely/connect/statuses/1d052abff97bc3c88b028d3d68d4c5efae755f0e","head":{"label":"cored:hotfix/directory-restructure","ref":"hotfix/directory-restructure","sha":"1d052abff97bc3c88b028d3d68d4c5efae755f0e","user":{"login":"cored","id":11719,"avatar_url":"https://avatars.githubusercontent.com/u/11719?v=3","gravatar_id":"","url":"https://api.github.com/users/cored","html_url":"https://github.com/cored","followers_url":"https://api.github.com/users/cored/followers","following_url":"https://api.github.com/users/cored/following{/other_user}","gists_url":"https://api.github.com/users/cored/gists{/gist_id}","starred_url":"https://api.github.com/users/cored/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cored/subscriptions","organizations_url":"https://api.github.com/users/cored/orgs","repos_url":"https://api.github.com/users/cored/repos","events_url":"https://api.github.com/users/cored/events{/privacy}","received_events_url":"https://api.github.com/users/cored/received_events","type":"User","site_admin":false},"repo":{"id":28971123,"name":"connect","full_name":"cored/connect","owner":{"login":"cored","id":11719,"avatar_url":"https://avatars.githubusercontent.com/u/11719?v=3","gravatar_id":"","url":"https://api.github.com/users/cored","html_url":"https://github.com/cored","followers_url":"https://api.github.com/users/cored/followers","following_url":"https://api.github.com/users/cored/following{/other_user}","gists_url":"https://api.github.com/users/cored/gists{/gist_id}","starred_url":"https://api.github.com/users/cored/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cored/subscriptions","organizations_url":"https://api.github.com/users/cored/orgs","repos_url":"https://api.github.com/users/cored/repos","events_url":"https://api.github.com/users/cored/events{/privacy}","received_events_url":"https://api.github.com/users/cored/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cored/connect","description":"Namely Connect – Integrate with Namely.","fork":true,"url":"https://api.github.com/repos/cored/connect","forks_url":"https://api.github.com/repos/cored/connect/forks","keys_url":"https://api.github.com/repos/cored/connect/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cored/connect/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cored/connect/teams","hooks_url":"https://api.github.com/repos/cored/connect/hooks","issue_events_url":"https://api.github.com/repos/cored/connect/issues/events{/number}","events_url":"https://api.github.com/repos/cored/connect/events","assignees_url":"https://api.github.com/repos/cored/connect/assignees{/user}","branches_url":"https://api.github.com/repos/cored/connect/branches{/branch}","tags_url":"https://api.github.com/repos/cored/connect/tags","blobs_url":"https://api.github.com/repos/cored/connect/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cored/connect/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cored/connect/git/refs{/sha}","trees_url":"https://api.github.com/repos/cored/connect/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cored/connect/statuses/{sha}","languages_url":"https://api.github.com/repos/cored/connect/languages","stargazers_url":"https://api.github.com/repos/cored/connect/stargazers","contributors_url":"https://api.github.com/repos/cored/connect/contributors","subscribers_url":"https://api.github.com/repos/cored/connect/subscribers","subscription_url":"https://api.github.com/repos/cored/connect/subscription","commits_url":"https://api.github.com/repos/cored/connect/commits{/sha}","git_commits_url":"https://api.github.com/repos/cored/connect/git/commits{/sha}","comments_url":"https://api.github.com/repos/cored/connect/comments{/number}","issue_comment_url":"https://api.github.com/repos/cored/connect/issues/comments/{number}","contents_url":"https://api.github.com/repos/cored/connect/contents/{+path}","compare_url":"https://api.github.com/repos/cored/connect/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cored/connect/merges","archive_url":"https://api.github.com/repos/cored/connect/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cored/connect/downloads","issues_url":"https://api.github.com/repos/cored/connect/issues{/number}","pulls_url":"https://api.github.com/repos/cored/connect/pulls{/number}","milestones_url":"https://api.github.com/repos/cored/connect/milestones{/number}","notifications_url":"https://api.github.com/repos/cored/connect/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cored/connect/labels{/name}","releases_url":"https://api.github.com/repos/cored/connect/releases{/id}","created_at":"2015-01-08T15:06:40Z","updated_at":"2015-01-08T15:06:41Z","pushed_at":"2015-01-16T22:12:39Z","git_url":"git://github.com/cored/connect.git","ssh_url":"git@github.com:cored/connect.git","clone_url":"https://github.com/cored/connect.git","svn_url":"https://github.com/cored/connect","homepage":"","size":400,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"namely:master","ref":"master","sha":"a0d4bac6f0b594c149e3f11b1142b14eeab32e44","user":{"login":"namely","id":1004321,"avatar_url":"https://avatars.githubusercontent.com/u/1004321?v=3","gravatar_id":"","url":"https://api.github.com/users/namely","html_url":"https://github.com/namely","followers_url":"https://api.github.com/users/namely/followers","following_url":"https://api.github.com/users/namely/following{/other_user}","gists_url":"https://api.github.com/users/namely/gists{/gist_id}","starred_url":"https://api.github.com/users/namely/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/namely/subscriptions","organizations_url":"https://api.github.com/users/namely/orgs","repos_url":"https://api.github.com/users/namely/repos","events_url":"https://api.github.com/users/namely/events{/privacy}","received_events_url":"https://api.github.com/users/namely/received_events","type":"Organization","site_admin":false},"repo":{"id":26101808,"name":"connect","full_name":"namely/connect","owner":{"login":"namely","id":1004321,"avatar_url":"https://avatars.githubusercontent.com/u/1004321?v=3","gravatar_id":"","url":"https://api.github.com/users/namely","html_url":"https://github.com/namely","followers_url":"https://api.github.com/users/namely/followers","following_url":"https://api.github.com/users/namely/following{/other_user}","gists_url":"https://api.github.com/users/namely/gists{/gist_id}","starred_url":"https://api.github.com/users/namely/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/namely/subscriptions","organizations_url":"https://api.github.com/users/namely/orgs","repos_url":"https://api.github.com/users/namely/repos","events_url":"https://api.github.com/users/namely/events{/privacy}","received_events_url":"https://api.github.com/users/namely/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/namely/connect","description":"Namely Connect – Integrate with Namely.","fork":false,"url":"https://api.github.com/repos/namely/connect","forks_url":"https://api.github.com/repos/namely/connect/forks","keys_url":"https://api.github.com/repos/namely/connect/keys{/key_id}","collaborators_url":"https://api.github.com/repos/namely/connect/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/namely/connect/teams","hooks_url":"https://api.github.com/repos/namely/connect/hooks","issue_events_url":"https://api.github.com/repos/namely/connect/issues/events{/number}","events_url":"https://api.github.com/repos/namely/connect/events","assignees_url":"https://api.github.com/repos/namely/connect/assignees{/user}","branches_url":"https://api.github.com/repos/namely/connect/branches{/branch}","tags_url":"https://api.github.com/repos/namely/connect/tags","blobs_url":"https://api.github.com/repos/namely/connect/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/namely/connect/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/namely/connect/git/refs{/sha}","trees_url":"https://api.github.com/repos/namely/connect/git/trees{/sha}","statuses_url":"https://api.github.com/repos/namely/connect/statuses/{sha}","languages_url":"https://api.github.com/repos/namely/connect/languages","stargazers_url":"https://api.github.com/repos/namely/connect/stargazers","contributors_url":"https://api.github.com/repos/namely/connect/contributors","subscribers_url":"https://api.github.com/repos/namely/connect/subscribers","subscription_url":"https://api.github.com/repos/namely/connect/subscription","commits_url":"https://api.github.com/repos/namely/connect/commits{/sha}","git_commits_url":"https://api.github.com/repos/namely/connect/git/commits{/sha}","comments_url":"https://api.github.com/repos/namely/connect/comments{/number}","issue_comment_url":"https://api.github.com/repos/namely/connect/issues/comments/{number}","contents_url":"https://api.github.com/repos/namely/connect/contents/{+path}","compare_url":"https://api.github.com/repos/namely/connect/compare/{base}...{head}","merges_url":"https://api.github.com/repos/namely/connect/merges","archive_url":"https://api.github.com/repos/namely/connect/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/namely/connect/downloads","issues_url":"https://api.github.com/repos/namely/connect/issues{/number}","pulls_url":"https://api.github.com/repos/namely/connect/pulls{/number}","milestones_url":"https://api.github.com/repos/namely/connect/milestones{/number}","notifications_url":"https://api.github.com/repos/namely/connect/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/namely/connect/labels{/name}","releases_url":"https://api.github.com/repos/namely/connect/releases{/id}","created_at":"2014-11-03T03:10:16Z","updated_at":"2015-01-14T16:02:52Z","pushed_at":"2015-01-14T16:02:52Z","git_url":"git://github.com/namely/connect.git","ssh_url":"git@github.com:namely/connect.git","clone_url":"https://github.com/namely/connect.git","svn_url":"https://github.com/namely/connect","homepage":"","size":2311,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/namely/connect/pulls/41"},"html":{"href":"https://github.com/namely/connect/pull/41"},"issue":{"href":"https://api.github.com/repos/namely/connect/issues/41"},"comments":{"href":"https://api.github.com/repos/namely/connect/issues/41/comments"},"review_comments":{"href":"https://api.github.com/repos/namely/connect/pulls/41/comments"},"review_comment":{"href":"https://api.github.com/repos/namely/connect/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/namely/connect/pulls/41/commits"},"statuses":{"href":"https://api.github.com/repos/namely/connect/statuses/1d052abff97bc3c88b028d3d68d4c5efae755f0e"}}}}