fql 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +5 -0
- data/lib/fql/query.rb +1 -1
- data/lib/fql/version.rb +1 -1
- data/test/fql/query_test.rb +10 -6
- metadata +2 -2
data/README.markdown
CHANGED
@@ -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
|
---
|
data/lib/fql/query.rb
CHANGED
data/lib/fql/version.rb
CHANGED
data/test/fql/query_test.rb
CHANGED
@@ -2,10 +2,7 @@ require 'test_helper'
|
|
2
2
|
require 'fql/query'
|
3
3
|
|
4
4
|
class FqlQueryTest < ActiveSupport::TestCase
|
5
|
-
|
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.
|
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-
|
12
|
+
date: 2012-09-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|