appbaseio 0.0.1 → 0.0.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.
- checksums.yaml +4 -4
- data/README.md +18 -2
- data/lib/appbaseio/client.rb +2 -1
- data/lib/appbaseio/version.rb +1 -1
- data/spec/appbaseio/client_spec.rb +9 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d6ce66665f56b8ee3f30b7ac29c3b8923e26eb5
|
4
|
+
data.tar.gz: bf67752d05ce65f5b7813c5eb2fac2a5720bba16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16618936dcfe794fd82e1154811df965bf6f6af89198ec866b08138cc006ae52673277ff2507990fa3e09e07cac890ea4bf29dd7c66d5f86e959e79f28a48fd9
|
7
|
+
data.tar.gz: 73fb69a61133ca4ba1845d8b392b3606096c6e47f813b12887244f19632215ef4f7751a8090c9e2d4acf43fab1facdbe9a8e8975e0beedd77f355b0819903d8e
|
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Appbaseio
|
2
2
|
|
3
|
-
|
3
|
+
[](https://travis-ci.org/ruanwz/appbaseio)
|
5
|
+
|
6
|
+
AppBase.io Ruby Rest Client
|
4
7
|
|
5
8
|
## Installation
|
6
9
|
|
@@ -20,7 +23,20 @@ Or install it yourself as:
|
|
20
23
|
|
21
24
|
## Usage
|
22
25
|
|
23
|
-
|
26
|
+
Read /spec/appbaseio/client\_spec.rb
|
27
|
+
|
28
|
+
```
|
29
|
+
require 'Appbaseio'
|
30
|
+
options = {
|
31
|
+
server_host: 'api.appbase.io',
|
32
|
+
app_name: 'testapp',
|
33
|
+
api_version: 'v2',
|
34
|
+
namespace: 'test_api',
|
35
|
+
app_secret: 'your secret'
|
36
|
+
}
|
37
|
+
client = Appbaseio::Client.new(options)
|
38
|
+
client.create_properties vertex: 'abc', data: {foo: 'bar'}
|
39
|
+
```
|
24
40
|
|
25
41
|
## Contributing
|
26
42
|
|
data/lib/appbaseio/client.rb
CHANGED
@@ -15,7 +15,7 @@ module Appbaseio
|
|
15
15
|
'delete' => :delete,
|
16
16
|
'properties' => :patch
|
17
17
|
}
|
18
|
-
TARGETS = %w{list properties edges}
|
18
|
+
TARGETS = %w{list properties edges search}
|
19
19
|
class Client
|
20
20
|
include Virtus.model
|
21
21
|
attribute :server_host, String, default: 'api.appbase.io'
|
@@ -56,6 +56,7 @@ module Appbaseio
|
|
56
56
|
data = {data: options[:data]}
|
57
57
|
data = {all: true} if operation == 'read' and target == 'properties'
|
58
58
|
data = {filters: {}} if operation == 'read' and target == 'edges'
|
59
|
+
data = options[:data] if target == 'search'
|
59
60
|
|
60
61
|
method = HTTP_METHOD_MAP[operation]
|
61
62
|
if data
|
data/lib/appbaseio/version.rb
CHANGED
@@ -35,6 +35,14 @@ describe Appbaseio::Client do
|
|
35
35
|
|
36
36
|
end
|
37
37
|
|
38
|
+
it "search vertex" do
|
39
|
+
VCR.use_cassette('search vertex') do
|
40
|
+
subject.create_properties vertex: 'notebook', data: {foo: 'some joke'}
|
41
|
+
resp = subject.read_search data: {query: {text: 'some joke', properties: ["foo"]}}
|
42
|
+
|
43
|
+
expect(resp.status).to be 204
|
44
|
+
end
|
45
|
+
end
|
38
46
|
it "create vertex" do
|
39
47
|
VCR.use_cassette('create vertex') do
|
40
48
|
resp = subject.create_properties vertex: 'abc', data: {foo: 'bar'}
|
@@ -95,4 +103,5 @@ describe Appbaseio::Client do
|
|
95
103
|
expect(resp.status).to be 200
|
96
104
|
end
|
97
105
|
end
|
106
|
+
|
98
107
|
end
|