class OCI::Marketplace::Models::ListingSummary

The model for a summary of an Oracle Cloud Infrastructure Marketplace listing.

Constants

LISTING_TYPE_ENUM
PACKAGE_TYPE_ENUM
PRICING_TYPES_ENUM

Attributes

categories[RW]

Product categories that the listing belongs to. @return [Array<String>]

icon[RW]

@return [OCI::Marketplace::Models::UploadData]

id[RW]

The unique identifier for the listing in Marketplace. @return [String]

listing_type[R]

The publisher category to which the listing belongs. The publisher category informs where the listing appears for use. @return [String]

name[RW]

The name of the listing. @return [String]

package_type[R]

The listing's package type. @return [String]

pricing_types[R]

Summary of the pricing types available across all packages in the listing. @return [Array<String>]

publisher[RW]

@return [OCI::Marketplace::Models::PublisherSummary]

regions[RW]

The regions where you can deploy the listing. (Some listings have restrictions that limit their deployment to United States regions only.)

@return [Array<OCI::Marketplace::Models::Region>]

short_description[RW]

A short description of the listing. @return [String]

supported_operating_systems[RW]

The list of operating systems supported by the listing. @return [Array<OCI::Marketplace::Models::OperatingSystem>]

tagline[RW]

The tagline of the listing. @return [String]

Public Class Methods

attribute_map() click to toggle source

Attribute mapping from ruby-style variable name to JSON key.

# File lib/oci/marketplace/models/listing_summary.rb, line 83
def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'name': :'name',
    'short_description': :'shortDescription',
    'tagline': :'tagline',
    'icon': :'icon',
    'package_type': :'packageType',
    'pricing_types': :'pricingTypes',
    'regions': :'regions',
    'is_featured': :'isFeatured',
    'categories': :'categories',
    'publisher': :'publisher',
    'supported_operating_systems': :'supportedOperatingSystems',
    'listing_type': :'listingType'
    # rubocop:enable Style/SymbolLiteral
  }
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash @option attributes [String] :id The value to assign to the {#id} property @option attributes [String] :name The value to assign to the {#name} property @option attributes [String] :short_description The value to assign to the {#short_description} property @option attributes [String] :tagline The value to assign to the {#tagline} property @option attributes [OCI::Marketplace::Models::UploadData] :icon The value to assign to the {#icon} property @option attributes [String] :package_type The value to assign to the {#package_type} property @option attributes [Array<String>] :pricing_types The value to assign to the {#pricing_types} property @option attributes [Array<OCI::Marketplace::Models::Region>] :regions The value to assign to the {#regions} property @option attributes [BOOLEAN] :is_featured The value to assign to the {#is_featured} property @option attributes [Array<String>] :categories The value to assign to the {#categories} property @option attributes [OCI::Marketplace::Models::PublisherSummary] :publisher The value to assign to the {#publisher} property @option attributes [Array<OCI::Marketplace::Models::OperatingSystem>] :supported_operating_systems The value to assign to the {#supported_operating_systems} property @option attributes [String] :listing_type The value to assign to the {#listing_type} property

# File lib/oci/marketplace/models/listing_summary.rb, line 143
def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.id = attributes[:'id'] if attributes[:'id']

  self.name = attributes[:'name'] if attributes[:'name']

  self.short_description = attributes[:'shortDescription'] if attributes[:'shortDescription']

  raise 'You cannot provide both :shortDescription and :short_description' if attributes.key?(:'shortDescription') && attributes.key?(:'short_description')

  self.short_description = attributes[:'short_description'] if attributes[:'short_description']

  self.tagline = attributes[:'tagline'] if attributes[:'tagline']

  self.icon = attributes[:'icon'] if attributes[:'icon']

  self.package_type = attributes[:'packageType'] if attributes[:'packageType']

  raise 'You cannot provide both :packageType and :package_type' if attributes.key?(:'packageType') && attributes.key?(:'package_type')

  self.package_type = attributes[:'package_type'] if attributes[:'package_type']

  self.pricing_types = attributes[:'pricingTypes'] if attributes[:'pricingTypes']

  raise 'You cannot provide both :pricingTypes and :pricing_types' if attributes.key?(:'pricingTypes') && attributes.key?(:'pricing_types')

  self.pricing_types = attributes[:'pricing_types'] if attributes[:'pricing_types']

  self.regions = attributes[:'regions'] if attributes[:'regions']

  self.is_featured = attributes[:'isFeatured'] unless attributes[:'isFeatured'].nil?

  raise 'You cannot provide both :isFeatured and :is_featured' if attributes.key?(:'isFeatured') && attributes.key?(:'is_featured')

  self.is_featured = attributes[:'is_featured'] unless attributes[:'is_featured'].nil?

  self.categories = attributes[:'categories'] if attributes[:'categories']

  self.publisher = attributes[:'publisher'] if attributes[:'publisher']

  self.supported_operating_systems = attributes[:'supportedOperatingSystems'] if attributes[:'supportedOperatingSystems']

  raise 'You cannot provide both :supportedOperatingSystems and :supported_operating_systems' if attributes.key?(:'supportedOperatingSystems') && attributes.key?(:'supported_operating_systems')

  self.supported_operating_systems = attributes[:'supported_operating_systems'] if attributes[:'supported_operating_systems']

  self.listing_type = attributes[:'listingType'] if attributes[:'listingType']

  raise 'You cannot provide both :listingType and :listing_type' if attributes.key?(:'listingType') && attributes.key?(:'listing_type')

  self.listing_type = attributes[:'listing_type'] if attributes[:'listing_type']
end
swagger_types() click to toggle source

Attribute type mapping.

# File lib/oci/marketplace/models/listing_summary.rb, line 104
def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'name': :'String',
    'short_description': :'String',
    'tagline': :'String',
    'icon': :'OCI::Marketplace::Models::UploadData',
    'package_type': :'String',
    'pricing_types': :'Array<String>',
    'regions': :'Array<OCI::Marketplace::Models::Region>',
    'is_featured': :'BOOLEAN',
    'categories': :'Array<String>',
    'publisher': :'OCI::Marketplace::Models::PublisherSummary',
    'supported_operating_systems': :'Array<OCI::Marketplace::Models::OperatingSystem>',
    'listing_type': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Public Instance Methods

==(other) click to toggle source

Checks equality by comparing each attribute. @param [Object] other the other object to be compared

# File lib/oci/marketplace/models/listing_summary.rb, line 253
def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    id == other.id &&
    name == other.name &&
    short_description == other.short_description &&
    tagline == other.tagline &&
    icon == other.icon &&
    package_type == other.package_type &&
    pricing_types == other.pricing_types &&
    regions == other.regions &&
    is_featured == other.is_featured &&
    categories == other.categories &&
    publisher == other.publisher &&
    supported_operating_systems == other.supported_operating_systems &&
    listing_type == other.listing_type
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/oci/marketplace/models/listing_summary.rb, line 295
def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end
eql?(other) click to toggle source

@see the `==` method @param [Object] other the other object to be compared

# File lib/oci/marketplace/models/listing_summary.rb, line 275
def eql?(other)
  self == other
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Fixnum] Hash code

# File lib/oci/marketplace/models/listing_summary.rb, line 284
def hash
  [id, name, short_description, tagline, icon, package_type, pricing_types, regions, is_featured, categories, publisher, supported_operating_systems, listing_type].hash
end
listing_type=(listing_type) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] listing_type Object to be assigned

# File lib/oci/marketplace/models/listing_summary.rb, line 237
def listing_type=(listing_type)
  # rubocop:disable Style/ConditionalAssignment
  if listing_type && !LISTING_TYPE_ENUM.include?(listing_type)
    OCI.logger.debug("Unknown value for 'listing_type' [" + listing_type + "]. Mapping to 'LISTING_TYPE_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @listing_type = LISTING_TYPE_UNKNOWN_ENUM_VALUE
  else
    @listing_type = listing_type
  end
  # rubocop:enable Style/ConditionalAssignment
end
package_type=(package_type) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] package_type Object to be assigned

# File lib/oci/marketplace/models/listing_summary.rb, line 204
def package_type=(package_type)
  # rubocop:disable Style/ConditionalAssignment
  if package_type && !PACKAGE_TYPE_ENUM.include?(package_type)
    OCI.logger.debug("Unknown value for 'package_type' [" + package_type + "]. Mapping to 'PACKAGE_TYPE_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @package_type = PACKAGE_TYPE_UNKNOWN_ENUM_VALUE
  else
    @package_type = package_type
  end
  # rubocop:enable Style/ConditionalAssignment
end
pricing_types=(pricing_types) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] pricing_types Object to be assigned

# File lib/oci/marketplace/models/listing_summary.rb, line 217
def pricing_types=(pricing_types)
  # rubocop:disable Style/ConditionalAssignment
  if pricing_types.nil?
    @pricing_types = nil
  else
    @pricing_types =
      pricing_types.collect do |item|
        if PRICING_TYPES_ENUM.include?(item)
          item
        else
          OCI.logger.debug("Unknown value for 'pricing_types' [#{item}]. Mapping to 'PRICING_TYPES_UNKNOWN_ENUM_VALUE'") if OCI.logger
          PRICING_TYPES_UNKNOWN_ENUM_VALUE
        end
      end
  end
  # rubocop:enable Style/ConditionalAssignment
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/oci/marketplace/models/listing_summary.rb, line 328
def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end
to_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/oci/marketplace/models/listing_summary.rb, line 322
def to_s
  to_hash.to_s
end

Private Instance Methods

_to_hash(value) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# File lib/oci/marketplace/models/listing_summary.rb, line 345
def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end