Class: WP::API::Client
- Inherits:
-
Object
- Object
- WP::API::Client
- Includes:
- HTTParty, Endpoints
- Defined in:
- lib/wp/api/client.rb
Constant Summary collapse
- DIRECT_PARAMS =
%w(type context filter)
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
Instance Method Summary collapse
-
#initialize(host:, scheme: 'http', user: nil, password: nil) ⇒ Client
constructor
A new instance of Client.
- #inspect ⇒ Object
Methods included from Endpoints
#page, #page_named, #pages, #post, #post_meta, #post_named, #posts
Constructor Details
#initialize(host:, scheme: 'http', user: nil, password: nil) ⇒ Client
Returns a new instance of Client.
15 16 17 18 19 20 21 22 |
# File 'lib/wp/api/client.rb', line 15 def initialize(host:, scheme: 'http', user: nil, password: nil) @scheme = scheme @host = host @user = user @password = password fail ':host is required' unless host.is_a?(String) && host.length > 0 end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
11 12 13 |
# File 'lib/wp/api/client.rb', line 11 def host @host end |
Instance Method Details
#inspect ⇒ Object
24 25 26 |
# File 'lib/wp/api/client.rb', line 24 def inspect to_s.sub(/>$/, '') + " @scheme=\"#{@scheme}\" @host=\"#{@host}\" @user=\"#{@user}\" @password=#{@password.present?}>" end |