{"action":"created","comment":{"url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/pulls/comments/40853146","id":40853146,"diff_hunk":"@@ -1,17 +1,23 @@\n-class DigestMailer < ActionMailer::Base\n-  default from: ENV[\"MAIL_NOTIFICATION\"]\n+class DigestMailer < ApplicationMailer\n+  default template_path: 'digest_mailer'\n+  default template_name: 'digest_mailer'\n \n-  # Subject can be set in your I18n file at config/locales/en.yml\n-  # with the following lookup:\n-  #\n-  # en.digest_mailer.daily_digest.subject\n+  def digest_mailer(history, user_id)\n+    @user = User.find user_id\n+    @posts = posts_to_email(history)\n+    @history = history\n+    attachments.inline[\"header_#{history.frequency}.png\"] =\n+      File.read(\"#{Rails.root}/app/assets/images/header_#{history.frequency}.png\")\n+    attachments.inline['footer.png'] =\n+      File.read(\"#{Rails.root}/app/assets/images/footer.png\")\n+    mail(to: @user.email, subject: \"RubyGameDev.com #{history.frequency} digest\")\n+  end\n+\n+  private\n \n-  def daily_digest(history, user)\n-    @discussions = history.discussions\n-    @tutorials = history.tutorials\n-    @libraries = history.libraries\n-    @new_users_count = User.count - history.users_count\n-    @user = user\n-    mail to: user.email, subject: 'RubyGameDev.com Daily Digest'\n+  def posts_to_email(history)","path":"app/mailers/digest_mailer.rb","position":31,"original_position":31,"commit_id":"b2e46c3772f45a7be458865be7f8f91dff9796ae","original_commit_id":"b2e46c3772f45a7be458865be7f8f91dff9796ae","user":{"login":"andrewhavens","id":446392,"avatar_url":"https://avatars.githubusercontent.com/u/446392?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewhavens","html_url":"https://github.com/andrewhavens","followers_url":"https://api.github.com/users/andrewhavens/followers","following_url":"https://api.github.com/users/andrewhavens/following{/other_user}","gists_url":"https://api.github.com/users/andrewhavens/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewhavens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewhavens/subscriptions","organizations_url":"https://api.github.com/users/andrewhavens/orgs","repos_url":"https://api.github.com/users/andrewhavens/repos","events_url":"https://api.github.com/users/andrewhavens/events{/privacy}","received_events_url":"https://api.github.com/users/andrewhavens/received_events","type":"User","site_admin":false},"body":"move this logic into the DigestHistory so that you can call `history.posts` instead of `posts_to_email(history)`","created_at":"2015-09-30T21:17:01Z","updated_at":"2015-09-30T21:17:01Z","html_url":"https://github.com/ruby-rcade/RubyGameDev.com/pull/63#discussion_r40853146","pull_request_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/pulls/63","_links":{"self":{"href":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/pulls/comments/40853146"},"html":{"href":"https://github.com/ruby-rcade/RubyGameDev.com/pull/63#discussion_r40853146"},"pull_request":{"href":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/pulls/63"}}},"pull_request":{"url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/pulls/63","id":44269520,"html_url":"https://github.com/ruby-rcade/RubyGameDev.com/pull/63","diff_url":"https://github.com/ruby-rcade/RubyGameDev.com/pull/63.diff","patch_url":"https://github.com/ruby-rcade/RubyGameDev.com/pull/63.patch","issue_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/issues/63","number":63,"state":"open","locked":false,"title":"Feature implement digest email","user":{"login":"KarenVentura","id":11162514,"avatar_url":"https://avatars.githubusercontent.com/u/11162514?v=3","gravatar_id":"","url":"https://api.github.com/users/KarenVentura","html_url":"https://github.com/KarenVentura","followers_url":"https://api.github.com/users/KarenVentura/followers","following_url":"https://api.github.com/users/KarenVentura/following{/other_user}","gists_url":"https://api.github.com/users/KarenVentura/gists{/gist_id}","starred_url":"https://api.github.com/users/KarenVentura/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KarenVentura/subscriptions","organizations_url":"https://api.github.com/users/KarenVentura/orgs","repos_url":"https://api.github.com/users/KarenVentura/repos","events_url":"https://api.github.com/users/KarenVentura/events{/privacy}","received_events_url":"https://api.github.com/users/KarenVentura/received_events","type":"User","site_admin":false},"body":"This PR include @andrewhavens \r\n\r\n-Implement frequency digest email\r\n-Change subscription into settings user\r\n-Create rspec test for digest email\r\n-Create design for digest email views","created_at":"2015-09-04T23:08:49Z","updated_at":"2015-09-30T21:17:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"99cf6d483380cac88c62142c3a79659fef22c559","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/pulls/63/commits","review_comments_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/pulls/63/comments","review_comment_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/issues/63/comments","statuses_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/statuses/b2e46c3772f45a7be458865be7f8f91dff9796ae","head":{"label":"PowerCodeGirls:master","ref":"master","sha":"b2e46c3772f45a7be458865be7f8f91dff9796ae","user":{"login":"PowerCodeGirls","id":13152786,"avatar_url":"https://avatars.githubusercontent.com/u/13152786?v=3","gravatar_id":"","url":"https://api.github.com/users/PowerCodeGirls","html_url":"https://github.com/PowerCodeGirls","followers_url":"https://api.github.com/users/PowerCodeGirls/followers","following_url":"https://api.github.com/users/PowerCodeGirls/following{/other_user}","gists_url":"https://api.github.com/users/PowerCodeGirls/gists{/gist_id}","starred_url":"https://api.github.com/users/PowerCodeGirls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PowerCodeGirls/subscriptions","organizations_url":"https://api.github.com/users/PowerCodeGirls/orgs","repos_url":"https://api.github.com/users/PowerCodeGirls/repos","events_url":"https://api.github.com/users/PowerCodeGirls/events{/privacy}","received_events_url":"https://api.github.com/users/PowerCodeGirls/received_events","type":"Organization","site_admin":false},"repo":{"id":38441001,"name":"RubyGameDev.com","full_name":"PowerCodeGirls/RubyGameDev.com","owner":{"login":"PowerCodeGirls","id":13152786,"avatar_url":"https://avatars.githubusercontent.com/u/13152786?v=3","gravatar_id":"","url":"https://api.github.com/users/PowerCodeGirls","html_url":"https://github.com/PowerCodeGirls","followers_url":"https://api.github.com/users/PowerCodeGirls/followers","following_url":"https://api.github.com/users/PowerCodeGirls/following{/other_user}","gists_url":"https://api.github.com/users/PowerCodeGirls/gists{/gist_id}","starred_url":"https://api.github.com/users/PowerCodeGirls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PowerCodeGirls/subscriptions","organizations_url":"https://api.github.com/users/PowerCodeGirls/orgs","repos_url":"https://api.github.com/users/PowerCodeGirls/repos","events_url":"https://api.github.com/users/PowerCodeGirls/events{/privacy}","received_events_url":"https://api.github.com/users/PowerCodeGirls/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PowerCodeGirls/RubyGameDev.com","description":"A community-contributed, information hub to help others build games in Ruby.","fork":true,"url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com","forks_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/forks","keys_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/teams","hooks_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/hooks","issue_events_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/issues/events{/number}","events_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/events","assignees_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/assignees{/user}","branches_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/branches{/branch}","tags_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/tags","blobs_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/git/refs{/sha}","trees_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/statuses/{sha}","languages_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/languages","stargazers_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/stargazers","contributors_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/contributors","subscribers_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/subscribers","subscription_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/subscription","commits_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/commits{/sha}","git_commits_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/git/commits{/sha}","comments_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/comments{/number}","issue_comment_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/issues/comments{/number}","contents_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/contents/{+path}","compare_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/merges","archive_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/downloads","issues_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/issues{/number}","pulls_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/pulls{/number}","milestones_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/milestones{/number}","notifications_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/labels{/name}","releases_url":"https://api.github.com/repos/PowerCodeGirls/RubyGameDev.com/releases{/id}","created_at":"2015-07-02T15:33:10Z","updated_at":"2015-07-20T15:40:49Z","pushed_at":"2015-09-29T23:35:23Z","git_url":"git://github.com/PowerCodeGirls/RubyGameDev.com.git","ssh_url":"git@github.com:PowerCodeGirls/RubyGameDev.com.git","clone_url":"https://github.com/PowerCodeGirls/RubyGameDev.com.git","svn_url":"https://github.com/PowerCodeGirls/RubyGameDev.com","homepage":"http://www.rubygamedev.com","size":2078,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"ruby-rcade:master","ref":"master","sha":"44f96b9d6d8f197ec792cdec98e8106a0779416e","user":{"login":"ruby-rcade","id":4380629,"avatar_url":"https://avatars.githubusercontent.com/u/4380629?v=3","gravatar_id":"","url":"https://api.github.com/users/ruby-rcade","html_url":"https://github.com/ruby-rcade","followers_url":"https://api.github.com/users/ruby-rcade/followers","following_url":"https://api.github.com/users/ruby-rcade/following{/other_user}","gists_url":"https://api.github.com/users/ruby-rcade/gists{/gist_id}","starred_url":"https://api.github.com/users/ruby-rcade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruby-rcade/subscriptions","organizations_url":"https://api.github.com/users/ruby-rcade/orgs","repos_url":"https://api.github.com/users/ruby-rcade/repos","events_url":"https://api.github.com/users/ruby-rcade/events{/privacy}","received_events_url":"https://api.github.com/users/ruby-rcade/received_events","type":"Organization","site_admin":false},"repo":{"id":13728103,"name":"RubyGameDev.com","full_name":"ruby-rcade/RubyGameDev.com","owner":{"login":"ruby-rcade","id":4380629,"avatar_url":"https://avatars.githubusercontent.com/u/4380629?v=3","gravatar_id":"","url":"https://api.github.com/users/ruby-rcade","html_url":"https://github.com/ruby-rcade","followers_url":"https://api.github.com/users/ruby-rcade/followers","following_url":"https://api.github.com/users/ruby-rcade/following{/other_user}","gists_url":"https://api.github.com/users/ruby-rcade/gists{/gist_id}","starred_url":"https://api.github.com/users/ruby-rcade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruby-rcade/subscriptions","organizations_url":"https://api.github.com/users/ruby-rcade/orgs","repos_url":"https://api.github.com/users/ruby-rcade/repos","events_url":"https://api.github.com/users/ruby-rcade/events{/privacy}","received_events_url":"https://api.github.com/users/ruby-rcade/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ruby-rcade/RubyGameDev.com","description":"A community-contributed, information hub to help others build games in Ruby.","fork":false,"url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com","forks_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/forks","keys_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/teams","hooks_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/hooks","issue_events_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/issues/events{/number}","events_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/events","assignees_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/assignees{/user}","branches_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/branches{/branch}","tags_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/tags","blobs_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/git/refs{/sha}","trees_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/statuses/{sha}","languages_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/languages","stargazers_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/stargazers","contributors_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/contributors","subscribers_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/subscribers","subscription_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/subscription","commits_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/commits{/sha}","git_commits_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/git/commits{/sha}","comments_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/comments{/number}","issue_comment_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/issues/comments{/number}","contents_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/contents/{+path}","compare_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/merges","archive_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/downloads","issues_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/issues{/number}","pulls_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/pulls{/number}","milestones_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/milestones{/number}","notifications_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/labels{/name}","releases_url":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/releases{/id}","created_at":"2013-10-20T22:28:22Z","updated_at":"2015-07-22T22:59:13Z","pushed_at":"2015-09-30T07:44:59Z","git_url":"git://github.com/ruby-rcade/RubyGameDev.com.git","ssh_url":"git@github.com:ruby-rcade/RubyGameDev.com.git","clone_url":"https://github.com/ruby-rcade/RubyGameDev.com.git","svn_url":"https://github.com/ruby-rcade/RubyGameDev.com","homepage":"http://www.rubygamedev.com","size":2297,"stargazers_count":8,"watchers_count":8,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":21,"forks":6,"open_issues":21,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/pulls/63"},"html":{"href":"https://github.com/ruby-rcade/RubyGameDev.com/pull/63"},"issue":{"href":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/issues/63"},"comments":{"href":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/issues/63/comments"},"review_comments":{"href":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/pulls/63/comments"},"review_comment":{"href":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/pulls/63/commits"},"statuses":{"href":"https://api.github.com/repos/ruby-rcade/RubyGameDev.com/statuses/b2e46c3772f45a7be458865be7f8f91dff9796ae"}}}}