cortex-client 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -3
- data/lib/cortex/version.rb +1 -1
- data/spec/client_spec.rb +1 -1
- data/spec/posts_spec.rb +8 -1
- data/spec/request_spec.rb +1 -1
- data/spec/users_spec.rb +1 -1
- 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: 52c91d9ed9913220d2dffdb5f5ba62bdd9203da2
|
4
|
+
data.tar.gz: 048fc0c77d4b098fa9457e9d35607b043dd67e4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1244ad240d3928ab04f55c3a65c8a2aeba3a36fae7cfdc57e8cc649a5580843614c99d6b2c9adb709ffc6b202bf35d65eabc558efe9738e97e521a2c1de0877f
|
7
|
+
data.tar.gz: 13c739389d695629dc14645fa661585e47073d1f6510429d6d546b0605491c38773377d4584b95b42f205889dcc348cbc8be91e5d7a57f628075029df63dc12a
|
data/README.md
CHANGED
@@ -12,19 +12,29 @@ Please note that 0.1.0 and onward now require a hash be passed. You can access t
|
|
12
12
|
```ruby
|
13
13
|
require 'cortex-client'
|
14
14
|
|
15
|
-
client = Cortex::Client.new(access_token: access_token)
|
15
|
+
client = Cortex::Client.new(access_token: 'access_token')
|
16
16
|
|
17
17
|
client.posts.query().each do |post|
|
18
18
|
puts post
|
19
19
|
end
|
20
20
|
```
|
21
21
|
|
22
|
-
Alternatively, cortex-client will handle
|
22
|
+
Alternatively, cortex-client will handle OAuth2 authentication for you:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
require 'cortex-client'
|
26
|
+
|
27
|
+
client = Cortex::Client.new(key: 'my-app-id', secret: 'secrey-key-ssh', base_url: 'base_url')
|
28
|
+
|
29
|
+
client.posts.query().each do |post|
|
30
|
+
puts post
|
31
|
+
end
|
32
|
+
```
|
23
33
|
|
24
34
|
### Supported Endpoints
|
25
35
|
|
26
36
|
- *Users* - me, get ,save
|
27
|
-
- *Posts* - query, get, save, delete
|
37
|
+
- *Posts* - query, get, save, delete, feed
|
28
38
|
|
29
39
|
### TODO
|
30
40
|
- Handle pagination
|
data/lib/cortex/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe Cortex::Client do
|
|
5
5
|
let(:access_token) { '123' }
|
6
6
|
let(:base_url) { 'http://localhost:3000' }
|
7
7
|
let(:client) do
|
8
|
-
Cortex::Client.new(access_token, base_url)
|
8
|
+
Cortex::Client.new(access_token: access_token, base_url: base_url)
|
9
9
|
end
|
10
10
|
|
11
11
|
it 'should preserve settings' do
|
data/spec/posts_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Cortex::Posts do
|
4
4
|
|
5
|
-
let(:client) { Cortex::Client.new('123') }
|
5
|
+
let(:client) { Cortex::Client.new(access_token: '123') }
|
6
6
|
|
7
7
|
describe :get do
|
8
8
|
it 'should correctly make the request' do
|
@@ -11,6 +11,13 @@ describe Cortex::Posts do
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
describe :feed do
|
15
|
+
it 'should correctly make the request' do
|
16
|
+
client.should_receive(:get).with('/posts/feed').and_return('response')
|
17
|
+
client.posts.feed().should == 'response'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
14
21
|
describe :save do
|
15
22
|
context 'with an existing post' do
|
16
23
|
it 'should correctly make the request' do
|
data/spec/request_spec.rb
CHANGED
data/spec/users_spec.rb
CHANGED