Class: Portage::Ucp::Media

Inherits:
Data
  • Object
show all
Defined in:
lib/portage/ucp/value_objects.rb

Overview

schemas/shopping/types/media.json

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, url:, alt_text: nil, width: nil, height: nil) ⇒ Media

Returns a new instance of Media.



42
# File 'lib/portage/ucp/value_objects.rb', line 42

def initialize(type:, url:, alt_text: nil, width: nil, height: nil) = super

Instance Attribute Details

#alt_textObject (readonly)

Returns the value of attribute alt_text

Returns:

  • (Object)

    the current value of alt_text



41
42
43
# File 'lib/portage/ucp/value_objects.rb', line 41

def alt_text
  @alt_text
end

#heightObject (readonly)

Returns the value of attribute height

Returns:

  • (Object)

    the current value of height



41
42
43
# File 'lib/portage/ucp/value_objects.rb', line 41

def height
  @height
end

#typeObject (readonly)

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



41
42
43
# File 'lib/portage/ucp/value_objects.rb', line 41

def type
  @type
end

#urlObject (readonly)

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url



41
42
43
# File 'lib/portage/ucp/value_objects.rb', line 41

def url
  @url
end

#widthObject (readonly)

Returns the value of attribute width

Returns:

  • (Object)

    the current value of width



41
42
43
# File 'lib/portage/ucp/value_objects.rb', line 41

def width
  @width
end

Instance Method Details

#to_wire_hObject



44
45
46
# File 'lib/portage/ucp/value_objects.rb', line 44

def to_wire_h
  { "type" => type, "url" => url, "alt_text" => alt_text, "width" => width, "height" => height }.compact
end