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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7a1b56612823b783b538e87dc5caf6ed4e00781
4
- data.tar.gz: 103661f8e6887d36dd16d2c09f0f20f89958928e
3
+ metadata.gz: 94ebe4bf9964cd59307bc4936c8c965ebffff39d
4
+ data.tar.gz: 2fa3a08a085bc684be79f6e1cdc8eff8b671e507
5
5
  SHA512:
6
- metadata.gz: b714dee47f9db903f43ae53d755164e8c92f791a2c531e99ad52c72c016765f304575b46b07e42629bbc0fb699f786114b6c207626c87098f467fc80fbf01ee4
7
- data.tar.gz: bbe61828ae974866f0ece28763ce654a2d34fdaf1b3b2c18b20ea552815d8e2dcb13dce8f7fae7ecc121c5a854f1516515e1165f088614a81e33578c8a2c7680
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
@@ -22,6 +22,7 @@ module WpApiClient
22
22
  attr_accessor :oauth_credentials
23
23
  attr_accessor :debug
24
24
  attr_accessor :cache
25
+ attr_accessor :basic_auth
25
26
 
26
27
  def initialize
27
28
  @endpoint = 'http://localhost:8080/wp-json/wp/v2'
@@ -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
@@ -1,3 +1,3 @@
1
1
  module WpApiClient
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wp-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Duncan Brown