Sha256: 2e6c8765e2939e6ceb8a0b315c9a08828fae0dd16671454e48e1f6c2dd340f63

Contents?: true

Size: 727 Bytes

Versions: 2

Compression:

Stored size: 727 Bytes

Contents

# frozen_string_literal: true

require 'date'
require 'schema_dot_org'

# Model the Schema.org `Thing > Place`.  See https://schema.org/Offer
#
module SchemaDotOrg
  class Offer < SchemaType
    attr_accessor :priceCurrency,
                  :price,
                  :availability,
                  :url

    validates :priceCurrency,       type: String
    validates :price,               type: Numeric
    validates :availability,        type: String, allow_nil: true
    validates :url,                 type: String, allow_nil: true

    def _to_json_struct
      {
        "price" => price,
        "priceCurrency" => priceCurrency,
        "availability" => availability,
        "url" => url
      }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
schema_dot_org-2.1 lib/schema_dot_org/offer.rb
schema_dot_org-2.0 lib/schema_dot_org/offer.rb