Class: CS::Messages

Inherits:
Object
  • Object
show all
Defined in:
lib/csapi.rb

Instance Method Summary collapse

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

#countObject



182
183
184
# File 'lib/csapi.rb', line 182

def count
  return @data.count
end

#eachObject



190
191
192
193
194
# File 'lib/csapi.rb', line 190

def each
  @data.each do |url|
    yield @ref.message(url)
  end
end

#has_more?Boolean

Returns:

  • (Boolean)


186
187
188
# File 'lib/csapi.rb', line 186

def has_more?
  return @after != nil
end

#moreObject



196
197
198
199
200
201
# File 'lib/csapi.rb', line 196

def more
  more = @ref.messages(@q[:type], @q[:limit], @after)
  @data = more['object']
  @after = more.include?('after') ?  more['after'] : nil; 
  return self
end