Class: WpApiClient::Entities::Term
- Defined in:
- lib/wp_api_client/entities/term.rb
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
build, #initialize, #links, #method_missing, #relations
Constructor Details
This class inherits a constructor from WpApiClient::Entities::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class WpApiClient::Entities::Base
Class Method Details
.represents?(json) ⇒ Boolean
6 7 8 |
# File 'lib/wp_api_client/entities/term.rb', line 6 def self.represents?(json) json.dig("_links", "about") and json["_links"]["about"].first["href"] =~ /wp\/v2\/taxonomies/ end |
Instance Method Details
#posts(post_type = nil) ⇒ Object
14 15 16 |
# File 'lib/wp_api_client/entities/term.rb', line 14 def posts(post_type = nil) relations("http://api.w.org/v2/post_type", post_type) end |
#taxonomy ⇒ Object
10 11 12 |
# File 'lib/wp_api_client/entities/term.rb', line 10 def taxonomy WpApiClient.get_client.get(links["about"].first["href"]) end |