wp-api-client 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +3 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/LICENSE.txt +21 -0
- data/README.md +130 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/wp_api_client.rb +10 -0
- data/lib/wp_api_client/client.rb +47 -0
- data/lib/wp_api_client/collection.rb +45 -0
- data/lib/wp_api_client/connection.rb +23 -0
- data/lib/wp_api_client/entities/base_entity.rb +25 -0
- data/lib/wp_api_client/entities/post.rb +39 -0
- data/lib/wp_api_client/entities/taxonomy.rb +19 -0
- data/lib/wp_api_client/entities/term.rb +34 -0
- data/lib/wp_api_client/version.rb +3 -0
- data/wp_api_client.gemspec +38 -0
- metadata +148 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d1e0339d85de70f76fa1053b11e8c81d34498b57
|
4
|
+
data.tar.gz: 96321f28e3713c144ee3d580e364ead14a530268
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0852242e985bd4de60df6820b522845f422f608e1db5efe3e0e40f429ec5353bbdd6310d0050d9a18edb7aef05c91a6ec2d127b76b29d4db2d751a48bed59bff
|
7
|
+
data.tar.gz: f7bc70aa9662df06d7916f647119021113ff04c838ccb0090681618436b2cbf341d850425f18851b5839eea9108cf9e0638c759fb5a60aaec462c004a6cff3fc
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at duncanjbrown@gmail.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Duncan Brown
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
# A read-only Ruby client for WP-API v2
|
2
|
+
|
3
|
+
This unambitious client provides read-only access for WP-API v2.
|
4
|
+
|
5
|
+
It does not support authentication (yet).
|
6
|
+
|
7
|
+
It does not support comments or POST requests.
|
8
|
+
|
9
|
+
It requires **Ruby 2.3** and is tested against **WP-API 2.0-beta12**.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem install wp-api-client
|
15
|
+
```
|
16
|
+
|
17
|
+
And
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
require 'wp_api_client'
|
21
|
+
```
|
22
|
+
|
23
|
+
## Usage examples
|
24
|
+
|
25
|
+
#### Set up the client and get some posts
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
# create a client
|
29
|
+
@connection = WpApiClient::Connection.new('http://localhost:8080/wp-json/wp/v2')
|
30
|
+
@api = WpApiClient::Client.new(@connection)
|
31
|
+
|
32
|
+
# get some posts
|
33
|
+
posts = @api.get('custom_post_type/') # or "posts/" etc
|
34
|
+
# => <WpApiClient::Collection:0x007fed432a5660 @resources=[#<WpApiClient::Entities::Post...
|
35
|
+
|
36
|
+
posts.map { |p| puts p.title }
|
37
|
+
# Custom Post Type 99
|
38
|
+
# Custom Post Type 98
|
39
|
+
# Custom Post Type 97
|
40
|
+
|
41
|
+
term = @posts.first.terms.first
|
42
|
+
# => #<WpApiClient::Entities::Term:0x007fed42b3e458 @resource={"id"=>2...
|
43
|
+
```
|
44
|
+
|
45
|
+
#### Navigate between posts, terms and taxonomies
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
term.taxonomy
|
49
|
+
# => #<WpApiClient::Entities::Taxonomy:0x007f9c2c86f1a8 @resource={"name"=>"Custom taxonomy"...
|
50
|
+
|
51
|
+
term.posts
|
52
|
+
# => #<WpApiClient::Collection:0x007fd65d07d588 @resources=[#<WpApiClient::Entities::Post...
|
53
|
+
|
54
|
+
# term.posts.first.terms.first.taxonomy.terms.first... etc etc etc
|
55
|
+
```
|
56
|
+
|
57
|
+
#### Pagination
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
posts = @api.get('posts', page: 2)
|
61
|
+
|
62
|
+
posts.count
|
63
|
+
# => 10
|
64
|
+
|
65
|
+
posts.total_available
|
66
|
+
# => 100
|
67
|
+
|
68
|
+
next_page = @api.get(posts.next_page)
|
69
|
+
# => #<WpApiClient::Collection:0x00bbcafe938827 @resources=[#<WpApiClient::Entities::Post...
|
70
|
+
|
71
|
+
page_after_that = @api.get(next_page.page_after_that)
|
72
|
+
# => #<WpApiClient::Collection:0x00bbcafe938827 @resources=[#<WpApiClient::Entities::Post...
|
73
|
+
```
|
74
|
+
|
75
|
+
#### Loading a taxonomy via a slug
|
76
|
+
|
77
|
+
WP-API returns an array even if there's only one result, so you need to be careful here
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
term = @api.get('custom_taxonomy', slug: 'term_one').first
|
81
|
+
taxonomy_name = term.taxonomy.name
|
82
|
+
posts = term.posts
|
83
|
+
```
|
84
|
+
|
85
|
+
## Testing and compatibility
|
86
|
+
|
87
|
+
This library comes with VCR cassettes recorded against a local WP installation
|
88
|
+
running WP-API v2-beta12. It is not tested with other versions.
|
89
|
+
|
90
|
+
To run the tests, invoke `rspec`.
|
91
|
+
|
92
|
+
## Structure
|
93
|
+
|
94
|
+
### Public Objects
|
95
|
+
|
96
|
+
#### `WpApiClient::Client`
|
97
|
+
|
98
|
+
Accepts a `WpApiClient::Connection` and exposes a `#get` method.
|
99
|
+
|
100
|
+
Pass a URL into `#get` and it will do its best to return usable data.
|
101
|
+
|
102
|
+
The second parameter accepts an optional hash of query params.
|
103
|
+
|
104
|
+
#### `WpApiClient::Connection`
|
105
|
+
|
106
|
+
Initialize with an API endpoint like `http://localhost:8080/wp-json/wp/v2`, then
|
107
|
+
pass into a new client. Faraday options might be pulled out of here in the future.
|
108
|
+
|
109
|
+
### Internal Objects
|
110
|
+
|
111
|
+
#### `WpApiClient::Collection`
|
112
|
+
|
113
|
+
Wraps a set of `WpApiClient::Entities` in an `Enumerable` interface and provides `next_page`
|
114
|
+
and `previous_page` methods. Pass these into `@api` and it will give you back the
|
115
|
+
data you want
|
116
|
+
|
117
|
+
```ruby
|
118
|
+
next_page = @api.get(posts.next_page)
|
119
|
+
# => #<WpApiClient::Collection:0x00bbcafe938827 @resources=[#<WpApiClient::Entities::Post...
|
120
|
+
```
|
121
|
+
|
122
|
+
#### `WpApiClient::Entities::BaseEntity`
|
123
|
+
|
124
|
+
Base class for `Post`, `Term` and `Taxonomy`, so far. Not all methods are implemented.
|
125
|
+
|
126
|
+
## Other
|
127
|
+
|
128
|
+
This library puts `?_embed` on every request to save on HTTP requests right now.
|
129
|
+
|
130
|
+
Thanks [WP-API](https://github.com/WP-API/WP-API)!
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "wp_api_client"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require "wp_api_client/version"
|
2
|
+
|
3
|
+
require "wp_api_client/entities/base_entity"
|
4
|
+
require "wp_api_client/entities/post"
|
5
|
+
require "wp_api_client/entities/taxonomy"
|
6
|
+
require "wp_api_client/entities/term"
|
7
|
+
|
8
|
+
require "wp_api_client/client"
|
9
|
+
require "wp_api_client/connection"
|
10
|
+
require "wp_api_client/collection"
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module WpApiClient
|
2
|
+
class Client
|
3
|
+
|
4
|
+
Types = [
|
5
|
+
WpApiClient::Entities::Post,
|
6
|
+
WpApiClient::Entities::Term,
|
7
|
+
WpApiClient::Entities::Taxonomy
|
8
|
+
]
|
9
|
+
|
10
|
+
def initialize(connection)
|
11
|
+
@connection = connection
|
12
|
+
end
|
13
|
+
|
14
|
+
def get(url, params = {})
|
15
|
+
response = @connection.get(api_path_from(url), params)
|
16
|
+
@headers = response.headers
|
17
|
+
|
18
|
+
native_representation_of response.body
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def api_path_from(url)
|
24
|
+
url.split('wp/v2/').last
|
25
|
+
end
|
26
|
+
|
27
|
+
# Take the API response and figure out what it is
|
28
|
+
def native_representation_of(response_body)
|
29
|
+
if response_body.is_a? Array
|
30
|
+
collection = true
|
31
|
+
object = response_body.first
|
32
|
+
else
|
33
|
+
collection = false
|
34
|
+
object = response_body
|
35
|
+
end
|
36
|
+
|
37
|
+
type = Types.find { |type| type.represents?(object) }
|
38
|
+
|
39
|
+
if collection
|
40
|
+
resources = response_body.map! { |object| type.new(object, self) }
|
41
|
+
WpApiClient::Collection.new(resources, @headers)
|
42
|
+
else
|
43
|
+
type.new(response_body, self)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module WpApiClient
|
2
|
+
class Collection
|
3
|
+
include Enumerable
|
4
|
+
|
5
|
+
attr_accessor :resources, :total_available
|
6
|
+
|
7
|
+
def initialize(resources, headers)
|
8
|
+
@resources = resources
|
9
|
+
@links = parse_link_header(headers['Link'])
|
10
|
+
@total_available = headers['X-WP-TOTAL'].to_i
|
11
|
+
end
|
12
|
+
|
13
|
+
def each(&block)
|
14
|
+
@resources.each{|p| block.call(p)}
|
15
|
+
end
|
16
|
+
|
17
|
+
def next_page
|
18
|
+
@links[:next] && @links[:next]
|
19
|
+
end
|
20
|
+
|
21
|
+
def previous_page
|
22
|
+
@links[:prev] && @links[:prev]
|
23
|
+
end
|
24
|
+
|
25
|
+
def method_missing(sym)
|
26
|
+
@resources.send(sym)
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
# https://www.snip2code.com/Snippet/71914/Parse-link-headers-from-Github-API-in-Ru
|
32
|
+
def parse_link_header(header, params={})
|
33
|
+
links = Hash.new
|
34
|
+
return links unless header
|
35
|
+
parts = header.split(',')
|
36
|
+
parts.each do |part, index|
|
37
|
+
section = part.split(';')
|
38
|
+
url = section[0][/<(.*)>/,1]
|
39
|
+
name = section[1][/rel="(.*)"/,1].to_sym
|
40
|
+
links[name] = url
|
41
|
+
end
|
42
|
+
return links
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'faraday_middleware'
|
3
|
+
|
4
|
+
module WpApiClient
|
5
|
+
class Connection
|
6
|
+
|
7
|
+
attr_accessor :headers
|
8
|
+
|
9
|
+
def initialize(endpoint)
|
10
|
+
@conn = Faraday.new(:url => endpoint) do |faraday|
|
11
|
+
faraday.request :url_encoded # form-encode POST params
|
12
|
+
#faraday.response :logger # log requests to STDOUT
|
13
|
+
faraday.response :json, :content_type => /\bjson$/
|
14
|
+
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# translate requests into wp-api urls
|
19
|
+
def get(url, params = {})
|
20
|
+
@conn.get url, params.merge({_embed: true})
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module WpApiClient
|
2
|
+
module Entities
|
3
|
+
class BaseEntity
|
4
|
+
attr_reader :resource
|
5
|
+
|
6
|
+
def initialize(resource, api)
|
7
|
+
unless resource.is_a? Hash
|
8
|
+
raise ArgumentError.new('Tried to initialize a WP-API resource with something other than a Hash')
|
9
|
+
end
|
10
|
+
@resource = resource
|
11
|
+
@api = api
|
12
|
+
end
|
13
|
+
|
14
|
+
def links
|
15
|
+
resource["_links"]
|
16
|
+
end
|
17
|
+
|
18
|
+
def embedded
|
19
|
+
resource["_embedded"]
|
20
|
+
end
|
21
|
+
|
22
|
+
alias :embedded? :embedded
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module WpApiClient
|
2
|
+
module Entities
|
3
|
+
class Post < BaseEntity
|
4
|
+
alias :post :resource
|
5
|
+
|
6
|
+
def self.represents?(json)
|
7
|
+
json.dig("_links", "about") and json["_links"]["about"].first["href"] =~ /wp\/v2\/types/
|
8
|
+
end
|
9
|
+
|
10
|
+
def title
|
11
|
+
post["title"]["rendered"]
|
12
|
+
end
|
13
|
+
|
14
|
+
def date
|
15
|
+
Time.new(post["date_gmt"])
|
16
|
+
end
|
17
|
+
|
18
|
+
def content
|
19
|
+
post["content"]["rendered"]
|
20
|
+
end
|
21
|
+
|
22
|
+
def id
|
23
|
+
post["id"]
|
24
|
+
end
|
25
|
+
|
26
|
+
def terms
|
27
|
+
if embedded?
|
28
|
+
terms = []
|
29
|
+
embedded["https://api.w.org/term"].map do |taxonomy|
|
30
|
+
taxonomy.each do |term|
|
31
|
+
terms << WpApiClient::Entities::Term.new(term, @api)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
terms
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module WpApiClient
|
2
|
+
module Entities
|
3
|
+
class Taxonomy < BaseEntity
|
4
|
+
alias :taxonomy :resource
|
5
|
+
|
6
|
+
def self.represents?(json)
|
7
|
+
!json.dig("hierarchical").nil?
|
8
|
+
end
|
9
|
+
|
10
|
+
def name
|
11
|
+
taxonomy["name"]
|
12
|
+
end
|
13
|
+
|
14
|
+
def terms
|
15
|
+
@api.get(links["https://api.w.org/items"].first["href"])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module WpApiClient
|
2
|
+
module Entities
|
3
|
+
class Term < BaseEntity
|
4
|
+
alias :term :resource
|
5
|
+
|
6
|
+
def self.represents?(json)
|
7
|
+
json.dig("_links", "about") and json["_links"]["about"].first["href"] =~ /wp\/v2\/taxonomies/
|
8
|
+
end
|
9
|
+
|
10
|
+
def taxonomy
|
11
|
+
@api.get(links["about"].first["href"])
|
12
|
+
end
|
13
|
+
|
14
|
+
def posts(post_type = "post")
|
15
|
+
post_type_links = links["http://api.w.org/v2/post_type"]
|
16
|
+
link = post_type_links.find { |link| link["href"] =~ /wp\/v2\/#{post_type}/ }
|
17
|
+
@api.get(link["href"]) if link
|
18
|
+
end
|
19
|
+
|
20
|
+
def name
|
21
|
+
term["name"]
|
22
|
+
end
|
23
|
+
|
24
|
+
def slug
|
25
|
+
term["slug"]
|
26
|
+
end
|
27
|
+
|
28
|
+
def id
|
29
|
+
term["id"]
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'wp_api_client/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "wp-api-client"
|
8
|
+
spec.version = WpApiClient::VERSION
|
9
|
+
spec.authors = ["Duncan Brown"]
|
10
|
+
spec.email = ["duncanjbrown@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{A read-only client for the WordPress REST API (v2).}
|
13
|
+
spec.homepage = "https://github.com/duncanjbrown/wp-api-client"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
17
|
+
# delete this section to allow pushing this gem to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
20
|
+
else
|
21
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
22
|
+
end
|
23
|
+
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.required_ruby_version = '~> 2.3'
|
30
|
+
|
31
|
+
spec.add_dependency "faraday", "~> 0.9"
|
32
|
+
spec.add_dependency "faraday_middleware", "~> 0.10"
|
33
|
+
|
34
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
35
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
36
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
37
|
+
spec.add_development_dependency "vcr", "~> 3"
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: wp-api-client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Duncan Brown
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.9'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday_middleware
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.10'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.10'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.11'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.11'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: vcr
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3'
|
97
|
+
description:
|
98
|
+
email:
|
99
|
+
- duncanjbrown@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".travis.yml"
|
107
|
+
- CODE_OF_CONDUCT.md
|
108
|
+
- LICENSE.txt
|
109
|
+
- README.md
|
110
|
+
- Rakefile
|
111
|
+
- bin/console
|
112
|
+
- bin/setup
|
113
|
+
- lib/wp_api_client.rb
|
114
|
+
- lib/wp_api_client/client.rb
|
115
|
+
- lib/wp_api_client/collection.rb
|
116
|
+
- lib/wp_api_client/connection.rb
|
117
|
+
- lib/wp_api_client/entities/base_entity.rb
|
118
|
+
- lib/wp_api_client/entities/post.rb
|
119
|
+
- lib/wp_api_client/entities/taxonomy.rb
|
120
|
+
- lib/wp_api_client/entities/term.rb
|
121
|
+
- lib/wp_api_client/version.rb
|
122
|
+
- wp_api_client.gemspec
|
123
|
+
homepage: https://github.com/duncanjbrown/wp-api-client
|
124
|
+
licenses:
|
125
|
+
- MIT
|
126
|
+
metadata:
|
127
|
+
allowed_push_host: https://rubygems.org
|
128
|
+
post_install_message:
|
129
|
+
rdoc_options: []
|
130
|
+
require_paths:
|
131
|
+
- lib
|
132
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - "~>"
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '2.3'
|
137
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
requirements: []
|
143
|
+
rubyforge_project:
|
144
|
+
rubygems_version: 2.5.1
|
145
|
+
signing_key:
|
146
|
+
specification_version: 4
|
147
|
+
summary: A read-only client for the WordPress REST API (v2).
|
148
|
+
test_files: []
|