wp-api-client 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -1
- data/lib/wp_api_client/configuration.rb +1 -0
- data/lib/wp_api_client/connection.rb +4 -0
- data/lib/wp_api_client/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94ebe4bf9964cd59307bc4936c8c965ebffff39d
|
4
|
+
data.tar.gz: 2fa3a08a085bc684be79f6e1cdc8eff8b671e507
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6910fe16593959cdeb492278344d669bf20e734088493076255c8263698ab8e23adae2a671cb9d4cdf822d8e38a06d91f0705d9696859a458836132195cc9191
|
7
|
+
data.tar.gz: 2bdd4f9c237badbcd4cb16b3197556b295a5633741a4696ad07758d7ec7c6c0e6166b7f3afe649212e051ede4e43801c42cac0d4ba408dd5f47be81cca36d8fa
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
This unambitious client provides read-only access for WP-API v2.
|
4
4
|
|
5
|
-
It supports authentication via OAuth.
|
5
|
+
It supports authentication via OAuth or Basic Auth.
|
6
6
|
|
7
7
|
It does not support comments, users or POST requests.
|
8
8
|
|
@@ -146,6 +146,18 @@ end
|
|
146
146
|
client = WpApiClient.get_client
|
147
147
|
```
|
148
148
|
|
149
|
+
#### Basic Auth
|
150
|
+
|
151
|
+
Provide a symbol-keyed hash of `username` and `password` on configuration.
|
152
|
+
|
153
|
+
```ruby
|
154
|
+
WpApiClient.configure do |api_client|
|
155
|
+
api_client.basic_auth = {username: 'miles', password: 'smile'}
|
156
|
+
end
|
157
|
+
|
158
|
+
client = WpApiClient.get_client
|
159
|
+
```
|
160
|
+
|
149
161
|
## Testing and compatibility
|
150
162
|
|
151
163
|
This library comes with VCR cassettes recorded against a local WP installation
|
@@ -15,6 +15,10 @@ module WpApiClient
|
|
15
15
|
faraday.use FaradayMiddleware::OAuth, configuration.oauth_credentials
|
16
16
|
end
|
17
17
|
|
18
|
+
if configuration.basic_auth
|
19
|
+
faraday.basic_auth(configuration.basic_auth[:username], configuration.basic_auth[:password])
|
20
|
+
end
|
21
|
+
|
18
22
|
if configuration.debug
|
19
23
|
faraday.response :logger
|
20
24
|
end
|