Class: WpApiClient::Entities::BaseEntity
- Inherits:
-
Object
- Object
- WpApiClient::Entities::BaseEntity
- Defined in:
- lib/wp_api_client/entities/base_entity.rb
Instance Attribute Summary collapse
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Instance Method Summary collapse
- #embedded ⇒ Object (also: #embedded?)
-
#initialize(resource, api) ⇒ BaseEntity
constructor
A new instance of BaseEntity.
- #links ⇒ Object
Constructor Details
#initialize(resource, api) ⇒ BaseEntity
6 7 8 9 10 11 12 |
# File 'lib/wp_api_client/entities/base_entity.rb', line 6 def initialize(resource, api) unless resource.is_a? Hash raise ArgumentError.new('Tried to initialize a WP-API resource with something other than a Hash') end @resource = resource @api = api end |
Instance Attribute Details
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
4 5 6 |
# File 'lib/wp_api_client/entities/base_entity.rb', line 4 def resource @resource end |
Instance Method Details
#embedded ⇒ Object Also known as: embedded?
18 19 20 |
# File 'lib/wp_api_client/entities/base_entity.rb', line 18 def resource["_embedded"] end |
#links ⇒ Object
14 15 16 |
# File 'lib/wp_api_client/entities/base_entity.rb', line 14 def links resource["_links"] end |