wordpress_client 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +15 -6
- data/.rubocop.yml +31 -29
- data/Changelog.md +5 -0
- data/Gemfile +6 -1
- data/README.md +1 -1
- data/circle.yml +3 -0
- data/lib/wordpress_client/post_parser.rb +3 -3
- data/lib/wordpress_client/version.rb +1 -1
- data/spec/connection_spec.rb +7 -3
- data/spec/docker/Dockerfile +18 -0
- data/spec/fixtures/post-with-forbidden-metadata.json +1 -1
- data/spec/fixtures/post-with-metadata.json +1 -1
- data/spec/spec_helper.rb +1 -0
- data/wordpress_client.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bd8f4433a29ac4f20d54d6da4927412cead3fb1
|
4
|
+
data.tar.gz: 757a924fa15dcc666a24c672858076027cdae856
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fe40c7cda920e86de18cffd8f6c717de65576b07ee14db1ef5a264677a1bf1403c3e494a5ef05ae17160e83833d50fc2f2843e25738f48d4f634c0b5a488eca
|
7
|
+
data.tar.gz: 2c1a4c7d51dabdbdedcda5c1824a6a6a3bec1ccb228e1d5efd7e0c5d28adeacae8ecca45b7d1ace6fd9adcfa6eea7203b5cafd1fc1d7863ede7ad0b24701729e
|
data/.codeclimate.yml
CHANGED
@@ -1,14 +1,23 @@
|
|
1
|
-
---
|
2
1
|
engines:
|
3
|
-
|
2
|
+
duplication:
|
4
3
|
enabled: true
|
5
|
-
|
4
|
+
config:
|
5
|
+
languages:
|
6
|
+
- ruby
|
7
|
+
rubocop:
|
6
8
|
enabled: true
|
7
9
|
fixme:
|
8
10
|
enabled: true
|
11
|
+
config:
|
12
|
+
strings:
|
13
|
+
- FIXME
|
14
|
+
- TODO
|
9
15
|
ratings:
|
10
16
|
paths:
|
11
|
-
-
|
17
|
+
- Gemfile.lock
|
18
|
+
- lib/**
|
19
|
+
- "**.rb"
|
12
20
|
exclude_paths:
|
13
|
-
-
|
14
|
-
-
|
21
|
+
- doc/**/*
|
22
|
+
- spec/**/*
|
23
|
+
- tmp/**/*
|
data/.rubocop.yml
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
AllCops:
|
2
|
+
TargetRubyVersion: 2.2
|
2
3
|
Include:
|
3
4
|
- "**/*.gemspec"
|
4
5
|
- "**/*.podspec"
|
@@ -15,12 +16,10 @@ AllCops:
|
|
15
16
|
- "**/Berksfile"
|
16
17
|
- "**/Cheffile"
|
17
18
|
- "**/Vagabondfile"
|
18
|
-
Exclude:
|
19
|
-
- "vendor/**/*"
|
20
|
-
- "db/schema.rb"
|
21
|
-
RunRailsCops: false
|
22
19
|
DisplayCopNames: false
|
23
20
|
StyleGuideCopsOnly: false
|
21
|
+
Rails:
|
22
|
+
Enabled: false
|
24
23
|
Style/AccessModifierIndentation:
|
25
24
|
Description: Check indentation of private/protected visibility modifiers.
|
26
25
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#indent-public-private-protected
|
@@ -275,7 +274,7 @@ Style/MultilineOperationIndentation:
|
|
275
274
|
Style/NumericLiterals:
|
276
275
|
Description: Add underscores to large numeric literals to improve their readability.
|
277
276
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics
|
278
|
-
Enabled:
|
277
|
+
Enabled: true
|
279
278
|
MinDigits: 5
|
280
279
|
Style/ParenthesesAroundCondition:
|
281
280
|
Description: Don't use parentheses around the condition of an if/unless/while.
|
@@ -432,14 +431,14 @@ Style/TrailingBlankLines:
|
|
432
431
|
SupportedStyles:
|
433
432
|
- final_newline
|
434
433
|
- final_blank_line
|
435
|
-
Style/
|
436
|
-
Description: Checks for trailing comma in
|
437
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas
|
434
|
+
Style/TrailingCommaInArguments:
|
435
|
+
Description: 'Checks for trailing comma in argument lists.'
|
436
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
437
|
+
Enabled: false
|
438
|
+
Style/TrailingCommaInLiteral:
|
439
|
+
Description: 'Checks for trailing comma in array and hash literals.'
|
440
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
438
441
|
Enabled: false
|
439
|
-
EnforcedStyleForMultiline: no_comma
|
440
|
-
SupportedStyles:
|
441
|
-
- comma
|
442
|
-
- no_comma
|
443
442
|
Style/TrivialAccessors:
|
444
443
|
Description: Prefer attr_* methods to trivial readers/writers.
|
445
444
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#attr_family
|
@@ -558,11 +557,6 @@ Rails/ActionFilter:
|
|
558
557
|
- filter
|
559
558
|
Include:
|
560
559
|
- app/controllers/**/*.rb
|
561
|
-
Rails/DefaultScope:
|
562
|
-
Description: Checks if the argument passed to default_scope is a block.
|
563
|
-
Enabled: true
|
564
|
-
Include:
|
565
|
-
- app/models/**/*.rb
|
566
560
|
Rails/HasAndBelongsToMany:
|
567
561
|
Description: Prefer has_many :through to has_and_belongs_to_many.
|
568
562
|
Enabled: true
|
@@ -576,6 +570,11 @@ Rails/Output:
|
|
576
570
|
- config/**/*.rb
|
577
571
|
- db/**/*.rb
|
578
572
|
- lib/**/*.rb
|
573
|
+
Exclude:
|
574
|
+
- lib/capistrano/**/*.rb
|
575
|
+
- config/deploy.rb
|
576
|
+
- config/deploy/**/*.rb
|
577
|
+
- lib/tasks/**/*.rb
|
579
578
|
Rails/ReadWriteAttribute:
|
580
579
|
Description: Checks for read_attribute(:attr) and write_attribute(:attr, val).
|
581
580
|
Enabled: true
|
@@ -744,6 +743,7 @@ Style/IndentationConsistency:
|
|
744
743
|
Style/IndentArray:
|
745
744
|
Description: Checks the indentation of the first element in an array literal.
|
746
745
|
Enabled: true
|
746
|
+
EnforcedStyle: consistent
|
747
747
|
Style/InfiniteLoop:
|
748
748
|
Description: Use Kernel#loop for infinite loops.
|
749
749
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#infinite-loop
|
@@ -840,9 +840,10 @@ Style/SelfAssignment:
|
|
840
840
|
used.
|
841
841
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#self-assignment
|
842
842
|
Enabled: false
|
843
|
-
Style/
|
844
|
-
Description:
|
845
|
-
|
843
|
+
Style/SpaceBeforeFirstArg:
|
844
|
+
Description: >-
|
845
|
+
Checks that exactly one space is used between a method name
|
846
|
+
and the first argument for method calls without parentheses.
|
846
847
|
Enabled: true
|
847
848
|
Style/SpaceAfterColon:
|
848
849
|
Description: Use spaces after colons.
|
@@ -852,8 +853,8 @@ Style/SpaceAfterComma:
|
|
852
853
|
Description: Use spaces after commas.
|
853
854
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-operators
|
854
855
|
Enabled: true
|
855
|
-
Style/
|
856
|
-
Description: Use
|
856
|
+
Style/SpaceAroundKeyword:
|
857
|
+
Description: 'Use a space around keywords if appropriate.'
|
857
858
|
Enabled: true
|
858
859
|
Style/SpaceAfterMethodName:
|
859
860
|
Description: Do not put a space between a method name and the opening parenthesis
|
@@ -881,9 +882,6 @@ Style/SpaceAroundOperators:
|
|
881
882
|
Description: Use spaces around operators.
|
882
883
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-operators
|
883
884
|
Enabled: true
|
884
|
-
Style/SpaceBeforeModifierKeyword:
|
885
|
-
Description: Put a space before the modifier keyword.
|
886
|
-
Enabled: true
|
887
885
|
Style/SpaceInsideBrackets:
|
888
886
|
Description: No spaces after [ or before ].
|
889
887
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-spaces-braces
|
@@ -940,6 +938,11 @@ Style/WhileUntilDo:
|
|
940
938
|
Description: Checks for redundant do after while or until.
|
941
939
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-multiline-while-do
|
942
940
|
Enabled: true
|
941
|
+
Style/MultilineMethodCallIndentation:
|
942
|
+
Description: Checks the indentation of the method name part in method calls that span more than one line.
|
943
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
|
944
|
+
Enabled: true
|
945
|
+
EnforcedStyle: indented
|
943
946
|
Lint/AmbiguousOperator:
|
944
947
|
Description: Checks for ambiguous operators in the first argument of a method invocation
|
945
948
|
without parentheses.
|
@@ -1019,10 +1022,6 @@ Lint/ShadowingOuterLocalVariable:
|
|
1019
1022
|
Description: Do not use the same name as outer local variable for block arguments
|
1020
1023
|
or block local variables.
|
1021
1024
|
Enabled: true
|
1022
|
-
Lint/SpaceBeforeFirstArg:
|
1023
|
-
Description: Put a space between a method name and the first argument in a method
|
1024
|
-
call without parentheses.
|
1025
|
-
Enabled: true
|
1026
1025
|
Lint/StringConversionInInterpolation:
|
1027
1026
|
Description: Checks for Object#to_s usage in string interpolation.
|
1028
1027
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-to-s
|
@@ -1063,3 +1062,6 @@ Lint/Void:
|
|
1063
1062
|
Rails/Delegate:
|
1064
1063
|
Description: Prefer delegate method for delegations.
|
1065
1064
|
Enabled: false
|
1065
|
+
Rails/TimeZone:
|
1066
|
+
Enabled: true
|
1067
|
+
EnforcedStyle: flexible
|
data/Changelog.md
CHANGED
data/Gemfile
CHANGED
@@ -5,7 +5,12 @@ gemspec
|
|
5
5
|
|
6
6
|
gem "codeclimate-test-reporter", group: :test, require: nil
|
7
7
|
|
8
|
-
group :development do
|
8
|
+
group :development, :test do
|
9
|
+
gem 'pry'
|
10
|
+
gem 'pry-byebug', require: true
|
11
|
+
end
|
12
|
+
|
13
|
+
group :guard do
|
9
14
|
gem 'guard', '~> 2.13'
|
10
15
|
gem 'guard-rspec', '~> 4.6'
|
11
16
|
end
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
WordpressClient is a very simple client for the Wordpress [WP REST API plugin][api] (version 2 beta 8.0).
|
4
4
|
|
5
|
-
[![Circle CI](https://circleci.com/gh/hemnet/wordpress_client.svg?style=svg)](https://circleci.com/gh/hemnet/wordpress_client) [![Code Climate](https://codeclimate.com/repos/5645938269568041da00cded/badges/5e870b57428f23c1f2ff/gpa.svg)](https://codeclimate.com/repos/5645938269568041da00cded/feed) [![Test Coverage](https://codeclimate.com/repos/5645938269568041da00cded/badges/5e870b57428f23c1f2ff/coverage.svg)](https://codeclimate.com/repos/5645938269568041da00cded/coverage) [![Gem Version](https://badge.fury.io/rb/wordpress_client.svg)](https://badge.fury.io/rb/wordpress_client)
|
5
|
+
[![Circle CI](https://circleci.com/gh/hemnet/wordpress_client.svg?style=svg)](https://circleci.com/gh/hemnet/wordpress_client) [![Code Climate](https://codeclimate.com/repos/5645938269568041da00cded/badges/5e870b57428f23c1f2ff/gpa.svg)](https://codeclimate.com/repos/5645938269568041da00cded/feed) [![Test Coverage](https://codeclimate.com/repos/5645938269568041da00cded/badges/5e870b57428f23c1f2ff/coverage.svg)](https://codeclimate.com/repos/5645938269568041da00cded/coverage) [![Gem Version](https://badge.fury.io/rb/wordpress_client.svg)](https://badge.fury.io/rb/wordpress_client)[![Dependency Status](https://gemnasium.com/hemnet/wordpress_client.svg)](https://gemnasium.com/hemnet/wordpress_client)
|
6
6
|
|
7
7
|
## Usage
|
8
8
|
|
data/circle.yml
CHANGED
@@ -63,7 +63,7 @@ module WordpressClient
|
|
63
63
|
def assign_featured_image(post)
|
64
64
|
featured_id = data["featured_image"]
|
65
65
|
if featured_id
|
66
|
-
features = (embedded["
|
66
|
+
features = (embedded["wp:featuredmedia"] || []).flatten
|
67
67
|
media = features.detect { |feature| feature["id"] == featured_id }
|
68
68
|
if media
|
69
69
|
post.featured_image = Media.parse(media)
|
@@ -72,7 +72,7 @@ module WordpressClient
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def parse_metadata
|
75
|
-
embedded_metadata = (embedded["
|
75
|
+
embedded_metadata = (embedded["wp:meta"] || []).flatten
|
76
76
|
validate_embedded_metadata(embedded_metadata)
|
77
77
|
|
78
78
|
meta = {}
|
@@ -87,7 +87,7 @@ module WordpressClient
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def embedded_terms(type)
|
90
|
-
term_collections = embedded["https://api.w.org/term"] || []
|
90
|
+
term_collections = embedded["wp:term"] || embedded["https://api.w.org/term"] || []
|
91
91
|
|
92
92
|
# term_collections is an array of arrays with terms in them. We can see
|
93
93
|
# the type of the "collection" by inspecting the first child's taxonomy.
|
data/spec/connection_spec.rb
CHANGED
@@ -6,7 +6,7 @@ module WordpressClient
|
|
6
6
|
Connection.new(url: "http://example.com/", username: "jane", password: "doe")
|
7
7
|
}
|
8
8
|
|
9
|
-
let(:base_url) { "http://
|
9
|
+
let(:base_url) { "http://example.com/wp/v2" }
|
10
10
|
let(:model) { class_double(Post, parse: model_instance) }
|
11
11
|
let(:model_instance) { instance_double(Post) }
|
12
12
|
|
@@ -235,11 +235,12 @@ module WordpressClient
|
|
235
235
|
headers = {"content-type" => "#{content_type}; charset=utf-8"}
|
236
236
|
headers["X-WP-Total"] = total.to_s if total
|
237
237
|
|
238
|
-
stub_request(:get, path).to_return(status: status, body: body, headers: headers)
|
238
|
+
stub_request(:get, path).with(basic_auth: ['jane', 'doe']).to_return(status: status, body: body, headers: headers)
|
239
239
|
end
|
240
240
|
|
241
241
|
def stub_successful_post_with_redirect(path, data, redirects_to:)
|
242
242
|
stub_request(:post, path).with(
|
243
|
+
basic_auth: ['jane', 'doe'],
|
243
244
|
headers: {"content-type" => "application/json; charset=#{"".encoding}"},
|
244
245
|
body: data.to_json,
|
245
246
|
).to_return(
|
@@ -249,7 +250,9 @@ module WordpressClient
|
|
249
250
|
end
|
250
251
|
|
251
252
|
def stub_failing_post(path, returns:, status:)
|
252
|
-
stub_request(:post, path).
|
253
|
+
stub_request(:post, path).with(
|
254
|
+
basic_auth: ['jane', 'doe']
|
255
|
+
).to_return(
|
253
256
|
status: status,
|
254
257
|
body: returns.to_json,
|
255
258
|
headers: {"content-type" => "application/json; charset=utf-8"},
|
@@ -258,6 +261,7 @@ module WordpressClient
|
|
258
261
|
|
259
262
|
def stub_patch(path, data, returns:, status: 200)
|
260
263
|
stub_request(:patch, path).with(
|
264
|
+
basic_auth: ['jane', 'doe'],
|
261
265
|
headers: {"content-type" => "application/json; charset=#{"".encoding}"},
|
262
266
|
body: data.to_json,
|
263
267
|
).to_return(
|
data/spec/docker/Dockerfile
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
FROM appcontainers/wordpress
|
2
2
|
|
3
|
+
# Wordpress latest isn't actually the lastest we want to be on the bleeding edge
|
4
|
+
RUN rm -rf /var/www/html/
|
5
|
+
RUN wget -P /var/www/html/ https://wordpress.org/latest.zip && \
|
6
|
+
unzip /var/www/html/latest.zip -d /var/www/html/ && \
|
7
|
+
rm -fr /var/www/html/latest.zip
|
8
|
+
|
9
|
+
# Copy the WP-Config file
|
10
|
+
RUN cp /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php
|
11
|
+
|
3
12
|
# base image only contains American timezones
|
4
13
|
RUN yum install -y tzdata
|
5
14
|
|
@@ -38,3 +47,12 @@ RUN curl -SL -o /tmp/rest-api.zip https://downloads.wordpress.org/plugin/rest-ap
|
|
38
47
|
RUN curl -SL https://github.com/WP-API/Basic-Auth/archive/master.tar.gz \
|
39
48
|
| tar -xzC /var/www/html/wordpress/wp-content/plugins/ \
|
40
49
|
&& mv /var/www/html/wordpress/wp-content/plugins/Basic-Auth* /var/www/html/wordpress/wp-content/plugins/basic-auth
|
50
|
+
|
51
|
+
# The appcontainer will run apache in the foreground after running their setup
|
52
|
+
# script. The setup script will unset all the env variables with passwords and
|
53
|
+
# other important information so they aren't exposed to the foregrounded apache
|
54
|
+
# process, so for this reason we cannot just append our DB restore to that
|
55
|
+
# script.
|
56
|
+
# The container used to just run bash, and by switching back to that we get
|
57
|
+
# everything working again.
|
58
|
+
CMD /bin/bash
|
@@ -1 +1 @@
|
|
1
|
-
{"id":4,"date":null,"guid":{"rendered":"http:\/\/192.168.99.100:8181\/?p=4"},"modified":null,"modified_gmt":null,"slug":"","type":"post","link":"http:\/\/192.168.99.100:8181\/?p=4","title":{"rendered":"Metadata creation"},"content":{"rendered":""},"excerpt":{"rendered":""},"author":1,"featured_image":0,"comment_status":"open","ping_status":"open","sticky":false,"format":"standard","_links":{"self":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4"}],"collection":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts"}],"author":[{"embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/comments?post_id=4"}],"version-history":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/revisions"}],"https:\/\/api.w.org\/attachment":[{"embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/media?post_parent=4"}],"https:\/\/api.w.org\/term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/terms\/category"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/terms\/tag"},{"taxonomy":"post_format","embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/terms\/post_format"}],"
|
1
|
+
{"id":4,"date":null,"guid":{"rendered":"http:\/\/192.168.99.100:8181\/?p=4"},"modified":null,"modified_gmt":null,"slug":"","type":"post","link":"http:\/\/192.168.99.100:8181\/?p=4","title":{"rendered":"Metadata creation"},"content":{"rendered":""},"excerpt":{"rendered":""},"author":1,"featured_image":0,"comment_status":"open","ping_status":"open","sticky":false,"format":"standard","_links":{"self":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4"}],"collection":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts"}],"author":[{"embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/comments?post_id=4"}],"version-history":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/revisions"}],"https:\/\/api.w.org\/attachment":[{"embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/media?post_parent=4"}],"https:\/\/api.w.org\/term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/terms\/category"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/terms\/tag"},{"taxonomy":"post_format","embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/terms\/post_format"}],"wp:meta":[{"embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/meta"}]},"_embedded":{"author":[{"avatar_urls":{"24":"http:\/\/2.gravatar.com\/avatar\/55502f40dc8b7c769880b10874abc9d0?s=24&d=mm&r=g","48":"http:\/\/2.gravatar.com\/avatar\/55502f40dc8b7c769880b10874abc9d0?s=48&d=mm&r=g","96":"http:\/\/2.gravatar.com\/avatar\/55502f40dc8b7c769880b10874abc9d0?s=96&d=mm&r=g"},"description":"","id":1,"link":"http:\/\/192.168.99.100:8181\/author\/test\/","name":"test","url":"","_links":{"self":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/users\/1"}],"collection":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/users"}]}}],"replies":[[{"id":1,"parent":0,"author":0,"author_name":"Mr WordPress","author_url":"https:\/\/wordpress.org\/","author_avatar_urls":{"24":"http:\/\/1.gravatar.com\/avatar\/?s=24&d=mm&r=g","48":"http:\/\/1.gravatar.com\/avatar\/?s=48&d=mm&r=g","96":"http:\/\/2.gravatar.com\/avatar\/?s=96&d=mm&r=g"},"date":"2015-11-03T07:47:41","content":{"rendered":"<p>Hi, this is a comment.<br \/>\nTo delete a comment, just log in and view the post's comments. There you will have the option to edit or delete them.<\/p>\n"},"link":"http:\/\/192.168.99.100:8181\/2015\/11\/03\/hello-world\/#comment-1","type":"comment","_links":{"self":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/comments\/1"}],"collection":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/comments"}],"up":[{"embeddable":true,"post_type":"post","href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/1"}]}}]],"https:\/\/api.w.org\/term":[[{"id":1,"link":"http:\/\/192.168.99.100:8181\/category\/uncategorized\/","name":"Uncategorized","slug":"uncategorized","taxonomy":"category","_links":{"self":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/terms\/category\/1"}],"collection":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/terms\/category"}]}}],[],[{"code":"rest_no_route","message":"No route was found matching the URL and request method","data":{"status":404}}]],"wp:meta":[[{"code":"rest_forbidden","message":"Sorry, you cannot view the meta for this post.","data":{"status":403}}]]}}
|
@@ -1 +1 @@
|
|
1
|
-
{"id":4,"date":null,"guid":{"rendered":"http:\/\/192.168.99.100:8181\/?p=4"},"modified":null,"modified_gmt":null,"slug":"","type":"post","link":"http:\/\/192.168.99.100:8181\/?p=4","title":{"rendered":"Metadata creation"},"content":{"rendered":""},"excerpt":{"rendered":""},"author":1,"featured_image":0,"comment_status":"open","ping_status":"open","sticky":false,"format":"standard","_links":{"self":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4"}],"collection":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts"}],"author":[{"embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/comments?post_id=4"}],"version-history":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/revisions"}],"https:\/\/api.w.org\/attachment":[{"embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/media?post_parent=4"}],"https:\/\/api.w.org\/term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/terms\/category"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/terms\/tag"},{"taxonomy":"post_format","embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/terms\/post_format"}],"
|
1
|
+
{"id":4,"date":null,"guid":{"rendered":"http:\/\/192.168.99.100:8181\/?p=4"},"modified":null,"modified_gmt":null,"slug":"","type":"post","link":"http:\/\/192.168.99.100:8181\/?p=4","title":{"rendered":"Metadata creation"},"content":{"rendered":""},"excerpt":{"rendered":""},"author":1,"featured_image":0,"comment_status":"open","ping_status":"open","sticky":false,"format":"standard","_links":{"self":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4"}],"collection":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts"}],"author":[{"embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/comments?post_id=4"}],"version-history":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/revisions"}],"https:\/\/api.w.org\/attachment":[{"embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/media?post_parent=4"}],"https:\/\/api.w.org\/term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/terms\/category"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/terms\/tag"},{"taxonomy":"post_format","embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/terms\/post_format"}],"wp:meta":[{"embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/4\/meta"}]},"_embedded":{"author":[{"avatar_urls":{"24":"http:\/\/2.gravatar.com\/avatar\/55502f40dc8b7c769880b10874abc9d0?s=24&d=mm&r=g","48":"http:\/\/2.gravatar.com\/avatar\/55502f40dc8b7c769880b10874abc9d0?s=48&d=mm&r=g","96":"http:\/\/2.gravatar.com\/avatar\/55502f40dc8b7c769880b10874abc9d0?s=96&d=mm&r=g"},"description":"","id":1,"link":"http:\/\/192.168.99.100:8181\/author\/test\/","name":"test","url":"","_links":{"self":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/users\/1"}],"collection":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/users"}]}}],"replies":[[{"id":1,"parent":0,"author":0,"author_name":"Mr WordPress","author_url":"https:\/\/wordpress.org\/","author_avatar_urls":{"24":"http:\/\/1.gravatar.com\/avatar\/?s=24&d=mm&r=g","48":"http:\/\/1.gravatar.com\/avatar\/?s=48&d=mm&r=g","96":"http:\/\/2.gravatar.com\/avatar\/?s=96&d=mm&r=g"},"date":"2015-11-03T07:47:41","content":{"rendered":"<p>Hi, this is a comment.<br \/>\nTo delete a comment, just log in and view the post's comments. There you will have the option to edit or delete them.<\/p>\n"},"link":"http:\/\/192.168.99.100:8181\/2015\/11\/03\/hello-world\/#comment-1","type":"comment","_links":{"self":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/comments\/1"}],"collection":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/comments"}],"up":[{"embeddable":true,"post_type":"post","href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/posts\/1"}]}}]],"https:\/\/api.w.org\/term":[[{"id":1,"link":"http:\/\/192.168.99.100:8181\/category\/uncategorized\/","name":"Uncategorized","slug":"uncategorized","taxonomy":"category","_links":{"self":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/terms\/category\/1"}],"collection":[{"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/v2\/terms\/category"}]}}],[],[{"code":"rest_no_route","message":"No route was found matching the URL and request method","data":{"status":404}}]],"wp:meta":[[{"id":2,"key":"foo","value":"bar","_links":{"about":[{"embeddable":true,"href":"http:\/\/192.168.99.100:8181\/wp-json\/wp\/posts\/4"}]}}]]}}
|
data/spec/spec_helper.rb
CHANGED
data/wordpress_client.gemspec
CHANGED
@@ -23,6 +23,6 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.7"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
25
|
spec.add_development_dependency "rspec", "~> 3.3"
|
26
|
-
spec.add_development_dependency "webmock", "~>
|
26
|
+
spec.add_development_dependency "webmock", "~> 2.0"
|
27
27
|
spec.add_development_dependency "yard", "~> 0.8.7"
|
28
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wordpress_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Magnus Bergmark
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-05-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -73,14 +73,14 @@ dependencies:
|
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
76
|
+
version: '2.0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '
|
83
|
+
version: '2.0'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: yard
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|