Class: SimpleFacebookConnect::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_facebook_connect/service.rb

Instance Method Summary collapse

Constructor Details

#initialize(api_base, api_path, api_key) ⇒ Service

Returns a new instance of Service.



6
7
8
9
10
# File 'lib/simple_facebook_connect/service.rb', line 6

def initialize(api_base, api_path, api_key)
  @api_base = api_base
  @api_path = api_path
  @api_key = api_key
end

Instance Method Details

#post(params) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/simple_facebook_connect/service.rb', line 12

def post(params)
  attempt = 0
  Parser.parse(params[:method], post_form(url,params) )
rescue Errno::ECONNRESET, EOFError
  if attempt == 0
    attempt += 1
    retry
  end
end

#post_form(url, params) ⇒ Object



22
23
24
# File 'lib/simple_facebook_connect/service.rb', line 22

def post_form(url,params)
  Net::HTTP.post_form(url, params.stringify_keys)
end