Module: Koala::Facebook::RestAPIMethods

Included in:
GraphAndRestAPI, RestAPI
Defined in:
lib/koala/rest_api.rb

Instance Method Summary collapse

Instance Method Details

#fql_query(fql) ⇒ Object



6
7
8
# File 'lib/koala/rest_api.rb', line 6

def fql_query(fql)
  rest_call('fql.query', 'query' => fql)
end

#rest_call(method, args = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/koala/rest_api.rb', line 10

def rest_call(method, args = {})
  response = api("method/#{method}", args.merge('format' => 'json'), 'get', :rest_api => true) do |response|
    # 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
  end
  
  response
end