Class: Workarea::Blog::Import::Wordpress::Attachment

Inherits:
Object
  • Object
show all
Defined in:
lib/workarea/blog/import/wordpress/attachment.rb

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Attachment

Returns a new instance of Attachment.



6
7
8
# File 'lib/workarea/blog/import/wordpress/attachment.rb', line 6

def initialize(url)
  @attachment_path = url
end

Instance Method Details

#saveObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/workarea/blog/import/wordpress/attachment.rb', line 10

def save
  attributes = {
    name: file_name,
    tag_list: 'Wordpress',
    file: image_file
  }

  asset = Workarea::Content::Asset.create!(attributes)
  puts "Created Asset: #{asset.name}"
  asset
end