Class: Ledger::Event

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Event

Returns a new instance of Event.



5
6
7
8
9
# File 'lib/ledger/event.rb', line 5

def initialize opts
  opts.each do |attr, value|
    self.send("#{attr}=", value) if respond_to?("#{attr}=")
  end
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



3
4
5
# File 'lib/ledger/event.rb', line 3

def action
  @action
end

#actorObject

Returns the value of attribute actor.



3
4
5
# File 'lib/ledger/event.rb', line 3

def actor
  @actor
end

#created_atObject

Returns the value of attribute created_at.



3
4
5
# File 'lib/ledger/event.rb', line 3

def created_at
  @created_at
end

#dataObject

Returns the value of attribute data.



3
4
5
# File 'lib/ledger/event.rb', line 3

def data
  @data
end

#objectObject

Returns the value of attribute object.



3
4
5
# File 'lib/ledger/event.rb', line 3

def object
  @object
end

Class Method Details

.from_json(json) ⇒ Object



12
13
14
15
# File 'lib/ledger/event.rb', line 12

def from_json json
  require 'json'
  self.new JSON.parse json
end