{"action":"created","comment":{"url":"https://api.github.com/repos/lotus/mailer/pulls/comments/38315827","id":38315827,"diff_hunk":"@@ -42,7 +42,346 @@ Or install it yourself as:\n \n ## Usage\n \n-TODO: Write usage instructions here\n+### Conventions\n+\n+  * Templates are searched under `Lotus::Mailer.configuration.root`, set this value according to your app structure (eg. `\"app/templates\"`).\n+  * A mailer will look for a template with a file name that is composed by its full class name (eg. `\"articles/index\"`).\n+  * A template must have two concatenated extensions: one for the format and one for the engine (eg. `\".html.erb\"`).\n+  * The framework must be loaded before rendering the first time: `Lotus::Mailer.load!`.\n+\n+### Mailers\n+\n+A simple mailer looks like this:\n+\n+```ruby\n+require lotus/mailer\n+\n+class InvoiceMailer\n+  include Lotus::Mailer\n+end\n+```\n+\n+A mailer with `to` and `from` addresses and mailer delivery:\n+\n+```ruby\n+require lotus/mailer\n+\n+class InvoiceMailer\n+  include Lotus::Mailer\n+  \n+  from 'noreply@sender.com'\n+  to 'noreply@recipient.com'\n+  subject 'Welcome'\n+end\n+\n+CustomDelivery = {\n+  :address              => \"smtp.gmail.com\",\n+  :port                 => 587,\n+  :domain               => \"localhost:8000\",\n+  :user_name            => \"noreply@sender.com\",\n+  :password             => \"password\",\n+  :authentication       => \"plain\",\n+  :enable_starttls_auto => true\n+}\n+\n+Lotus::Mailer.configuration do\n+  delivery_method CustomDelivery\n+end\n+\n+Lotus::Mailer.load!\n+InvoiceMailer.deliver\n+```\n+\n+### Locals\n+\n+The set of objects passed in the `deliver` call are called `locals` and are used to render templates that use objects with the same symbol.\n+\n+```ruby\n+require lotus/mailer\n+\n+class User\n+  def initialize(name, username)\n+    @name = name\n+    @username = username\n+  end\n+\n+  attr_reader :name, :username\n+end\n+\n+luca = User.new('Luca', 'jodosha')\n+InvoiceMailer.deliver(user:luca)\n+```\n+\n+The corresponding `erb` file:\n+\n+```erb\n+Hello <%= user.name %>!\n+```\n+\n+### Scope\n+\n+All the methods defined in the mailer are accessible from the template:","path":"README.md","position":null,"original_position":83,"commit_id":"95e6d81ea428116185d54edb0709f58807b9c339","original_commit_id":"2dfceed7f1a6dcdefb73bf62267b415d42685478","user":{"login":"joneslee85","id":135605,"avatar_url":"https://avatars.githubusercontent.com/u/135605?v=3","gravatar_id":"","url":"https://api.github.com/users/joneslee85","html_url":"https://github.com/joneslee85","followers_url":"https://api.github.com/users/joneslee85/followers","following_url":"https://api.github.com/users/joneslee85/following{/other_user}","gists_url":"https://api.github.com/users/joneslee85/gists{/gist_id}","starred_url":"https://api.github.com/users/joneslee85/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joneslee85/subscriptions","organizations_url":"https://api.github.com/users/joneslee85/orgs","repos_url":"https://api.github.com/users/joneslee85/repos","events_url":"https://api.github.com/users/joneslee85/events{/privacy}","received_events_url":"https://api.github.com/users/joneslee85/received_events","type":"User","site_admin":false},"body":"@inescoelho yes please","created_at":"2015-08-31T14:17:55Z","updated_at":"2015-08-31T14:17:55Z","html_url":"https://github.com/lotus/mailer/pull/22#discussion_r38315827","pull_request_url":"https://api.github.com/repos/lotus/mailer/pulls/22","_links":{"self":{"href":"https://api.github.com/repos/lotus/mailer/pulls/comments/38315827"},"html":{"href":"https://github.com/lotus/mailer/pull/22#discussion_r38315827"},"pull_request":{"href":"https://api.github.com/repos/lotus/mailer/pulls/22"}}},"pull_request":{"url":"https://api.github.com/repos/lotus/mailer/pulls/22","id":43635251,"html_url":"https://github.com/lotus/mailer/pull/22","diff_url":"https://github.com/lotus/mailer/pull/22.diff","patch_url":"https://github.com/lotus/mailer/pull/22.patch","issue_url":"https://api.github.com/repos/lotus/mailer/issues/22","number":22,"state":"open","locked":false,"title":"Usage documentation (#18)","user":{"login":"inescoelho","id":3616894,"avatar_url":"https://avatars.githubusercontent.com/u/3616894?v=3","gravatar_id":"","url":"https://api.github.com/users/inescoelho","html_url":"https://github.com/inescoelho","followers_url":"https://api.github.com/users/inescoelho/followers","following_url":"https://api.github.com/users/inescoelho/following{/other_user}","gists_url":"https://api.github.com/users/inescoelho/gists{/gist_id}","starred_url":"https://api.github.com/users/inescoelho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inescoelho/subscriptions","organizations_url":"https://api.github.com/users/inescoelho/orgs","repos_url":"https://api.github.com/users/inescoelho/repos","events_url":"https://api.github.com/users/inescoelho/events{/privacy}","received_events_url":"https://api.github.com/users/inescoelho/received_events","type":"User","site_admin":false},"body":"Added usage documentation in README file.","created_at":"2015-08-28T14:44:00Z","updated_at":"2015-08-31T14:17:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"de03c55a14e9e33fd6ec5cc359d1f272f777893d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/lotus/mailer/pulls/22/commits","review_comments_url":"https://api.github.com/repos/lotus/mailer/pulls/22/comments","review_comment_url":"https://api.github.com/repos/lotus/mailer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lotus/mailer/issues/22/comments","statuses_url":"https://api.github.com/repos/lotus/mailer/statuses/95e6d81ea428116185d54edb0709f58807b9c339","head":{"label":"DEIGirls:master","ref":"master","sha":"95e6d81ea428116185d54edb0709f58807b9c339","user":{"login":"DEIGirls","id":11925583,"avatar_url":"https://avatars.githubusercontent.com/u/11925583?v=3","gravatar_id":"","url":"https://api.github.com/users/DEIGirls","html_url":"https://github.com/DEIGirls","followers_url":"https://api.github.com/users/DEIGirls/followers","following_url":"https://api.github.com/users/DEIGirls/following{/other_user}","gists_url":"https://api.github.com/users/DEIGirls/gists{/gist_id}","starred_url":"https://api.github.com/users/DEIGirls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DEIGirls/subscriptions","organizations_url":"https://api.github.com/users/DEIGirls/orgs","repos_url":"https://api.github.com/users/DEIGirls/repos","events_url":"https://api.github.com/users/DEIGirls/events{/privacy}","received_events_url":"https://api.github.com/users/DEIGirls/received_events","type":"Organization","site_admin":false},"repo":{"id":39508439,"name":"mailer","full_name":"DEIGirls/mailer","owner":{"login":"DEIGirls","id":11925583,"avatar_url":"https://avatars.githubusercontent.com/u/11925583?v=3","gravatar_id":"","url":"https://api.github.com/users/DEIGirls","html_url":"https://github.com/DEIGirls","followers_url":"https://api.github.com/users/DEIGirls/followers","following_url":"https://api.github.com/users/DEIGirls/following{/other_user}","gists_url":"https://api.github.com/users/DEIGirls/gists{/gist_id}","starred_url":"https://api.github.com/users/DEIGirls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DEIGirls/subscriptions","organizations_url":"https://api.github.com/users/DEIGirls/orgs","repos_url":"https://api.github.com/users/DEIGirls/repos","events_url":"https://api.github.com/users/DEIGirls/events{/privacy}","received_events_url":"https://api.github.com/users/DEIGirls/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DEIGirls/mailer","description":"Mail for Ruby applications","fork":true,"url":"https://api.github.com/repos/DEIGirls/mailer","forks_url":"https://api.github.com/repos/DEIGirls/mailer/forks","keys_url":"https://api.github.com/repos/DEIGirls/mailer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DEIGirls/mailer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DEIGirls/mailer/teams","hooks_url":"https://api.github.com/repos/DEIGirls/mailer/hooks","issue_events_url":"https://api.github.com/repos/DEIGirls/mailer/issues/events{/number}","events_url":"https://api.github.com/repos/DEIGirls/mailer/events","assignees_url":"https://api.github.com/repos/DEIGirls/mailer/assignees{/user}","branches_url":"https://api.github.com/repos/DEIGirls/mailer/branches{/branch}","tags_url":"https://api.github.com/repos/DEIGirls/mailer/tags","blobs_url":"https://api.github.com/repos/DEIGirls/mailer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DEIGirls/mailer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DEIGirls/mailer/git/refs{/sha}","trees_url":"https://api.github.com/repos/DEIGirls/mailer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DEIGirls/mailer/statuses/{sha}","languages_url":"https://api.github.com/repos/DEIGirls/mailer/languages","stargazers_url":"https://api.github.com/repos/DEIGirls/mailer/stargazers","contributors_url":"https://api.github.com/repos/DEIGirls/mailer/contributors","subscribers_url":"https://api.github.com/repos/DEIGirls/mailer/subscribers","subscription_url":"https://api.github.com/repos/DEIGirls/mailer/subscription","commits_url":"https://api.github.com/repos/DEIGirls/mailer/commits{/sha}","git_commits_url":"https://api.github.com/repos/DEIGirls/mailer/git/commits{/sha}","comments_url":"https://api.github.com/repos/DEIGirls/mailer/comments{/number}","issue_comment_url":"https://api.github.com/repos/DEIGirls/mailer/issues/comments{/number}","contents_url":"https://api.github.com/repos/DEIGirls/mailer/contents/{+path}","compare_url":"https://api.github.com/repos/DEIGirls/mailer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DEIGirls/mailer/merges","archive_url":"https://api.github.com/repos/DEIGirls/mailer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DEIGirls/mailer/downloads","issues_url":"https://api.github.com/repos/DEIGirls/mailer/issues{/number}","pulls_url":"https://api.github.com/repos/DEIGirls/mailer/pulls{/number}","milestones_url":"https://api.github.com/repos/DEIGirls/mailer/milestones{/number}","notifications_url":"https://api.github.com/repos/DEIGirls/mailer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DEIGirls/mailer/labels{/name}","releases_url":"https://api.github.com/repos/DEIGirls/mailer/releases{/id}","created_at":"2015-07-22T13:43:51Z","updated_at":"2015-07-22T13:43:51Z","pushed_at":"2015-08-31T13:46:59Z","git_url":"git://github.com/DEIGirls/mailer.git","ssh_url":"git@github.com:DEIGirls/mailer.git","clone_url":"https://github.com/DEIGirls/mailer.git","svn_url":"https://github.com/DEIGirls/mailer","homepage":"http://lotusrb.org","size":380,"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":"lotus:master","ref":"master","sha":"c63ee122bbc0a96cd2e837b85744cb5350ba76be","user":{"login":"lotus","id":3210273,"avatar_url":"https://avatars.githubusercontent.com/u/3210273?v=3","gravatar_id":"","url":"https://api.github.com/users/lotus","html_url":"https://github.com/lotus","followers_url":"https://api.github.com/users/lotus/followers","following_url":"https://api.github.com/users/lotus/following{/other_user}","gists_url":"https://api.github.com/users/lotus/gists{/gist_id}","starred_url":"https://api.github.com/users/lotus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lotus/subscriptions","organizations_url":"https://api.github.com/users/lotus/orgs","repos_url":"https://api.github.com/users/lotus/repos","events_url":"https://api.github.com/users/lotus/events{/privacy}","received_events_url":"https://api.github.com/users/lotus/received_events","type":"Organization","site_admin":false},"repo":{"id":38034388,"name":"mailer","full_name":"lotus/mailer","owner":{"login":"lotus","id":3210273,"avatar_url":"https://avatars.githubusercontent.com/u/3210273?v=3","gravatar_id":"","url":"https://api.github.com/users/lotus","html_url":"https://github.com/lotus","followers_url":"https://api.github.com/users/lotus/followers","following_url":"https://api.github.com/users/lotus/following{/other_user}","gists_url":"https://api.github.com/users/lotus/gists{/gist_id}","starred_url":"https://api.github.com/users/lotus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lotus/subscriptions","organizations_url":"https://api.github.com/users/lotus/orgs","repos_url":"https://api.github.com/users/lotus/repos","events_url":"https://api.github.com/users/lotus/events{/privacy}","received_events_url":"https://api.github.com/users/lotus/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lotus/mailer","description":"Mail for Ruby applications","fork":false,"url":"https://api.github.com/repos/lotus/mailer","forks_url":"https://api.github.com/repos/lotus/mailer/forks","keys_url":"https://api.github.com/repos/lotus/mailer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lotus/mailer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lotus/mailer/teams","hooks_url":"https://api.github.com/repos/lotus/mailer/hooks","issue_events_url":"https://api.github.com/repos/lotus/mailer/issues/events{/number}","events_url":"https://api.github.com/repos/lotus/mailer/events","assignees_url":"https://api.github.com/repos/lotus/mailer/assignees{/user}","branches_url":"https://api.github.com/repos/lotus/mailer/branches{/branch}","tags_url":"https://api.github.com/repos/lotus/mailer/tags","blobs_url":"https://api.github.com/repos/lotus/mailer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lotus/mailer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lotus/mailer/git/refs{/sha}","trees_url":"https://api.github.com/repos/lotus/mailer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lotus/mailer/statuses/{sha}","languages_url":"https://api.github.com/repos/lotus/mailer/languages","stargazers_url":"https://api.github.com/repos/lotus/mailer/stargazers","contributors_url":"https://api.github.com/repos/lotus/mailer/contributors","subscribers_url":"https://api.github.com/repos/lotus/mailer/subscribers","subscription_url":"https://api.github.com/repos/lotus/mailer/subscription","commits_url":"https://api.github.com/repos/lotus/mailer/commits{/sha}","git_commits_url":"https://api.github.com/repos/lotus/mailer/git/commits{/sha}","comments_url":"https://api.github.com/repos/lotus/mailer/comments{/number}","issue_comment_url":"https://api.github.com/repos/lotus/mailer/issues/comments{/number}","contents_url":"https://api.github.com/repos/lotus/mailer/contents/{+path}","compare_url":"https://api.github.com/repos/lotus/mailer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lotus/mailer/merges","archive_url":"https://api.github.com/repos/lotus/mailer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lotus/mailer/downloads","issues_url":"https://api.github.com/repos/lotus/mailer/issues{/number}","pulls_url":"https://api.github.com/repos/lotus/mailer/pulls{/number}","milestones_url":"https://api.github.com/repos/lotus/mailer/milestones{/number}","notifications_url":"https://api.github.com/repos/lotus/mailer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lotus/mailer/labels{/name}","releases_url":"https://api.github.com/repos/lotus/mailer/releases{/id}","created_at":"2015-06-25T07:21:02Z","updated_at":"2015-06-30T11:21:48Z","pushed_at":"2015-08-31T13:46:59Z","git_url":"git://github.com/lotus/mailer.git","ssh_url":"git@github.com:lotus/mailer.git","clone_url":"https://github.com/lotus/mailer.git","svn_url":"https://github.com/lotus/mailer","homepage":"http://lotusrb.org","size":422,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lotus/mailer/pulls/22"},"html":{"href":"https://github.com/lotus/mailer/pull/22"},"issue":{"href":"https://api.github.com/repos/lotus/mailer/issues/22"},"comments":{"href":"https://api.github.com/repos/lotus/mailer/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/lotus/mailer/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/lotus/mailer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lotus/mailer/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/lotus/mailer/statuses/95e6d81ea428116185d54edb0709f58807b9c339"}}}}