Class: Pulitzer::PostTypesController::Import

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

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Import

Returns a new instance of Import.



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

def initialize(params)
  @params = params
end

Instance Method Details

#callObject



7
8
9
10
11
12
13
# File 'app/interactions/pulitzer/post_types_controller/import.rb', line 7

def call
  import_json = @params[:import_json].read
  pt = Pulitzer::PostType.new
  pt.from_json import_json
  pt.save
  pt
end