Class: Radar::MessageList

Inherits:
Resource show all
Defined in:
lib/radar_client_rb/resource.rb

Instance Method Summary collapse

Methods inherited from Resource

#logger

Constructor Details

#initialize(client, name) ⇒ MessageList

Returns a new instance of MessageList.



87
88
89
# File 'lib/radar_client_rb/resource.rb', line 87

def initialize(client, name)
  super(client, "message:/#{client.subdomain}/#{name}")
end

Instance Method Details

#getObject



91
92
93
94
95
96
97
98
99
100
# File 'lib/radar_client_rb/resource.rb', line 91

def get
  # Unfortunately we can't apply any maxAge policies.
  result_arr = @client.redis.zrange(@name, -100, -1, :with_scores => true)
  result = []
  result_arr.each do |message_json, time|
    message = JSON.parse(message_json, :quirks_mode => true)
    result << [message, time]
  end
  result
end