class STAC::Asset

Represents STAC asset object, which contains a link to data associated with an Item or Collection that can be downloaded or streamed.

Attributes

description[RW]
href[RW]
roles[RW]
title[RW]
type[RW]

Public Class Methods

from_hash(hash) click to toggle source

Deserializes an Asset from a Hash.

# File lib/stac/asset.rb, line 15
def from_hash(hash)
  new(**hash.transform_keys(&:to_sym))
end
new(href:, title: nil, description: nil, type: nil, roles: nil, **extra) click to toggle source
# File lib/stac/asset.rb, line 22
def initialize(href:, title: nil, description: nil, type: nil, roles: nil, **extra)
  @href = href
  @title = title
  @description = description
  @type = type
  @roles = roles
  @extra = extra.transform_keys(&:to_s)
end

Public Instance Methods

to_h() click to toggle source

Serializes self to a Hash.

# File lib/stac/asset.rb, line 32
def to_h
  {
    'href' => href,
    'title' => title,
    'description' => description,
    'type' => type,
    'roles' => roles,
  }.merge(extra).compact
end