Sha256: 069e58c9d870af60184f40ff856b1b95b6542ab2064acc581901dc39675347df

Contents?: true

Size: 649 Bytes

Versions: 1

Compression:

Stored size: 649 Bytes

Contents

module Koala
  module Facebook
    REST_SERVER = "api.facebook.com"
    
    module RestAPIMethods
      def fql_query(fql)
        args = {
          "query" => fql,
          "format" => "json",
        }

        api('method/fql.query', args, 'get', :rest_api => true)
      end
      
      def api(*args)
        response = super
        
        # check for REST API-specific errors
        if response.is_a?(Hash) && response["error_code"]
          raise APIError.new("type" => response["error_code"], "message" => response["error_msg"])
        end
        
        response
      end
    end
    
  end # module Facebook
end # module Koala

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
koala-0.6.0 lib/rest_api.rb