Class: ALD::API::Item

Inherits:
CollectionEntry show all
Defined in:
lib/ALD/item.rb

Overview

Public: An item (e.g. a library or app) uploaded to an ALD server.

Instance Method Summary collapse

Methods inherited from CollectionEntry

define_attributes!, #initialized?

Constructor Details

#initialize(api, data, initialized = false) ⇒ Item

Internal: Create a new instance for given data. This method should not called by library consumers. Instead access entries via API#item or ItemCollection#[].

api - the ALD::API instance this item belongs to data - a Hash containing data concerning the item:

id      - the GUID of the item
name    - the name of the item
version - the semver version of the item
The above fields are mandatory. However, the hash may
contain a lot more data about the item.

initialized - a Boolean indicating if data only contains the mandatory

fields or *all* data on the item.

Raises:

  • (ArgumentError)


141
142
143
144
# File 'lib/ALD/item.rb', line 141

def initialize(api, data, initialized = false)
  raise ArgumentError unless Item.valid_data?(data)
  super(api, data, initialized)
end