17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/rolltools/utils.rb', line 17
def self.get_items(counter)
token = Rolltools::Settings.get('read_token')
raise "token is not set, use 'rolltools set_config token VALUE'" if token.nil?
item_id = get_item_for_counter(counter)
Enumerator.new do |y|
page = 1
begin
get_item_res = conn.get "/api/1/item/#{item_id}/instances/", access_token: token, page: page
item = JSON.parse(get_item_res.body)
item['result']['instances'].each do |i|
e = i['data']['body']['trace']['exception']
y << { url: i['data']['request']['url'],
user_agent: i['data']['request']['headers']['User-Agent'],
instance_id: i['id'],
exception: "#{e['class']} #{e['message']}"
}
end
page += 1
end until item['result']['instances'].empty?
end
end
|