class ButterCMS::Parsers::PostObject

Public Class Methods

call(post_attributes) click to toggle source

Returns the new instance of post with the associations included

@return [ButterCMS::Post]

# File lib/butter_cms/parsers/post_object.rb, line 7
def self.call(post_attributes)
  updated_post_attributes = {
    'tags' => ::ButterCMS::Parsers::TagsObjects.call(post_attributes.delete('tags')),
    'categories' => ::ButterCMS::Parsers::CategoriesObjects.call(post_attributes.delete('categories')),
    'author' => ::ButterCMS::Parsers::AuthorObject.call(post_attributes.delete('author'))
  }

  ::ButterCMS::Post.new(post_attributes.merge(updated_post_attributes))
end