class Pinterest::Image
A object representing a Pinterest
image.
Public Class Methods
new(data)
click to toggle source
Creates a new image object.
@param data [Hash] The data of the new object. @return [Pinterest::Board] The new board object.
# File lib/pinterest/models/image.rb, line 13 def initialize(data) @data = data end
Public Instance Methods
as_json(_ = {})
click to toggle source
Serialize the object as a Hash that can be serialized as JSON.
@param _ [Hash] The options to use to serialize. @return [Hash] The serialized object.
# File lib/pinterest/models/image.rb, line 45 def as_json(_ = {}) @data end
size(version)
click to toggle source
Returns the size of a version of the image.
@param version [String] The version to inspect. @return [Hash] A hash with the `:width` and `:height` keys.
# File lib/pinterest/models/image.rb, line 28 def size(version) data = @data.fetch(version.to_s) {width: data["width"], height: data["height"]} end
url(version)
click to toggle source
Returns the URL of a version of the image.
@param version [String] The version to inspect. @return [String] The version URL.
# File lib/pinterest/models/image.rb, line 37 def url(version) @data.fetch(version.to_s)["url"] end
versions()
click to toggle source
Returns the possible versions of a image.
@return [Array] A list of possible version of a image.
# File lib/pinterest/models/image.rb, line 20 def versions @data.keys end