Insightly / insightly-ruby

Ruby Library for the Insightly REST API
16 stars 45 forks source link

Added query_params to get_contacts, get_projects, for filtering #41

Closed rept closed 7 years ago

rept commented 7 years ago

This commit enables OData filtering which wasn't possible before.

See here: https://api.insight.ly/v2.1/Help/TechnicalDetails for details.

I have enabled this for:

get_contacts get_organisations get_opportunities get_projects get_tasks get_emails get_notes

This is backwards compatible.

You can use it like this:

last_sync_time = (user.insightly['insightly_last_sync'].to_time).utc.strftime('%FT%T')
client.get_contacts(query_params: { '$filter' => "DATE_UPDATED_UTC gt DateTime'#{last_sync_time}'" })

You can also use query_params to only return parent objects like this:

client.get_contacts(query_params: { 'Brief' => :True })

Or you can of course combine both:

client.get_contacts(query_params: { 'Brief' => :True, '$filter' => "DATE_UPDATED_UTC gt DateTime'#{last_sync_time}'" })
rept commented 7 years ago

@dior001 @brianinsightly Hi guys, would appreciate if any of you could take a look at this. Thanks.

rept commented 7 years ago

@brianinsightly is anybody at insightly considering these pull requests?