voog_api 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.rspec +2 -0
- data/Gemfile +3 -0
- data/Guardfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.markdown +55 -0
- data/Rakefile +1 -0
- data/lib/voog_api/api/articles.rb +77 -0
- data/lib/voog_api/api/assets.rb +31 -0
- data/lib/voog_api/api/comments.rb +36 -0
- data/lib/voog_api/api/content_partials.rb +21 -0
- data/lib/voog_api/api/contents.rb +38 -0
- data/lib/voog_api/api/element_definitions.rb +31 -0
- data/lib/voog_api/api/elements.rb +63 -0
- data/lib/voog_api/api/forms.rb +21 -0
- data/lib/voog_api/api/languages.rb +68 -0
- data/lib/voog_api/api/layout_assets.rb +39 -0
- data/lib/voog_api/api/layouts.rb +31 -0
- data/lib/voog_api/api/media_sets.rb +36 -0
- data/lib/voog_api/api/nodes.rb +26 -0
- data/lib/voog_api/api/pages.rb +77 -0
- data/lib/voog_api/api/people.rb +16 -0
- data/lib/voog_api/api/site.rb +35 -0
- data/lib/voog_api/api/tags.rb +26 -0
- data/lib/voog_api/api/texts.rb +21 -0
- data/lib/voog_api/api/tickets.rb +26 -0
- data/lib/voog_api/client.rb +140 -0
- data/lib/voog_api/version.rb +3 -0
- data/lib/voog_api.rb +46 -0
- data/spec/fixtures/articles/article.json +37 -0
- data/spec/fixtures/articles/articles.json +75 -0
- data/spec/fixtures/assets/asset.json +24 -0
- data/spec/fixtures/assets/assets.json +29 -0
- data/spec/fixtures/comments/comment.json +21 -0
- data/spec/fixtures/comments/comments.json +35 -0
- data/spec/fixtures/content_partials/content_partial.json +27 -0
- data/spec/fixtures/content_partials/content_partials.json +47 -0
- data/spec/fixtures/contents/content.json +31 -0
- data/spec/fixtures/contents/contents.json +63 -0
- data/spec/fixtures/element_definitions/element_definition.json +31 -0
- data/spec/fixtures/element_definitions/element_definitions.json +15 -0
- data/spec/fixtures/elements/element.json +35 -0
- data/spec/fixtures/elements/elements.json +57 -0
- data/spec/fixtures/forms/form.json +104 -0
- data/spec/fixtures/forms/forms.json +43 -0
- data/spec/fixtures/languages/language.json +13 -0
- data/spec/fixtures/languages/languages.json +27 -0
- data/spec/fixtures/layout_assets/layout_asset.json +14 -0
- data/spec/fixtures/layout_assets/layout_assets.json +29 -0
- data/spec/fixtures/layouts/layout.json +11 -0
- data/spec/fixtures/layouts/layouts.json +23 -0
- data/spec/fixtures/media_sets/media_set.json +23 -0
- data/spec/fixtures/media_sets/media_sets.json +32 -0
- data/spec/fixtures/nodes/node.json +11 -0
- data/spec/fixtures/nodes/nodes.json +23 -0
- data/spec/fixtures/pages/page.json +73 -0
- data/spec/fixtures/pages/pages.json +104 -0
- data/spec/fixtures/people/people.json +29 -0
- data/spec/fixtures/people/person.json +14 -0
- data/spec/fixtures/site/site.json +30 -0
- data/spec/fixtures/tags/tag.json +20 -0
- data/spec/fixtures/tags/tags.json +31 -0
- data/spec/fixtures/texts/text.json +23 -0
- data/spec/fixtures/texts/texts.json +45 -0
- data/spec/fixtures/tickets/ticket.json +26 -0
- data/spec/fixtures/tickets/tickets.json +29 -0
- data/spec/spec_helper.rb +46 -0
- data/spec/voog_api/api/articles_spec.rb +89 -0
- data/spec/voog_api/api/assets_spec.rb +53 -0
- data/spec/voog_api/api/comments_spec.rb +66 -0
- data/spec/voog_api/api/content_partials_spec.rb +41 -0
- data/spec/voog_api/api/contents_spec.rb +53 -0
- data/spec/voog_api/api/element_definitions_spec.rb +53 -0
- data/spec/voog_api/api/elements_spec.rb +78 -0
- data/spec/voog_api/api/forms_spec.rb +41 -0
- data/spec/voog_api/api/languages_spec.rb +89 -0
- data/spec/voog_api/api/layout_assets_spec.rb +54 -0
- data/spec/voog_api/api/layouts_spec.rb +53 -0
- data/spec/voog_api/api/media_sets_spec.rb +64 -0
- data/spec/voog_api/api/nodes_spec.rb +52 -0
- data/spec/voog_api/api/pages_spec.rb +89 -0
- data/spec/voog_api/api/people_spec.rb +30 -0
- data/spec/voog_api/api/site_spec.rb +53 -0
- data/spec/voog_api/api/tags_spec.rb +53 -0
- data/spec/voog_api/api/texts_spec.rb +41 -0
- data/spec/voog_api/api/tickets_spec.rb +54 -0
- data/spec/voog_spec.rb +38 -0
- data/voog_api.gemspec +27 -0
- metadata +278 -0
@@ -0,0 +1,77 @@
|
|
1
|
+
module Voog
|
2
|
+
class API
|
3
|
+
module Pages
|
4
|
+
|
5
|
+
# List pages
|
6
|
+
def pages(params = {})
|
7
|
+
get 'pages', {query: params}
|
8
|
+
end
|
9
|
+
|
10
|
+
# Get a single page
|
11
|
+
def page(id, params = {})
|
12
|
+
get "pages/#{id}", {query: params}
|
13
|
+
end
|
14
|
+
|
15
|
+
# Create a page
|
16
|
+
def create_page(data)
|
17
|
+
post 'pages', data
|
18
|
+
end
|
19
|
+
|
20
|
+
# Update a page
|
21
|
+
def update_page(id, data)
|
22
|
+
put "pages/#{id}", data
|
23
|
+
end
|
24
|
+
|
25
|
+
# Patch a page
|
26
|
+
def patch_page(id, data)
|
27
|
+
patch "pages/#{id}", data
|
28
|
+
end
|
29
|
+
|
30
|
+
# Delete a page
|
31
|
+
def delete_page(id)
|
32
|
+
delete "pages/#{id}"
|
33
|
+
end
|
34
|
+
|
35
|
+
# Update/create a key in page data field
|
36
|
+
#
|
37
|
+
# @params id [String] key in data field
|
38
|
+
def update_page_data(page_id, id, data)
|
39
|
+
put "pages/#{page_id}/data/#{id}", {value: data}
|
40
|
+
end
|
41
|
+
|
42
|
+
# Delete a key from page data field
|
43
|
+
#
|
44
|
+
# @params id [String] key in data field
|
45
|
+
def delete_page_data(page_id, id)
|
46
|
+
delete "pages/#{page_id}/data/#{id}"
|
47
|
+
end
|
48
|
+
|
49
|
+
# Page contents
|
50
|
+
|
51
|
+
# List contents for page
|
52
|
+
def page_contents(id, params = {})
|
53
|
+
contents(Voog::API::Contents::ParentKind::Page, id, params)
|
54
|
+
end
|
55
|
+
|
56
|
+
# Get a single content for page
|
57
|
+
def page_content(page_id, id, params = {})
|
58
|
+
content(Voog::API::Contents::ParentKind::Page, page_id, id, params)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Create a page content for page
|
62
|
+
def create_page_content(page_id, data)
|
63
|
+
create_content(Voog::API::Contents::ParentKind::Page, page_id, data)
|
64
|
+
end
|
65
|
+
|
66
|
+
# Delete a content from page
|
67
|
+
def delete_page_content(page_id, id)
|
68
|
+
delete_content(Voog::API::Contents::ParentKind::Page, page_id, id)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Reorder/move page content inside/between content areas and parent objects
|
72
|
+
def move_page_content(page_id, id, params = {})
|
73
|
+
move_content(Voog::API::Contents::ParentKind::Page, page_id, id, params)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Voog
|
2
|
+
class API
|
3
|
+
module Site
|
4
|
+
|
5
|
+
# Get site attributes
|
6
|
+
def site(params = {})
|
7
|
+
get 'site', {query: params}
|
8
|
+
end
|
9
|
+
|
10
|
+
# Update a site
|
11
|
+
def update_site(data)
|
12
|
+
put "site", data
|
13
|
+
end
|
14
|
+
|
15
|
+
# Patch a site
|
16
|
+
def patch_site(data)
|
17
|
+
patch "site", data
|
18
|
+
end
|
19
|
+
|
20
|
+
# Update/create a key in site data field
|
21
|
+
#
|
22
|
+
# @params id [String] key in data field
|
23
|
+
def update_site_data(id, data)
|
24
|
+
put "site/data/#{id}", {value: data}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Delete a key from site data field
|
28
|
+
#
|
29
|
+
# @params id [String] key in data field
|
30
|
+
def delete_site_data(id)
|
31
|
+
delete "site/data/#{id}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Voog
|
2
|
+
class API
|
3
|
+
module Tags
|
4
|
+
|
5
|
+
# List tags
|
6
|
+
def tags(params = {})
|
7
|
+
get 'tags', {query: params}
|
8
|
+
end
|
9
|
+
|
10
|
+
# Get a single tag
|
11
|
+
def tag(id, params = {})
|
12
|
+
get "tags/#{id}", {query: params}
|
13
|
+
end
|
14
|
+
|
15
|
+
# Update a tag
|
16
|
+
def update_tag(id, data)
|
17
|
+
put "tags/#{id}", data
|
18
|
+
end
|
19
|
+
|
20
|
+
# Delete a tag
|
21
|
+
def delete_tag(id)
|
22
|
+
delete "tags/#{id}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Voog
|
2
|
+
class API
|
3
|
+
module Texts
|
4
|
+
|
5
|
+
# List text contents
|
6
|
+
def texts(params = {})
|
7
|
+
get 'texts', {query: params}
|
8
|
+
end
|
9
|
+
|
10
|
+
# Get a single text content
|
11
|
+
def text(id, params = {})
|
12
|
+
get "texts/#{id}", {query: params}
|
13
|
+
end
|
14
|
+
|
15
|
+
# Update a text content
|
16
|
+
def update_text(id, data)
|
17
|
+
put "texts/#{id}", data
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Voog
|
2
|
+
class API
|
3
|
+
module Tickets
|
4
|
+
|
5
|
+
# List form tickets
|
6
|
+
def tickets(form_id, params = {})
|
7
|
+
get "forms/#{form_id}/tickets", {query: params}
|
8
|
+
end
|
9
|
+
|
10
|
+
# Get a single ticket for form
|
11
|
+
def ticket(form_id, id, params = {})
|
12
|
+
get "forms/#{form_id}/tickets/#{id}", {query: params}
|
13
|
+
end
|
14
|
+
|
15
|
+
# Delete a form ticket
|
16
|
+
def delete_ticket(form_id, id)
|
17
|
+
delete "forms/#{form_id}/tickets/#{id}"
|
18
|
+
end
|
19
|
+
|
20
|
+
# Delete all spam ticket for form
|
21
|
+
def delete_spam_tickets(form_id)
|
22
|
+
delete "forms/#{form_id}/tickets/delete_spam"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,140 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'sawyer'
|
3
|
+
|
4
|
+
require 'voog_api/api/articles'
|
5
|
+
require 'voog_api/api/assets'
|
6
|
+
require 'voog_api/api/comments'
|
7
|
+
require 'voog_api/api/content_partials'
|
8
|
+
require 'voog_api/api/contents'
|
9
|
+
require 'voog_api/api/element_definitions'
|
10
|
+
require 'voog_api/api/elements'
|
11
|
+
require 'voog_api/api/forms'
|
12
|
+
require 'voog_api/api/languages'
|
13
|
+
require 'voog_api/api/layouts'
|
14
|
+
require 'voog_api/api/layout_assets'
|
15
|
+
require 'voog_api/api/media_sets'
|
16
|
+
require 'voog_api/api/nodes'
|
17
|
+
require 'voog_api/api/site'
|
18
|
+
require 'voog_api/api/pages'
|
19
|
+
require 'voog_api/api/people'
|
20
|
+
require 'voog_api/api/tags'
|
21
|
+
require 'voog_api/api/texts'
|
22
|
+
require 'voog_api/api/tickets'
|
23
|
+
|
24
|
+
module Voog
|
25
|
+
|
26
|
+
class Client
|
27
|
+
|
28
|
+
include Voog::API::Articles
|
29
|
+
include Voog::API::Assets
|
30
|
+
include Voog::API::Comments
|
31
|
+
include Voog::API::ContentPartials
|
32
|
+
include Voog::API::Contents
|
33
|
+
include Voog::API::ElementDefinitions
|
34
|
+
include Voog::API::Elements
|
35
|
+
include Voog::API::Forms
|
36
|
+
include Voog::API::Languages
|
37
|
+
include Voog::API::Layouts
|
38
|
+
include Voog::API::LayoutAssets
|
39
|
+
include Voog::API::MediaSets
|
40
|
+
include Voog::API::Nodes
|
41
|
+
include Voog::API::Pages
|
42
|
+
include Voog::API::People
|
43
|
+
include Voog::API::Site
|
44
|
+
include Voog::API::Tags
|
45
|
+
include Voog::API::Texts
|
46
|
+
include Voog::API::Tickets
|
47
|
+
|
48
|
+
attr_reader :api_token, :host
|
49
|
+
|
50
|
+
def initialize(host = Voog.host, api_token = Voog.api_token, options = {})
|
51
|
+
@host = host
|
52
|
+
@api_token = api_token
|
53
|
+
@options = options
|
54
|
+
@raise_on_error = options.fetch(:raise_on_error, true)
|
55
|
+
end
|
56
|
+
|
57
|
+
def get(url, options = {})
|
58
|
+
request :get, url, nil, options
|
59
|
+
end
|
60
|
+
|
61
|
+
def post(url, data, options = {})
|
62
|
+
request :post, url, data, options
|
63
|
+
end
|
64
|
+
|
65
|
+
def put(url, data, options = {})
|
66
|
+
request :put, url, data, options
|
67
|
+
end
|
68
|
+
|
69
|
+
def patch(url, data, options = {})
|
70
|
+
request :patch, url, data, options
|
71
|
+
end
|
72
|
+
|
73
|
+
def delete(url, options = {})
|
74
|
+
request :delete, url, nil, options
|
75
|
+
end
|
76
|
+
|
77
|
+
def head(url, options = {})
|
78
|
+
request :head, url, nil, options
|
79
|
+
end
|
80
|
+
|
81
|
+
def api_endpoint
|
82
|
+
"http://#{host}/admin/api"
|
83
|
+
end
|
84
|
+
|
85
|
+
def agent
|
86
|
+
@agent ||= Sawyer::Agent.new(api_endpoint, sawyer_options) do |http|
|
87
|
+
http.headers[:content_type] = 'application/json'
|
88
|
+
http.headers[:accept] = 'application/json'
|
89
|
+
http.headers[:user_agent] = 'Voog.rb Ruby wrapper'
|
90
|
+
http.headers[:x_api_token] = @api_token
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def multipart_agent
|
95
|
+
Faraday.new do |faraday|
|
96
|
+
faraday.request :multipart
|
97
|
+
faraday.response :raise_error if @raise_on_error
|
98
|
+
faraday.adapter :net_http
|
99
|
+
|
100
|
+
faraday.headers['X_API_TOKEN'] = @api_token
|
101
|
+
faraday.headers['User-Agent'] = 'Voog.rb Ruby wrapper'
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def last_response
|
106
|
+
@last_response
|
107
|
+
end
|
108
|
+
|
109
|
+
def parse_response(response)
|
110
|
+
JSON.parse(response).inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
111
|
+
end
|
112
|
+
|
113
|
+
private
|
114
|
+
|
115
|
+
def request(method, path, data, options = {})
|
116
|
+
multipart = options.fetch(:multipart, false) && (method == :post)
|
117
|
+
|
118
|
+
@last_response = response = multipart ? \
|
119
|
+
multipart_agent.post("#{api_endpoint}/#{path}", data) : \
|
120
|
+
agent.call(method, URI.encode(path.to_s), data, options)
|
121
|
+
if multipart
|
122
|
+
parse_response(response.body)
|
123
|
+
else
|
124
|
+
response.data
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def sawyer_options(multipart = false)
|
129
|
+
faraday = Faraday.new do |faraday|
|
130
|
+
faraday.response :raise_error if @raise_on_error
|
131
|
+
faraday.adapter :net_http
|
132
|
+
end
|
133
|
+
opts = {
|
134
|
+
links_parser: Sawyer::LinkParsers::Simple.new,
|
135
|
+
faraday: faraday
|
136
|
+
}
|
137
|
+
opts
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
data/lib/voog_api.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'voog_api/version'
|
2
|
+
require 'voog_api/client'
|
3
|
+
|
4
|
+
module Voog
|
5
|
+
|
6
|
+
class << self
|
7
|
+
|
8
|
+
attr_accessor :host, :api_token
|
9
|
+
|
10
|
+
def client(options = {})
|
11
|
+
unless host.nil? && api_token.nil?
|
12
|
+
Voog::Client.new(host, api_token, options)
|
13
|
+
else
|
14
|
+
nil
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def configure
|
19
|
+
yield self
|
20
|
+
true
|
21
|
+
end
|
22
|
+
|
23
|
+
if RUBY_VERSION >= '1.9'
|
24
|
+
|
25
|
+
def respond_to_missing?(method_name, include_private = false)
|
26
|
+
client.respond_to?(method_name, include_private)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
if RUBY_VERSION < '1.9'
|
32
|
+
|
33
|
+
def respond_to?(method_name, include_private = false)
|
34
|
+
client.respond_to?(method_name, include_private) || super
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def method_missing(method_name, *args, &block)
|
42
|
+
return super unless client.respond_to?(method_name)
|
43
|
+
client.send(method_name, *args, &block)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
{
|
2
|
+
"id": 2,
|
3
|
+
"title": "How I wrote my first article",
|
4
|
+
"path": "how-i-wrote-my-first-article",
|
5
|
+
"comments_count": 0,
|
6
|
+
"publishing": true,
|
7
|
+
"published": true,
|
8
|
+
"data": {},
|
9
|
+
"created_at": "2014-01-23T09:22:04.000Z",
|
10
|
+
"updated_at": "2014-01-23T09:22:04.000Z",
|
11
|
+
"published_at": "2014-01-23T09:22:04.000Z",
|
12
|
+
"url": "http://voog.test/admin/api/articles/2",
|
13
|
+
"public_url": "http://voog.test/blog/how-i-wrote-my-first-article",
|
14
|
+
"contents_url": "http://voog.test/admin/api/articles/2/contents",
|
15
|
+
"comments_url": "http://voog.test/admin/api/site/articles/2/comments",
|
16
|
+
"page": {
|
17
|
+
"id": 3,
|
18
|
+
"content_type": "blog",
|
19
|
+
"created_at": "2014-01-23T09:19:04.000Z",
|
20
|
+
"updated_at": "2014-01-23T09:19:04.000Z",
|
21
|
+
"published_at": "2014-01-23T09:19:04.000Z",
|
22
|
+
"url": "http://voog.test/admin/api/pages/3"
|
23
|
+
},
|
24
|
+
"language": {
|
25
|
+
"id": 1,
|
26
|
+
"code": "en",
|
27
|
+
"title": "ENG",
|
28
|
+
"created_at": "2014-01-23T09:19:04.000Z",
|
29
|
+
"updated_at": "2014-01-23T09:19:04.000Z",
|
30
|
+
"url": "http://voog.test/admin/api/languages/1"
|
31
|
+
},
|
32
|
+
"author": {
|
33
|
+
"id": 1,
|
34
|
+
"name": "John Smith",
|
35
|
+
"url": "http://voog.test/admin/api/people/1"
|
36
|
+
}
|
37
|
+
}
|
@@ -0,0 +1,75 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": 2,
|
4
|
+
"title": "How I wrote my first article",
|
5
|
+
"path": "how-i-wrote-my-first-article",
|
6
|
+
"comments_count": 0,
|
7
|
+
"publishing": true,
|
8
|
+
"published": true,
|
9
|
+
"data": {},
|
10
|
+
"created_at": "2014-01-23T09:22:04.000Z",
|
11
|
+
"updated_at": "2014-01-23T09:22:04.000Z",
|
12
|
+
"published_at": "2014-01-23T09:22:04.000Z",
|
13
|
+
"url": "http://voog.test/admin/api/articles/2",
|
14
|
+
"public_url": "http://voog.test/blog/how-i-wrote-my-first-article",
|
15
|
+
"contents_url": "http://voog.test/admin/api/articles/2/contents",
|
16
|
+
"comments_url": "http://voog.test/admin/api/site/articles/2/comments",
|
17
|
+
"page": {
|
18
|
+
"id": 3,
|
19
|
+
"content_type": "blog",
|
20
|
+
"created_at": "2014-01-23T09:19:04.000Z",
|
21
|
+
"updated_at": "2014-01-23T09:19:04.000Z",
|
22
|
+
"published_at": "2014-01-23T09:19:04.000Z",
|
23
|
+
"url": "http://voog.test/admin/api/pages/3"
|
24
|
+
},
|
25
|
+
"language": {
|
26
|
+
"id": 1,
|
27
|
+
"code": "en",
|
28
|
+
"title": "ENG",
|
29
|
+
"created_at": "2014-01-23T09:19:04.000Z",
|
30
|
+
"updated_at": "2014-01-23T09:19:04.000Z",
|
31
|
+
"url": "http://voog.test/admin/api/languages/1"
|
32
|
+
},
|
33
|
+
"author": {
|
34
|
+
"id": 1,
|
35
|
+
"name": "John Smith",
|
36
|
+
"url": "http://voog.test/admin/api/people/1"
|
37
|
+
}
|
38
|
+
}, {
|
39
|
+
"id": 1,
|
40
|
+
"title": "Having sample news pieces?",
|
41
|
+
"path": "having-sample-news-pieces",
|
42
|
+
"comments_count": 0,
|
43
|
+
"publishing": true,
|
44
|
+
"published": true,
|
45
|
+
"data": {},
|
46
|
+
"created_at": "2014-01-23T09:19:04.000Z",
|
47
|
+
"updated_at": "2014-01-23T09:19:04.000Z",
|
48
|
+
"published_at": "2014-01-23T09:19:04.000Z",
|
49
|
+
"url": "http://voog.test/admin/api/articles/1",
|
50
|
+
"public_url": "http://voog.test/blog/having-sample-news-pieces",
|
51
|
+
"contents_url": "http://voog.test/admin/api/articles/1/contents",
|
52
|
+
"comments_url": "http://voog.test/admin/api/site/articles/1/comments",
|
53
|
+
"page": {
|
54
|
+
"id": 3,
|
55
|
+
"content_type": "blog",
|
56
|
+
"created_at": "2014-01-23T09:19:04.000Z",
|
57
|
+
"updated_at": "2014-01-23T09:19:04.000Z",
|
58
|
+
"published_at": "2014-01-23T09:19:04.000Z",
|
59
|
+
"url": "http://voog.test/admin/api/pages/3"
|
60
|
+
},
|
61
|
+
"language": {
|
62
|
+
"id": 1,
|
63
|
+
"code": "en",
|
64
|
+
"title": "ENG",
|
65
|
+
"created_at": "2014-01-23T09:19:04.000Z",
|
66
|
+
"updated_at": "2014-01-23T09:19:04.000Z",
|
67
|
+
"url": "http://voog.test/admin/api/languages/1"
|
68
|
+
},
|
69
|
+
"author": {
|
70
|
+
"id": 1,
|
71
|
+
"name": "John Smith",
|
72
|
+
"url": "http://voog.test/admin/api/people/1"
|
73
|
+
}
|
74
|
+
}
|
75
|
+
]
|
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"id": 1,
|
3
|
+
"filename": "Screen Shot 2014-01-28 at 10.53.26.png",
|
4
|
+
"content_type": "image/png",
|
5
|
+
"size": 95708,
|
6
|
+
"extension": "png",
|
7
|
+
"type": "image",
|
8
|
+
"created_at": "2014-02-04T10:55:28.000Z",
|
9
|
+
"updated_at": "2014-02-04T10:55:30.000Z",
|
10
|
+
"url": "http://voog.test/admin/api/assets/1",
|
11
|
+
"original_url": "http://media.voog.com/0000/0000/0001/photos/Screen%20Shot%202014-01-28%20at%2010.53.26.png",
|
12
|
+
"thumbnail_url": "http://media.voog.com/0000/0000/0001/photos/Screen%20Shot%202014-01-28%20at%2010.53.26_large.jpg",
|
13
|
+
"medium_thumbnail_url": "http://media.voog.com/0000/0000/0001/photos/Screen%20Shot%202014-01-28%20at%2010.53.26_medium.jpg",
|
14
|
+
"width": 999,
|
15
|
+
"height": 569,
|
16
|
+
"media_sets": [{
|
17
|
+
"id": 1,
|
18
|
+
"title": "",
|
19
|
+
"created_at": "2014-01-16T08:04:27.000Z",
|
20
|
+
"updated_at": "2014-01-16T08:04:27.000Z",
|
21
|
+
"url": "http://media.voog.com/admin/api/media_sets/1",
|
22
|
+
"add_assets_url": "http://media.voog.com/admin/api/media_sets/1/add_assets"
|
23
|
+
}]
|
24
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": 2,
|
4
|
+
"filename": "report.pdf",
|
5
|
+
"content_type": "application/pdf",
|
6
|
+
"size": 36657,
|
7
|
+
"extension": "pdf",
|
8
|
+
"type": "document",
|
9
|
+
"created_at": "2014-02-04T14:37:41.000Z",
|
10
|
+
"updated_at": "2014-02-04T14:37:41.000Z",
|
11
|
+
"url": "http://voog.test/admin/api/assets/2",
|
12
|
+
"original_url": "http://media.voog.com/0000/0000/0001/files/report.pdf"
|
13
|
+
}, {
|
14
|
+
"id": 1,
|
15
|
+
"filename": "Screen Shot 2014-01-28 at 10.53.26.png",
|
16
|
+
"content_type": "image/png",
|
17
|
+
"size": 95708,
|
18
|
+
"extension": "png",
|
19
|
+
"type": "image",
|
20
|
+
"created_at": "2014-02-04T10:55:28.000Z",
|
21
|
+
"updated_at": "2014-02-04T10:55:30.000Z",
|
22
|
+
"url": "http://voog.test/admin/api/assets/1",
|
23
|
+
"original_url": "http://media.voog.com/0000/0000/0001/photos/Screen%20Shot%202014-01-28%20at%2010.53.26.png",
|
24
|
+
"thumbnail_url": "http://media.voog.com/0000/0000/0001/photos/Screen%20Shot%202014-01-28%20at%2010.53.26_large.jpg",
|
25
|
+
"medium_thumbnail_url": "http://media.voog.com/0000/0000/0001/photos/Screen%20Shot%202014-01-28%20at%2010.53.26_medium.jpg",
|
26
|
+
"width": 999,
|
27
|
+
"height": 569
|
28
|
+
}
|
29
|
+
]
|
@@ -0,0 +1,21 @@
|
|
1
|
+
{
|
2
|
+
"id": 2,
|
3
|
+
"author": "I'm a Spammer!",
|
4
|
+
"body": "Buy something!",
|
5
|
+
"spam": false,
|
6
|
+
"created_at": "2014-02-07T10:54:08.000Z",
|
7
|
+
"updated_at": "2014-02-07T10:54:08.000Z",
|
8
|
+
"url": "http://voog.test/admin/api/articles/1/comments/2",
|
9
|
+
"article": {
|
10
|
+
"id": 1,
|
11
|
+
"title": "How I wrote my first article",
|
12
|
+
"created_at": "2014-02-07T10:56:07.000Z",
|
13
|
+
"updated_at": "2014-02-07T10:56:07.000Z",
|
14
|
+
"url": "http://voog.test/admin/api/articles/1",
|
15
|
+
"public_url": "http://voog.test/blog/how-i-wrote-my-first-article"
|
16
|
+
},
|
17
|
+
"author_email": "spam@spam.com",
|
18
|
+
"user_ip": "23.81.71.154",
|
19
|
+
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:27.0) Gecko/20100101 Firefox/27.0",
|
20
|
+
"referrer": "http://voog.test/blog/how-i-wrote-my-first-article"
|
21
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": 2,
|
4
|
+
"author": "I'm a Spammer!",
|
5
|
+
"body": "Buy something!",
|
6
|
+
"spam": false,
|
7
|
+
"created_at": "2014-02-07T10:54:08.000Z",
|
8
|
+
"updated_at": "2014-02-07T10:56:07.000Z",
|
9
|
+
"url": "http://voog.test/admin/api/articles/1/comments/2",
|
10
|
+
"article": {
|
11
|
+
"id": 1,
|
12
|
+
"title": "How I wrote my first article",
|
13
|
+
"created_at": "2014-02-07T10:56:07.000Z",
|
14
|
+
"updated_at": "2014-02-07T10:56:07.000Z",
|
15
|
+
"url": "http://voog.test/admin/api/articles/1",
|
16
|
+
"public_url": "http://voog.test/blog/how-i-wrote-my-first-article"
|
17
|
+
}
|
18
|
+
}, {
|
19
|
+
"id": 1,
|
20
|
+
"author": "Me",
|
21
|
+
"body": "Hi!\r\n\r\nThis is a comment!!",
|
22
|
+
"spam": false,
|
23
|
+
"created_at": "2014-02-06T15:53:01.000Z",
|
24
|
+
"updated_at": "2014-02-06T15:53:01.000Z",
|
25
|
+
"url": "http://voog.test/admin/api/articles/1/comments/1",
|
26
|
+
"article": {
|
27
|
+
"id": 1,
|
28
|
+
"title": "How I wrote my first article",
|
29
|
+
"created_at": "2014-02-07T10:56:07.000Z",
|
30
|
+
"updated_at": "2014-02-07T10:56:07.000Z",
|
31
|
+
"url": "http://voog.test/admin/api/articles/1",
|
32
|
+
"public_url": "http://voog.test/blog/how-i-wrote-my-first-article"
|
33
|
+
}
|
34
|
+
}
|
35
|
+
]
|
@@ -0,0 +1,27 @@
|
|
1
|
+
{
|
2
|
+
"id": 2,
|
3
|
+
"content_type": "video",
|
4
|
+
"created_at": "2014-05-30T10:22:04.000Z",
|
5
|
+
"updated_at": "2014-05-30T10:22:04.000Z",
|
6
|
+
"url": "http://voog.test/admin/api/content_partials/2",
|
7
|
+
"content": {
|
8
|
+
"id": 3,
|
9
|
+
"name": "body",
|
10
|
+
"position": 1,
|
11
|
+
"created_at": "2014-05-30T10:22:04.000Z",
|
12
|
+
"updated_at": "2014-05-30T10:22:04.000Z",
|
13
|
+
"url": "http://voog.test/admin/api/pages/1/contents/3"
|
14
|
+
},
|
15
|
+
"parent": {
|
16
|
+
"id": 1,
|
17
|
+
"title": "Home page",
|
18
|
+
"type": "page",
|
19
|
+
"created_at": "2014-01-13T09:19:04.000Z",
|
20
|
+
"updated_at": "2014-01-13T09:19:04.000Z",
|
21
|
+
"url": "http://voog.test/admin/api/pages/1"
|
22
|
+
},
|
23
|
+
"body": "<iframe></iframe>",
|
24
|
+
"metainfo": {
|
25
|
+
"type": "video"
|
26
|
+
}
|
27
|
+
}
|