{"action":"created","comment":{"url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/pulls/comments/46976003","id":46976003,"diff_hunk":"@@ -0,0 +1,151 @@\n+mimecontent      = require('mime-content')\n+mimeparse        = require('mimeparse')\n+DataObjectParser = require('dataobject-parser')\n+\n+\n+#\n+# Request Function -------------------------------------------------------\n+#\n+\n+\n+request = (req) ->\n+  lead = req.body\n+\n+  # ensure supported method\n+  method = req.method?.toLowerCase()\n+  if method != 'post'\n+    throw new HttpError(415, { 'Content-Type': 'text/plain', Allow: 'POST' }, \"The #{method.toUpperCase()} method is not allowed\")\n+\n+  # ensure a content type header\n+  contentType = req.headers['Content-Type']\n+  unless contentType\n+    throw new HttpError(415, {'Content-Type': 'text/plain'}, 'Content-Type header is required')\n+\n+  # ensure correct mime type\n+  mimeType = req.headers['Content-Type']\n+  unless mimeType is 'application/x-www-form-urlencoded' \n+    throw new HttpError(406, {'Content-Type': 'text/plain'}, \"MIME type in Content-Type header is not supported. Use only application/x-www-form-urlencoded\")\n+\n+  parsed = mimecontent(lead, mimeType)\n+  lead   = resolveKeysWithDotNotation(parsed)\n+\n+  mobile_opt_in: lead.mobile_opt_in\n+  first_name: lead.first_name\n+  last_name: lead.last_name\n+  email: lead.email\n+  phone_1: lead.primary_phone\n+  comments: lead.comments\n+  credit_score: lead.credit_score\n+  postal_code: lead.business_zip\n+  \n+\n+  lendio: \n+    affiliate: lead.affiliate\n+    username: lead.username\n+    password: lead.password\n+\n+  company: \n+    accounts_receivable: lead.accounts_receivable\n+    monthly_charges: lead.monthly_charges\n+    address_1: lead.business_street\n+    city: lead.business_city\n+    type: lead.primary_customer\n+    monthly_sales: lead.average_monthly_sales\n+    name: lead.business_name \n+    time_in_business: lead.time_in_business\n+    industry: lead.industry\n+    postal_code: lead.business_zip\n+\n+  loan:\n+    collateral: lead.collateral_available\n+    has_financing: lead.current_financing\n+    amount: lead.finance_amount\n+    purpose: lead.loan_purpose\n+    timeframe_days: lead.time_to_funding\n+\n+\n+request.variables = ->\n+\n+  [ \n+    { name: 'lendio.affiliate', type: 'string', description: 'Affiliate data' }\n+    { name: 'lendio.username', type: 'string', description: 'Lendio user name' }\n+    { name: 'lendio.password', type: 'string', description: 'Lendio password' }\n+\n+    { name: 'first_name', type: 'string', description: 'First name' }\n+    { name: 'last_name',  type: 'string', description: 'Last name' }\n+    { name: 'email', type: 'email', description: 'Email address' }\n+    { name: 'phone_1', type: 'phone', description: 'First phone number' }\n+    { name: 'comments', type: 'string', description: 'Comments' }\n+    { name: 'mobile_opt_in', type:'boolean', description:'Consumer opted-in to mobile contact' }\n+    { name: 'credit_score', type:'range', description: 'Credit score' }\n+    { name: 'campaign', type:'string', description: 'Campaign name for tracking purposes' }\n+    { name: 'adgroup', type:'string', description: 'Adgroup name tracking purposes' }\n+\n+    { name: 'loan.has_financing', type:'boolean', description:'Loan Financing has been obtained' }\n+    { name: 'loan.timeframe_days', type: 'range', description:'Time until loan is funded in days' }\n+    { name: 'loan.amount', type:'range', description:'Loan Amount' }\n+    { name: 'loan.purpose', type:'string', description: 'Loan Purpose' }\n+    { name: 'loan.collateral', type:'string', description:'Type of loan collateral' }\n+\n+    { name: 'company.time_in_business', type:'range', description:'Company Years in Business' }\n+    { name: 'company.type', type:'string', description:'Business to Consumer, Business to Business, Business to Government' }\n+    { name: 'company.monthly_sales', type:'range', description:'Company Monthly Sales' }\n+    { name: 'company.industry', type:'string', description:'Company Industry' }\n+    { name: 'company.city', type: 'string', description: 'Company City' }\n+    { name: 'company.state', type: 'state', description: 'Company State' }\n+    { name: 'company.accounts_receivable', type: 'range', description:'Accounts Receivable amount' }\n+    { name: 'company.monthly_charges', type: 'range', description:'Monthly charges via credit cards' }\n+    { name: 'company.name', type:'string', description:'Name of company/employer' }\n+    { name: 'company.address_1', type: 'street', description: 'Company Address 1' }\n+    { name: 'company.postal_code', type: 'postal_code', description: 'Company Postal Code' }\n+  ]\n+\n+\n+#\n+# Response Function ------------------------------------------------------\n+#\n+\n+\n+response = (req, vars) ->\n+  body = JSON.stringify(\n+    outcome: vars.outcome\n+    reason:  vars.reason","path":"src/inbound.coffee","position":112,"original_position":112,"commit_id":"f5e74274edf69b6ee1a78ee60dd050b0fe641bb1","original_commit_id":"f5e74274edf69b6ee1a78ee60dd050b0fe641bb1","user":{"login":"ros3bud","id":3402403,"avatar_url":"https://avatars.githubusercontent.com/u/3402403?v=3","gravatar_id":"","url":"https://api.github.com/users/ros3bud","html_url":"https://github.com/ros3bud","followers_url":"https://api.github.com/users/ros3bud/followers","following_url":"https://api.github.com/users/ros3bud/following{/other_user}","gists_url":"https://api.github.com/users/ros3bud/gists{/gist_id}","starred_url":"https://api.github.com/users/ros3bud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros3bud/subscriptions","organizations_url":"https://api.github.com/users/ros3bud/orgs","repos_url":"https://api.github.com/users/ros3bud/repos","events_url":"https://api.github.com/users/ros3bud/events{/privacy}","received_events_url":"https://api.github.com/users/ros3bud/received_events","type":"User","site_admin":false},"body":"Wouldn't reason just be blank in the case of success? ","created_at":"2015-12-08T16:28:28Z","updated_at":"2015-12-08T16:28:28Z","html_url":"https://github.com/activeprospect/leadconduit-integration-lendio/pull/44#discussion_r46976003","pull_request_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/pulls/44","_links":{"self":{"href":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/pulls/comments/46976003"},"html":{"href":"https://github.com/activeprospect/leadconduit-integration-lendio/pull/44#discussion_r46976003"},"pull_request":{"href":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/pulls/44"}}},"pull_request":{"url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/pulls/44","id":52711180,"html_url":"https://github.com/activeprospect/leadconduit-integration-lendio/pull/44","diff_url":"https://github.com/activeprospect/leadconduit-integration-lendio/pull/44.diff","patch_url":"https://github.com/activeprospect/leadconduit-integration-lendio/pull/44.patch","issue_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/issues/44","number":44,"state":"open","locked":false,"title":"Inbound lw","user":{"login":"ros3bud","id":3402403,"avatar_url":"https://avatars.githubusercontent.com/u/3402403?v=3","gravatar_id":"","url":"https://api.github.com/users/ros3bud","html_url":"https://github.com/ros3bud","followers_url":"https://api.github.com/users/ros3bud/followers","following_url":"https://api.github.com/users/ros3bud/following{/other_user}","gists_url":"https://api.github.com/users/ros3bud/gists{/gist_id}","starred_url":"https://api.github.com/users/ros3bud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros3bud/subscriptions","organizations_url":"https://api.github.com/users/ros3bud/orgs","repos_url":"https://api.github.com/users/ros3bud/repos","events_url":"https://api.github.com/users/ros3bud/events{/privacy}","received_events_url":"https://api.github.com/users/ros3bud/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-04T19:34:37Z","updated_at":"2015-12-08T16:28:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"42214414858d7e6a7a74afe21f2407214d82b028","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/pulls/44/commits","review_comments_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/pulls/44/comments","review_comment_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/pulls/comments{/number}","comments_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/issues/44/comments","statuses_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/statuses/f5e74274edf69b6ee1a78ee60dd050b0fe641bb1","head":{"label":"activeprospect:inbound-lw","ref":"inbound-lw","sha":"f5e74274edf69b6ee1a78ee60dd050b0fe641bb1","user":{"login":"activeprospect","id":245554,"avatar_url":"https://avatars.githubusercontent.com/u/245554?v=3","gravatar_id":"","url":"https://api.github.com/users/activeprospect","html_url":"https://github.com/activeprospect","followers_url":"https://api.github.com/users/activeprospect/followers","following_url":"https://api.github.com/users/activeprospect/following{/other_user}","gists_url":"https://api.github.com/users/activeprospect/gists{/gist_id}","starred_url":"https://api.github.com/users/activeprospect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/activeprospect/subscriptions","organizations_url":"https://api.github.com/users/activeprospect/orgs","repos_url":"https://api.github.com/users/activeprospect/repos","events_url":"https://api.github.com/users/activeprospect/events{/privacy}","received_events_url":"https://api.github.com/users/activeprospect/received_events","type":"Organization","site_admin":false},"repo":{"id":28639392,"name":"leadconduit-integration-lendio","full_name":"activeprospect/leadconduit-integration-lendio","owner":{"login":"activeprospect","id":245554,"avatar_url":"https://avatars.githubusercontent.com/u/245554?v=3","gravatar_id":"","url":"https://api.github.com/users/activeprospect","html_url":"https://github.com/activeprospect","followers_url":"https://api.github.com/users/activeprospect/followers","following_url":"https://api.github.com/users/activeprospect/following{/other_user}","gists_url":"https://api.github.com/users/activeprospect/gists{/gist_id}","starred_url":"https://api.github.com/users/activeprospect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/activeprospect/subscriptions","organizations_url":"https://api.github.com/users/activeprospect/orgs","repos_url":"https://api.github.com/users/activeprospect/repos","events_url":"https://api.github.com/users/activeprospect/events{/privacy}","received_events_url":"https://api.github.com/users/activeprospect/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/activeprospect/leadconduit-integration-lendio","description":"","fork":false,"url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio","forks_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/forks","keys_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/teams","hooks_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/hooks","issue_events_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/issues/events{/number}","events_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/events","assignees_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/assignees{/user}","branches_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/branches{/branch}","tags_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/tags","blobs_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/git/refs{/sha}","trees_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/statuses/{sha}","languages_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/languages","stargazers_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/stargazers","contributors_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/contributors","subscribers_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/subscribers","subscription_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/subscription","commits_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/commits{/sha}","git_commits_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/git/commits{/sha}","comments_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/comments{/number}","issue_comment_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/issues/comments{/number}","contents_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/contents/{+path}","compare_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/merges","archive_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/downloads","issues_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/issues{/number}","pulls_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/pulls{/number}","milestones_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/milestones{/number}","notifications_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/labels{/name}","releases_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/releases{/id}","created_at":"2014-12-30T17:33:00Z","updated_at":"2015-04-30T15:34:03Z","pushed_at":"2015-12-08T15:31:30Z","git_url":"git://github.com/activeprospect/leadconduit-integration-lendio.git","ssh_url":"git@github.com:activeprospect/leadconduit-integration-lendio.git","clone_url":"https://github.com/activeprospect/leadconduit-integration-lendio.git","svn_url":"https://github.com/activeprospect/leadconduit-integration-lendio","homepage":null,"size":118,"stargazers_count":0,"watchers_count":0,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":6,"forks":1,"open_issues":6,"watchers":0,"default_branch":"master"}},"base":{"label":"activeprospect:master","ref":"master","sha":"fe8a23b6253971fc89f1362c6670b18ea627fe07","user":{"login":"activeprospect","id":245554,"avatar_url":"https://avatars.githubusercontent.com/u/245554?v=3","gravatar_id":"","url":"https://api.github.com/users/activeprospect","html_url":"https://github.com/activeprospect","followers_url":"https://api.github.com/users/activeprospect/followers","following_url":"https://api.github.com/users/activeprospect/following{/other_user}","gists_url":"https://api.github.com/users/activeprospect/gists{/gist_id}","starred_url":"https://api.github.com/users/activeprospect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/activeprospect/subscriptions","organizations_url":"https://api.github.com/users/activeprospect/orgs","repos_url":"https://api.github.com/users/activeprospect/repos","events_url":"https://api.github.com/users/activeprospect/events{/privacy}","received_events_url":"https://api.github.com/users/activeprospect/received_events","type":"Organization","site_admin":false},"repo":{"id":28639392,"name":"leadconduit-integration-lendio","full_name":"activeprospect/leadconduit-integration-lendio","owner":{"login":"activeprospect","id":245554,"avatar_url":"https://avatars.githubusercontent.com/u/245554?v=3","gravatar_id":"","url":"https://api.github.com/users/activeprospect","html_url":"https://github.com/activeprospect","followers_url":"https://api.github.com/users/activeprospect/followers","following_url":"https://api.github.com/users/activeprospect/following{/other_user}","gists_url":"https://api.github.com/users/activeprospect/gists{/gist_id}","starred_url":"https://api.github.com/users/activeprospect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/activeprospect/subscriptions","organizations_url":"https://api.github.com/users/activeprospect/orgs","repos_url":"https://api.github.com/users/activeprospect/repos","events_url":"https://api.github.com/users/activeprospect/events{/privacy}","received_events_url":"https://api.github.com/users/activeprospect/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/activeprospect/leadconduit-integration-lendio","description":"","fork":false,"url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio","forks_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/forks","keys_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/teams","hooks_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/hooks","issue_events_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/issues/events{/number}","events_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/events","assignees_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/assignees{/user}","branches_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/branches{/branch}","tags_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/tags","blobs_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/git/refs{/sha}","trees_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/statuses/{sha}","languages_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/languages","stargazers_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/stargazers","contributors_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/contributors","subscribers_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/subscribers","subscription_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/subscription","commits_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/commits{/sha}","git_commits_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/git/commits{/sha}","comments_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/comments{/number}","issue_comment_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/issues/comments{/number}","contents_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/contents/{+path}","compare_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/merges","archive_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/downloads","issues_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/issues{/number}","pulls_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/pulls{/number}","milestones_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/milestones{/number}","notifications_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/labels{/name}","releases_url":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/releases{/id}","created_at":"2014-12-30T17:33:00Z","updated_at":"2015-04-30T15:34:03Z","pushed_at":"2015-12-08T15:31:30Z","git_url":"git://github.com/activeprospect/leadconduit-integration-lendio.git","ssh_url":"git@github.com:activeprospect/leadconduit-integration-lendio.git","clone_url":"https://github.com/activeprospect/leadconduit-integration-lendio.git","svn_url":"https://github.com/activeprospect/leadconduit-integration-lendio","homepage":null,"size":118,"stargazers_count":0,"watchers_count":0,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":6,"forks":1,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/pulls/44"},"html":{"href":"https://github.com/activeprospect/leadconduit-integration-lendio/pull/44"},"issue":{"href":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/issues/44"},"comments":{"href":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/issues/44/comments"},"review_comments":{"href":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/pulls/44/comments"},"review_comment":{"href":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/pulls/44/commits"},"statuses":{"href":"https://api.github.com/repos/activeprospect/leadconduit-integration-lendio/statuses/f5e74274edf69b6ee1a78ee60dd050b0fe641bb1"}}}}