{"action":"created","comment":{"url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/pulls/comments/41691473","id":41691473,"diff_hunk":"@@ -1,29 +1,44 @@\n-# SMS notification service for Messages sent to Participants.\n+# SMS notification service for Messages and Notifications sent to Participants.\n class MessageSmsNotification\n-  def self.messages\n-    @messages ||= []\n-  end\n+  attr_reader :body, :phone_number\n \n-  def self.deliver_to(recipient, body = nil)\n-    from = \"#{ Rails.application.config.try(:twilio_account_telephone_number) }\"\n-    message = {\n-      from: from,\n-      to: \"+#{ recipient.phone_number }\",\n-      body: body || \"You have a new ThinkFeelDo message.\"\n-    }\n-    deliver message\n+  def initialize(body:, phone_number:)\n+    @body = body\n+    @phone_number = phone_number\n   end\n \n-  def self.deliver(message)\n-    if Rails.env.staging? || Rails.env.production?\n+  def deliver\n+    if environment.staging? || environment.production?\n       client = Twilio::REST::Client.new(","path":"app/models/message_sms_notification.rb","position":26,"original_position":26,"commit_id":"3aa841e2c42c76b9e2fd27b3fa5cd3a7e3fa4028","original_commit_id":"3aa841e2c42c76b9e2fd27b3fa5cd3a7e3fa4028","user":{"login":"ericcf","id":58693,"avatar_url":"https://avatars.githubusercontent.com/u/58693?v=3","gravatar_id":"","url":"https://api.github.com/users/ericcf","html_url":"https://github.com/ericcf","followers_url":"https://api.github.com/users/ericcf/followers","following_url":"https://api.github.com/users/ericcf/following{/other_user}","gists_url":"https://api.github.com/users/ericcf/gists{/gist_id}","starred_url":"https://api.github.com/users/ericcf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericcf/subscriptions","organizations_url":"https://api.github.com/users/ericcf/orgs","repos_url":"https://api.github.com/users/ericcf/repos","events_url":"https://api.github.com/users/ericcf/events{/privacy}","received_events_url":"https://api.github.com/users/ericcf/received_events","type":"User","site_admin":false},"body":"Would this be worth extracting to the following?\r\n```ruby\r\ndef sms_client\r\n  @sms_client ||= Twilio::REST::Client.new(\r\n    config.twilio_account_sid,\r\n    config.twilio_auth_token\r\n  )\r\nend\r\n```","created_at":"2015-10-10T01:50:14Z","updated_at":"2015-10-10T01:50:14Z","html_url":"https://github.com/cbitstech/think_feel_do_engine/pull/259#discussion_r41691473","pull_request_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/pulls/259","_links":{"self":{"href":"https://api.github.com/repos/cbitstech/think_feel_do_engine/pulls/comments/41691473"},"html":{"href":"https://github.com/cbitstech/think_feel_do_engine/pull/259#discussion_r41691473"},"pull_request":{"href":"https://api.github.com/repos/cbitstech/think_feel_do_engine/pulls/259"}}},"pull_request":{"url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/pulls/259","id":47326505,"html_url":"https://github.com/cbitstech/think_feel_do_engine/pull/259","diff_url":"https://github.com/cbitstech/think_feel_do_engine/pull/259.diff","patch_url":"https://github.com/cbitstech/think_feel_do_engine/pull/259.patch","issue_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/issues/259","number":259,"state":"open","locked":false,"title":"Update SMS Notification Class","user":{"login":"michaelwehrley","id":526136,"avatar_url":"https://avatars.githubusercontent.com/u/526136?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelwehrley","html_url":"https://github.com/michaelwehrley","followers_url":"https://api.github.com/users/michaelwehrley/followers","following_url":"https://api.github.com/users/michaelwehrley/following{/other_user}","gists_url":"https://api.github.com/users/michaelwehrley/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelwehrley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelwehrley/subscriptions","organizations_url":"https://api.github.com/users/michaelwehrley/orgs","repos_url":"https://api.github.com/users/michaelwehrley/repos","events_url":"https://api.github.com/users/michaelwehrley/events{/privacy}","received_events_url":"https://api.github.com/users/michaelwehrley/received_events","type":"User","site_admin":false},"body":"* Refactor SMS notification and add spec\r\n* Add host applications' lesson notification rake task\r\n* Update rake task to consider app name.\r\n\r\n[#105006670]","created_at":"2015-10-09T22:24:30Z","updated_at":"2015-10-10T01:50:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1855fede7df1d80ed0e86ba4f28e7ef7aff84545","assignee":{"login":"ericcf","id":58693,"avatar_url":"https://avatars.githubusercontent.com/u/58693?v=3","gravatar_id":"","url":"https://api.github.com/users/ericcf","html_url":"https://github.com/ericcf","followers_url":"https://api.github.com/users/ericcf/followers","following_url":"https://api.github.com/users/ericcf/following{/other_user}","gists_url":"https://api.github.com/users/ericcf/gists{/gist_id}","starred_url":"https://api.github.com/users/ericcf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericcf/subscriptions","organizations_url":"https://api.github.com/users/ericcf/orgs","repos_url":"https://api.github.com/users/ericcf/repos","events_url":"https://api.github.com/users/ericcf/events{/privacy}","received_events_url":"https://api.github.com/users/ericcf/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/pulls/259/commits","review_comments_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/pulls/259/comments","review_comment_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/issues/259/comments","statuses_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/statuses/3aa841e2c42c76b9e2fd27b3fa5cd3a7e3fa4028","head":{"label":"cbitstech:msw_105006670_update_sms_notifications","ref":"msw_105006670_update_sms_notifications","sha":"3aa841e2c42c76b9e2fd27b3fa5cd3a7e3fa4028","user":{"login":"cbitstech","id":864362,"avatar_url":"https://avatars.githubusercontent.com/u/864362?v=3","gravatar_id":"","url":"https://api.github.com/users/cbitstech","html_url":"https://github.com/cbitstech","followers_url":"https://api.github.com/users/cbitstech/followers","following_url":"https://api.github.com/users/cbitstech/following{/other_user}","gists_url":"https://api.github.com/users/cbitstech/gists{/gist_id}","starred_url":"https://api.github.com/users/cbitstech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbitstech/subscriptions","organizations_url":"https://api.github.com/users/cbitstech/orgs","repos_url":"https://api.github.com/users/cbitstech/repos","events_url":"https://api.github.com/users/cbitstech/events{/privacy}","received_events_url":"https://api.github.com/users/cbitstech/received_events","type":"User","site_admin":false},"repo":{"id":24353466,"name":"think_feel_do_engine","full_name":"cbitstech/think_feel_do_engine","owner":{"login":"cbitstech","id":864362,"avatar_url":"https://avatars.githubusercontent.com/u/864362?v=3","gravatar_id":"","url":"https://api.github.com/users/cbitstech","html_url":"https://github.com/cbitstech","followers_url":"https://api.github.com/users/cbitstech/followers","following_url":"https://api.github.com/users/cbitstech/following{/other_user}","gists_url":"https://api.github.com/users/cbitstech/gists{/gist_id}","starred_url":"https://api.github.com/users/cbitstech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbitstech/subscriptions","organizations_url":"https://api.github.com/users/cbitstech/orgs","repos_url":"https://api.github.com/users/cbitstech/repos","events_url":"https://api.github.com/users/cbitstech/events{/privacy}","received_events_url":"https://api.github.com/users/cbitstech/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cbitstech/think_feel_do_engine","description":"","fork":false,"url":"https://api.github.com/repos/cbitstech/think_feel_do_engine","forks_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/forks","keys_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/teams","hooks_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/hooks","issue_events_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/issues/events{/number}","events_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/events","assignees_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/assignees{/user}","branches_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/branches{/branch}","tags_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/tags","blobs_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/statuses/{sha}","languages_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/languages","stargazers_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/stargazers","contributors_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/contributors","subscribers_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/subscribers","subscription_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/subscription","commits_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/contents/{+path}","compare_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/merges","archive_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/downloads","issues_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/issues{/number}","pulls_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/pulls{/number}","milestones_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/milestones{/number}","notifications_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/labels{/name}","releases_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/releases{/id}","created_at":"2014-09-23T02:18:05Z","updated_at":"2015-05-01T20:05:35Z","pushed_at":"2015-10-09T22:24:30Z","git_url":"git://github.com/cbitstech/think_feel_do_engine.git","ssh_url":"git@github.com:cbitstech/think_feel_do_engine.git","clone_url":"https://github.com/cbitstech/think_feel_do_engine.git","svn_url":"https://github.com/cbitstech/think_feel_do_engine","homepage":null,"size":6295,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"cbitstech:master","ref":"master","sha":"7a42e980257c6b0c883570ade5cd41a4ae569759","user":{"login":"cbitstech","id":864362,"avatar_url":"https://avatars.githubusercontent.com/u/864362?v=3","gravatar_id":"","url":"https://api.github.com/users/cbitstech","html_url":"https://github.com/cbitstech","followers_url":"https://api.github.com/users/cbitstech/followers","following_url":"https://api.github.com/users/cbitstech/following{/other_user}","gists_url":"https://api.github.com/users/cbitstech/gists{/gist_id}","starred_url":"https://api.github.com/users/cbitstech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbitstech/subscriptions","organizations_url":"https://api.github.com/users/cbitstech/orgs","repos_url":"https://api.github.com/users/cbitstech/repos","events_url":"https://api.github.com/users/cbitstech/events{/privacy}","received_events_url":"https://api.github.com/users/cbitstech/received_events","type":"User","site_admin":false},"repo":{"id":24353466,"name":"think_feel_do_engine","full_name":"cbitstech/think_feel_do_engine","owner":{"login":"cbitstech","id":864362,"avatar_url":"https://avatars.githubusercontent.com/u/864362?v=3","gravatar_id":"","url":"https://api.github.com/users/cbitstech","html_url":"https://github.com/cbitstech","followers_url":"https://api.github.com/users/cbitstech/followers","following_url":"https://api.github.com/users/cbitstech/following{/other_user}","gists_url":"https://api.github.com/users/cbitstech/gists{/gist_id}","starred_url":"https://api.github.com/users/cbitstech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbitstech/subscriptions","organizations_url":"https://api.github.com/users/cbitstech/orgs","repos_url":"https://api.github.com/users/cbitstech/repos","events_url":"https://api.github.com/users/cbitstech/events{/privacy}","received_events_url":"https://api.github.com/users/cbitstech/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cbitstech/think_feel_do_engine","description":"","fork":false,"url":"https://api.github.com/repos/cbitstech/think_feel_do_engine","forks_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/forks","keys_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/teams","hooks_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/hooks","issue_events_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/issues/events{/number}","events_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/events","assignees_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/assignees{/user}","branches_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/branches{/branch}","tags_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/tags","blobs_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/statuses/{sha}","languages_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/languages","stargazers_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/stargazers","contributors_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/contributors","subscribers_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/subscribers","subscription_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/subscription","commits_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/contents/{+path}","compare_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/merges","archive_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/downloads","issues_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/issues{/number}","pulls_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/pulls{/number}","milestones_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/milestones{/number}","notifications_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/labels{/name}","releases_url":"https://api.github.com/repos/cbitstech/think_feel_do_engine/releases{/id}","created_at":"2014-09-23T02:18:05Z","updated_at":"2015-05-01T20:05:35Z","pushed_at":"2015-10-09T22:24:30Z","git_url":"git://github.com/cbitstech/think_feel_do_engine.git","ssh_url":"git@github.com:cbitstech/think_feel_do_engine.git","clone_url":"https://github.com/cbitstech/think_feel_do_engine.git","svn_url":"https://github.com/cbitstech/think_feel_do_engine","homepage":null,"size":6295,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cbitstech/think_feel_do_engine/pulls/259"},"html":{"href":"https://github.com/cbitstech/think_feel_do_engine/pull/259"},"issue":{"href":"https://api.github.com/repos/cbitstech/think_feel_do_engine/issues/259"},"comments":{"href":"https://api.github.com/repos/cbitstech/think_feel_do_engine/issues/259/comments"},"review_comments":{"href":"https://api.github.com/repos/cbitstech/think_feel_do_engine/pulls/259/comments"},"review_comment":{"href":"https://api.github.com/repos/cbitstech/think_feel_do_engine/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cbitstech/think_feel_do_engine/pulls/259/commits"},"statuses":{"href":"https://api.github.com/repos/cbitstech/think_feel_do_engine/statuses/3aa841e2c42c76b9e2fd27b3fa5cd3a7e3fa4028"}}}}