Class: TrailerVote::MediaTypes::AudioFragment
- Defined in:
- lib/trailer_vote/media_types/audio_fragment.rb
Overview
Media Types for Audio Fragments
Audio Fragments are recognizable using FingerprintBinary. It might be an advertisement, a trailer or a sound bite. They belong to a Product. Audio fragments are used for recognition, e.g. showing an advertisement when it’s recognised, and used for feedback, i.e. a requirement to record and store Feedback.
Instance Method Summary collapse
-
#to_constructable ⇒ ::MediaTypes::Constructable
Returns the construtable media type.
-
#valid?(data, constructed_media_type, **opts) ⇒ TrueClass, FalseClass
Validates the
data
against the validation forconstructed_media_type
. -
#validate!(data, constructed_media_type, **opts) ⇒ TrueClass
Validates the
data
against the validation forconstructed_media_type
.
Methods inherited from BaseText
Instance Method Details
#to_constructable ⇒ ::MediaTypes::Constructable
Returns the construtable media type
25 |
# File 'lib/trailer_vote/media_types/audio_fragment.rb', line 25 use_name 'audio_fragment' |
#valid?(data, constructed_media_type, **opts) ⇒ TrueClass, FalseClass
Validates the data
against the validation for constructed_media_type
.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/trailer_vote/media_types/audio_fragment.rb', line 53 validations do version 1 do version_1_base = ::MediaTypes::Scheme.new do attribute :content_addressable, String attribute :expires_at, AllowNil(Types::Iso8601) link :self link :product link :feedback link :advert link :direct end attribute :audio_fragment do merge version_1_base end view 'index' do attribute :audio_fragments do collection :_index, allow_empty: true do attribute :href, Types::HttpUrl not_strict end not_strict end end view 'collection' do attribute :audio_fragments do collection :_embedded, version_1_base, allow_empty: true not_strict end end end end |
#validate!(data, constructed_media_type, **opts) ⇒ TrueClass
Validates the data
against the validation for constructed_media_type
. Raises if invalid
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/trailer_vote/media_types/audio_fragment.rb', line 53 validations do version 1 do version_1_base = ::MediaTypes::Scheme.new do attribute :content_addressable, String attribute :expires_at, AllowNil(Types::Iso8601) link :self link :product link :feedback link :advert link :direct end attribute :audio_fragment do merge version_1_base end view 'index' do attribute :audio_fragments do collection :_index, allow_empty: true do attribute :href, Types::HttpUrl not_strict end not_strict end end view 'collection' do attribute :audio_fragments do collection :_embedded, version_1_base, allow_empty: true not_strict end end end end |