Parsing or access result object data?
This seems like it should be simple but I'm doing something wrong. How do I get access to the data from the result? I'm trying this:
result = Cloudinary::Api.resources(type: :upload)
result.resources.each do |resource|
puts resource
end
I see the results returned. But when I try to access the data I get this error:
undefined method `resources' for #<Cloudinary::Api::Response:0x007fa38fdeb9c8>
What am I missing?
0
-
Nevermind, I figured out out.
I was trying result.resources and I tried result[:resources] but I forgot to try result['resources'] which works.
I was really stumped for a while there.
0 -
Hi Adam,
Thanks for the details.
Indeed the response is a hash so result['resources'] is the way to go:)
0
Post is closed for comments.
Comments
2 comments