Class: SimpleFacebookConnect::Service
- Inherits:
-
Object
- Object
- SimpleFacebookConnect::Service
- Defined in:
- lib/simple_facebook_connect/service.rb
Instance Method Summary collapse
-
#initialize(api_base, api_path, api_key) ⇒ Service
constructor
A new instance of Service.
- #post(params) ⇒ Object
- #post_form(url, params) ⇒ Object
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 |