orchestrate.io 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 030c4576b297c75a43131f0ee77a6480a3ad54de
4
- data.tar.gz: 41d62609e2f8f47af724f6c81fdfd55692c8525f
3
+ metadata.gz: 64d4dc3dcb7ee565eac14b038f92c43d21a774e3
4
+ data.tar.gz: 46c4c37e165aa91732991565e81fb31d93526c01
5
5
  SHA512:
6
- metadata.gz: 8112bd88a96b59c3f70d8b466127f0ef128c02fe916269405650250bda8c90fbaece103c97f6e64420d9fdf415c239e80999b3f133cc9895ea9af4d2ad9c6ebe
7
- data.tar.gz: 7b62f8740304def1591fbad20dc163a878ed00e75f7df08d291a975681cacd1074029d612b2c2d313565d41e227b100b4d38ffec77b449a9314c43318d17bba0
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
- #### Key/Value
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
- @io.key_value :get do
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
- #### Search
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
- #### Events
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.events :put do
108
+ @io.event :get do
68
109
  collection "foo"
69
110
  key "bar"
70
111
  type "log"
71
- data @json_data
72
-  timestamp 1384224213
112
+  from 1384224210
113
+  to 1384224213
73
114
  end.perform
115
+ ```
74
116
 
75
- @io.events :get do
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
-  from 1384224210
80
-  to 1384224213
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
- #### Graph
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/events'
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 Events
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.events :get do
11
+ # request = io.event :get do
12
12
  # collection 'films'
13
13
  # key 'the_godfather'
14
14
  # type 'comments'
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module OrchestrateIo
4
- Version = VERSION = "0.1.4"
4
+ Version = VERSION = "0.1.5"
5
5
  end
@@ -74,16 +74,16 @@ describe OrchestrateIo::Client do
74
74
  end
75
75
  end
76
76
 
77
- context '#events' do
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.events(:get){
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::Events
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::Events do
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.events :put do
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.events :get do
33
+ client.event :get do
34
34
  collection "films"
35
35
  key "the_godfather"
36
36
  type "comments"
@@ -3,6 +3,13 @@ require 'sinatra/base'
3
3
 
4
4
  class PseudoOrchestrateIo < Sinatra::Base
5
5
 
6
+ # == Collection
7
+
8
+ # DELETE /:version/:collection
9
+ delete "/:version/:collection" do
10
+ json_response 204
11
+ end
12
+
6
13
  # == KeyValue
7
14
 
8
15
  # PUT /:version/:collection/:key
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
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 00:00:00.000000000 Z
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/events.rb
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