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 method to get all users. #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lead_router.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|

spec.add_development_dependency "bundler", "~> 1.11"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "minitest", "~> 5.8"
spec.add_development_dependency "minitest", "~> 5.11.3"
spec.add_development_dependency "mocha", "~> 1.1"
spec.add_development_dependency "webmock", "~> 2.3.2"
end
6 changes: 6 additions & 0 deletions lib/lead_router/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ def create_potential_seller_lead(site_uuid, lead)
request :post, "https://#{@host}/rest/sites/#{site_uuid}/potential-seller-leads", lead.to_json
end

# Returns all users for the given site
def get_users(site_uuid)
require_arg "site_uuid", site_uuid
request :get, "https://#{@host}/rest/sites/#{site_uuid}/users"
end

# Send a request to notify a user was updated in the Lead Manager
#
# Only the lead manager is allowed to send this request, every other
Expand Down
2 changes: 1 addition & 1 deletion lib/lead_router/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module LeadRouter
VERSION = "1.4.0"
VERSION = "1.4.1"
end
Binary file added pkg/lead_router-1.4.1.gem
Binary file not shown.
8 changes: 7 additions & 1 deletion test/test_lead_router.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'minitest/autorun'
require 'webmock/minitest'
require 'mocha/mini_test'
require 'mocha/minitest'

require 'lead_router'

Expand Down Expand Up @@ -44,6 +44,12 @@ def test_update_lead
client.update_lead("site-123", "lead-abc", {email: "[email protected]"})
end

def test_get_users
client.expects(:request).with(:get, "https://api.com/rest/sites/site-123/users")

client.get_users("site-123")
end

def test_update_user
client.expects(:request).with(:put, "https://api.com/rest/sites/site-123/users/1234",
'{"name":"Kat","email":"[email protected]"}')
Expand Down