Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marshalling Contentful::Asset Objects #88

Closed
DanielWright opened this issue Mar 9, 2016 · 3 comments
Closed

Marshalling Contentful::Asset Objects #88

DanielWright opened this issue Mar 9, 2016 · 3 comments
Assignees

Comments

@DanielWright
Copy link
Contributor

Hi there,

I've encountered some difficulty marshalling Contentful::Asset objects nested within other Contentful::Entry objects returned by the gem. Here's some REPL code that should be illustrative:

2.2.4 (#<ContentfulClientService:0x007ffea8218708>):0 > image
=> #<Image: @properties={:image=>#<Contentful::Asset: @fields={:title=>"Slider 1 - The No Makeup-Makeup Redux", :description=>"natural-looking makeup", :file=>#<Contentful::File: @properties={:fileName=>"Slider 1 - The No Makeup-Makeup Redux", :contentType=>"image/jpeg", :details=>{"image"=>{"width"=>1000, "height"=>667}, "size"=>594865}, :url=>"//images.contentful.com/g8qtv9gzg47d/image_post_78787/5508ddf7049078118beca005464d2647/Slider_1_-_The_No_Makeup-Makeup_Redux"}>} @sys={:space=>#<Contentful::Link: @sys={:type=>"Link", :linkType=>"Space", :id=>"g8qtv9gzg47d"}>, :type=>"Asset", :id=>"image_post_78787", :revision=>2, :createdAt=>Fri, 26 Feb 2016 16:02:07 +0000, :updatedAt=>Fri, 26 Feb 2016 16:05:31 +0000, :locale=>"en-US"}>, :caption=>nil, :credit=>nil} @fields={:name=>"Slider 1 - The No Makeup-Makeup Redux", :image=>#<Contentful::Asset: @fields={:title=>"Slider 1 - The No Makeup-Makeup Redux", :description=>"natural-looking makeup", :file=>#<Contentful::File: @properties={:fileName=>"Slider 1 - The No Makeup-Makeup Redux", :contentType=>"image/jpeg", :details=>{"image"=>{"width"=>1000, "height"=>667}, "size"=>594865}, :url=>"//images.contentful.com/g8qtv9gzg47d/image_post_78787/5508ddf7049078118beca005464d2647/Slider_1_-_The_No_Makeup-Makeup_Redux"}>} @sys={:space=>#<Contentful::Link: @sys={:type=>"Link", :linkType=>"Space", :id=>"g8qtv9gzg47d"}>, :type=>"Asset", :id=>"image_post_78787", :revision=>2, :createdAt=>Fri, 26 Feb 2016 16:02:07 +0000, :updatedAt=>Fri, 26 Feb 2016 16:05:31 +0000, :locale=>"en-US"}>} @sys={:space=>#<Contentful::Link: @sys={:type=>"Link", :linkType=>"Space", :id=>"g8qtv9gzg47d"}>, :type=>"Entry", :contentType=>#<Contentful::Link: @sys={:type=>"Link", :linkType=>"ContentType", :id=>"48qqOz2Bj2oQSwKkW2C6ee"}>, :id=>"image_78787", :revision=>1, :createdAt=>Fri, 26 Feb 2016 16:00:41 +0000, :updatedAt=>Fri, 26 Feb 2016 16:00:41 +0000, :locale=>"en-US"}>

2.2.4 (#<ContentfulClientService:0x007ffea8218708>):0 > Marshal.dump(image)
TypeError: can't dump anonymous class #<Module:0x007ffea9c9ca20>

2.2.4 (#<ContentfulClientService:0x007ffea8218708>):0 > asset = image.properties[:image]
=> #<Contentful::Asset: @fields={:title=>"Slider 1 - The No Makeup-Makeup Redux", :description=>"natural-looking makeup", :file=>#<Contentful::File: @properties={:fileName=>"Slider 1 - The No Makeup-Makeup Redux", :contentType=>"image/jpeg", :details=>{"image"=>{"width"=>1000, "height"=>667}, "size"=>594865}, :url=>"//images.contentful.com/g8qtv9gzg47d/image_post_78787/5508ddf7049078118beca005464d2647/Slider_1_-_The_No_Makeup-Makeup_Redux"}>} @sys={:space=>#<Contentful::Link: @sys={:type=>"Link", :linkType=>"Space", :id=>"g8qtv9gzg47d"}>, :type=>"Asset", :id=>"image_post_78787", :revision=>2, :createdAt=>Fri, 26 Feb 2016 16:02:07 +0000, :updatedAt=>Fri, 26 Feb 2016 16:05:31 +0000, :locale=>"en-US"}>

2.2.4 (#<ContentfulClientService:0x007ffea8218708>):0 > Marshal.dump(asset)
TypeError: can't dump anonymous class #<Module:0x007ffea9c9ca20>

Have you got any recommendations on marshalling these assets, or plans to support it in the future along the lines of #81?

Thanks for your help!

@dlitvakb
Copy link
Contributor

Hey @DanielWright,

This looks like something we need to take care of!

I'll look into it as soon as I can, but next release should definitely contain a fix for this.

In the meanwhile, if you are interested in contributing a solution yourself, you're more than welcome to do so.

I can guide you through the code if you need any help.

Cheers

@dlitvakb dlitvakb self-assigned this Mar 10, 2016
@thisiscab
Copy link

Hey @dlitvakb,

Has there been any progress on that?
When is the next release being planned to be release?

Thanks!

@dlitvakb
Copy link
Contributor

Hey @cabouffard,

Thanks for reminding me about this, we had a tight schedule on other things and this one slipped through the cracks.

I'll tackle this one between Monday and Tuesday.

Release should be done before Friday.

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
@DanielWright @dlitvakb @thisiscab and others