Comparing version 1.2.0 to 1.3.0
@@ -24,10 +24,13 @@ 'use strict'; | ||
} | ||
var option_keys = Object.keys(options); | ||
if (option_keys.length > 0) { | ||
parameters.query = ''; | ||
option_keys.forEach(function(option) { | ||
var option_wrapper = (!/^".*"$/.test(option) && / +/.test(option)) ? '"' : ''; | ||
parameters.query += option_wrapper + option + option_wrapper + ':' + options[option] + ' '; | ||
}); | ||
if ('query' in options) { | ||
parameters.query = options.query; | ||
} else { | ||
var option_keys = Object.keys(options); | ||
if (option_keys.length > 0) { | ||
parameters.query = ''; | ||
option_keys.forEach(function(option) { | ||
var option_wrapper = (!/^".*"$/.test(option) && / +/.test(option)) ? '"' : ''; | ||
parameters.query += option_wrapper + option + option_wrapper + ':' + options[option] + ' '; | ||
}); | ||
} | ||
} | ||
@@ -300,3 +303,3 @@ | ||
options = { | ||
uri: 'https://app.close.io/api/v1' + path, | ||
uri: 'https://api.close.com/api/v1' + path, | ||
body: JSON.stringify(options), | ||
@@ -313,3 +316,3 @@ headers: { | ||
var options = { | ||
uri: 'https://app.close.io/api/v1' + path, | ||
uri: 'https://api.close.com/api/v1' + path, | ||
method: 'GET', | ||
@@ -323,3 +326,3 @@ qs: parameters | ||
options = { | ||
uri: 'https://app.close.io/api/v1' + path, | ||
uri: 'https://api.close.com/api/v1' + path, | ||
body: JSON.stringify(options), | ||
@@ -336,3 +339,3 @@ headers: { | ||
var options = { | ||
uri: 'https://app.close.io/api/v1' + path, | ||
uri: 'https://api.close.com/api/v1' + path, | ||
method: 'DELETE' | ||
@@ -339,0 +342,0 @@ }; |
{ | ||
"name": "close.io", | ||
"preferGlobal": "false", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"author": "John Wehr <johnwehr@gmail.com>", | ||
@@ -6,0 +6,0 @@ "description": "", |
@@ -38,1 +38,24 @@ Close.io | ||
``` | ||
**Searching for Leads** | ||
The `lead.search` method accepts either a string or a dictionary of search keywords as valid parameters. | ||
To use a string to specify your search query, pass a `query` parameter to the `lead.search` method: | ||
```javascript | ||
closeio.lead.search({query: 'name:"Bruce Wayne" email_address:bruce@wayneenterprises.com'}) | ||
.then(function(search_results){ | ||
console.log(search_results.total_results); | ||
}); | ||
``` | ||
To use a dictionary of search keywords to specify your search query, structure your parameters as follows: | ||
```javascript | ||
closeio.lead.search({name: "Bruce Wayne", email_address: 'bruce@wayneenterprises.com'}) | ||
.then(function(search_results){ | ||
console.log(search_results.total_results); | ||
}); | ||
``` | ||
**Note**: The `query` parameter will override any other search keywords present in your dictionary. |
@@ -128,3 +128,11 @@ 'use strict'; | ||
it('should search a lead by query', function () { | ||
var lead_id; | ||
return closeio.lead.search({ query: 'name:"John Wehr"'}) | ||
.then(function (data) { | ||
// console.log(data) | ||
assert(data.data.length > 0); | ||
}); | ||
}); | ||
after(function () { | ||
@@ -131,0 +139,0 @@ return closeio.lead.delete(lead_id) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16842
457
61