taylorbrooks / closeio

A Ruby wrapper for the Close.io API
http://developer.close.com
MIT License
45 stars 57 forks source link

Allow query params to be passed as a hash when searching leads, to keep client API consistent. Add options param to #list_leads to allow usage of meta search fields, such as _limit, _fields, and _skip. #23

Closed mful closed 9 years ago

mful commented 9 years ago

Fixes #20

Ideally, the fields param could be deprecated, as the options param is a functional replacement. Didn't want to break the current API, though...

tyre commented 9 years ago

:+1: At least make the default for query be more obvious. If you pass in a hash, the URL encoding botches the query:

I, [2015-07-29T09:50:50.372889 #17642]  INFO -- : get https://app.close.io/api/v1/lead/?query%5Bemail_address%3A%5D=kurt.vonnegut%40seneca.systems
taylorbrooks commented 9 years ago

The problem with converting query: to a hash is that you are limited to key/value type queries and you wouldn't be able to support complex queries:

https://help.close.io/customer/portal/articles/1564202-search-syntax

Meaning none of these queries would be supported: email_date < "7 days ago" email_address in ([ma**@hellocompass.us, m***@hellocompass.us]) city:"New York" or city:"San Francisco" state:CA and not city:"San Francisco"

cc/@tyre @mful

taylorbrooks commented 9 years ago

Actually this is probably good, I thought Ruby's String responded to #map.