{"action":"created","comment":{"url":"https://api.github.com/repos/workato/connector_sdk/pulls/comments/137219487","pull_request_review_id":60855748,"id":137219487,"diff_hunk":"@@ -0,0 +1,163 @@\n+{\n+  title: 'Mandrill',\n+  \n+  connection: {\n+    fields: [\n+      {\n+        name: 'api_key',\n+        label: 'API Key',\n+        control_type: 'password',\n+        hint: \"You may find it in <a href='https://mandrillapp.com//settings'>here</a>\",\n+        optional: false,\n+      }\n+    ],\n+    \n+    authorization: {\n+      type: 'api_key',\n+      \n+      credentials: ->(connection) {\n+        payload(key: connection['api_key'])\n+      },\n+    }\n+  },\n+  \n+  test: ->(connection) {\n+    post(\"https://mandrillapp.com/api/1.0/templates/list.json\")\n+  },\n+  \n+  object_definitions: {\n+    send_template_input: {\n+      fields: ->(connection, config_fields) {\n+        template_variables = (config_fields.blank?) ? ([]) : (\n+        post(\"https://mandrillapp.com/api/1.0/templates/info.json\", name: config_fields[\"template\"])[\"code\"]\n+        .scan(/mc:edit=\\\"([^\\\"]*)\\\"/)\n+        .map { |var|\n+          {\n+            name: var.first,\n+            hint: \"Include html tags for better formatting\"\n+          }\n+        }\n+        )\n+        \n+        [\n+          {\n+            name: \"from_email\",\n+            hint: \"The default sender address for the template, if provided - draft version\",\n+            optional: false,\n+          },\n+          {\n+            name: \"from_name\",\n+            hint: \"The default sender from name for the template, if provided - draft version\",\n+          },\n+          {\n+            name: \"to\",\n+            hint: \"List of email recipients, one per line.\",\n+            optional: false,\n+          },\n+          {\n+            name: \"important\",\n+            hint: \"Whether or not this message is important, and should be delivered ahead of non-important messages\",\n+            type: \"boolean\",\n+          },\n+          {\n+            name: \"track_opens\",\n+            hint: \"Whether or not to turn on open tracking for the message\",\n+            type: \"boolean\"\n+          },\n+          {\n+            name: \"track_clicks\",\n+            hint: \"Whether or not to turn on click tracking for the message\",\n+            type: \"boolean\"\n+          },\n+          {\n+            name: \"send_at\",\n+            hint: \"When this message should be sent as a UTC timestamp in YYYY-MM-DD HH:MM:SS format. If you specify a time in the past, the message will be sent immediately. Note: An additional fee applies for scheduled email, and this feature is only available to accounts with a positive balance.\",\n+            type: \"timestamp\",\n+          }\n+        ].concat(\n+        if template_variables.blank?\n+          []\n+        else\n+          [\n+            {\n+              name: \"template_content\",\n+              type: \"object\",\n+              properties: template_variables\n+            }\n+          ]\n+        end\n+        )\n+      }\n+    },\n+  },\n+  \n+  \n+  actions: {\n+    create_message_from_template: {\n+      description: 'Create <span class=\"provider\">message from template</span> in <span class=\"provider\">Mandrill</span>',\n+      \n+      config_fields: [\n+        {\n+          name: \"template\",\n+          control_type: \"select\",\n+          pick_list: \"templates\",\n+          optional: false,\n+        },\n+      ],\n+      \n+      input_fields: ->(object_definitions) {\n+        object_definitions[\"send_template_input\"]\n+      },\n+      \n+      execute: ->(connection, input) {\n+        message = {\n+          \"from_email\" => input['from_email'],\n+          \"from_name\" => input['from_name'],\n+          \"to\" => input['to']\n+          .split(\"\\n\")\n+          .map { |to| { email: to.strip } },\n+          \"important\" => input['important'],\n+          \"track_opens\" => input['track_opens'],\n+          \"track_clicks\" => input['track_clicks']\n+        }\n+        \n+        post(\"https://mandrillapp.com/api/1.0/messages/send-template.json\")\n+        .payload(\n+        template_name: input['template'],\n+        template_content: (\n+        input['template_content'] || []\n+        )\n+        .map { |k,v| { name: k, content: v } },\n+        message: message,\n+        send_at: input['send_at']\n+        )\n+        &.first\n+      },\n+      \n+      output_fields: ->(object_definitions) {\n+        [\n+          { name: 'email' },\n+          { name: 'status' },\n+          { name: '_id' },","path":"api_key_auth/mandrill_connector.rb","position":141,"original_position":141,"commit_id":"69dc9ce6b850456d11cb0c8aff7cb1e649fac907","original_commit_id":"69dc9ce6b850456d11cb0c8aff7cb1e649fac907","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars0.githubusercontent.com/u/6697940?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.","created_at":"2017-09-06T09:41:00Z","updated_at":"2017-09-06T09:41:01Z","html_url":"https://github.com/workato/connector_sdk/pull/87#discussion_r137219487","pull_request_url":"https://api.github.com/repos/workato/connector_sdk/pulls/87","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/workato/connector_sdk/pulls/comments/137219487"},"html":{"href":"https://github.com/workato/connector_sdk/pull/87#discussion_r137219487"},"pull_request":{"href":"https://api.github.com/repos/workato/connector_sdk/pulls/87"}}},"pull_request":{"url":"https://api.github.com/repos/workato/connector_sdk/pulls/87","id":139515370,"html_url":"https://github.com/workato/connector_sdk/pull/87","diff_url":"https://github.com/workato/connector_sdk/pull/87.diff","patch_url":"https://github.com/workato/connector_sdk/pull/87.patch","issue_url":"https://api.github.com/repos/workato/connector_sdk/issues/87","number":87,"state":"open","locked":false,"title":"Mandrill Connector","user":{"login":"sharat-developer","id":13619060,"avatar_url":"https://avatars0.githubusercontent.com/u/13619060?v=4","gravatar_id":"","url":"https://api.github.com/users/sharat-developer","html_url":"https://github.com/sharat-developer","followers_url":"https://api.github.com/users/sharat-developer/followers","following_url":"https://api.github.com/users/sharat-developer/following{/other_user}","gists_url":"https://api.github.com/users/sharat-developer/gists{/gist_id}","starred_url":"https://api.github.com/users/sharat-developer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharat-developer/subscriptions","organizations_url":"https://api.github.com/users/sharat-developer/orgs","repos_url":"https://api.github.com/users/sharat-developer/repos","events_url":"https://api.github.com/users/sharat-developer/events{/privacy}","received_events_url":"https://api.github.com/users/sharat-developer/received_events","type":"User","site_admin":false},"body":"Adapter Initial commit","created_at":"2017-09-06T09:40:52Z","updated_at":"2017-09-06T09:41:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"742694ed86996813491cad9a3b32fc598ac0746c","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/workato/connector_sdk/pulls/87/commits","review_comments_url":"https://api.github.com/repos/workato/connector_sdk/pulls/87/comments","review_comment_url":"https://api.github.com/repos/workato/connector_sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/workato/connector_sdk/issues/87/comments","statuses_url":"https://api.github.com/repos/workato/connector_sdk/statuses/69dc9ce6b850456d11cb0c8aff7cb1e649fac907","head":{"label":"workato:sharat-developer-mandrill","ref":"sharat-developer-mandrill","sha":"69dc9ce6b850456d11cb0c8aff7cb1e649fac907","user":{"login":"workato","id":5629924,"avatar_url":"https://avatars3.githubusercontent.com/u/5629924?v=4","gravatar_id":"","url":"https://api.github.com/users/workato","html_url":"https://github.com/workato","followers_url":"https://api.github.com/users/workato/followers","following_url":"https://api.github.com/users/workato/following{/other_user}","gists_url":"https://api.github.com/users/workato/gists{/gist_id}","starred_url":"https://api.github.com/users/workato/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/workato/subscriptions","organizations_url":"https://api.github.com/users/workato/orgs","repos_url":"https://api.github.com/users/workato/repos","events_url":"https://api.github.com/users/workato/events{/privacy}","received_events_url":"https://api.github.com/users/workato/received_events","type":"Organization","site_admin":false},"repo":{"id":54221993,"name":"connector_sdk","full_name":"workato/connector_sdk","owner":{"login":"workato","id":5629924,"avatar_url":"https://avatars3.githubusercontent.com/u/5629924?v=4","gravatar_id":"","url":"https://api.github.com/users/workato","html_url":"https://github.com/workato","followers_url":"https://api.github.com/users/workato/followers","following_url":"https://api.github.com/users/workato/following{/other_user}","gists_url":"https://api.github.com/users/workato/gists{/gist_id}","starred_url":"https://api.github.com/users/workato/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/workato/subscriptions","organizations_url":"https://api.github.com/users/workato/orgs","repos_url":"https://api.github.com/users/workato/repos","events_url":"https://api.github.com/users/workato/events{/privacy}","received_events_url":"https://api.github.com/users/workato/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/workato/connector_sdk","description":"Connector SDK samples and documentation","fork":false,"url":"https://api.github.com/repos/workato/connector_sdk","forks_url":"https://api.github.com/repos/workato/connector_sdk/forks","keys_url":"https://api.github.com/repos/workato/connector_sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/workato/connector_sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/workato/connector_sdk/teams","hooks_url":"https://api.github.com/repos/workato/connector_sdk/hooks","issue_events_url":"https://api.github.com/repos/workato/connector_sdk/issues/events{/number}","events_url":"https://api.github.com/repos/workato/connector_sdk/events","assignees_url":"https://api.github.com/repos/workato/connector_sdk/assignees{/user}","branches_url":"https://api.github.com/repos/workato/connector_sdk/branches{/branch}","tags_url":"https://api.github.com/repos/workato/connector_sdk/tags","blobs_url":"https://api.github.com/repos/workato/connector_sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/workato/connector_sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/workato/connector_sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/workato/connector_sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/workato/connector_sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/workato/connector_sdk/languages","stargazers_url":"https://api.github.com/repos/workato/connector_sdk/stargazers","contributors_url":"https://api.github.com/repos/workato/connector_sdk/contributors","subscribers_url":"https://api.github.com/repos/workato/connector_sdk/subscribers","subscription_url":"https://api.github.com/repos/workato/connector_sdk/subscription","commits_url":"https://api.github.com/repos/workato/connector_sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/workato/connector_sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/workato/connector_sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/workato/connector_sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/workato/connector_sdk/contents/{+path}","compare_url":"https://api.github.com/repos/workato/connector_sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/workato/connector_sdk/merges","archive_url":"https://api.github.com/repos/workato/connector_sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/workato/connector_sdk/downloads","issues_url":"https://api.github.com/repos/workato/connector_sdk/issues{/number}","pulls_url":"https://api.github.com/repos/workato/connector_sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/workato/connector_sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/workato/connector_sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/workato/connector_sdk/labels{/name}","releases_url":"https://api.github.com/repos/workato/connector_sdk/releases{/id}","deployments_url":"https://api.github.com/repos/workato/connector_sdk/deployments","created_at":"2016-03-18T18:08:56Z","updated_at":"2017-05-11T11:40:27Z","pushed_at":"2017-09-06T09:40:52Z","git_url":"git://github.com/workato/connector_sdk.git","ssh_url":"git@github.com:workato/connector_sdk.git","clone_url":"https://github.com/workato/connector_sdk.git","svn_url":"https://github.com/workato/connector_sdk","homepage":"","size":1497,"stargazers_count":10,"watchers_count":10,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":25,"mirror_url":null,"open_issues_count":27,"forks":25,"open_issues":27,"watchers":10,"default_branch":"master"}},"base":{"label":"workato:master","ref":"master","sha":"d782fe8cdae74bc84a65c225ac23048f79a8c748","user":{"login":"workato","id":5629924,"avatar_url":"https://avatars3.githubusercontent.com/u/5629924?v=4","gravatar_id":"","url":"https://api.github.com/users/workato","html_url":"https://github.com/workato","followers_url":"https://api.github.com/users/workato/followers","following_url":"https://api.github.com/users/workato/following{/other_user}","gists_url":"https://api.github.com/users/workato/gists{/gist_id}","starred_url":"https://api.github.com/users/workato/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/workato/subscriptions","organizations_url":"https://api.github.com/users/workato/orgs","repos_url":"https://api.github.com/users/workato/repos","events_url":"https://api.github.com/users/workato/events{/privacy}","received_events_url":"https://api.github.com/users/workato/received_events","type":"Organization","site_admin":false},"repo":{"id":54221993,"name":"connector_sdk","full_name":"workato/connector_sdk","owner":{"login":"workato","id":5629924,"avatar_url":"https://avatars3.githubusercontent.com/u/5629924?v=4","gravatar_id":"","url":"https://api.github.com/users/workato","html_url":"https://github.com/workato","followers_url":"https://api.github.com/users/workato/followers","following_url":"https://api.github.com/users/workato/following{/other_user}","gists_url":"https://api.github.com/users/workato/gists{/gist_id}","starred_url":"https://api.github.com/users/workato/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/workato/subscriptions","organizations_url":"https://api.github.com/users/workato/orgs","repos_url":"https://api.github.com/users/workato/repos","events_url":"https://api.github.com/users/workato/events{/privacy}","received_events_url":"https://api.github.com/users/workato/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/workato/connector_sdk","description":"Connector SDK samples and documentation","fork":false,"url":"https://api.github.com/repos/workato/connector_sdk","forks_url":"https://api.github.com/repos/workato/connector_sdk/forks","keys_url":"https://api.github.com/repos/workato/connector_sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/workato/connector_sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/workato/connector_sdk/teams","hooks_url":"https://api.github.com/repos/workato/connector_sdk/hooks","issue_events_url":"https://api.github.com/repos/workato/connector_sdk/issues/events{/number}","events_url":"https://api.github.com/repos/workato/connector_sdk/events","assignees_url":"https://api.github.com/repos/workato/connector_sdk/assignees{/user}","branches_url":"https://api.github.com/repos/workato/connector_sdk/branches{/branch}","tags_url":"https://api.github.com/repos/workato/connector_sdk/tags","blobs_url":"https://api.github.com/repos/workato/connector_sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/workato/connector_sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/workato/connector_sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/workato/connector_sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/workato/connector_sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/workato/connector_sdk/languages","stargazers_url":"https://api.github.com/repos/workato/connector_sdk/stargazers","contributors_url":"https://api.github.com/repos/workato/connector_sdk/contributors","subscribers_url":"https://api.github.com/repos/workato/connector_sdk/subscribers","subscription_url":"https://api.github.com/repos/workato/connector_sdk/subscription","commits_url":"https://api.github.com/repos/workato/connector_sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/workato/connector_sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/workato/connector_sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/workato/connector_sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/workato/connector_sdk/contents/{+path}","compare_url":"https://api.github.com/repos/workato/connector_sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/workato/connector_sdk/merges","archive_url":"https://api.github.com/repos/workato/connector_sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/workato/connector_sdk/downloads","issues_url":"https://api.github.com/repos/workato/connector_sdk/issues{/number}","pulls_url":"https://api.github.com/repos/workato/connector_sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/workato/connector_sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/workato/connector_sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/workato/connector_sdk/labels{/name}","releases_url":"https://api.github.com/repos/workato/connector_sdk/releases{/id}","deployments_url":"https://api.github.com/repos/workato/connector_sdk/deployments","created_at":"2016-03-18T18:08:56Z","updated_at":"2017-05-11T11:40:27Z","pushed_at":"2017-09-06T09:40:52Z","git_url":"git://github.com/workato/connector_sdk.git","ssh_url":"git@github.com:workato/connector_sdk.git","clone_url":"https://github.com/workato/connector_sdk.git","svn_url":"https://github.com/workato/connector_sdk","homepage":"","size":1497,"stargazers_count":10,"watchers_count":10,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":25,"mirror_url":null,"open_issues_count":27,"forks":25,"open_issues":27,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/workato/connector_sdk/pulls/87"},"html":{"href":"https://github.com/workato/connector_sdk/pull/87"},"issue":{"href":"https://api.github.com/repos/workato/connector_sdk/issues/87"},"comments":{"href":"https://api.github.com/repos/workato/connector_sdk/issues/87/comments"},"review_comments":{"href":"https://api.github.com/repos/workato/connector_sdk/pulls/87/comments"},"review_comment":{"href":"https://api.github.com/repos/workato/connector_sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/workato/connector_sdk/pulls/87/commits"},"statuses":{"href":"https://api.github.com/repos/workato/connector_sdk/statuses/69dc9ce6b850456d11cb0c8aff7cb1e649fac907"}},"author_association":"NONE"}}
{"actor":{"display_login":"houndci-bot"}}