nateleavitt / infusionsoft

Ruby Gem for the Infusionsoft API
MIT License
58 stars 70 forks source link

Tag names on infusionsoft #45

Closed EnriqueVidal closed 8 years ago

EnriqueVidal commented 9 years ago

So I need to get the tags a contact has been assigned, and seems like Infusionsoft call these groups, however I can't get the names of the tags, this is what I'm doing:

Infusionsoft.data_load 'Contact', 1017, [:groups]
#=> {"groups"=>"103"}

Searching for groups will only give me the id not the actual tag name, and given that Infusionsoft generates this upon creation the id itself won't tell my app anything about this contact, so I did some digging and found that Infusion soft has another table ContactGroupAssign were they keep the tag information so I tried that using the DataService.load and this is what happens:

Infusionsoft.data_load 'ContactGroupAssign', 103, [ :GroupId ]
=begin
Infusionsoft::NoFieldFoundError: [NoFieldFound]No field found: ContactGroupAssign.Id
from /Users/enrique/.rbenv/versions/1.9.3-p429/lib/ruby/gems/1.9.1/gems/infusionsoft-1.1.8/lib/infusionsoft/exception_handler.rb:26:in `initialize'
=end

Infusionsoft breaks away from convention here, by naming it's primary key to GroupId instead and the gem seems to default to Id which is causing an error of NoFieldFound, maybe there is a way in this gem to bypass this but so far I couldn't find any, is this a bug or am I overlooking something? I attached the list of column names in the ContactGroupAssign table from infusionsoft docs.

http://developers.infusionsoft.com/dbDocs/ContactGroupAssign.html

Thanks in advance

EnriqueVidal commented 9 years ago

I found that I've been looking at the wrong table, I should be looking at ContactGroup rather than it's join table, not sure if this issue should be close though since we're still unable to load data from tables who's primary key isn't Id.

nateleavitt commented 9 years ago

Okay cool! Glad you found the solution.

I'll look into the primary key issue.