Class: SilverMother::Event
- Inherits:
-
Object
- Object
- SilverMother::Event
- Includes:
- Singleton
- Defined in:
- lib/silver_mother/event.rb
Instance Attribute Summary collapse
-
#event_cache ⇒ Object
readonly
Returns the value of attribute event_cache.
-
#feed_uids ⇒ Object
readonly
Returns the value of attribute feed_uids.
-
#feeds ⇒ Object
readonly
Returns the value of attribute feeds.
-
#node_uids ⇒ Object
readonly
Returns the value of attribute node_uids.
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
-
#token ⇒ Object
Returns the value of attribute token.
-
#ttls ⇒ Object
readonly
Returns the value of attribute ttls.
Instance Method Summary collapse
Instance Attribute Details
#event_cache ⇒ Object (readonly)
Returns the value of attribute event_cache.
8 9 10 |
# File 'lib/silver_mother/event.rb', line 8 def event_cache @event_cache end |
#feed_uids ⇒ Object (readonly)
Returns the value of attribute feed_uids.
8 9 10 |
# File 'lib/silver_mother/event.rb', line 8 def feed_uids @feed_uids end |
#feeds ⇒ Object (readonly)
Returns the value of attribute feeds.
8 9 10 |
# File 'lib/silver_mother/event.rb', line 8 def feeds @feeds end |
#node_uids ⇒ Object (readonly)
Returns the value of attribute node_uids.
8 9 10 |
# File 'lib/silver_mother/event.rb', line 8 def node_uids @node_uids end |
#nodes ⇒ Object (readonly)
Returns the value of attribute nodes.
8 9 10 |
# File 'lib/silver_mother/event.rb', line 8 def nodes @nodes end |
#token ⇒ Object
Returns the value of attribute token.
7 8 9 |
# File 'lib/silver_mother/event.rb', line 7 def token @token end |
#ttls ⇒ Object (readonly)
Returns the value of attribute ttls.
8 9 10 |
# File 'lib/silver_mother/event.rb', line 8 def ttls @ttls end |
Instance Method Details
#call(token) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/silver_mother/event.rb', line 15 def call(token) @token = token @feeds_api = SilverMother::Feed.instance @feeds_api.call(@token) @nodes_api = SilverMother::Node.instance @nodes_api.call(@token) end |
#clear_cache! ⇒ Object
50 51 52 53 |
# File 'lib/silver_mother/event.rb', line 50 def clear_cache! @event_cache = {} @ttls = {} end |
#events(uid, type = nil) ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/silver_mother/event.rb', line 39 def events(uid, type = nil) @event_cache ||= {} @ttls ||= {} clear_cache(uid) if expired?(@ttls[uid]) @ttls[uid] ||= ttl(TTL) @event_cache[uid] ||= Api.instance .get(path(uid, type), @token) .to_ostruct .objects end |