You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting an error using the gem when trying to use the lists membership API.
The specific call I'm using when I get this error is api_client.crm.lists.memberships_api.get_page(list_id: list_id) (The ID points to a list of companies)
This returns the error:
NoMethodError: undefined method 'to_i' for an instance of Hash
which comes from lib/hubspot/codegen/crm/lists/models/collection_response_long.rb:161
It looks like it's passing the _deserialize method the type :Integer for the values in the results array, when in fact these are hashes:
Fetching companies from a paginated list is currently broken.
The issue is described here in more detail: HubSpot#324
This commit implements the fix suggested there while we await a fix on the official gem.
The other strategy i considered here was switching to use the V1 API as we already do that for a contacts list in Charlie, as that would bypass the broken code. However according to
https://legacydocs.hubspot.com/docs/methods/lists/get_list_contacts
there is no v1 API for company based lists...
WillRogers727
added a commit
to CharlieHR/hubspot-api-ruby
that referenced
this issue
Jul 9, 2024
Fetching companies from a paginated list is currently broken.
The issue is described here in more detail: HubSpot#324
This commit implements the fix suggested there which updates the attribute type mapping in CollectionResponseLong to expect an array of hashes.
I'm getting an error using the gem when trying to use the lists membership API.
The specific call I'm using when I get this error is
api_client.crm.lists.memberships_api.get_page(list_id: list_id)
(The ID points to a list of companies)
This returns the error:
NoMethodError: undefined method 'to_i' for an instance of Hash
which comes from
lib/hubspot/codegen/crm/lists/models/collection_response_long.rb:161
It looks like it's passing the
_deserialize
method the type:Integer
for the values in the results array, when in fact these are hashes:More specifically, the method is called on the line
lib/hubspot/codegen/crm/lists/models/collection_response_long.rb:137
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
where $1 is
Integer
This has ultimately come from the
Hubspot::Crm::Lists::CollectionResponseLong#openapi_types
method:Updating this method like this seems to fix the issue:
Though I'm not sure if there are any edge cases this might break.
Let me know if you need any other info to replicate this.
Thanks!
The text was updated successfully, but these errors were encountered: