class STAC::Properties

Represents STAC properties object, which is additional metadata for Item.

Specification: github.com/radiantearth/stac-spec/blob/master/item-spec/item-spec.md#properties-object

Attributes

datetime[RW]

Public Class Methods

from_hash(hash) click to toggle source

Deserializes a Properties from a Hash.

# File lib/stac/properties.rb, line 17
def from_hash(hash)
  h = hash.transform_keys(&:to_sym)
  h[:datetime] = h[:datetime] ? Time.iso8601(h[:datetime]) : nil
  new(**h)
end
new(datetime:, **extra) click to toggle source
# File lib/stac/properties.rb, line 26
def initialize(datetime:, **extra)
  @datetime = datetime
  @extra = extra.transform_keys(&:to_s)
end

Public Instance Methods

to_h() click to toggle source

Serializes self to a Hash.

# File lib/stac/properties.rb, line 32
def to_h
  {
    'datetime' => datetime&.iso8601,
  }.merge(extra)
end