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.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/docker/event.rb', line 56 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.
51 52 53 |
# File 'lib/docker/event.rb', line 51 def Action @Action end |
#Actor ⇒ Object Also known as: actor
Returns the value of attribute Actor.
52 53 54 |
# File 'lib/docker/event.rb', line 52 def Actor @Actor end |
#from ⇒ Object
Deprecated interface
54 55 56 |
# File 'lib/docker/event.rb', line 54 def from @from end |
#status ⇒ Object
Deprecated interface
54 55 56 |
# File 'lib/docker/event.rb', line 54 def status @status end |
#time ⇒ Object
Returns the value of attribute time.
51 52 53 |
# File 'lib/docker/event.rb', line 51 def time @time end |
#timeNano ⇒ Object Also known as: time_nano
Returns the value of attribute timeNano.
51 52 53 |
# File 'lib/docker/event.rb', line 51 def timeNano @timeNano end |
#Type ⇒ Object Also known as: type
Returns the value of attribute Type.
51 52 53 |
# File 'lib/docker/event.rb', line 51 def Type @Type end |
Class Method Details
.new_event(body, remaining, total) ⇒ Object
44 45 46 47 48 |
# File 'lib/docker/event.rb', line 44 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
40 41 42 |
# File 'lib/docker/event.rb', line 40 def since(since, opts = {}, conn = Docker.connection, &block) stream(opts.merge(:since => since), conn, &block) end |
.stream(opts = {}, conn = Docker.connection, &block) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/docker/event.rb', line 32 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
74 75 76 |
# File 'lib/docker/event.rb', line 74 def ID self.actor.ID end |
#to_s ⇒ Object
93 94 95 96 97 98 99 |
# File 'lib/docker/event.rb', line 93 def to_s if type.nil? && action.nil? to_s_legacy else to_s_actor_style end end |