Class: Hope::Source::Base

Inherits:
Object show all
Defined in:
lib/hope/source/base.rb

Direct Known Subclasses

Sub, Twitter

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/hope/source/base.rb', line 4

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/hope/source/base.rb', line 4

def options
  @options
end

Class Method Details

.event_typesObject



6
7
8
# File 'lib/hope/source/base.rb', line 6

def self.event_types
  []
end

Instance Method Details

#parse(m) ⇒ Object



25
26
27
# File 'lib/hope/source/base.rb', line 25

def parse m
  JSON.parse m
end

#serializable_hashObject

Misc



11
12
13
14
15
16
17
18
19
# File 'lib/hope/source/base.rb', line 11

def serializable_hash
  {
    :id       => @name,
    :name     => @name,
    :type     => self.class.name,
    :options  => @options,
    :received => @received
  }
end

#to_jsonObject



21
22
23
# File 'lib/hope/source/base.rb', line 21

def to_json
  serializable_hash.to_json
end