Class: Tappy::AgentFilter
- Defined in:
- lib/tappy/filter/agent_filter.rb
Instance Attribute Summary
Attributes inherited from Filter
Instance Method Summary collapse
Methods inherited from Filter
Constructor Details
This class inherits a constructor from Tappy::Filter
Instance Method Details
#filter(response) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tappy/filter/agent_filter.rb', line 3 def filter(response) json = JSON.parse(response.body) begin if json.class == Array json.each do |item| source = item["source"] if source.nil? elsif source.match() puts "filterer: #{item["source"]}" json.delete(item) else puts "not filtered: #{source}" end end statues.to_s else response.body end rescue response.body end end |