fql 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -34,6 +34,11 @@ gem 'fql'
34
34
  "query2" => "SELECT name FROM user WHERE uid IN (SELECT uid FROM #query1)"
35
35
  }, options)
36
36
  # => [{"name"=>"query1", "fql_result_set"=>[{"uid"=>712638919, "rsvp_status"=>"attending"}, {"uid"=>711903876, "rsvp_status"=>"attending"}, {"uid"=>711447283, "rsvp_status"=>"attending"}]}, {"name"=>"query2", "fql_result_set"=>[{"name"=>"Srikanth Nagandla"}, {"name"=>"Hinling Yeung"}, {"name"=>"G\u00F6khan Olgun"}]}]
37
+ # Or the same result but formatted:
38
+ # [
39
+ # {"name"=>"query1", "fql_result_set"=>[{"uid"=>712638919, "rsvp_status"=>"attending"}, {"uid"=>711903876, "rsvp_status"=>"attending"}, {"uid"=>711447283, "rsvp_status"=>"attending"}]},
40
+ # {"name"=>"query2", "fql_result_set"=>[{"name"=>"Srikanth Nagandla"}, {"name"=>"Hinling Yeung"}, {"name"=>"G\u00F6khan Olgun"}]}
41
+ # ]
37
42
  ```
38
43
 
39
44
  ---
@@ -33,7 +33,7 @@ module Fql
33
33
  end
34
34
 
35
35
  def compose_single_query
36
- @queries[:q]
36
+ @queries[@queries.keys[0]]
37
37
  end
38
38
 
39
39
  end
@@ -1,3 +1,3 @@
1
1
  module Fql
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -2,10 +2,7 @@ require 'test_helper'
2
2
  require 'fql/query'
3
3
 
4
4
  class FqlQueryTest < ActiveSupport::TestCase
5
- test "truth" do
6
- assert_kind_of Class, Fql::Query
7
- end
8
-
5
+
9
6
  test "can create single query without using hash" do
10
7
  assert_nothing_raised do
11
8
  query = Fql::Query.new "SELECT uid2 FROM friend WHERE uid1=me()"
@@ -17,16 +14,23 @@ class FqlQueryTest < ActiveSupport::TestCase
17
14
  test 'multiquery gets composed properly' do
18
15
  multi_query = {
19
16
  all_friends: "SELECT uid2 FROM friend WHERE uid1=me()",
20
- my_name: "SELECT name FROM user WHERE uid=me()"
17
+ my_name: "SELECT name FROM user WHERE uid=me()"
21
18
  }
22
19
  query = Fql::Query.new multi_query
23
20
 
24
21
  actual = query.compose
25
22
  expected = "{" +
26
- "'all_friends':'SELECT uid2 FROM friend WHERE uid1=me()'," +
23
+ "'all_friends':'SELECT uid2 FROM friend WHERE uid1=me()'," +
27
24
  "'my_name':'SELECT name FROM user WHERE uid=me()'" +
28
25
  "}"
29
26
 
30
27
  assert_equal expected, actual
31
28
  end
29
+
30
+ test 'single query gets composed properly' do
31
+ query = Fql::Query.new "SELECT name FROM user WHERE uid=me()"
32
+ actual = query.compose
33
+ expected = "SELECT name FROM user WHERE uid=me()"
34
+ assert_equal expected, actual
35
+ end
32
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-16 00:00:00.000000000 Z
12
+ date: 2012-09-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json