estately / rets

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

Translating values using metadata on the fly? #204

Closed Siggs2000 closed 7 years ago

Siggs2000 commented 7 years ago

I'm working with an MLS that seems to lean heavily on using data from lookups. I'm having a little trouble accessing the data in the metadata though. Is there an easy way to lookup on the fly using the metadata that it pulls during the client login?

Here's an example of a value for the status field of a particular listing: UA8R267V0JV and I'll need to use the lookup (in the metadata) feature.

What I know about the attribute itself is this:

LIST_15 ListingStatus   Status  status  100 Character   1   Lookup  20090725042206214793000000  0   0
</DATA>

If I manually grep around, into the metadata that I pull by using client.metadata, I can see that that value is Active. I'd love to do this lookup while I'm creating the new listing in my db while parsing the response. It seems like that is possible with this gem but I'm a little stuck in finding the right syntax to do it...

Thanks in advance!

dougcole commented 7 years ago

Hi @Siggs2000 the rets gem should decode metadata on the fly automatically if you use the :resolve option for the find method. Is that what you were looking for?

Siggs2000 commented 7 years ago

Well, that's pretty life-altering :)

Can't thank you enough for the gem. Want me to add a PR with an example that uses :resolve?

dougcole commented 7 years ago

@Siggs2000: yeah, that'd be great. We've done a pretty poor job with documentation....

Can't thank you enough for the gem.

Thanks! ☺️