class UltracartClient::LibraryItem

Attributes

assets[RW]
attributes[RW]
categories[RW]
content[RW]
content_type[RW]
description[RW]
industries[RW]
library_item_oid[RW]
merchant_id[RW]
my_purchased_version[RW]

If this is a public item and the merchant has already purchased it, this is their version. If not yet purchased, this will be zero. This value will only be populated during a searchPublicItems() call.

original_object_id[RW]

This id points to the original object that was added to the library. For flows and campaigns, this is a uuid string. For upsells, it is an oid integer. For transactional_emails, it is an email name.

price[RW]

The price of the published item. Null for any private library items.

price_formatted[RW]

The formatted price of the published item. Null for any private library items.

published[RW]

True if this library item is a published item (not source)

published_dts[RW]

The timestamp of the last published version

published_from_library_item_oid[RW]

The source item used to publish this item. This allows for comparisons between source and published

published_meta[RW]
published_version[RW]

The source version when this item was published. This allows for out-of-date alerts to be shown when there is a difference between source and published

purchased[RW]

True if this library item has been purchased

purchased_from_library_item_oid[RW]

The published item that was purchased to make this item. This allows for comparisons between published and purchased

purchased_meta[RW]
purchased_version[RW]

The published version when this item was purchased. This allows for out-of-date alerts to be shown when there is a difference between published and purchased

rejected[RW]

Any published library reviewed by UltraCart staff for malicious or inappropriate content will have this flag set to true. This is always false for non-published items

rejected_reason[RW]

Any rejected published item will have this field populated with the reason.

release_notes[RW]

Release notes specific to each published version and only appearing on public items.

release_version[RW]

This counter records how many times a library item has been published. This is used to show version history.

reviewed[RW]

Any published library items must be reviewed by UltraCart staff for malicious content. This flag shows the status of that review. This is always false for non-published items

reviewed_dts[RW]

This is the timestamp for a published items formal review by UltraCart staff for malicious content.

screenshots[RW]
share_with_accounts[RW]
share_with_other_emails[RW]
shared[RW]

True if this item is shared from another merchant account

source[RW]

True if this library item has been published

source_to_library_item_oid[RW]

This oid points to the published library item, if there is one.

source_version[RW]

The version of this item. Increment every time the item is saved.

style[RW]
times_purchased[RW]
title[RW]
type[RW]
under_review[RW]

True if this library item was published but is awaiting review from UltraCart staff.

Public Class Methods

attribute_map() click to toggle source

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

# File lib/ultracart_api/models/library_item.rb, line 120
def self.attribute_map
  {
    :'assets' => :'assets',
    :'attributes' => :'attributes',
    :'categories' => :'categories',
    :'content' => :'content',
    :'content_type' => :'content_type',
    :'description' => :'description',
    :'industries' => :'industries',
    :'library_item_oid' => :'library_item_oid',
    :'merchant_id' => :'merchant_id',
    :'my_purchased_version' => :'my_purchased_version',
    :'original_object_id' => :'original_object_id',
    :'price' => :'price',
    :'price_formatted' => :'price_formatted',
    :'published' => :'published',
    :'published_dts' => :'published_dts',
    :'published_from_library_item_oid' => :'published_from_library_item_oid',
    :'published_meta' => :'published_meta',
    :'published_version' => :'published_version',
    :'purchased' => :'purchased',
    :'purchased_from_library_item_oid' => :'purchased_from_library_item_oid',
    :'purchased_meta' => :'purchased_meta',
    :'purchased_version' => :'purchased_version',
    :'rejected' => :'rejected',
    :'rejected_reason' => :'rejected_reason',
    :'release_notes' => :'release_notes',
    :'release_version' => :'release_version',
    :'reviewed' => :'reviewed',
    :'reviewed_dts' => :'reviewed_dts',
    :'screenshots' => :'screenshots',
    :'share_with_accounts' => :'share_with_accounts',
    :'share_with_other_emails' => :'share_with_other_emails',
    :'shared' => :'shared',
    :'source' => :'source',
    :'source_to_library_item_oid' => :'source_to_library_item_oid',
    :'source_version' => :'source_version',
    :'style' => :'style',
    :'times_purchased' => :'times_purchased',
    :'title' => :'title',
    :'type' => :'type',
    :'under_review' => :'under_review'
  }
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# File lib/ultracart_api/models/library_item.rb, line 213
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 }

  if attributes.has_key?(:'assets')
    if (value = attributes[:'assets']).is_a?(Array)
      self.assets = value
    end
  end

  if attributes.has_key?(:'attributes')
    if (value = attributes[:'attributes']).is_a?(Array)
      self.attributes = value
    end
  end

  if attributes.has_key?(:'categories')
    if (value = attributes[:'categories']).is_a?(Array)
      self.categories = value
    end
  end

  if attributes.has_key?(:'content')
    self.content = attributes[:'content']
  end

  if attributes.has_key?(:'content_type')
    self.content_type = attributes[:'content_type']
  end

  if attributes.has_key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.has_key?(:'industries')
    if (value = attributes[:'industries']).is_a?(Array)
      self.industries = value
    end
  end

  if attributes.has_key?(:'library_item_oid')
    self.library_item_oid = attributes[:'library_item_oid']
  end

  if attributes.has_key?(:'merchant_id')
    self.merchant_id = attributes[:'merchant_id']
  end

  if attributes.has_key?(:'my_purchased_version')
    self.my_purchased_version = attributes[:'my_purchased_version']
  end

  if attributes.has_key?(:'original_object_id')
    self.original_object_id = attributes[:'original_object_id']
  end

  if attributes.has_key?(:'price')
    self.price = attributes[:'price']
  end

  if attributes.has_key?(:'price_formatted')
    self.price_formatted = attributes[:'price_formatted']
  end

  if attributes.has_key?(:'published')
    self.published = attributes[:'published']
  end

  if attributes.has_key?(:'published_dts')
    self.published_dts = attributes[:'published_dts']
  end

  if attributes.has_key?(:'published_from_library_item_oid')
    self.published_from_library_item_oid = attributes[:'published_from_library_item_oid']
  end

  if attributes.has_key?(:'published_meta')
    self.published_meta = attributes[:'published_meta']
  end

  if attributes.has_key?(:'published_version')
    self.published_version = attributes[:'published_version']
  end

  if attributes.has_key?(:'purchased')
    self.purchased = attributes[:'purchased']
  end

  if attributes.has_key?(:'purchased_from_library_item_oid')
    self.purchased_from_library_item_oid = attributes[:'purchased_from_library_item_oid']
  end

  if attributes.has_key?(:'purchased_meta')
    self.purchased_meta = attributes[:'purchased_meta']
  end

  if attributes.has_key?(:'purchased_version')
    self.purchased_version = attributes[:'purchased_version']
  end

  if attributes.has_key?(:'rejected')
    self.rejected = attributes[:'rejected']
  end

  if attributes.has_key?(:'rejected_reason')
    self.rejected_reason = attributes[:'rejected_reason']
  end

  if attributes.has_key?(:'release_notes')
    self.release_notes = attributes[:'release_notes']
  end

  if attributes.has_key?(:'release_version')
    self.release_version = attributes[:'release_version']
  end

  if attributes.has_key?(:'reviewed')
    self.reviewed = attributes[:'reviewed']
  end

  if attributes.has_key?(:'reviewed_dts')
    self.reviewed_dts = attributes[:'reviewed_dts']
  end

  if attributes.has_key?(:'screenshots')
    if (value = attributes[:'screenshots']).is_a?(Array)
      self.screenshots = value
    end
  end

  if attributes.has_key?(:'share_with_accounts')
    if (value = attributes[:'share_with_accounts']).is_a?(Array)
      self.share_with_accounts = value
    end
  end

  if attributes.has_key?(:'share_with_other_emails')
    if (value = attributes[:'share_with_other_emails']).is_a?(Array)
      self.share_with_other_emails = value
    end
  end

  if attributes.has_key?(:'shared')
    self.shared = attributes[:'shared']
  end

  if attributes.has_key?(:'source')
    self.source = attributes[:'source']
  end

  if attributes.has_key?(:'source_to_library_item_oid')
    self.source_to_library_item_oid = attributes[:'source_to_library_item_oid']
  end

  if attributes.has_key?(:'source_version')
    self.source_version = attributes[:'source_version']
  end

  if attributes.has_key?(:'style')
    self.style = attributes[:'style']
  end

  if attributes.has_key?(:'times_purchased')
    self.times_purchased = attributes[:'times_purchased']
  end

  if attributes.has_key?(:'title')
    self.title = attributes[:'title']
  end

  if attributes.has_key?(:'type')
    self.type = attributes[:'type']
  end

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

Attribute type mapping.

# File lib/ultracart_api/models/library_item.rb, line 166
def self.swagger_types
  {
    :'assets' => :'Array<LibraryItemAsset>',
    :'attributes' => :'Array<LibraryItemAttribute>',
    :'categories' => :'Array<String>',
    :'content' => :'String',
    :'content_type' => :'String',
    :'description' => :'String',
    :'industries' => :'Array<String>',
    :'library_item_oid' => :'Integer',
    :'merchant_id' => :'String',
    :'my_purchased_version' => :'Integer',
    :'original_object_id' => :'String',
    :'price' => :'Float',
    :'price_formatted' => :'String',
    :'published' => :'BOOLEAN',
    :'published_dts' => :'Object',
    :'published_from_library_item_oid' => :'Integer',
    :'published_meta' => :'LibraryItemPublishedMeta',
    :'published_version' => :'Integer',
    :'purchased' => :'BOOLEAN',
    :'purchased_from_library_item_oid' => :'Integer',
    :'purchased_meta' => :'LibraryItemPurchasedMeta',
    :'purchased_version' => :'Integer',
    :'rejected' => :'BOOLEAN',
    :'rejected_reason' => :'String',
    :'release_notes' => :'String',
    :'release_version' => :'Integer',
    :'reviewed' => :'BOOLEAN',
    :'reviewed_dts' => :'Object',
    :'screenshots' => :'Array<LibraryItemScreenshot>',
    :'share_with_accounts' => :'Array<LibraryItemAccount>',
    :'share_with_other_emails' => :'Array<LibraryItemEmail>',
    :'shared' => :'BOOLEAN',
    :'source' => :'BOOLEAN',
    :'source_to_library_item_oid' => :'Integer',
    :'source_version' => :'Integer',
    :'style' => :'String',
    :'times_purchased' => :'Integer',
    :'title' => :'String',
    :'type' => :'String',
    :'under_review' => :'BOOLEAN'
  }
end

Public Instance Methods

==(o) click to toggle source

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

# File lib/ultracart_api/models/library_item.rb, line 409
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      assets == o.assets &&
      attributes == o.attributes &&
      categories == o.categories &&
      content == o.content &&
      content_type == o.content_type &&
      description == o.description &&
      industries == o.industries &&
      library_item_oid == o.library_item_oid &&
      merchant_id == o.merchant_id &&
      my_purchased_version == o.my_purchased_version &&
      original_object_id == o.original_object_id &&
      price == o.price &&
      price_formatted == o.price_formatted &&
      published == o.published &&
      published_dts == o.published_dts &&
      published_from_library_item_oid == o.published_from_library_item_oid &&
      published_meta == o.published_meta &&
      published_version == o.published_version &&
      purchased == o.purchased &&
      purchased_from_library_item_oid == o.purchased_from_library_item_oid &&
      purchased_meta == o.purchased_meta &&
      purchased_version == o.purchased_version &&
      rejected == o.rejected &&
      rejected_reason == o.rejected_reason &&
      release_notes == o.release_notes &&
      release_version == o.release_version &&
      reviewed == o.reviewed &&
      reviewed_dts == o.reviewed_dts &&
      screenshots == o.screenshots &&
      share_with_accounts == o.share_with_accounts &&
      share_with_other_emails == o.share_with_other_emails &&
      shared == o.shared &&
      source == o.source &&
      source_to_library_item_oid == o.source_to_library_item_oid &&
      source_version == o.source_version &&
      style == o.style &&
      times_purchased == o.times_purchased &&
      title == o.title &&
      type == o.type &&
      under_review == o.under_review
end
_deserialize(type, value) click to toggle source

Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data

# File lib/ultracart_api/models/library_item.rb, line 490
def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = UltracartClient.const_get(type).new
    temp_model.build_from_hash(value)
  end
end
_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/ultracart_api/models/library_item.rb, line 556
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
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/ultracart_api/models/library_item.rb, line 469
def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(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?(o) click to toggle source

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

# File lib/ultracart_api/models/library_item.rb, line 456
def eql?(o)
  self == o
end
hash() click to toggle source

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

# File lib/ultracart_api/models/library_item.rb, line 462
def hash
  [assets, attributes, categories, content, content_type, description, industries, library_item_oid, merchant_id, my_purchased_version, original_object_id, price, price_formatted, published, published_dts, published_from_library_item_oid, published_meta, published_version, purchased, purchased_from_library_item_oid, purchased_meta, purchased_version, rejected, rejected_reason, release_notes, release_version, reviewed, reviewed_dts, screenshots, share_with_accounts, share_with_other_emails, shared, source, source_to_library_item_oid, source_version, style, times_purchased, title, type, under_review].hash
end
list_invalid_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons

# File lib/ultracart_api/models/library_item.rb, line 396
def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end
to_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/ultracart_api/models/library_item.rb, line 536
def to_body
  to_hash
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/ultracart_api/models/library_item.rb, line 542
def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    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/ultracart_api/models/library_item.rb, line 530
def to_s
  to_hash.to_s
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# File lib/ultracart_api/models/library_item.rb, line 403
def valid?
  true
end