Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add client.merge_leads #20

Merged
merged 4 commits into from
Mar 12, 2017
Merged

Add client.merge_leads #20

merged 4 commits into from
Mar 12, 2017

Conversation

justinsoong
Copy link
Contributor

No description provided.

Remove params init

Fix array join
@justinsoong
Copy link
Contributor Author

@raszi added merge leads method, do i need to show some real requests/responses as part of the PR, i followed the API docs, and also tried with my test marketo account

@justinsoong
Copy link
Contributor Author

screen shot 2017-03-07 at 11 06 39 am

@justinsoong
Copy link
Contributor Author

Any chance in looking at this?

Copy link
Owner

@raszi raszi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

params[:leadIds] = losing_lead_ids.join(",") if losing_lead_ids
params[:mergeInCRM] = merge_in_crm

post("/rest/v1/leads/#{winning_lead_id}/merge.json?#{params.to_query}") do |req|
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should go to the body.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

screen shot 2017-03-10 at 10 02 48 am

docs say query, tested it out in the body does work either

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry, I did not catch that. Then we should use the query.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@raszi cool no worries!

@@ -40,5 +40,17 @@ def associate_lead(id, cookie)
json_payload(req, {})
end
end

def merge_leads(winning_lead_id, losing_lead_ids, merge_in_crm: false)
params = Faraday::Utils::ParamsHash.new
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to use Faraday::Utils::ParamsHash.new a simple Hash would make it.

json_payload(req, {})
end
end

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the unnecessary newline.

end
end
end

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the unnecessary newline from here.


describe '#merge_leads' do
let(:id) { 1 }
let(:losing_lead_ids){[2,3,4]}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please format it like this:

let(:losing_lead_ids) { [2, 3, 4] }

def merge_leads(winning_lead_id, losing_lead_ids, merge_in_crm: false)
params = Faraday::Utils::ParamsHash.new

params[:leadIds] = losing_lead_ids.join(",") if losing_lead_ids
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use simple quotes when interpolation is not necessary.

@raszi raszi merged commit 5e4d7d4 into raszi:master Mar 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants