orchestrate.io 0.1.4 → 0.1.5
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 +71 -17
- data/lib/orchestrate.io/client.rb +2 -1
- data/lib/orchestrate.io/collection.rb +46 -0
- data/lib/orchestrate.io/{events.rb → event.rb} +2 -2
- data/lib/orchestrate.io/version.rb +1 -1
- data/spec/orchestrate.io/client_spec.rb +3 -3
- data/spec/orchestrate.io/collection_spec.rb +26 -0
- data/spec/orchestrate.io/events_spec.rb +3 -3
- data/spec/support/pseudo_orchestrate.io.rb +7 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64d4dc3dcb7ee565eac14b038f92c43d21a774e3
|
4
|
+
data.tar.gz: 46c4c37e165aa91732991565e81fb31d93526c01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: baaa6949592a3d9976db9a8353015618da3c928b9eed997401f1e282dda17bf1b7c4014e299faf79d1dd35380652eea3c39b8f67497624af12c81356aa434378
|
7
|
+
data.tar.gz: cf657f6f6024c72a3db4a0767d52cbde041edf276ea4eeb658039b47e417336c7b31e9ab641afeff97f831a2ab7bef7c469467870b6728175c346b9959785a74
|
data/README.md
CHANGED
@@ -28,6 +28,8 @@ $ gem install orchestrate.io
|
|
28
28
|
|
29
29
|
## Usage
|
30
30
|
|
31
|
+
Initializes the `OrchestrateIo` class with your API key to create a new object that you perform the following API calls with.
|
32
|
+
|
31
33
|
```
|
32
34
|
require 'orchestrate.io'
|
33
35
|
require 'json'
|
@@ -37,7 +39,36 @@ require 'json'
|
|
37
39
|
@search_query = "hello dolly"
|
38
40
|
```
|
39
41
|
|
40
|
-
|
42
|
+
### Collections
|
43
|
+
|
44
|
+
##### DELETE
|
45
|
+
Deletes an entire collection.
|
46
|
+
|
47
|
+
> under development
|
48
|
+
|
49
|
+
```
|
50
|
+
@io.collection :delete do
|
51
|
+
collection "foo"
|
52
|
+
force true
|
53
|
+
end.perform
|
54
|
+
```
|
55
|
+
|
56
|
+
### Key/Value
|
57
|
+
|
58
|
+
##### GET
|
59
|
+
Gets the latest value assigned to a key.
|
60
|
+
|
61
|
+
```
|
62
|
+
@io.key_value :get do
|
63
|
+
collection "foo"
|
64
|
+
key "bar"
|
65
|
+
end.perform
|
66
|
+
```
|
67
|
+
|
68
|
+
##### PUT
|
69
|
+
Creates or updates the value at the collection/key specified.
|
70
|
+
|
71
|
+
`NOTE`: You can create a new collection by performing a Key/Value PUT to the collection.
|
41
72
|
|
42
73
|
```
|
43
74
|
@io.key_value :put do
|
@@ -45,14 +76,21 @@ require 'json'
|
|
45
76
|
key "bar"
|
46
77
|
data @json_data
|
47
78
|
end.perform
|
79
|
+
```
|
48
80
|
|
49
|
-
|
81
|
+
##### DELETE
|
82
|
+
Sets the value of a key to a null object.
|
83
|
+
|
84
|
+
```
|
85
|
+
@io.key_value :delete do
|
50
86
|
collection "foo"
|
51
87
|
key "bar"
|
52
88
|
end.perform
|
53
89
|
```
|
54
90
|
|
55
|
-
|
91
|
+
### Search
|
92
|
+
|
93
|
+
Returns list of items matching the lucene query.
|
56
94
|
|
57
95
|
```
|
58
96
|
@io.search :get do
|
@@ -61,27 +99,49 @@ end.perform
|
|
61
99
|
end.perform
|
62
100
|
```
|
63
101
|
|
64
|
-
|
102
|
+
### Events
|
103
|
+
|
104
|
+
##### GET
|
105
|
+
Returns a list of events, optionally limited to specified time range in reverse chronological order.
|
65
106
|
|
66
107
|
```
|
67
|
-
@io.
|
108
|
+
@io.event :get do
|
68
109
|
collection "foo"
|
69
110
|
key "bar"
|
70
111
|
type "log"
|
71
|
-
|
72
|
-
|
112
|
+
from 1384224210
|
113
|
+
to 1384224213
|
73
114
|
end.perform
|
115
|
+
```
|
74
116
|
|
75
|
-
|
117
|
+
##### PUT
|
118
|
+
Puts an event with an optional user defined timestamp.
|
119
|
+
|
120
|
+
```
|
121
|
+
@io.event :put do
|
76
122
|
collection "foo"
|
77
123
|
key "bar"
|
78
124
|
type "log"
|
79
|
-
|
80
|
-
|
125
|
+
data @json_data
|
126
|
+
timestamp 1384224213
|
127
|
+
end.perform
|
128
|
+
```
|
129
|
+
|
130
|
+
### Graph
|
131
|
+
|
132
|
+
##### GET
|
133
|
+
Returns relation’s collection, key, ref, and values.
|
134
|
+
|
135
|
+
```
|
136
|
+
@io.graph :get do
|
137
|
+
collection "foo"
|
138
|
+
key "bar1"
|
139
|
+
relation "friends"
|
81
140
|
end.perform
|
82
141
|
```
|
83
142
|
|
84
|
-
|
143
|
+
##### PUT
|
144
|
+
Creates a relationship between two objects. Relations can span collections.
|
85
145
|
|
86
146
|
```
|
87
147
|
@io.graph :put do
|
@@ -91,12 +151,6 @@ end.perform
|
|
91
151
|
to_collection "hoge"
|
92
152
|
to_key "bar2"
|
93
153
|
end.perform
|
94
|
-
|
95
|
-
@io.graph :get do
|
96
|
-
collection "foo"
|
97
|
-
key "bar1"
|
98
|
-
relation "friends"
|
99
|
-
end.perform
|
100
154
|
```
|
101
155
|
|
102
156
|
## Contributing
|
@@ -2,9 +2,10 @@
|
|
2
2
|
require 'httparty'
|
3
3
|
require 'orchestrate.io/helper'
|
4
4
|
require 'orchestrate.io/configuration'
|
5
|
+
require 'orchestrate.io/collection'
|
5
6
|
require 'orchestrate.io/key_value'
|
6
7
|
require 'orchestrate.io/search'
|
7
|
-
require 'orchestrate.io/
|
8
|
+
require 'orchestrate.io/event'
|
8
9
|
require 'orchestrate.io/graph'
|
9
10
|
require 'orchestrate.io/request'
|
10
11
|
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module OrchestrateIo
|
4
|
+
class Collection
|
5
|
+
|
6
|
+
attr_reader :request
|
7
|
+
|
8
|
+
# == Usage
|
9
|
+
#
|
10
|
+
# io = OrchestrateIo.new(api_key: "abc")
|
11
|
+
# request = io.collection :delete do
|
12
|
+
# collection 'films'
|
13
|
+
# key 'the_godfather'
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# request.perform
|
17
|
+
# #=> HTTParty::Response
|
18
|
+
#
|
19
|
+
def initialize(client, method, &block)
|
20
|
+
args = {
|
21
|
+
client: client,
|
22
|
+
http_method: method,
|
23
|
+
uri: uri,
|
24
|
+
options: options
|
25
|
+
}
|
26
|
+
|
27
|
+
@request = OrchestrateIo::Request.new(args, &block)
|
28
|
+
end
|
29
|
+
|
30
|
+
def perform
|
31
|
+
request.perform
|
32
|
+
end
|
33
|
+
|
34
|
+
protected
|
35
|
+
|
36
|
+
def uri
|
37
|
+
"/:version/:collection"
|
38
|
+
end
|
39
|
+
|
40
|
+
def options
|
41
|
+
options = {}
|
42
|
+
options[:query] = { force: :force }
|
43
|
+
options
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module OrchestrateIo
|
4
|
-
class
|
4
|
+
class Event
|
5
5
|
|
6
6
|
attr_reader :request
|
7
7
|
|
8
8
|
# == Usage
|
9
9
|
#
|
10
10
|
# io = OrchestrateIo.new(api_key: "abc")
|
11
|
-
# request = io.
|
11
|
+
# request = io.event :get do
|
12
12
|
# collection 'films'
|
13
13
|
# key 'the_godfather'
|
14
14
|
# type 'comments'
|
@@ -74,16 +74,16 @@ describe OrchestrateIo::Client do
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
-
context '#
|
77
|
+
context '#event' do
|
78
78
|
it 'creates a new event instance' do
|
79
79
|
request_data = '{ "User": "peter_bradshaw", "Text": "A measured, deathly serious epic." }'
|
80
80
|
expect(
|
81
|
-
client.
|
81
|
+
client.event(:get){
|
82
82
|
collection "films"
|
83
83
|
key "the_godfather"
|
84
84
|
type "comments"
|
85
85
|
}
|
86
|
-
).to be_an_instance_of OrchestrateIo::
|
86
|
+
).to be_an_instance_of OrchestrateIo::Event
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe OrchestrateIo::Collection do
|
5
|
+
let(:client) { OrchestrateIo.new(api_key: 'abc') }
|
6
|
+
|
7
|
+
describe "DELETE /:version/:collection" do
|
8
|
+
let(:request) {
|
9
|
+
client.collection :delete do
|
10
|
+
collection "films"
|
11
|
+
force true
|
12
|
+
end
|
13
|
+
}
|
14
|
+
|
15
|
+
it "performs a request with the correct options" do
|
16
|
+
client.should_receive(:request).
|
17
|
+
with(:delete, "/v0/films", {:query=>{:force=>true}})
|
18
|
+
request.perform
|
19
|
+
end
|
20
|
+
|
21
|
+
it "returns http no content" do
|
22
|
+
response = request.perform
|
23
|
+
expect(response.code).to eql 204
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
describe OrchestrateIo::
|
4
|
+
describe OrchestrateIo::Event do
|
5
5
|
let(:client) { OrchestrateIo.new(api_key: 'abc') }
|
6
6
|
|
7
7
|
describe "PUT /:version/:collection/:key/events/:type" do
|
8
8
|
let(:request) {
|
9
|
-
client.
|
9
|
+
client.event :put do
|
10
10
|
collection "films"
|
11
11
|
key "the_godfather"
|
12
12
|
type "comments"
|
@@ -30,7 +30,7 @@ describe OrchestrateIo::Events do
|
|
30
30
|
|
31
31
|
describe "GET /:version/:collection/:key/events/:type" do
|
32
32
|
let(:request) {
|
33
|
-
client.
|
33
|
+
client.event :get do
|
34
34
|
collection "films"
|
35
35
|
key "the_godfather"
|
36
36
|
type "comments"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orchestrate.io
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- azukiwasher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -184,10 +184,11 @@ files:
|
|
184
184
|
- bin/orchestrate.io
|
185
185
|
- lib/orchestrate.io.rb
|
186
186
|
- lib/orchestrate.io/client.rb
|
187
|
+
- lib/orchestrate.io/collection.rb
|
187
188
|
- lib/orchestrate.io/configuration.rb
|
188
189
|
- lib/orchestrate.io/core_ext.rb
|
189
190
|
- lib/orchestrate.io/core_ext/string.rb
|
190
|
-
- lib/orchestrate.io/
|
191
|
+
- lib/orchestrate.io/event.rb
|
191
192
|
- lib/orchestrate.io/graph.rb
|
192
193
|
- lib/orchestrate.io/helper.rb
|
193
194
|
- lib/orchestrate.io/key_value.rb
|
@@ -197,6 +198,7 @@ files:
|
|
197
198
|
- lib/orchestrate.io/version.rb
|
198
199
|
- orchestrate.io.gemspec
|
199
200
|
- spec/orchestrate.io/client_spec.rb
|
201
|
+
- spec/orchestrate.io/collection_spec.rb
|
200
202
|
- spec/orchestrate.io/core_ext/string_spec.rb
|
201
203
|
- spec/orchestrate.io/events_spec.rb
|
202
204
|
- spec/orchestrate.io/graph_spec.rb
|
@@ -237,6 +239,7 @@ specification_version: 4
|
|
237
239
|
summary: A Ruby wrapper for the Orchestrate.io API.
|
238
240
|
test_files:
|
239
241
|
- spec/orchestrate.io/client_spec.rb
|
242
|
+
- spec/orchestrate.io/collection_spec.rb
|
240
243
|
- spec/orchestrate.io/core_ext/string_spec.rb
|
241
244
|
- spec/orchestrate.io/events_spec.rb
|
242
245
|
- spec/orchestrate.io/graph_spec.rb
|