Class: Mogli::FqlMultiquery

Inherits:
Object
  • Object
show all
Defined in:
lib/mogli/fql_multiquery.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (FqlMultiquery) initialize(client)

Takes Mogli::Client object



6
7
8
9
# File 'lib/mogli/fql_multiquery.rb', line 6

def initialize(client)
  @client   = client
  @queries  = {}
end

Instance Attribute Details

- (Object) client (readonly)

Returns the value of attribute client



3
4
5
# File 'lib/mogli/fql_multiquery.rb', line 3

def client
  @client
end

- (Object) queries (readonly)

Returns the value of attribute queries



3
4
5
# File 'lib/mogli/fql_multiquery.rb', line 3

def queries
  @queries
end

- (Object) raw_response (readonly)

Returns the value of attribute raw_response



3
4
5
# File 'lib/mogli/fql_multiquery.rb', line 3

def raw_response
  @raw_response
end

Instance Method Details

- (Object) add_named_query_for_class(query_name, query, klass)

Adds single query to multiquery with class used to populate results



12
13
14
# File 'lib/mogli/fql_multiquery.rb', line 12

def add_named_query_for_class(query_name, query, klass)
  @queries[query_name] = [query, klass]
end

- (Object) results

Fetch and parse results. Returns hash with the query names as keys, class objects as values. An empty or missing subquery value is returned as an empty array.



19
20
21
# File 'lib/mogli/fql_multiquery.rb', line 19

def results
  parse_response @raw_response = @client.fql_multiquery(query_map)
end