Class: AdoptAPet::Pet::Photo

Inherits:
Object
  • Object
show all
Defined in:
lib/adopt_a_pet/pet.rb

Overview

Class for Adopt-A-Pet Pet Photos

Author:

  • Stephen Dolan

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(height, width, url) ⇒ Pet::Photo

Create a single instance of a Pet Photo

Examples:

Create a new Photo

my_photo = Pet::Photo.new(100, 100, 'images.com/my_image')
height = my_photo.height

Parameters:

  • height (Integer)

    the height of the photo

  • width (Integer)

    the width of the Photo

  • url (String)

    a URL where you can view the photo

Author:

  • Stephen Dolan



263
264
265
266
267
# File 'lib/adopt_a_pet/pet.rb', line 263

def initialize(height, width, url)
  self.height  = height
  self.width   = width
  self.url     = url
end

Instance Attribute Details

#heightInteger

Returns the height of the Photo.

Returns:

  • (Integer)

    the height of the Photo



248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/adopt_a_pet/pet.rb', line 248

class Photo
  attr_accessor :height, :width, :url

  # Create a single instance of a Pet Photo
  # @author Stephen Dolan
  #
  # @param [Integer] height the height of the photo
  # @param [Integer] width the width of the Photo
  # @param [String] url a URL where you can view the photo
  #
  # @return [Pet::Photo] a new Pet Photo
  #
  # @example Create a new Photo
  #   my_photo = Pet::Photo.new(100, 100, 'images.com/my_image')
  #   height = my_photo.height
  def initialize(height, width, url)
    self.height  = height
    self.width   = width
    self.url     = url
  end
end

#urlString

Returns a URL where you can view the Photo.

Returns:

  • (String)

    a URL where you can view the Photo



248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/adopt_a_pet/pet.rb', line 248

class Photo
  attr_accessor :height, :width, :url

  # Create a single instance of a Pet Photo
  # @author Stephen Dolan
  #
  # @param [Integer] height the height of the photo
  # @param [Integer] width the width of the Photo
  # @param [String] url a URL where you can view the photo
  #
  # @return [Pet::Photo] a new Pet Photo
  #
  # @example Create a new Photo
  #   my_photo = Pet::Photo.new(100, 100, 'images.com/my_image')
  #   height = my_photo.height
  def initialize(height, width, url)
    self.height  = height
    self.width   = width
    self.url     = url
  end
end

#widthInteger

Returns the width of the Photo.

Returns:

  • (Integer)

    the width of the Photo



248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/adopt_a_pet/pet.rb', line 248

class Photo
  attr_accessor :height, :width, :url

  # Create a single instance of a Pet Photo
  # @author Stephen Dolan
  #
  # @param [Integer] height the height of the photo
  # @param [Integer] width the width of the Photo
  # @param [String] url a URL where you can view the photo
  #
  # @return [Pet::Photo] a new Pet Photo
  #
  # @example Create a new Photo
  #   my_photo = Pet::Photo.new(100, 100, 'images.com/my_image')
  #   height = my_photo.height
  def initialize(height, width, url)
    self.height  = height
    self.width   = width
    self.url     = url
  end
end