Class: WpApiClient::Entities::Image

Inherits:
Base
  • Object
show all
Defined in:
lib/wp_api_client/entities/image.rb

Instance Attribute Summary

Attributes inherited from Base

#resource

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

Returns:

  • (Boolean)


6
7
8
# File 'lib/wp_api_client/entities/image.rb', line 6

def self.represents?(json)
  json["media_type"] and json["media_type"] == 'image'
end

Instance Method Details

#sizes(size = :full) ⇒ Object



10
11
12
# File 'lib/wp_api_client/entities/image.rb', line 10

def sizes(size = :full)
  image.dig("media_details", "sizes", size.to_s, "source_url")
end