thebigdb 1.2.2 → 1.2.3
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/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/thebigdb/resources/statement.rb +9 -3
- data/lib/thebigdb/version.rb +1 -1
- data/spec/resources/statement_spec.rb +9 -9
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -11,7 +11,7 @@ A simple ruby wrapper for making requests to the API of [TheBigDB.com](http://th
|
|
11
11
|
## Simple usage
|
12
12
|
|
13
13
|
The following actions return a TheBigDB::StatementRequest object, on which you can add params using ``.with(hash_of_params)``.
|
14
|
-
The request will be executed once you call regular methods of Hash on it (``each_pair``, ``[key]``, etc.), or force it with ``
|
14
|
+
The request will be executed once you call regular methods of Hash on it (``each_pair``, ``[key]``, etc.), or force it with ``load``.
|
15
15
|
The Hash returned represents the server's JSON response.
|
16
16
|
|
17
17
|
### Search \([api doc](http://developers.thebigdb.com/api#statements-search)\)
|
@@ -30,15 +30,21 @@ module TheBigDB
|
|
30
30
|
@response.send(method_name, *arguments, &block)
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
33
|
+
def load
|
34
34
|
to_hash # goes through method_missing
|
35
35
|
end
|
36
|
-
alias_method :response, :
|
36
|
+
alias_method :response, :load
|
37
|
+
alias_method :execute, :load
|
37
38
|
|
38
|
-
def
|
39
|
+
def load! # forces the request to be re-loadd
|
39
40
|
@response = nil
|
40
41
|
to_hash
|
41
42
|
end
|
43
|
+
alias_method :execute!, :load!
|
44
|
+
|
45
|
+
def inspect
|
46
|
+
load.inspect
|
47
|
+
end
|
42
48
|
end
|
43
49
|
|
44
50
|
# Shortcuts to actions
|
data/lib/thebigdb/version.rb
CHANGED
@@ -42,12 +42,12 @@ describe "StatementRequest" do
|
|
42
42
|
stub_request(:get, @request_path.call("search")).to_return(:body => '{status: "success", statements: []}')
|
43
43
|
|
44
44
|
response = TheBigDB.search("a", "b", {match: "blue"}).with(page: 2)
|
45
|
-
response.
|
46
|
-
response.
|
45
|
+
response.load
|
46
|
+
response.load
|
47
47
|
|
48
48
|
response = TheBigDB.search("a", "b", {match: "red"}).with(page: 2)
|
49
|
-
response.
|
50
|
-
response.
|
49
|
+
response.load
|
50
|
+
response.load!
|
51
51
|
|
52
52
|
a_request(:get, @request_path.call("search"))
|
53
53
|
.with(query: hash_including({"nodes" => ["a", "b", {match: "blue"}], "page" => "2"})).should have_been_made.once
|
@@ -63,11 +63,11 @@ describe "StatementRequest" do
|
|
63
63
|
stub_request(:post, @request_path.call("upvote")).to_return(:body => '{status: "success"}')
|
64
64
|
stub_request(:post, @request_path.call("downvote")).to_return(:body => '{status: "success"}')
|
65
65
|
|
66
|
-
TheBigDB.search("a", "b", {match: "blue"}).
|
67
|
-
TheBigDB.show("foobar").
|
68
|
-
TheBigDB.create("foobar").
|
69
|
-
TheBigDB.upvote("foobar").
|
70
|
-
TheBigDB.downvote("foobar").
|
66
|
+
TheBigDB.search("a", "b", {match: "blue"}).load
|
67
|
+
TheBigDB.show("foobar").load
|
68
|
+
TheBigDB.create("foobar").load
|
69
|
+
TheBigDB.upvote("foobar").load
|
70
|
+
TheBigDB.downvote("foobar").load
|
71
71
|
|
72
72
|
a_request(:get, @request_path.call("search")).should have_been_made.once
|
73
73
|
a_request(:get, @request_path.call("show")).should have_been_made.once
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thebigdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
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: 2013-04-
|
12
|
+
date: 2013-04-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|