Class: Docker::Event
- Inherits:
-
Object
- Object
- Docker::Event
- Extended by:
- Error
- Includes:
- Error
- Defined in:
- lib/docker/event.rb
Overview
This class represents a Docker Event.
Defined Under Namespace
Classes: Actor
Instance Attribute Summary collapse
-
#Action ⇒ Object
(also: #action)
Returns the value of attribute Action.
-
#Actor ⇒ Object
(also: #actor)
Returns the value of attribute Actor.
-
#from ⇒ Object
Deprecated interface.
-
#status ⇒ Object
Deprecated interface.
-
#time ⇒ Object
Returns the value of attribute time.
-
#timeNano ⇒ Object
(also: #time_nano)
Returns the value of attribute timeNano.
-
#Type ⇒ Object
(also: #type)
Returns the value of attribute Type.
Class Method Summary collapse
- .new_event(body, remaining, total) ⇒ Object
- .since(since, opts = {}, conn = Docker.connection, &block) ⇒ Object
- .stream(opts = {}, conn = Docker.connection, &block) ⇒ Object
Instance Method Summary collapse
- #ID ⇒ Object (also: #id)
-
#initialize(event_attributes = {}) ⇒ Event
constructor
A new instance of Event.
- #to_s ⇒ Object
Constructor Details
#initialize(event_attributes = {}) ⇒ Event
Returns a new instance of Event.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/docker/event.rb', line 54 def initialize(event_attributes = {}) [:Type, :Action, :Actor, :time, :timeNano, :status, :from].each do |sym| value = event_attributes[sym] if value.nil? value = event_attributes[sym.to_s] end send("#{sym}=", value) end if @Actor.nil? value = event_attributes[:id] if value.nil? value = event_attributes['id'] end self.Actor = Actor.new(ID: value) end end |
Instance Attribute Details
#Action ⇒ Object Also known as: action
Returns the value of attribute Action.
49 50 51 |
# File 'lib/docker/event.rb', line 49 def Action @Action end |
#Actor ⇒ Object Also known as: actor
Returns the value of attribute Actor.
50 51 52 |
# File 'lib/docker/event.rb', line 50 def Actor @Actor end |
#from ⇒ Object
Deprecated interface
52 53 54 |
# File 'lib/docker/event.rb', line 52 def from @from end |
#status ⇒ Object
Deprecated interface
52 53 54 |
# File 'lib/docker/event.rb', line 52 def status @status end |
#time ⇒ Object
Returns the value of attribute time.
49 50 51 |
# File 'lib/docker/event.rb', line 49 def time @time end |
#timeNano ⇒ Object Also known as: time_nano
Returns the value of attribute timeNano.
49 50 51 |
# File 'lib/docker/event.rb', line 49 def timeNano @timeNano end |
#Type ⇒ Object Also known as: type
Returns the value of attribute Type.
49 50 51 |
# File 'lib/docker/event.rb', line 49 def Type @Type end |
Class Method Details
.new_event(body, remaining, total) ⇒ Object
42 43 44 45 46 |
# File 'lib/docker/event.rb', line 42 def new_event(body, remaining, total) return if body.nil? || body.empty? json = Docker::Util.parse_json(body) Docker::Event.new(json) end |
.since(since, opts = {}, conn = Docker.connection, &block) ⇒ Object
38 39 40 |
# File 'lib/docker/event.rb', line 38 def since(since, opts = {}, conn = Docker.connection, &block) stream(opts.merge(:since => since), conn, &block) end |
.stream(opts = {}, conn = Docker.connection, &block) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/docker/event.rb', line 30 def stream(opts = {}, conn = Docker.connection, &block) conn.get('/events', opts, :response_block => lambda { |b, r, t| b.each_line do |line| block.call(new_event(line, r, t)) end }) end |
Instance Method Details
#ID ⇒ Object Also known as: id
72 73 74 |
# File 'lib/docker/event.rb', line 72 def ID self.actor.ID end |
#to_s ⇒ Object
91 92 93 94 95 96 97 |
# File 'lib/docker/event.rb', line 91 def to_s if type.nil? && action.nil? to_s_legacy else to_s_actor_style end end |