Class: Cpi::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/cpi/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = nil) ⇒ Event

Returns a new instance of Event.



34
35
36
37
38
39
# File 'lib/cpi/event.rb', line 34

def initialize(attrs=nil)
  @event_type = attrs[:event_type]
  @source_tenant_uid = attrs[:source_tenant_uid]
  @event_uid = attrs[:event_uid]
  @content = attrs[:content]
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



32
33
34
# File 'lib/cpi/event.rb', line 32

def content
  @content
end

#event_typeObject

Returns the value of attribute event_type.



32
33
34
# File 'lib/cpi/event.rb', line 32

def event_type
  @event_type
end

#event_uidObject

Returns the value of attribute event_uid.



32
33
34
# File 'lib/cpi/event.rb', line 32

def event_uid
  @event_uid
end

#source_tenant_uidObject

Returns the value of attribute source_tenant_uid.



32
33
34
# File 'lib/cpi/event.rb', line 32

def source_tenant_uid
  @source_tenant_uid
end

Instance Method Details

#xmlObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/cpi/event.rb', line 41

def xml
  builder = Nokogiri::XML::Builder.new do |xml|
    xml.cpi_event {
      xml.header {
        xml.event_uid event_uid
        xml.event_type event_type
        xml.source_tenant_uid source_tenant_uid
      }
      xml.content do
        xml << content
      end
    }
  end
  builder.doc.root.to_xml
end