Sha256: 5192926ca649f9e66632ce1cc2624ca7bde32c6e2f42e4b6ae85fbd2f7a112a6
Contents?: true
Size: 684 Bytes
Versions: 18
Compression:
Stored size: 684 Bytes
Contents
require 'net/http' require 'facebooker/parser' module Facebooker class Service def initialize(api_base, api_path, api_key) @api_base = api_base @api_path = api_path @api_key = api_key end # TODO: support ssl 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 def post_file(params) Parser.parse(params[:method], Net::HTTP.post_multipart_form(url, params)) end private def url URI.parse('http://'+ @api_base + @api_path) end end end
Version data entries
18 entries across 18 versions & 6 rubygems