thebigdb 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- thebigdb (1.2.2)
4
+ thebigdb (1.2.3)
5
5
  rack (~> 1.4)
6
6
 
7
7
  GEM
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 ``execute``.
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 execute
33
+ def load
34
34
  to_hash # goes through method_missing
35
35
  end
36
- alias_method :response, :execute
36
+ alias_method :response, :load
37
+ alias_method :execute, :load
37
38
 
38
- def execute! # forces the request to be re-executed
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
@@ -2,7 +2,7 @@ module TheBigDB
2
2
  module VERSION
3
3
  MAJOR = 1
4
4
  MINOR = 2
5
- TINY = 2
5
+ TINY = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
8
8
  end
@@ -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.execute
46
- response.execute
45
+ response.load
46
+ response.load
47
47
 
48
48
  response = TheBigDB.search("a", "b", {match: "red"}).with(page: 2)
49
- response.execute
50
- response.execute!
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"}).execute
67
- TheBigDB.show("foobar").execute
68
- TheBigDB.create("foobar").execute
69
- TheBigDB.upvote("foobar").execute
70
- TheBigDB.downvote("foobar").execute
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.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-02 00:00:00.000000000 Z
12
+ date: 2013-04-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack