Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
module ActionSprout::Facebook
  class HTTPService
    def get(url, options, graph)
      build_response(HTTParty.get(url, options), graph)
    end

    def post(url, options, graph)
      build_response(HTTParty.post(url, options), graph)
    end

    private

    def build_response(httparty_response, graph)
      headers = headers_from_httparty httparty_response
      Response.new httparty_response.code, httparty_response.parsed_response, headers, graph
    end

    def headers_from_httparty(httparty_response)
      headers_hash = httparty_response.headers.to_h
      headers_hash.each_with_object({}) do |(key, val), object|
        object[key] = val.first
      end
    end

  end
end