{"action":"opened","number":6,"pull_request":{"url":"https://api.github.com/repos/BrennanAyers/rales_engine/pulls/6","id":292999713,"node_id":"MDExOlB1bGxSZXF1ZXN0MjkyOTk5NzEz","html_url":"https://github.com/BrennanAyers/rales_engine/pull/6","diff_url":"https://github.com/BrennanAyers/rales_engine/pull/6.diff","patch_url":"https://github.com/BrennanAyers/rales_engine/pull/6.patch","issue_url":"https://api.github.com/repos/BrennanAyers/rales_engine/issues/6","number":6,"state":"open","locked":false,"title":"All Merchants Business Intelligence","user":{"login":"BrennanAyers","id":45154998,"node_id":"MDQ6VXNlcjQ1MTU0OTk4","avatar_url":"https://avatars0.githubusercontent.com/u/45154998?v=4","gravatar_id":"","url":"https://api.github.com/users/BrennanAyers","html_url":"https://github.com/BrennanAyers","followers_url":"https://api.github.com/users/BrennanAyers/followers","following_url":"https://api.github.com/users/BrennanAyers/following{/other_user}","gists_url":"https://api.github.com/users/BrennanAyers/gists{/gist_id}","starred_url":"https://api.github.com/users/BrennanAyers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrennanAyers/subscriptions","organizations_url":"https://api.github.com/users/BrennanAyers/orgs","repos_url":"https://api.github.com/users/BrennanAyers/repos","events_url":"https://api.github.com/users/BrennanAyers/events{/privacy}","received_events_url":"https://api.github.com/users/BrennanAyers/received_events","type":"User","site_admin":false},"body":"This PR brings in the functionality of 3 new endpoints providing business logic. These endpoints are for information from the Merchants table, taking into account all of the merchants in our system.\r\n\r\n- Most Revenue\r\n- - This endpoint will take a parameter of `quantity` and return a list of Merchants, limited by the quantity and then sorted by Most to Least revenue. With no parameter, it will return all Merchants.\r\n- Most Items\r\n- - This endpoint will take a parameter of `quantity` and return a list of Merchants, limited by the quantity and then sorted by Most to Least items. With no parameter, it will return all Merchants.\r\n- Revenue\r\n- - This endpoint will take a parameter of `date` and return a __dollar__ value of all invoices from day. With no parameter, it will return the value for invoices for _today_.\r\n- - This endpoint required a new Serializer, since the output of Total Revenue did not correspond to any existing resources in our database. While we may be calling the method on the Merchant table, the JSON output should not contain any other Merchant information other than Total Revenue.\r\n\r\nThis PR also brings in the scope for Transactions of `successful` to filter them for their result = 'success'. We use this in all of the above endpoints to ensure that our results are only based on Invoices that are completed. \r\nThe formatting of Unit Prices on Items and Invoice Items was also another concern handled in the process of creating these endpoints. In the situation where a price/revenue (in cents) ends in 0, the output would render as `10.0` instead of `10.00` like it should have. We added a round to the second decimal to resolve this, which also carried over to the Revenue endpoint output.","created_at":"2019-06-29T00:18:25Z","updated_at":"2019-06-29T00:18:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/BrennanAyers/rales_engine/pulls/6/commits","review_comments_url":"https://api.github.com/repos/BrennanAyers/rales_engine/pulls/6/comments","review_comment_url":"https://api.github.com/repos/BrennanAyers/rales_engine/pulls/comments{/number}","comments_url":"https://api.github.com/repos/BrennanAyers/rales_engine/issues/6/comments","statuses_url":"https://api.github.com/repos/BrennanAyers/rales_engine/statuses/5459c847405769dfe44fece6e7343bd6433b51f6","head":{"label":"BrennanAyers:all_merchants_business_intel","ref":"all_merchants_business_intel","sha":"5459c847405769dfe44fece6e7343bd6433b51f6","user":{"login":"BrennanAyers","id":45154998,"node_id":"MDQ6VXNlcjQ1MTU0OTk4","avatar_url":"https://avatars0.githubusercontent.com/u/45154998?v=4","gravatar_id":"","url":"https://api.github.com/users/BrennanAyers","html_url":"https://github.com/BrennanAyers","followers_url":"https://api.github.com/users/BrennanAyers/followers","following_url":"https://api.github.com/users/BrennanAyers/following{/other_user}","gists_url":"https://api.github.com/users/BrennanAyers/gists{/gist_id}","starred_url":"https://api.github.com/users/BrennanAyers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrennanAyers/subscriptions","organizations_url":"https://api.github.com/users/BrennanAyers/orgs","repos_url":"https://api.github.com/users/BrennanAyers/repos","events_url":"https://api.github.com/users/BrennanAyers/events{/privacy}","received_events_url":"https://api.github.com/users/BrennanAyers/received_events","type":"User","site_admin":false},"repo":{"id":193594885,"node_id":"MDEwOlJlcG9zaXRvcnkxOTM1OTQ4ODU=","name":"rales_engine","full_name":"BrennanAyers/rales_engine","private":false,"owner":{"login":"BrennanAyers","id":45154998,"node_id":"MDQ6VXNlcjQ1MTU0OTk4","avatar_url":"https://avatars0.githubusercontent.com/u/45154998?v=4","gravatar_id":"","url":"https://api.github.com/users/BrennanAyers","html_url":"https://github.com/BrennanAyers","followers_url":"https://api.github.com/users/BrennanAyers/followers","following_url":"https://api.github.com/users/BrennanAyers/following{/other_user}","gists_url":"https://api.github.com/users/BrennanAyers/gists{/gist_id}","starred_url":"https://api.github.com/users/BrennanAyers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrennanAyers/subscriptions","organizations_url":"https://api.github.com/users/BrennanAyers/orgs","repos_url":"https://api.github.com/users/BrennanAyers/repos","events_url":"https://api.github.com/users/BrennanAyers/events{/privacy}","received_events_url":"https://api.github.com/users/BrennanAyers/received_events","type":"User","site_admin":false},"html_url":"https://github.com/BrennanAyers/rales_engine","description":"ECommerce style API project using Ruby on Rails","fork":false,"url":"https://api.github.com/repos/BrennanAyers/rales_engine","forks_url":"https://api.github.com/repos/BrennanAyers/rales_engine/forks","keys_url":"https://api.github.com/repos/BrennanAyers/rales_engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BrennanAyers/rales_engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BrennanAyers/rales_engine/teams","hooks_url":"https://api.github.com/repos/BrennanAyers/rales_engine/hooks","issue_events_url":"https://api.github.com/repos/BrennanAyers/rales_engine/issues/events{/number}","events_url":"https://api.github.com/repos/BrennanAyers/rales_engine/events","assignees_url":"https://api.github.com/repos/BrennanAyers/rales_engine/assignees{/user}","branches_url":"https://api.github.com/repos/BrennanAyers/rales_engine/branches{/branch}","tags_url":"https://api.github.com/repos/BrennanAyers/rales_engine/tags","blobs_url":"https://api.github.com/repos/BrennanAyers/rales_engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BrennanAyers/rales_engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BrennanAyers/rales_engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/BrennanAyers/rales_engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BrennanAyers/rales_engine/statuses/{sha}","languages_url":"https://api.github.com/repos/BrennanAyers/rales_engine/languages","stargazers_url":"https://api.github.com/repos/BrennanAyers/rales_engine/stargazers","contributors_url":"https://api.github.com/repos/BrennanAyers/rales_engine/contributors","subscribers_url":"https://api.github.com/repos/BrennanAyers/rales_engine/subscribers","subscription_url":"https://api.github.com/repos/BrennanAyers/rales_engine/subscription","commits_url":"https://api.github.com/repos/BrennanAyers/rales_engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/BrennanAyers/rales_engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/BrennanAyers/rales_engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/BrennanAyers/rales_engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/BrennanAyers/rales_engine/contents/{+path}","compare_url":"https://api.github.com/repos/BrennanAyers/rales_engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BrennanAyers/rales_engine/merges","archive_url":"https://api.github.com/repos/BrennanAyers/rales_engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BrennanAyers/rales_engine/downloads","issues_url":"https://api.github.com/repos/BrennanAyers/rales_engine/issues{/number}","pulls_url":"https://api.github.com/repos/BrennanAyers/rales_engine/pulls{/number}","milestones_url":"https://api.github.com/repos/BrennanAyers/rales_engine/milestones{/number}","notifications_url":"https://api.github.com/repos/BrennanAyers/rales_engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BrennanAyers/rales_engine/labels{/name}","releases_url":"https://api.github.com/repos/BrennanAyers/rales_engine/releases{/id}","deployments_url":"https://api.github.com/repos/BrennanAyers/rales_engine/deployments","created_at":"2019-06-24T23:21:59Z","updated_at":"2019-06-26T23:25:50Z","pushed_at":"2019-06-29T00:14:29Z","git_url":"git://github.com/BrennanAyers/rales_engine.git","ssh_url":"git@github.com:BrennanAyers/rales_engine.git","clone_url":"https://github.com/BrennanAyers/rales_engine.git","svn_url":"https://github.com/BrennanAyers/rales_engine","homepage":"","size":597,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"BrennanAyers:master","ref":"master","sha":"6e01580fa0173d702c3ca9bb7c9fe44ab7fdd390","user":{"login":"BrennanAyers","id":45154998,"node_id":"MDQ6VXNlcjQ1MTU0OTk4","avatar_url":"https://avatars0.githubusercontent.com/u/45154998?v=4","gravatar_id":"","url":"https://api.github.com/users/BrennanAyers","html_url":"https://github.com/BrennanAyers","followers_url":"https://api.github.com/users/BrennanAyers/followers","following_url":"https://api.github.com/users/BrennanAyers/following{/other_user}","gists_url":"https://api.github.com/users/BrennanAyers/gists{/gist_id}","starred_url":"https://api.github.com/users/BrennanAyers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrennanAyers/subscriptions","organizations_url":"https://api.github.com/users/BrennanAyers/orgs","repos_url":"https://api.github.com/users/BrennanAyers/repos","events_url":"https://api.github.com/users/BrennanAyers/events{/privacy}","received_events_url":"https://api.github.com/users/BrennanAyers/received_events","type":"User","site_admin":false},"repo":{"id":193594885,"node_id":"MDEwOlJlcG9zaXRvcnkxOTM1OTQ4ODU=","name":"rales_engine","full_name":"BrennanAyers/rales_engine","private":false,"owner":{"login":"BrennanAyers","id":45154998,"node_id":"MDQ6VXNlcjQ1MTU0OTk4","avatar_url":"https://avatars0.githubusercontent.com/u/45154998?v=4","gravatar_id":"","url":"https://api.github.com/users/BrennanAyers","html_url":"https://github.com/BrennanAyers","followers_url":"https://api.github.com/users/BrennanAyers/followers","following_url":"https://api.github.com/users/BrennanAyers/following{/other_user}","gists_url":"https://api.github.com/users/BrennanAyers/gists{/gist_id}","starred_url":"https://api.github.com/users/BrennanAyers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrennanAyers/subscriptions","organizations_url":"https://api.github.com/users/BrennanAyers/orgs","repos_url":"https://api.github.com/users/BrennanAyers/repos","events_url":"https://api.github.com/users/BrennanAyers/events{/privacy}","received_events_url":"https://api.github.com/users/BrennanAyers/received_events","type":"User","site_admin":false},"html_url":"https://github.com/BrennanAyers/rales_engine","description":"ECommerce style API project using Ruby on Rails","fork":false,"url":"https://api.github.com/repos/BrennanAyers/rales_engine","forks_url":"https://api.github.com/repos/BrennanAyers/rales_engine/forks","keys_url":"https://api.github.com/repos/BrennanAyers/rales_engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BrennanAyers/rales_engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BrennanAyers/rales_engine/teams","hooks_url":"https://api.github.com/repos/BrennanAyers/rales_engine/hooks","issue_events_url":"https://api.github.com/repos/BrennanAyers/rales_engine/issues/events{/number}","events_url":"https://api.github.com/repos/BrennanAyers/rales_engine/events","assignees_url":"https://api.github.com/repos/BrennanAyers/rales_engine/assignees{/user}","branches_url":"https://api.github.com/repos/BrennanAyers/rales_engine/branches{/branch}","tags_url":"https://api.github.com/repos/BrennanAyers/rales_engine/tags","blobs_url":"https://api.github.com/repos/BrennanAyers/rales_engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BrennanAyers/rales_engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BrennanAyers/rales_engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/BrennanAyers/rales_engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BrennanAyers/rales_engine/statuses/{sha}","languages_url":"https://api.github.com/repos/BrennanAyers/rales_engine/languages","stargazers_url":"https://api.github.com/repos/BrennanAyers/rales_engine/stargazers","contributors_url":"https://api.github.com/repos/BrennanAyers/rales_engine/contributors","subscribers_url":"https://api.github.com/repos/BrennanAyers/rales_engine/subscribers","subscription_url":"https://api.github.com/repos/BrennanAyers/rales_engine/subscription","commits_url":"https://api.github.com/repos/BrennanAyers/rales_engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/BrennanAyers/rales_engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/BrennanAyers/rales_engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/BrennanAyers/rales_engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/BrennanAyers/rales_engine/contents/{+path}","compare_url":"https://api.github.com/repos/BrennanAyers/rales_engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BrennanAyers/rales_engine/merges","archive_url":"https://api.github.com/repos/BrennanAyers/rales_engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BrennanAyers/rales_engine/downloads","issues_url":"https://api.github.com/repos/BrennanAyers/rales_engine/issues{/number}","pulls_url":"https://api.github.com/repos/BrennanAyers/rales_engine/pulls{/number}","milestones_url":"https://api.github.com/repos/BrennanAyers/rales_engine/milestones{/number}","notifications_url":"https://api.github.com/repos/BrennanAyers/rales_engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BrennanAyers/rales_engine/labels{/name}","releases_url":"https://api.github.com/repos/BrennanAyers/rales_engine/releases{/id}","deployments_url":"https://api.github.com/repos/BrennanAyers/rales_engine/deployments","created_at":"2019-06-24T23:21:59Z","updated_at":"2019-06-26T23:25:50Z","pushed_at":"2019-06-29T00:14:29Z","git_url":"git://github.com/BrennanAyers/rales_engine.git","ssh_url":"git@github.com:BrennanAyers/rales_engine.git","clone_url":"https://github.com/BrennanAyers/rales_engine.git","svn_url":"https://github.com/BrennanAyers/rales_engine","homepage":"","size":597,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/BrennanAyers/rales_engine/pulls/6"},"html":{"href":"https://github.com/BrennanAyers/rales_engine/pull/6"},"issue":{"href":"https://api.github.com/repos/BrennanAyers/rales_engine/issues/6"},"comments":{"href":"https://api.github.com/repos/BrennanAyers/rales_engine/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/BrennanAyers/rales_engine/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/BrennanAyers/rales_engine/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/BrennanAyers/rales_engine/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/BrennanAyers/rales_engine/statuses/5459c847405769dfe44fece6e7343bd6433b51f6"}},"author_association":"OWNER","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":31,"additions":322,"deletions":6,"changed_files":16}}
{"actor":{"display_login":"BrennanAyers"}}