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
According to the docs the photoData property of this resource is encoded as web-safe Base64.
This gem returns a result which contains a Google::APIClient::Schema::Admin::DirectoryV1::UserPhoto instance.
When I access the photo_data method of this instance, I don't get the web-safe Base64 encoded string, I get back decoded data, but it's not a valid image. It seems that the Google::APIClient::Schema::Admin::DirectoryV1::UserPhoto class decodes the photoData property if it was plain old Base64. Basically it should be using Base64.urlsafe_decode64, but instead it seems to be using Base64.decode64. See http://ruby-doc.org/stdlib-2.0.0/libdoc/base64/rdoc/Base64.html
As a workaround, you can access the raw encoded string and decode it yourself.
Heres an example, given a configured Google::ApiClient client and a user id google_user_id:
Given gem version 0.6.4 and ruby 2.0.0-p195
I can make a successful request to this API call:
https://developers.google.com/admin-sdk/directory/v1/reference/users/photos/get
and get a resource as described by:
https://developers.google.com/admin-sdk/directory/v1/reference/users/photos#resource
According to the docs the photoData property of this resource is encoded as web-safe Base64.
This gem returns a result which contains a Google::APIClient::Schema::Admin::DirectoryV1::UserPhoto instance.
When I access the photo_data method of this instance, I don't get the web-safe Base64 encoded string, I get back decoded data, but it's not a valid image. It seems that the Google::APIClient::Schema::Admin::DirectoryV1::UserPhoto class decodes the photoData property if it was plain old Base64. Basically it should be using Base64.urlsafe_decode64, but instead it seems to be using Base64.decode64. See http://ruby-doc.org/stdlib-2.0.0/libdoc/base64/rdoc/Base64.html
As a workaround, you can access the raw encoded string and decode it yourself.
Heres an example, given a configured Google::ApiClient client and a user id google_user_id:
The text was updated successfully, but these errors were encountered: