Module: Iron::Entry::Exportable

Extended by:
ActiveSupport::Concern
Includes:
ActionView::Helpers::TagHelper
Included in:
Iron::Entry
Defined in:
app/models/iron/entry/exportable.rb

Instance Method Summary collapse

Instance Method Details

#export_attachment_path(blob) ⇒ Object



29
30
31
# File 'app/models/iron/entry/exportable.rb', line 29

def export_attachment_path(blob)
  "#{id}/#{blob.key}_#{blob.filename}"
end

#export_attachmentsObject



23
24
25
26
27
# File 'app/models/iron/entry/exportable.rb', line 23

def export_attachments
  collect_attachments.map do |blob|
    { path: export_attachment_path(blob), blob: blob }
  end
end

#export_attributesObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/models/iron/entry/exportable.rb', line 10

def export_attributes
  {
    gid: to_gid.to_s,
    id: id,
    content_type_handle: content_type.handle,
    created_at: created_at.iso8601,
    updated_at: updated_at.iso8601,
    route: route,
    creator_gid: creator&.to_gid&.to_s,
    fields: export_fields_by_locale
  }
end

#export_jsonObject



6
7
8
# File 'app/models/iron/entry/exportable.rb', line 6

def export_json
  JSON.pretty_generate(export_attributes)
end