Class: Facebooker::BatchRun

Inherits:
Parser
  • Object
show all
Defined in:
lib/facebooker/parser.rb

Overview

:nodoc:

Constant Summary

Constants inherited from Parser

Parser::PARSERS

Class Method Summary collapse

Methods inherited from Parser

anonymous_field_from, array_of, array_of_hashes, array_of_text_values, booleanize, element, hash_or_value_for, hashinate, parse

Class Method Details

.current_batchObject



291
292
293
# File 'lib/facebooker/parser.rb', line 291

def current_batch
  Thread.current[:facebooker_current_batch]
end

.current_batch=(current_batch) ⇒ Object



288
289
290
# File 'lib/facebooker/parser.rb', line 288

def current_batch=(current_batch)
  Thread.current[:facebooker_current_batch]=current_batch
end

.process(data) ⇒ Object



295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/facebooker/parser.rb', line 295

def self.process(data)
  array_of_text_values(element('batch_run_response',data),"batch_run_response_elt").each_with_index do |response,i|
    batch_request=current_batch[i]
    body=Struct.new(:body).new
    body.body=CGI.unescapeHTML(response)
    begin
      batch_request.result=Parser.parse(batch_request.method,body)
    rescue Exception=>ex
      batch_request.exception_raised=ex
    end
  end
end