Module: WordpressClient

Defined in:
lib/wordpress_client.rb,
lib/wordpress_client/tag.rb,
lib/wordpress_client/post.rb,
lib/wordpress_client/term.rb,
lib/wordpress_client/media.rb,
lib/wordpress_client/client.rb,
lib/wordpress_client/errors.rb,
lib/wordpress_client/version.rb,
lib/wordpress_client/category.rb,
lib/wordpress_client/connection.rb,
lib/wordpress_client/post_parser.rb,
lib/wordpress_client/rest_parser.rb,
lib/wordpress_client/media_parser.rb,
lib/wordpress_client/paginated_collection.rb

Defined Under Namespace

Classes: Category, Client, Error, Media, NotFoundError, PaginatedCollection, Post, ServerError, Tag, Term, TimeoutError, UnauthorizedError, ValidationError

Constant Summary collapse

VERSION =
Note:

This only applies if using a released version. A development build would not correspond to this constant.

Current version of the gem.

"2.0.1".freeze

Class Method Summary collapse

Class Method Details

.new(url:, username:, password:) ⇒ Client

Initialize a new client using the provided connection details. You need to provide authentication details, and the user must have edit permissions on the blog if you want to read Post Meta, or to modify anything.

Examples:

client = WordpressClient.new(
  url: "https://blog.example.com/wp-json",
  username: "bot",
  password: ENV.fetch("WORDPRESS_PASSWORD"),
)

Parameters:

  • url (String)

    The base URL to the wordpress install, including /wp-json.

  • username (String)

    A valid username on the wordpress installation.

  • password (String)

    The password for the provided user.

Returns:

See Also:



38
39
40
# File 'lib/wordpress_client.rb', line 38

def self.new(url:, username:, password:)
  Client.new(Connection.new(url: url, username: username, password: password))
end