martingordon / bronto-ruby

A Ruby wrapper for the Bronto SOAP API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bronto::Contact#get_field doesn't work

opened this issue · comments

The method Bronto::Contact#get_field isn't working for me. This is how I'm calling it:

filter = Bronto::Filter.new
filter.add_filter 'email', 'EqualsTo', 'email@example.org'
contact = Bronto::Contact.find(filter).first
filter = Bronto::Filter.new
filter.add_filter 'id', 'FIELD_ID'
field = Bronto::Field.find(filter)
puts contact.get_field(field).nil? ? 'NIL' : 'NOT NIL'

This outputs 'NIL' even when I know for a fact that the field has a value set.

You need to specify the fields you wish to retrieve in the Bronto::Contact.find call:

filter = Bronto::Filter.new
filter.add_filter 'id', 'FIELD_ID'
field = Bronto::Field.find(filter)

filter = Bronto::Filter.new
filter.add_filter 'email', 'EqualsTo', 'email@example.org'
contact = Bronto::Contact.find(filter, 1, field).first

puts contact.get_field(field)