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,73 @@
|
|
1
|
+
{
|
2
|
+
"id": 2,
|
3
|
+
"title": "Products",
|
4
|
+
"slug": "products",
|
5
|
+
"path": "products",
|
6
|
+
"content_type": "page",
|
7
|
+
"keywords": null,
|
8
|
+
"description": null,
|
9
|
+
"data": {
|
10
|
+
"my_key_1": "Value 1",
|
11
|
+
"my_key_2": 2
|
12
|
+
},
|
13
|
+
"root": false,
|
14
|
+
"hidden": false,
|
15
|
+
"publishing": true,
|
16
|
+
"isprivate": false,
|
17
|
+
"created_at": "2013-12-13T09:19:04.000Z",
|
18
|
+
"updated_at": "2014-01-03T12:14:34.000Z",
|
19
|
+
"published_at": "2013-12-13T09:19:04.000Z",
|
20
|
+
"url": "http://voog.test/admin/api/pages/2",
|
21
|
+
"public_url": "http://voog.test/products",
|
22
|
+
"contents_url": "http://voog.test/admin/api/pages/2/contents",
|
23
|
+
"children_url": "http://voog.test/admin/api/pages?parent_id=2",
|
24
|
+
"language": {
|
25
|
+
"id": 1,
|
26
|
+
"code": "en",
|
27
|
+
"title": "ENG",
|
28
|
+
"created_at": "2013-04-05T13:54:32.000Z",
|
29
|
+
"updated_at": "2013-04-11T10:09:51.000Z",
|
30
|
+
"url": "http://voog.test/admin/api/languages/1"
|
31
|
+
},
|
32
|
+
"layout": {
|
33
|
+
"id": 2,
|
34
|
+
"title": "Common page",
|
35
|
+
"layout_name": "page_default",
|
36
|
+
"content_type": "page",
|
37
|
+
"url": "http://voog.test/admin/api/layouts/2",
|
38
|
+
"created_at": "2013-04-05T13:54:32.000Z",
|
39
|
+
"updated_at": "2013-04-11T10:09:51.000Z",
|
40
|
+
"mime_type": "application/vnd.voog.design.custom+liquid"
|
41
|
+
},
|
42
|
+
"node": {
|
43
|
+
"id": 2,
|
44
|
+
"parent_id": 1,
|
45
|
+
"title": "Products",
|
46
|
+
"position": 2,
|
47
|
+
"created_at": "2013-12-13T09:19:04.000Z",
|
48
|
+
"updated_at": "2014-01-03T12:14:34.000Z",
|
49
|
+
"url": "http://voog.test/admin/api/nodes/2",
|
50
|
+
"children_url": "http://voog.test/admin/api/nodes?parent_id=2",
|
51
|
+
"parent_url": "http://voog.test/admin/api/nodes/1"
|
52
|
+
},
|
53
|
+
"contents": [
|
54
|
+
{
|
55
|
+
"id": 4,
|
56
|
+
"name": "body",
|
57
|
+
"position": 1,
|
58
|
+
"content_type": "text",
|
59
|
+
"url": "http://voog.test/admin/api/pages/2/contents/4",
|
60
|
+
"created_at": "2013-12-13T09:19:05.000Z",
|
61
|
+
"updated_at": "2013-12-13T09:19:05.000Z"
|
62
|
+
},
|
63
|
+
{
|
64
|
+
"id": 5,
|
65
|
+
"name": "slogan",
|
66
|
+
"position": 1,
|
67
|
+
"content_type": "text",
|
68
|
+
"url": "http://voog.test/admin/api/pages/2/contents/5",
|
69
|
+
"created_at": "2013-12-13T09:19:05.000Z",
|
70
|
+
"updated_at": "2013-12-13T09:19:05.000Z"
|
71
|
+
}
|
72
|
+
]
|
73
|
+
}
|
@@ -0,0 +1,104 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": 1,
|
4
|
+
"title": "Home Page",
|
5
|
+
"slug": null,
|
6
|
+
"path": "",
|
7
|
+
"content_type": "page",
|
8
|
+
"keywords": null,
|
9
|
+
"description": null,
|
10
|
+
"data": {},
|
11
|
+
"root": true,
|
12
|
+
"hidden": false,
|
13
|
+
"publishing": true,
|
14
|
+
"isprivate": false,
|
15
|
+
"created_at": "2013-12-13T09:19:04.000Z",
|
16
|
+
"updated_at": "2013-12-13T09:19:04.000Z",
|
17
|
+
"published_at": "2013-12-13T09:19:04.000Z",
|
18
|
+
"url": "http://voog.test/admin/api/pages/1",
|
19
|
+
"public_url": "http://voog.test/",
|
20
|
+
"contents_url": "http://voog.test/admin/api/pages/1/contents",
|
21
|
+
"children_url": "http://voog.test/admin/api/pages?parent_id=1",
|
22
|
+
"language": {
|
23
|
+
"id": 1,
|
24
|
+
"code": "en",
|
25
|
+
"title": "ENG",
|
26
|
+
"created_at": "2013-04-05T13:53:00.000Z",
|
27
|
+
"updated_at": "2013-04-11T10:08:54.000Z",
|
28
|
+
"url": "http://voog.test/admin/api/languages/1"
|
29
|
+
},
|
30
|
+
"layout": {
|
31
|
+
"id": 1,
|
32
|
+
"title": "Front page",
|
33
|
+
"layout_name": "page_front",
|
34
|
+
"content_type": "page",
|
35
|
+
"url": "http://voog.test/admin/api/layouts/1",
|
36
|
+
"created_at": "2013-04-05T13:53:00.000Z",
|
37
|
+
"updated_at": "2013-04-11T10:08:54.000Z",
|
38
|
+
"mime_type": "application/vnd.voog.design.custom+liquid"
|
39
|
+
},
|
40
|
+
"node": {
|
41
|
+
"id": 1,
|
42
|
+
"parent_id": null,
|
43
|
+
"title": "Home Page",
|
44
|
+
"position": 1,
|
45
|
+
"created_at": "2013-12-13T09:19:04.000Z",
|
46
|
+
"updated_at": "2013-12-13T09:19:04.000Z",
|
47
|
+
"url": "http://voog.test/admin/api/nodes/1",
|
48
|
+
"children_url": "http://voog.test/admin/api/nodes?parent_id=1",
|
49
|
+
"parent_url": null
|
50
|
+
}
|
51
|
+
}, {
|
52
|
+
"id": 2,
|
53
|
+
"title": "Products",
|
54
|
+
"slug": "products",
|
55
|
+
"path": "products",
|
56
|
+
"content_type": "page",
|
57
|
+
"keywords": null,
|
58
|
+
"description": null,
|
59
|
+
"data": {
|
60
|
+
"my_key_1": "Value 1",
|
61
|
+
"my_key_2": 2
|
62
|
+
},
|
63
|
+
"root": false,
|
64
|
+
"hidden": false,
|
65
|
+
"publishing": true,
|
66
|
+
"isprivate": false,
|
67
|
+
"created_at": "2013-12-13T09:19:04.000Z",
|
68
|
+
"updated_at": "2014-01-03T12:14:34.000Z",
|
69
|
+
"published_at": "2013-12-13T09:19:04.000Z",
|
70
|
+
"url": "http://voog.test/admin/api/pages/2",
|
71
|
+
"public_url": "http://voog.test/products",
|
72
|
+
"contents_url": "http://voog.test/admin/api/pages/2/contents",
|
73
|
+
"children_url": "http://voog.test/admin/api/pages?parent_id=2",
|
74
|
+
"language": {
|
75
|
+
"id": 1,
|
76
|
+
"code": "en",
|
77
|
+
"title": "ENG",
|
78
|
+
"created_at": "2013-04-05T13:54:32.000Z",
|
79
|
+
"updated_at": "2013-04-11T10:09:51.000Z",
|
80
|
+
"url": "http://voog.test/admin/api/languages/1"
|
81
|
+
},
|
82
|
+
"layout": {
|
83
|
+
"id": 2,
|
84
|
+
"title": "Common page",
|
85
|
+
"layout_name": "page_default",
|
86
|
+
"content_type": "page",
|
87
|
+
"url": "http://voog.test/admin/api/layouts/2",
|
88
|
+
"created_at": "2013-04-05T13:54:32.000Z",
|
89
|
+
"updated_at": "2013-04-11T10:09:51.000Z",
|
90
|
+
"mime_type": "application/vnd.voog.design.custom+liquid"
|
91
|
+
},
|
92
|
+
"node": {
|
93
|
+
"id": 2,
|
94
|
+
"parent_id": 1,
|
95
|
+
"title": "Products",
|
96
|
+
"position": 2,
|
97
|
+
"created_at": "2013-12-13T09:19:04.000Z",
|
98
|
+
"updated_at": "2014-01-03T12:14:34.000Z",
|
99
|
+
"url": "http://voog.test/admin/api/nodes/2",
|
100
|
+
"children_url": "http://voog.test/admin/api/nodes?parent_id=2",
|
101
|
+
"parent_url": "http://voog.test/admin/api/nodes/1"
|
102
|
+
}
|
103
|
+
}
|
104
|
+
]
|
@@ -0,0 +1,29 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": 1,
|
4
|
+
"firstname": "John",
|
5
|
+
"lastname": "Smith",
|
6
|
+
"name": "John Smith",
|
7
|
+
"email": "tanel@example.com",
|
8
|
+
"working_language": "en",
|
9
|
+
"status": "ACTIVATED",
|
10
|
+
"owner": true,
|
11
|
+
"created_at": "2014-01-23T09:19:04.000Z",
|
12
|
+
"updated_at": "2014-01-24T10:03:02.000Z",
|
13
|
+
"last_login_at": "2014-01-24T12:11:02.000Z",
|
14
|
+
"url": "http://voog.test/admin/api/people/1"
|
15
|
+
}, {
|
16
|
+
"id": 2,
|
17
|
+
"firstname": null,
|
18
|
+
"lastname": null,
|
19
|
+
"name": "api@example.com",
|
20
|
+
"email": "api@example.com",
|
21
|
+
"working_language": "en",
|
22
|
+
"status": "ACTIVATED",
|
23
|
+
"owner": true,
|
24
|
+
"created_at": "2014-01-23T10:03:04.000Z",
|
25
|
+
"updated_at": "2014-01-24T13:01:22.000Z",
|
26
|
+
"last_login_at": "2014-01-24T13:01:22.000Z",
|
27
|
+
"url": "http://voog.test/admin/api/people/2"
|
28
|
+
}
|
29
|
+
]
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"id": 2,
|
3
|
+
"firstname": null,
|
4
|
+
"lastname": null,
|
5
|
+
"name": "api@example.com",
|
6
|
+
"email": "api@example.com",
|
7
|
+
"working_language": "en",
|
8
|
+
"status": "ACTIVATED",
|
9
|
+
"owner": true,
|
10
|
+
"created_at": "2014-01-23T10:03:04.000Z",
|
11
|
+
"updated_at": "2014-01-24T13:01:22.000Z",
|
12
|
+
"last_login_at": "2014-01-24T13:01:22.000Z",
|
13
|
+
"url": "http://voog.test/admin/api/people/2"
|
14
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
{
|
2
|
+
"meta_keywords": "my key words",
|
3
|
+
"created_at": "2014-01-03T09:19:04.000Z",
|
4
|
+
"updated_at": "2014-01-22T14:58:01.000Z",
|
5
|
+
"search_enabled": false,
|
6
|
+
"data": {
|
7
|
+
"my_key_1": "Value 1",
|
8
|
+
"my_key_2": 2
|
9
|
+
},
|
10
|
+
"public_url": "http://voog.test/",
|
11
|
+
"data_usage": 332682,
|
12
|
+
"subscription": {
|
13
|
+
"subscription_plan": "plus",
|
14
|
+
"subscription_period": "1M",
|
15
|
+
"subscription_started_at": "2014-01-03T09:19:05.000Z",
|
16
|
+
"subscription_expires_at": "2014-02-03T09:19:05.000Z",
|
17
|
+
"active": true,
|
18
|
+
"type": "trial"
|
19
|
+
},
|
20
|
+
"stats": {
|
21
|
+
"webtools_verify_key": "googlef52f1d814b8972e9.html",
|
22
|
+
"stats_google_analytics": "<script type=\"text/javascript\">\n\n var _gaq = _gaq || [];\n _gaq.push(['_setAccount', 'UA-XXXXXXX-X']);\n _gaq.push(['_setDomainName', 'voog.test']);\n</script>",
|
23
|
+
"stats_compete": "",
|
24
|
+
"stats_chartbeat": "",
|
25
|
+
"stats_custom": "",
|
26
|
+
"stats_voog_code": "<script type=\"text/javascript\">\nvar _ews = _ews || {_account: 'A-36-1', _tzo: '7200'};</script>",
|
27
|
+
"stats_voog_timezone": "Tallinn",
|
28
|
+
"stats_voog_utc_offset": 7200
|
29
|
+
}
|
30
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"id": 2,
|
3
|
+
"name": "art",
|
4
|
+
"created_at": "2014-01-31T13:43:36.000Z",
|
5
|
+
"updated_at": "2014-01-31T13:43:36.000Z",
|
6
|
+
"url": "http://voog.test/admin/api/tags/2",
|
7
|
+
"language": {
|
8
|
+
"id": 40,
|
9
|
+
"code": "en",
|
10
|
+
"title": "ENG",
|
11
|
+
"created_at": "2014-01-22T09:19:04.000Z",
|
12
|
+
"updated_at": "2014-01-22T09:19:04.000Z",
|
13
|
+
"url": "http://voog.test/admin/api/languages/40"
|
14
|
+
},
|
15
|
+
"taggings": [{
|
16
|
+
"id": 1,
|
17
|
+
"type": "article",
|
18
|
+
"url": "http://voog.test/admin/api/articles/1"
|
19
|
+
}]
|
20
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": 2,
|
4
|
+
"name": "art",
|
5
|
+
"created_at": "2014-01-31T13:43:36.000Z",
|
6
|
+
"updated_at": "2014-01-31T13:43:36.000Z",
|
7
|
+
"url": "http://voog.test/admin/api/tags/2",
|
8
|
+
"language": {
|
9
|
+
"id": 40,
|
10
|
+
"code": "en",
|
11
|
+
"title": "ENG",
|
12
|
+
"created_at": "2014-01-22T09:19:04.000Z",
|
13
|
+
"updated_at": "2014-01-22T09:19:04.000Z",
|
14
|
+
"url": "http://voog.test/admin/api/languages/40"
|
15
|
+
}
|
16
|
+
}, {
|
17
|
+
"id": 1,
|
18
|
+
"name": "fun",
|
19
|
+
"created_at": "2014-01-31T13:43:36.000Z",
|
20
|
+
"updated_at": "2014-01-31T13:43:36.000Z",
|
21
|
+
"url": "http://voog.test/admin/api/tags/1",
|
22
|
+
"language": {
|
23
|
+
"id": 1,
|
24
|
+
"code": "en",
|
25
|
+
"title": "ENG",
|
26
|
+
"created_at": "2014-01-22T09:19:04.000Z",
|
27
|
+
"updated_at": "2014-01-22T09:19:04.000Z",
|
28
|
+
"url": "http://voog.test/admin/api/languages/40"
|
29
|
+
}
|
30
|
+
}
|
31
|
+
]
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"id": 2,
|
3
|
+
"created_at": "2014-01-14T10:22:04.000Z",
|
4
|
+
"updated_at": "2014-01-14T10:22:04.000Z",
|
5
|
+
"url": "http://voog.test/admin/api/texts/2",
|
6
|
+
"content": {
|
7
|
+
"id": 3,
|
8
|
+
"name": "body",
|
9
|
+
"position": 1,
|
10
|
+
"created_at": "2014-01-14T10:22:04.000Z",
|
11
|
+
"updated_at": "2014-01-14T10:22:04.000Z",
|
12
|
+
"url": "http://voog.test/admin/api/pages/1/contents/3"
|
13
|
+
},
|
14
|
+
"parent": {
|
15
|
+
"id": 1,
|
16
|
+
"type": "page",
|
17
|
+
"created_at": "2014-01-13T09:19:04.000Z",
|
18
|
+
"updated_at": "2014-01-13T09:19:04.000Z",
|
19
|
+
"url": "http://voog.test/admin/api/pages/1"
|
20
|
+
},
|
21
|
+
"body": "<h3>A better way to create a website</h3>",
|
22
|
+
"autosaved_body": "<h3>A better way to create a website (not published)</h3>"
|
23
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": 1,
|
4
|
+
"title": "Form page",
|
5
|
+
"created_at": "2014-01-14T09:25:22.000Z",
|
6
|
+
"updated_at": "2014-01-14T09:26:17.000Z",
|
7
|
+
"url": "http://voog.test/admin/api/forms/1",
|
8
|
+
"content": {
|
9
|
+
"id": 1,
|
10
|
+
"name": "body",
|
11
|
+
"created_at": "2014-01-14T09:25:22.000Z",
|
12
|
+
"updated_at": "2014-01-14T09:25:22.000Z",
|
13
|
+
"position": 1,
|
14
|
+
"url": "http://voog.test/admin/api/pages/1/contents/1"
|
15
|
+
},
|
16
|
+
"parent": {
|
17
|
+
"id": 1,
|
18
|
+
"created_at": "2014-01-14T09:22:49.000Z",
|
19
|
+
"updated_at": "2014-01-14T09:22:54.000Z",
|
20
|
+
"type": "page",
|
21
|
+
"url": "http://voog.test/admin/api/pages/1"
|
22
|
+
}
|
23
|
+
}, {
|
24
|
+
"id": 2,
|
25
|
+
"title": "Contact",
|
26
|
+
"created_at": "2014-01-14T11:43:42.000Z",
|
27
|
+
"updated_at": "2014-01-14T11:44:07.000Z",
|
28
|
+
"url": "http://voog.test/admin/api/forms/2",
|
29
|
+
"content": {
|
30
|
+
"id": 2,
|
31
|
+
"name": "body",
|
32
|
+
"created_at": "2014-01-14T11:43:42.000Z",
|
33
|
+
"updated_at": "2014-01-14T11:43:42.000Z",
|
34
|
+
"position": 2,
|
35
|
+
"url": "http://voog.test/admin/api/pages/3/contents/2"
|
36
|
+
},
|
37
|
+
"parent": {
|
38
|
+
"id": 3,
|
39
|
+
"created_at": "2014-01-14T11:43:37.000Z",
|
40
|
+
"updated_at": "2014-01-14T11:43:37.000Z",
|
41
|
+
"type": "page",
|
42
|
+
"url": "http://voog.test/admin/api/pages/3"
|
43
|
+
}
|
44
|
+
}
|
45
|
+
]
|
@@ -0,0 +1,26 @@
|
|
1
|
+
{
|
2
|
+
"id": 1,
|
3
|
+
"spam": false,
|
4
|
+
"created_at": "2014-02-07T15:08:49.000Z",
|
5
|
+
"updated_at": "2014-02-07T15:08:49.000Z",
|
6
|
+
"url": "http://voog.test/admin/api/forms/1/tickets/1",
|
7
|
+
"form": {
|
8
|
+
"id": 1,
|
9
|
+
"title": "Form page",
|
10
|
+
"created_at": "2014-02-07T11:22:01.000Z",
|
11
|
+
"updated_at": "2014-02-07T13:06:19.000Z",
|
12
|
+
"url": "http://voog.test/admin/api/forms/1"
|
13
|
+
},
|
14
|
+
"user_ip": "23.81.71.154",
|
15
|
+
"user_country": "us",
|
16
|
+
"user_city": "Phoenix",
|
17
|
+
"user_language": "en-US",
|
18
|
+
"user_latitude": "33.6748",
|
19
|
+
"user_longitude": "-111.9519",
|
20
|
+
"data": {
|
21
|
+
"field_1386926728322": "test@example.cpm",
|
22
|
+
"field_1386926764566": "Choice 3",
|
23
|
+
"field_1386926768551": "Text\nArea",
|
24
|
+
"field_1391778363674": "report.pdf"
|
25
|
+
}
|
26
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": 2,
|
4
|
+
"spam": false,
|
5
|
+
"created_at": "2014-02-07T16:06:45.000Z",
|
6
|
+
"updated_at": "2014-02-07T16:06:45.000Z",
|
7
|
+
"url": "http://voog.test/admin/api/forms/1/tickets/2",
|
8
|
+
"form": {
|
9
|
+
"id": 1,
|
10
|
+
"title": "Form page",
|
11
|
+
"created_at": "2014-02-07T11:22:01.000Z",
|
12
|
+
"updated_at": "2014-02-07T13:06:19.000Z",
|
13
|
+
"url": "http://voog.test/admin/api/forms/1"
|
14
|
+
}
|
15
|
+
}, {
|
16
|
+
"id": 1,
|
17
|
+
"spam": false,
|
18
|
+
"created_at": "2014-02-07T15:08:49.000Z",
|
19
|
+
"updated_at": "2014-02-07T15:08:49.000Z",
|
20
|
+
"url": "http://voog.test/admin/api/forms/1/tickets/1",
|
21
|
+
"form": {
|
22
|
+
"id": 1,
|
23
|
+
"title": "Form page",
|
24
|
+
"created_at": "2014-02-07T11:22:01.000Z",
|
25
|
+
"updated_at": "2014-02-07T13:06:19.000Z",
|
26
|
+
"url": "http://voog.test/admin/api/forms/1"
|
27
|
+
}
|
28
|
+
}
|
29
|
+
]
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'voog_api'
|
2
|
+
require 'webmock/rspec'
|
3
|
+
|
4
|
+
WebMock.disable_net_connect!
|
5
|
+
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
RSpec.configure do |config|
|
8
|
+
|
9
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
10
|
+
config.run_all_when_everything_filtered = true
|
11
|
+
config.filter_run :focus
|
12
|
+
|
13
|
+
# Run specs in random order to surface order dependencies. If you find an
|
14
|
+
# order dependency and want to debug it, you can fix the order by providing
|
15
|
+
# the seed, which is printed after each run.
|
16
|
+
# --seed 1234
|
17
|
+
config.order = 'random'
|
18
|
+
end
|
19
|
+
|
20
|
+
def voog_client
|
21
|
+
Voog.configure do |config|
|
22
|
+
config.host = 'voog.test'
|
23
|
+
config.api_token = 'afcf30182aecfc8155d390d7d4552d14'
|
24
|
+
end
|
25
|
+
Voog.client
|
26
|
+
end
|
27
|
+
|
28
|
+
def fixture(file)
|
29
|
+
File.read(File.expand_path('../fixtures', __FILE__) + '/' + file + '.json')
|
30
|
+
end
|
31
|
+
|
32
|
+
def request_fixture(method, path, options = {})
|
33
|
+
request = ({
|
34
|
+
headers: {'X-API-TOKEN' => 'afcf30182aecfc8155d390d7d4552d14'}
|
35
|
+
}).merge(options.fetch(:request, {}))
|
36
|
+
|
37
|
+
response = ({headers: {'Content-Type' => 'application/json'}}).tap { |response|
|
38
|
+
response[:body] = fixture(options[:fixture]) if options.has_key?(:fixture)
|
39
|
+
}.merge(options.fetch(:response, {}))
|
40
|
+
|
41
|
+
stub_request(method, voog_url(path)).with(request).to_return(response)
|
42
|
+
end
|
43
|
+
|
44
|
+
def voog_url(path)
|
45
|
+
"http://voog.test/admin/api/#{path}"
|
46
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Voog::API::Articles do
|
4
|
+
|
5
|
+
let(:client) { voog_client }
|
6
|
+
|
7
|
+
describe '#articles' do
|
8
|
+
before do
|
9
|
+
request_fixture(:get, 'articles', fixture: 'articles/articles')
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'returns a list of articles' do
|
13
|
+
expect(client.articles.length).to eql(2)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#article' do
|
18
|
+
before do
|
19
|
+
request_fixture(:get, 'articles/2', fixture: 'articles/article')
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'returns a single article' do
|
23
|
+
expect(client.article(2).title).to eq('How I wrote my first article')
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'returns a article with the same id as in the request' do
|
27
|
+
expect(client.article(2).id).to eq(2)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#delete_article' do
|
32
|
+
|
33
|
+
before do
|
34
|
+
request_fixture(:delete, 'articles/2')
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'calls delete method on article' do
|
38
|
+
client.delete_article(2)
|
39
|
+
assert_requested :delete, 'http://voog.test/admin/api/articles/2'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe '#update_article' do
|
44
|
+
|
45
|
+
before do
|
46
|
+
request_fixture(:put, 'articles/2', request: {body: {title: 'New release!'}}, response: {body: '{"id": 2, "title": "New release!"}'})
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'responds with new title' do
|
50
|
+
expect(client.update_article(2, title: 'New release!').title).to eq('New release!')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe '#patch_article' do
|
55
|
+
|
56
|
+
before do
|
57
|
+
request_fixture(:patch, 'articles/2', request: {body: {title: 'New release!'}}, response: {body: '{"id": 2, "title": "New release!"}'})
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'responds with new title' do
|
61
|
+
expect(client.patch_article(2, title: 'New release!').title).to eq('New release!')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe '#update_article_data' do
|
66
|
+
|
67
|
+
before do
|
68
|
+
request_fixture(:put, 'articles/2/data/my_key', request: {body: {value: 'New key'}}, response: {body: '{"id": 2, "data": {"my_key": "New key"}}'})
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'responds with updated data' do
|
72
|
+
expect(client.update_article_data(2, 'my_key', 'New key').data.my_key).to eq('New key')
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe '#article_content' do
|
77
|
+
before do
|
78
|
+
request_fixture(:get, 'articles/1/contents/2', fixture: 'contents/content')
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'returns a single content' do
|
82
|
+
expect(client.content(Voog::API::Contents::ParentKind::Article, 1, 2).name).to eq('slogan')
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'returns a content with the same id as in the request' do
|
86
|
+
expect(client.content(Voog::API::Contents::ParentKind::Article, 1, 2).id).to eq(2)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Voog::API::Assets do
|
4
|
+
|
5
|
+
let(:client) { voog_client }
|
6
|
+
|
7
|
+
describe '#assets' do
|
8
|
+
before do
|
9
|
+
request_fixture(:get, 'assets', fixture: 'assets/assets')
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'returns a list of assets' do
|
13
|
+
expect(client.assets.length).to eql(2)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#asset' do
|
18
|
+
before do
|
19
|
+
request_fixture(:get, 'assets/1', fixture: 'assets/asset')
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'returns a single asset' do
|
23
|
+
expect(client.asset(1).filename).to eq('Screen Shot 2014-01-28 at 10.53.26.png')
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'returns a asset with the same id as in the request' do
|
27
|
+
expect(client.asset(1).id).to eq(1)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#delete_asset' do
|
32
|
+
|
33
|
+
before do
|
34
|
+
request_fixture(:delete, 'assets/2')
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'calls delete method on asset' do
|
38
|
+
client.delete_asset(2)
|
39
|
+
assert_requested :delete, 'http://voog.test/admin/api/assets/2'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe '#confirm_asset' do
|
44
|
+
|
45
|
+
before do
|
46
|
+
request_fixture(:put, 'assets/1/confirm', response: {body: '{"id": 1, "filename": "Screen Shot 2014-01-28 at 10.53.26.png"}'})
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'responds with object' do
|
50
|
+
expect(client.confirm_asset(1).filename).to eq('Screen Shot 2014-01-28 at 10.53.26.png')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|