Skip to content

Commit e3ae664

Browse files
author
Alex Tharp
authored
Merge pull request #30 from cortex-cms/content-items
Basic Beta Cortex API
2 parents 28f2546 + db93bd6 commit e3ae664

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

lib/cortex/client.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
require 'cortex/connection'
44
require 'cortex/request'
55
require 'cortex/resource'
6+
require 'cortex/content_items'
67
require 'cortex/posts'
78
require 'cortex/users'
89
require 'cortex/webpages'
910
require 'cortex/result'
1011

1112
module Cortex
1213
class Client
13-
attr_reader :posts, :users, :webpages
14+
attr_reader :posts, :users, :webpages, :content_items
1415
attr_accessor :access_token, :base_url, :auth_method
1516
@key = ''
1617
@secret = ''
@@ -32,6 +33,7 @@ def initialize(hasharg)
3233
@posts = Cortex::Posts.new(self)
3334
@users = Cortex::Users.new(self)
3435
@webpages = Cortex::Webpages.new(self)
36+
@content_items = Cortex::ContentItems.new(self)
3537
end
3638

3739
def get_cc_token

lib/cortex/content_items.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module Cortex
2+
class ContentItems < Cortex::Resource
3+
def query(params = {})
4+
client.get('/content_items', params)
5+
end
6+
7+
def feed(params = {})
8+
client.get('/content_items/feed', params)
9+
end
10+
11+
def get(id)
12+
client.get("/content_items/#{id}")
13+
end
14+
15+
def get_published(id)
16+
client.get("/content_items/feed/#{id}")
17+
end
18+
19+
def save(content_item)
20+
client.save('/content_items', content_item)
21+
end
22+
23+
def delete(id)
24+
client.delete("/content_items/#{id}")
25+
end
26+
end
27+
end

lib/cortex/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Cortex
2-
VERSION = '0.10.3'
2+
VERSION = '0.11.0'
33
end

0 commit comments

Comments
 (0)