Class: MonogotoApi::Event::List
- Inherits:
-
Object
- Object
- MonogotoApi::Event::List
- Defined in:
- lib/monogoto_api/event/list.rb
Instance Attribute Summary collapse
-
#counter ⇒ Object
readonly
Returns the value of attribute counter.
-
#events ⇒ Object
readonly
Returns the value of attribute events.
Class Method Summary collapse
-
.parse(resp_events) ⇒ Object
Parser of API events response.
Instance Method Summary collapse
-
#initialize ⇒ List
constructor
A new instance of List.
-
#push(event) ⇒ Object
Push event element to events array.
Constructor Details
#initialize ⇒ List
Returns a new instance of List.
8 9 10 |
# File 'lib/monogoto_api/event/list.rb', line 8 def initialize @events = [] end |
Instance Attribute Details
#counter ⇒ Object (readonly)
Returns the value of attribute counter.
6 7 8 |
# File 'lib/monogoto_api/event/list.rb', line 6 def counter @counter end |
#events ⇒ Object (readonly)
Returns the value of attribute events.
6 7 8 |
# File 'lib/monogoto_api/event/list.rb', line 6 def events @events end |
Class Method Details
.parse(resp_events) ⇒ Object
Parser of API events response
20 21 22 23 24 |
# File 'lib/monogoto_api/event/list.rb', line 20 def self.parse(resp_events) list = new resp_events.fetch("hits", {}).each { |event| list.push(MonogotoApi::Event.parse(event)) } list end |
Instance Method Details
#push(event) ⇒ Object
Push event element to events array
13 14 15 16 17 |
# File 'lib/monogoto_api/event/list.rb', line 13 def push(event) push_result = @events.push(event) @counter = push_result.size push_result end |