Class: CS::Messages
- Inherits:
-
Object
- Object
- CS::Messages
- Defined in:
- lib/csapi.rb
Instance Method Summary collapse
- #count ⇒ Object
- #each ⇒ Object
- #has_more? ⇒ Boolean
-
#initialize(object, q, ref) ⇒ Messages
constructor
A new instance of Messages.
- #more ⇒ Object
Constructor Details
#initialize(object, q, ref) ⇒ Messages
Returns a new instance of Messages.
174 175 176 177 178 179 180 |
# File 'lib/csapi.rb', line 174 def initialize(object, q, ref) @after = object['after'] if object.include? 'after'; @q = q; @ref = ref @data = object['object'] end |
Instance Method Details
#count ⇒ Object
182 183 184 |
# File 'lib/csapi.rb', line 182 def count return @data.count end |
#each ⇒ Object
190 191 192 193 194 |
# File 'lib/csapi.rb', line 190 def each @data.each do |url| yield @ref.(url) end end |
#has_more? ⇒ Boolean
186 187 188 |
# File 'lib/csapi.rb', line 186 def has_more? return @after != nil end |
#more ⇒ Object
196 197 198 199 200 201 |
# File 'lib/csapi.rb', line 196 def more more = @ref.(@q[:type], @q[:limit], @after) @data = more['object'] @after = more.include?('after') ? more['after'] : nil; return self end |