estately / rets

A pure-ruby library for fetching data from RETS servers
https://github.com/estately/rets
127 stars 94 forks source link

More complete examples? #192

Closed Sinetheta closed 8 years ago

Sinetheta commented 8 years ago

Hey guys, I've been poking around this gem for some time now, but still having trouble figuring out the API.

Making the requests from the examples folder works fine, and calling client.metadata also appears to make a request and populate the client with some info. But how does one then take advantage of that?

client.find appears to return simple hashes, how is one supposed to use the metadata to expand on properties like "OwnershipType"=>"3"?

dougcole commented 8 years ago

Hi @Sinetheta, .find takes a second argument of an options hash. One of the options is :resolve, which if set to true will decode compact results. The other way to approach the problem is let the RETS server decode on their side by using the option `:format => 'COMPACT-DECODED'.

Sorry our examples are so sparse, if you have time and want to help add to them that'd be great! We have some documentation inline, which should also help. For example here is the documentation for .find: https://github.com/estately/rets/blob/master/lib/rets/client.rb#L53-L71

Sinetheta commented 8 years ago

Thanks @dougcole, I thought I tried resolve: true and still got back an array of hashes, but maybe that's related to the fact that my metadata (although fetching and parsing correctly) doesn't seem to be persisted to disk even when I use the file cache.

dougcole commented 8 years ago

Sorry @Sinetheta, sounds frustrating! resolve should work even if the metadata isn't persisted to disk, it'll just download it again if it isn't available.