Class: Url2Event::Base
- Inherits:
-
Object
- Object
- Url2Event::Base
- Defined in:
- lib/url_2_event/base.rb
Direct Known Subclasses
Class Attribute Summary collapse
-
.implementations ⇒ Object
Returns the value of attribute implementations.
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #event_endpoint ⇒ Object
- #get_event ⇒ Object
-
#initialize(uri) ⇒ Base
constructor
A new instance of Base.
- #sanitize(raw) ⇒ Object
- #to_event ⇒ Object
Constructor Details
#initialize(uri) ⇒ Base
Returns a new instance of Base.
21 22 23 |
# File 'lib/url_2_event/base.rb', line 21 def initialize(uri) @uri = uri end |
Class Attribute Details
.implementations ⇒ Object
Returns the value of attribute implementations.
7 8 9 |
# File 'lib/url_2_event/base.rb', line 7 def implementations @implementations end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/url_2_event/base.rb', line 3 def end |
Class Method Details
.inherited(subclass) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/url_2_event/base.rb', line 9 def inherited(subclass) subclass.class_eval do include HTTParty end @implementations << subclass unless @implementations.include?(subclass) end |
.is_parser_for? ⇒ Boolean
16 17 18 |
# File 'lib/url_2_event/base.rb', line 16 def is_parser_for? raise NotImplementedError, "You should define #{self.class}.#{__method__}." end |
Instance Method Details
#event_endpoint ⇒ Object
38 39 40 |
# File 'lib/url_2_event/base.rb', line 38 def event_endpoint raise NotImplementedError, "You should define #{self.class}##{__method__}." end |
#get_event ⇒ Object
25 26 27 28 |
# File 'lib/url_2_event/base.rb', line 25 def get_event response = self.class.get(event_endpoint, ) to_event(response) end |
#sanitize(raw) ⇒ Object
30 31 32 |
# File 'lib/url_2_event/base.rb', line 30 def sanitize(raw) Rails::Html::FullSanitizer.new().sanitize(raw) end |
#to_event ⇒ Object
34 35 36 |
# File 'lib/url_2_event/base.rb', line 34 def to_event raise NotImplementedError, "You should define #{self.class}##{__method__}." end |