wp-api 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: be8b365075e87e981f79e61c1a7e766cd93d078b
4
+ data.tar.gz: 4c59262402ba39fa3ab8ce90e6d05b24c3b285b7
5
+ SHA512:
6
+ metadata.gz: f2658d1c1d13e70bcdcaf28858a8c21c8b980b7a3413df509e99683cb8ab6b9a7274d92005cbd4afffb010341575fc34f67fafee91b1a3c80b3c4057939da8bd
7
+ data.tar.gz: c55d99f6ff6c9fd6aa2d5c0c58d203dbbe664f7a681f5baa0d142464caf94b6e90c92b0cd5dd3745f3e56840df753b79deb25ce711847e2ec01359095c7e1778
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --color
3
+ --format documentation
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in wp-api.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Colin Young
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # WP::API
2
+
3
+ Makes it incredibly easy and semantic to access Wordpress blogs that have the new, RESTful WP API plugin installed.
4
+
5
+ ## Installation
6
+
7
+ gem 'wp-api'
8
+ bundle
9
+
10
+ ## Usage
11
+
12
+ ```ruby
13
+ client = WP::API['yourwpsite.com']
14
+
15
+ # List all posts
16
+ client.posts
17
+
18
+ # List all users
19
+ client.users
20
+ ```
21
+
22
+ ## Author
23
+
24
+ @colinyoung
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/lib/wp/api.rb ADDED
@@ -0,0 +1,15 @@
1
+ require 'wp/api/version'
2
+ require 'wp/api/resource'
3
+ Dir['lib/wp/api/resources/*.rb'].each {|resource| require resource }
4
+ require 'wp/api/client'
5
+
6
+ require 'httparty'
7
+ require 'yajl'
8
+
9
+ module WP
10
+ module API
11
+ def self.[](host)
12
+ Client.new(host: host)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,47 @@
1
+ require 'httparty'
2
+ require 'yajl'
3
+ require 'addressable/uri'
4
+ require 'wp/api/endpoints'
5
+
6
+ module WP::API
7
+ class Client
8
+ include HTTParty
9
+ include Endpoints
10
+
11
+ attr_accessor :host
12
+
13
+ def initialize(host:, scheme: 'http')
14
+ @scheme = scheme
15
+ @host = host
16
+ fail ':host is required' unless host.is_a?(String) && host.length > 0
17
+ end
18
+
19
+ protected
20
+
21
+ def get(resource, query = {})
22
+ path = url_for(resource, query)
23
+ body = Client.get(path).body
24
+ parse(body)
25
+ end
26
+
27
+ private
28
+
29
+ def url_for(fragment, query)
30
+ url = "#{@scheme}://#{@host}/wp-json/#{fragment}"
31
+ url << ("?" + params(query)) unless query.empty?
32
+
33
+ url
34
+ end
35
+
36
+ def params(query)
37
+ uri = Addressable::URI.new
38
+ uri.query_values = query
39
+ uri.query
40
+ end
41
+
42
+ def parse(string)
43
+ @parser ||= Yajl::Parser.new
44
+ @parser.parse(string)
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,16 @@
1
+ module WP::API
2
+ module Endpoints
3
+
4
+ def posts(query = {})
5
+ get("posts", query).collect do |hash|
6
+ Post.new(hash)
7
+ end
8
+ end
9
+
10
+ def post(id, query = {})
11
+ hash = get("posts/#{id}", query)
12
+ Post.new(hash)
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,50 @@
1
+ require 'active_support/inflector'
2
+
3
+ module WP::API
4
+ class Resource
5
+ attr_reader :attributes
6
+
7
+ def initialize(attributes)
8
+ @attributes = attributes
9
+ end
10
+
11
+ def id
12
+ @attributes['ID']
13
+ end
14
+
15
+ protected
16
+
17
+ def method_missing(key, new_value = nil)
18
+ key = key.to_s
19
+ determinant = key[-1]
20
+ case determinant
21
+ when '?' # example: post.sticky?
22
+ @attributes[key.chomp(determinant)] == true
23
+ when '!' # unsupported
24
+ fail NoMethodError.new(key)
25
+ when '=' # example: post.title = 'my new title'
26
+ @attributes[key.chomp(determinant)] = new_value
27
+ else
28
+ # All other values. Hashes are converted to objects
29
+ # if a resource for them exists (e.g. Authors)
30
+ object key, @attributes[key]
31
+ end
32
+ end
33
+
34
+ private
35
+
36
+ def to_s
37
+ @attributes.to_s
38
+ end
39
+
40
+ def object(key, value)
41
+ klass = key.classify
42
+ if value.is_a?(Hash) && WP::API.const_defined?(klass)
43
+ resource = WP::API.const_get(klass)
44
+ resource.new(value)
45
+ else
46
+ value
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,4 @@
1
+ module WP::API
2
+ class Author < Resource
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module WP::API
2
+ class Post < Resource
3
+ end
4
+ end
@@ -0,0 +1,5 @@
1
+ module WP
2
+ module API
3
+ VERSION = "0.0.2"
4
+ end
5
+ end
@@ -0,0 +1,29 @@
1
+ describe WP::API do
2
+ context "raw HTTP request" do
3
+ let(:response) { HTTParty.get('http://wp.example.com/wp-json/posts/1').body }
4
+ let(:file) { support_file('posts/1.json') }
5
+ subject { parse_json(response) }
6
+
7
+ it { should eq parse_json(file) }
8
+ end
9
+
10
+ context "/wp-json/post/:post" do
11
+
12
+ let(:client) { WP::API['wp.example.com'] }
13
+
14
+ subject { client.post(1) }
15
+
16
+ it "should be a post" do
17
+ expect(subject).to be_a WP::API::Post
18
+ end
19
+
20
+ it "should have correct IDs" do
21
+ expect(subject.id).to eq 1
22
+ end
23
+
24
+ it "should have correct author" do
25
+ expect(subject.author.id).to eq 2
26
+ end
27
+ end
28
+
29
+ end
@@ -0,0 +1,60 @@
1
+ require 'pry'
2
+
3
+ describe WP::API do
4
+ context "raw HTTP request" do
5
+ let(:response) { HTTParty.get('http://wp.example.com/wp-json/posts').body }
6
+ let(:file) { support_file('posts.json') }
7
+ subject { parse_json(response) }
8
+
9
+ it { should eq parse_json(file) }
10
+ end
11
+
12
+ context "/wp-json/posts" do
13
+
14
+ let(:client) { WP::API['wp.example.com'] }
15
+
16
+ subject { client.posts }
17
+
18
+ it "should have size of 2" do
19
+ expect(subject.size).to eq 2
20
+ end
21
+
22
+ it "should have correct IDs" do
23
+ expect(subject.collect(&:id)).to match_array [1, 2]
24
+ end
25
+
26
+ it "should have authors" do
27
+ expect(subject.collect(&:author).size).to eq 2
28
+ end
29
+
30
+ context "first post" do
31
+ subject do
32
+ client.posts.find {|p| p.id == 1 }
33
+ end
34
+
35
+ it "should have boolean methods" do
36
+ expect(subject.sticky).to eq true
37
+ expect(subject.sticky?).to eq true
38
+ end
39
+
40
+ it("should have a title") { expect(subject.title).to eq "First post" }
41
+
42
+ context "author" do
43
+ let(:author) { subject.author }
44
+
45
+ it "should be converted to author class" do
46
+ expect(author).to be_a WP::API::Author
47
+ end
48
+ end
49
+
50
+ context "meta" do
51
+ let(:meta) { subject.meta }
52
+
53
+ it "should not be converted to a class" do
54
+ expect(meta).to be_a Hash
55
+ end
56
+ end
57
+ end
58
+
59
+ end
60
+ end
@@ -0,0 +1,340 @@
1
+ [{
2
+ "ID": 1,
3
+ "title": "First post",
4
+ "status": "publish",
5
+ "type": "post",
6
+ "author": {
7
+ "ID": 2,
8
+ "username": "test",
9
+ "name": "Test Testerson",
10
+ "first_name": "Test",
11
+ "last_name": "Testerson",
12
+ "nickname": "test",
13
+ "slug": "test",
14
+ "URL": "",
15
+ "avatar": "http:\/\/0.gravatar.com\/avatar\/55502f40dc8b7c769880b10874abc9d0?s=96",
16
+ "description": "",
17
+ "registered": "2014-09-17T17:06:50+00:00",
18
+ "meta": {
19
+ "links": {
20
+ "self": "http:\/\/wp.example.com\/wp-json\/users\/2",
21
+ "archives": "http:\/\/wp.example.com\/wp-json\/users\/2\/posts"
22
+ }
23
+ }
24
+ },
25
+ "content": "<p>This is a fox.</p><p><img src=\"http://i.imgur.com/3cTkRwm.gif\" /></p>\n",
26
+ "parent": 0,
27
+ "link": "http:\/\/wp.example.com\/what-does-the-fox-say\/",
28
+ "date": "2014-08-27T21:16:57+00:00",
29
+ "modified": "2014-08-27T21:16:57+00:00",
30
+ "format": "standard",
31
+ "slug": "what-does-the-fox-say",
32
+ "guid": "http:\/\/wp.example.com\/?p=1",
33
+ "excerpt": "<p>This is a fox.</p>\n",
34
+ "menu_order": 0,
35
+ "comment_status": "open",
36
+ "ping_status": "closed",
37
+ "sticky": true,
38
+ "date_tz": "UTC",
39
+ "date_gmt": "2014-08-27T21:16:57+00:00",
40
+ "modified_tz": "UTC",
41
+ "modified_gmt": "2014-08-27T21:16:57+00:00",
42
+ "meta": {
43
+ "links": {
44
+ "self": "http:\/\/wp.example.com\/wp-json\/posts\/1",
45
+ "author": "http:\/\/wp.example.com\/wp-json\/users\/2",
46
+ "collection": "http:\/\/wp.example.com\/wp-json\/posts",
47
+ "replies": "http:\/\/wp.example.com\/wp-json\/posts\/1\/comments",
48
+ "version-history": "http:\/\/wp.example.com\/wp-json\/posts\/1\/revisions"
49
+ }
50
+ },
51
+ "featured_image": {
52
+ "ID": 1,
53
+ "title": "cover",
54
+ "status": "inherit",
55
+ "type": "attachment",
56
+ "author": {
57
+ "ID": 1,
58
+ "username": "admin",
59
+ "name": "admin",
60
+ "first_name": "",
61
+ "last_name": "",
62
+ "nickname": "admin",
63
+ "slug": "admin",
64
+ "URL": "",
65
+ "avatar": "http:\/\/1.gravatar.com\/avatar\/fbbf698a470d3ece718ec58380668c6b?s=96",
66
+ "description": "",
67
+ "registered": "2014-09-17T16:57:26+00:00",
68
+ "meta": {
69
+ "links": {
70
+ "self": "http:\/\/wp.example.com\/wp-json\/users\/1",
71
+ "archives": "http:\/\/wp.example.com\/wp-json\/users\/1\/posts"
72
+ }
73
+ }
74
+ },
75
+ "content": "<p class=\"attachment\"><a href='http:\/\/wp.example.com\/wp-content\/uploads\/2014\/08\/cover.jpg'><img width=\"300\" height=\"300\" src=\"http:\/\/wp.example.com\/wp-content\/uploads\/2014\/08\/cover-300x300.jpg\" class=\"attachment-medium\" alt=\"Fox\" \/><\/a><\/p>\n",
76
+ "parent": 0,
77
+ "link": "http:\/\/wp.example.com\/?attachment_id=1",
78
+ "date": "2014-08-23T16:47:02+00:00",
79
+ "modified": "2014-08-23T16:47:02+00:00",
80
+ "format": "standard",
81
+ "slug": "cover-18",
82
+ "guid": "http:\/\/wp.example.com\/wp-content\/uploads\/2014\/08\/cover.jpg",
83
+ "excerpt": "<p>Fox</p>\n",
84
+ "menu_order": 0,
85
+ "comment_status": "open",
86
+ "ping_status": "closed",
87
+ "sticky": false,
88
+ "date_tz": "UTC",
89
+ "date_gmt": "2014-08-23T16:47:02+00:00",
90
+ "modified_tz": "UTC",
91
+ "modified_gmt": "2014-08-23T16:47:02+00:00",
92
+ "meta": {
93
+ "links": {
94
+ "self": "http:\/\/wp.example.com\/wp-json\/media\/1",
95
+ "author": "http:\/\/wp.example.com\/wp-json\/users\/1",
96
+ "collection": "http:\/\/wp.example.com\/wp-json\/media",
97
+ "replies": "http:\/\/wp.example.com\/wp-json\/media\/1\/comments",
98
+ "version-history": "http:\/\/wp.example.com\/wp-json\/media\/1\/revisions"
99
+ }
100
+ },
101
+ "terms": [],
102
+ "source": "http:\/\/wp.example.com\/wp-content\/uploads\/2014\/08\/cover.jpg",
103
+ "is_image": true,
104
+ "attachment_meta": {
105
+ "width": 700,
106
+ "height": 700,
107
+ "file": "2014\/08\/cover.jpg",
108
+ "sizes": {
109
+ "thumbnail": {
110
+ "file": "cover-150x150.jpg",
111
+ "width": 150,
112
+ "height": 150,
113
+ "mime-type": "image\/jpeg",
114
+ "url": "http:\/\/wp.example.com\/wp-content\/uploads\/2014\/08\/cover-150x150.jpg"
115
+ },
116
+ "medium": {
117
+ "file": "cover-300x300.jpg",
118
+ "width": 300,
119
+ "height": 300,
120
+ "mime-type": "image\/jpeg",
121
+ "url": "http:\/\/wp.example.com\/wp-content\/uploads\/2014\/08\/cover-300x300.jpg"
122
+ },
123
+ "post-thumbnail": {
124
+ "file": "cover-672x372.jpg",
125
+ "width": 672,
126
+ "height": 372,
127
+ "mime-type": "image\/jpeg",
128
+ "url": "http:\/\/wp.example.com\/wp-content\/uploads\/2014\/08\/cover-672x372.jpg"
129
+ },
130
+ "twentyfourteen-full-width": {
131
+ "file": "cover-700x576.jpg",
132
+ "width": 700,
133
+ "height": 576,
134
+ "mime-type": "image\/jpeg",
135
+ "url": "http:\/\/wp.example.com\/wp-content\/uploads\/2014\/08\/cover-700x576.jpg"
136
+ }
137
+ },
138
+ "image_meta": {
139
+ "aperture": 0,
140
+ "credit": "",
141
+ "camera": "",
142
+ "caption": "",
143
+ "created_timestamp": 0,
144
+ "copyright": "",
145
+ "focal_length": 0,
146
+ "iso": 0,
147
+ "shutter_speed": 0,
148
+ "title": "",
149
+ "orientation": 1
150
+ }
151
+ }
152
+ },
153
+ "terms": {
154
+ "post_tag": [{
155
+ "ID": 1,
156
+ "name": "animals",
157
+ "slug": "animals",
158
+ "description": "",
159
+ "parent": null,
160
+ "count": 1,
161
+ "link": "http:\/\/wp.example.com\/tag\/animals\/",
162
+ "meta": {
163
+ "links": {
164
+ "collection": "http:\/\/wp.example.com\/wp-json\/taxonomies\/post_tag\/terms",
165
+ "self": "http:\/\/wp.example.com\/wp-json\/taxonomies\/post_tag\/terms\/1"
166
+ }
167
+ }
168
+ }]
169
+ }
170
+ },
171
+ {
172
+ "ID": 2,
173
+ "title": "Second post",
174
+ "status": "publish",
175
+ "type": "post",
176
+ "author": {
177
+ "ID": 3,
178
+ "username": "other",
179
+ "name": "Other Author",
180
+ "first_name": "Other",
181
+ "last_name": "Author",
182
+ "nickname": "other",
183
+ "slug": "other-author",
184
+ "URL": "",
185
+ "avatar": "http:\/\/0.gravatar.com\/avatar\/55502f40dc8b7c769880b10874abc9d0?s=96",
186
+ "description": "",
187
+ "registered": "2014-09-17T17:06:50+00:00",
188
+ "meta": {
189
+ "links": {
190
+ "self": "http:\/\/wp.example.com\/wp-json\/users\/3",
191
+ "archives": "http:\/\/wp.example.com\/wp-json\/users\/3\/posts"
192
+ }
193
+ }
194
+ },
195
+ "content": "<p>This is a car.</p><p><img src=\"http://i.imgur.com/i6DYBd6.gif\" /></p>\n",
196
+ "parent": 0,
197
+ "link": "http:\/\/wp.example.com\/car-hit-by-green-shell\/",
198
+ "date": "2014-08-27T21:16:57+00:00",
199
+ "modified": "2014-08-27T21:16:57+00:00",
200
+ "format": "standard",
201
+ "slug": "car-hit-by-green-shell",
202
+ "guid": "http:\/\/wp.example.com\/?p=2",
203
+ "excerpt": "<p>This is a car.</p>\n",
204
+ "menu_order": 0,
205
+ "comment_status": "open",
206
+ "ping_status": "closed",
207
+ "sticky": false,
208
+ "date_tz": "UTC",
209
+ "date_gmt": "2014-08-27T21:16:57+00:00",
210
+ "modified_tz": "UTC",
211
+ "modified_gmt": "2014-08-27T21:16:57+00:00",
212
+ "meta": {
213
+ "links": {
214
+ "self": "http:\/\/wp.example.com\/wp-json\/posts\/1",
215
+ "author": "http:\/\/wp.example.com\/wp-json\/users\/2",
216
+ "collection": "http:\/\/wp.example.com\/wp-json\/posts",
217
+ "replies": "http:\/\/wp.example.com\/wp-json\/posts\/1\/comments",
218
+ "version-history": "http:\/\/wp.example.com\/wp-json\/posts\/1\/revisions"
219
+ }
220
+ },
221
+ "featured_image": {
222
+ "ID": 1,
223
+ "title": "cover",
224
+ "status": "inherit",
225
+ "type": "attachment",
226
+ "author": {
227
+ "ID": 1,
228
+ "username": "admin",
229
+ "name": "admin",
230
+ "first_name": "",
231
+ "last_name": "",
232
+ "nickname": "admin",
233
+ "slug": "admin",
234
+ "URL": "",
235
+ "avatar": "http:\/\/1.gravatar.com\/avatar\/fbbf698a470d3ece718ec58380668c6b?s=96",
236
+ "description": "",
237
+ "registered": "2014-09-17T16:57:26+00:00",
238
+ "meta": {
239
+ "links": {
240
+ "self": "http:\/\/wp.example.com\/wp-json\/users\/2",
241
+ "archives": "http:\/\/wp.example.com\/wp-json\/users\/2\/posts"
242
+ }
243
+ }
244
+ },
245
+ "content": "<p class=\"attachment\"><a href='http:\/\/wp.example.com\/wp-content\/uploads\/2014\/08\/cover.jpg'><img width=\"300\" height=\"300\" src=\"http:\/\/wp.example.com\/wp-content\/uploads\/2014\/08\/cover-300x300.jpg\" class=\"attachment-medium\" alt=\"Fox\" \/><\/a><\/p>\n",
246
+ "parent": 0,
247
+ "link": "http:\/\/wp.example.com\/?attachment_id=1",
248
+ "date": "2014-08-23T16:47:02+00:00",
249
+ "modified": "2014-08-23T16:47:02+00:00",
250
+ "format": "standard",
251
+ "slug": "cover-18",
252
+ "guid": "http:\/\/wp.example.com\/wp-content\/uploads\/2014\/08\/cover.jpg",
253
+ "excerpt": "<p>Fox</p>\n",
254
+ "menu_order": 0,
255
+ "comment_status": "open",
256
+ "ping_status": "closed",
257
+ "sticky": false,
258
+ "date_tz": "UTC",
259
+ "date_gmt": "2014-08-23T16:47:02+00:00",
260
+ "modified_tz": "UTC",
261
+ "modified_gmt": "2014-08-23T16:47:02+00:00",
262
+ "meta": {
263
+ "links": {
264
+ "self": "http:\/\/wp.example.com\/wp-json\/media\/1",
265
+ "author": "http:\/\/wp.example.com\/wp-json\/users\/1",
266
+ "collection": "http:\/\/wp.example.com\/wp-json\/media",
267
+ "replies": "http:\/\/wp.example.com\/wp-json\/media\/1\/comments",
268
+ "version-history": "http:\/\/wp.example.com\/wp-json\/media\/1\/revisions"
269
+ }
270
+ },
271
+ "terms": [],
272
+ "source": "http:\/\/wp.example.com\/wp-content\/uploads\/2014\/08\/cover.jpg",
273
+ "is_image": true,
274
+ "attachment_meta": {
275
+ "width": 700,
276
+ "height": 700,
277
+ "file": "2014\/08\/cover.jpg",
278
+ "sizes": {
279
+ "thumbnail": {
280
+ "file": "cover-150x150.jpg",
281
+ "width": 150,
282
+ "height": 150,
283
+ "mime-type": "image\/jpeg",
284
+ "url": "http:\/\/wp.example.com\/wp-content\/uploads\/2014\/08\/cover-150x150.jpg"
285
+ },
286
+ "medium": {
287
+ "file": "cover-300x300.jpg",
288
+ "width": 300,
289
+ "height": 300,
290
+ "mime-type": "image\/jpeg",
291
+ "url": "http:\/\/wp.example.com\/wp-content\/uploads\/2014\/08\/cover-300x300.jpg"
292
+ },
293
+ "post-thumbnail": {
294
+ "file": "cover-672x372.jpg",
295
+ "width": 672,
296
+ "height": 372,
297
+ "mime-type": "image\/jpeg",
298
+ "url": "http:\/\/wp.example.com\/wp-content\/uploads\/2014\/08\/cover-672x372.jpg"
299
+ },
300
+ "twentyfourteen-full-width": {
301
+ "file": "cover-700x576.jpg",
302
+ "width": 700,
303
+ "height": 576,
304
+ "mime-type": "image\/jpeg",
305
+ "url": "http:\/\/wp.example.com\/wp-content\/uploads\/2014\/08\/cover-700x576.jpg"
306
+ }
307
+ },
308
+ "image_meta": {
309
+ "aperture": 0,
310
+ "credit": "",
311
+ "camera": "",
312
+ "caption": "",
313
+ "created_timestamp": 0,
314
+ "copyright": "",
315
+ "focal_length": 0,
316
+ "iso": 0,
317
+ "shutter_speed": 0,
318
+ "title": "",
319
+ "orientation": 1
320
+ }
321
+ }
322
+ },
323
+ "terms": {
324
+ "post_tag": [{
325
+ "ID": 2,
326
+ "name": "cars",
327
+ "slug": "cars",
328
+ "description": "",
329
+ "parent": null,
330
+ "count": 1,
331
+ "link": "http:\/\/wp.example.com\/tag\/cars\/",
332
+ "meta": {
333
+ "links": {
334
+ "collection": "http:\/\/wp.example.com\/wp-json\/taxonomies\/post_tag\/terms",
335
+ "self": "http:\/\/wp.example.com\/wp-json\/taxonomies\/post_tag\/terms\/2"
336
+ }
337
+ }
338
+ }]
339
+ }
340
+ }]