Class: AkamaiApi::CLI::ECCU::EntryRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/akamai_api/cli/eccu/entry_renderer.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entry) ⇒ EntryRenderer

Returns a new instance of EntryRenderer.



17
18
19
# File 'lib/akamai_api/cli/eccu/entry_renderer.rb', line 17

def initialize entry
  @entry = entry
end

Instance Attribute Details

#entryObject (readonly)

Returns the value of attribute entry.



15
16
17
# File 'lib/akamai_api/cli/eccu/entry_renderer.rb', line 15

def entry
  @entry
end

Class Method Details

.render(entries) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/akamai_api/cli/eccu/entry_renderer.rb', line 6

def self.render entries
  output = ["----------"]
  entries.each do |e|
    output.concat new(e).render_entry
    output << "----------"
  end
  output.join "\n"
end

Instance Method Details

#renderObject



21
22
23
24
25
26
27
# File 'lib/akamai_api/cli/eccu/entry_renderer.rb', line 21

def render
  [
    "----------",
    render_entry,
    "----------"
  ].join "\n"
end

#render_entryObject



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/akamai_api/cli/eccu/entry_renderer.rb', line 29

def render_entry
  output = [
    "* Code    : #{entry.code}",
    entry_status,
    "            #{entry.status[:updated_at]}",
    entry_property
  ]
  output << "* Notes   : #{entry.notes}" if entry.notes.present?
  output << "* Email   : #{entry.email}" if entry.email
  output << "* Uploaded by #{entry.uploaded_by} on #{entry.upload_date}"
  output << "* Content:\n#{entry.file[:content]}" if entry.file[:content].present?
  output
end