Sha256: f450255e5c0d8d1e58badc7529a4da5f65557304651b8fc7caf8853c49a34c48

Contents?: true

Size: 381 Bytes

Versions: 49

Compression:

Stored size: 381 Bytes

Contents

class Pulitzer::CreateSingletonPost
  attr_accessor :post_type, :title

  def initialize(post_type, title)
    self.post_type = post_type
    self.title = title
  end

  def call
    if post_type.singular? && !post_type.singleton_post?
      singleton_post = post_type.posts.create(title: title)
      Pulitzer::CreatePostContentElements.new(singleton_post).call
    end
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
pulitzer-0.5.10 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.5.9 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.5.8 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.5.7 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.5.6 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.5.5 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.5.4 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.5.3 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.5.2 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.5.1 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.5.0 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.4.16 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.4.15 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.4.14 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.4.13 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.4.12 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.4.11 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.4.10 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.4.9 app/interactions/pulitzer/create_singleton_post.rb
pulitzer-0.4.8 app/interactions/pulitzer/create_singleton_post.rb