Class: PoxyClient::Processor

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

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Processor

Returns a new instance of Processor.



4
5
6
# File 'lib/poxy_client/processor.rb', line 4

def initialize(options = {})

end

Instance Method Details

#complete_itemsObject



27
28
29
# File 'lib/poxy_client/processor.rb', line 27

def complete_items
  @complete_items
end

#parse(content) ⇒ Array

Parse the JSON encoded string from the retriever and generates an Object

Parameters:

  • content (String)

    The JSON encoded string from the retriever.

Returns:

  • (Array)

    The list of items retrieved



12
13
14
15
16
17
18
19
20
21
# File 'lib/poxy_client/processor.rb', line 12

def parse(content)
  @response = []
  if ( content.respond_to?(:body) )
    @response = JSON.parse(content.body)
  else
    @response = JSON.parse(content)
  end
  @complete_items = @response["items"]
  @raw_items = @response["items"].map{|i| i['raw']}
end

#raw_itemsObject



31
32
33
# File 'lib/poxy_client/processor.rb', line 31

def raw_items
  @raw_items
end

#responseObject



23
24
25
# File 'lib/poxy_client/processor.rb', line 23

def response
  @response
end