Class: Facebooker::Service
- Inherits:
-
Object
- Object
- Facebooker::Service
- Defined in:
- lib/facebooker/service.rb
Instance Method Summary collapse
-
#initialize(api_base, api_path, api_key) ⇒ Service
constructor
A new instance of Service.
-
#post(params) ⇒ Object
TODO: support ssl.
- #post_file(params) ⇒ Object
Constructor Details
#initialize(api_base, api_path, api_key) ⇒ Service
Returns a new instance of Service.
5 6 7 8 9 |
# File 'lib/facebooker/service.rb', line 5 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
TODO: support ssl
12 13 14 15 16 17 18 19 20 |
# File 'lib/facebooker/service.rb', line 12 def post(params) attempt = 0 Parser.parse(params[:method], Net::HTTP.post_form(url, params)) rescue Errno::ECONNRESET, EOFError if attempt == 0 attempt += 1 retry end end |
#post_file(params) ⇒ Object
22 23 24 |
# File 'lib/facebooker/service.rb', line 22 def post_file(params) Parser.parse(params[:method], Net::HTTP.post_multipart_form(url, params)) end |