Class: Pulitzer::PostTypesController::Export

Inherits:
Object
  • Object
show all
Defined in:
app/interactions/pulitzer/post_types_controller/export.rb

Instance Method Summary collapse

Constructor Details

#initialize(post_type) ⇒ Export

Returns a new instance of Export.



3
4
5
# File 'app/interactions/pulitzer/post_types_controller/export.rb', line 3

def initialize(post_type)
  @post_type = post_type
end

Instance Method Details

#callObject



7
8
9
10
11
12
13
14
15
16
# File 'app/interactions/pulitzer/post_types_controller/export.rb', line 7

def call
  json_hash = @post_type.as_json(
    except: [:id, :created_at, :updated_at],
    include: {
      post_type_versions: Pulitzer::PostTypeVersion.export_config
    }
  )

  Pulitzer::PostTypeVersion.convert_hash_to_nested(json_hash).to_json
end