Class: Fql::Query
- Inherits:
-
Object
- Object
- Fql::Query
- Defined in:
- lib/fql/query.rb
Instance Method Summary collapse
-
#compose ⇒ Object
Returns the query as a String which has been properly formatted and can be sent to Facebook.
-
#initialize(queries) ⇒ Query
constructor
A new instance of Query.
Constructor Details
#initialize(queries) ⇒ Query
Returns a new instance of Query.
4 5 6 7 8 9 10 11 12 |
# File 'lib/fql/query.rb', line 4 def initialize(queries) if queries.is_a?(Hash) @queries = queries elsif queries.is_a?(String) @queries = { q: queries } else raise "Invalid Query format: has to be a String or a Hash" end end |
Instance Method Details
#compose ⇒ Object
Returns the query as a String which has been properly formatted and can be sent to Facebook.
16 17 18 19 20 21 22 |
# File 'lib/fql/query.rb', line 16 def compose if @queries.length > 1 compose_multi_query else compose_single_query end end |