Reputation: 41
According to the documentation in the code, member_resource_names
should return a "list of contact person resource names that are members of the contact group", but it's returning nil.
I'm doing something like this (ruby):
service = Google::Apis::PeopleV1::PeopleServiceService.new
# authentication code
contact_group = service.get_contact_group("contactGroups/xxxxxxxxxxxxxxxx")
=> #<Google::Apis::PeopleV1::ContactGroup:0x00007fd69fca6f48
@etag="xxxxxxxxxxxx",
@formatted_name="Contact list",
@group_type="USER_CONTACT_GROUP",
@member_count=10,
@metadata=#<...>,
@name="Contact list",
@resource_name="contactGroups/xxxxxxxxxxxxxxxx">
contact_group.member_resource_names
=> nil
Even though the member_count
is 10, member_resource_names
returns nil all the time.
I'm using ruby 2.4, and google gem 0.52.0.
Anyone else has seen this issue?
Upvotes: 1
Views: 141
Reputation: 19309
When calling contactGroups.get, you should specify maxMembers
.
If you visit the official API documentation regarding contactGroups, you'll see that memberResourceNames
is only populated in certain circumstances:
memberResourceNames[]: Output only. The list of contact person resource names that are members of the contact group. The field is only populated for GET requests and will only return as many members as maxMembers in the get request.
maxMembers
, though, if not specified, defaults to 0:
maxMembers: Optional. Specifies the maximum number of members to return. Defaults to 0 if not set, which will return zero members.
Therefore, based on the library sample:
def get_contact_group(resource_name, max_members: nil, fields: nil, quota_user: nil, options: nil, &block)
You should change this line:
contact_group = service.get_contact_group("contactGroups/xxxxxxxxxxxxxxxx")
With something similar to this:
contact_group = service.get_contact_group("contactGroups/xxxxxxxxxxxxxxxx", 100)
Where 100
is the maximum number of members to return (change it according to your preferences).
Upvotes: 1