trailer_vote-media_types 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rubocop.yml +29 -0
- data/.travis.yml +20 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +48 -0
- data/README.md +105 -0
- data/Rakefile +12 -0
- data/bin/console +16 -0
- data/bin/setup +8 -0
- data/lib/trailer_vote/media_types.rb +32 -0
- data/lib/trailer_vote/media_types/audio_fragment.rb +106 -0
- data/lib/trailer_vote/media_types/base_text.rb +22 -0
- data/lib/trailer_vote/media_types/carousel.rb +42 -0
- data/lib/trailer_vote/media_types/client_configuration.rb +34 -0
- data/lib/trailer_vote/media_types/configuration.rb +54 -0
- data/lib/trailer_vote/media_types/errors.rb +31 -0
- data/lib/trailer_vote/media_types/feedback.rb +49 -0
- data/lib/trailer_vote/media_types/feedback_listing.rb +48 -0
- data/lib/trailer_vote/media_types/fingerprint_binary.rb +67 -0
- data/lib/trailer_vote/media_types/interactive_player.rb +33 -0
- data/lib/trailer_vote/media_types/partials/image_links.rb +20 -0
- data/lib/trailer_vote/media_types/persona.rb +38 -0
- data/lib/trailer_vote/media_types/place.rb +105 -0
- data/lib/trailer_vote/media_types/product.rb +175 -0
- data/lib/trailer_vote/media_types/product_image.rb +113 -0
- data/lib/trailer_vote/media_types/product_lookup.rb +37 -0
- data/lib/trailer_vote/media_types/product_place_link.rb +37 -0
- data/lib/trailer_vote/media_types/product_video.rb +92 -0
- data/lib/trailer_vote/media_types/products_listing.rb +42 -0
- data/lib/trailer_vote/media_types/sentiment_feedback.rb +97 -0
- data/lib/trailer_vote/media_types/types/boolean.rb +15 -0
- data/lib/trailer_vote/media_types/types/product_data_type.rb +15 -0
- data/lib/trailer_vote/media_types/types/product_image_type.rb +25 -0
- data/lib/trailer_vote/media_types/types/product_movie_handler.rb +15 -0
- data/lib/trailer_vote/media_types/types/product_movie_type.rb +17 -0
- data/lib/trailer_vote/media_types/types/uuid_v4.rb +10 -0
- data/lib/trailer_vote/media_types/types/vote_value.rb +17 -0
- data/lib/trailer_vote/media_types/version.rb +7 -0
- data/trailer_vote-media_types.gemspec +32 -0
- metadata +209 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative './base_text'
|
|
4
|
+
require_relative './types/product_data_type'
|
|
5
|
+
|
|
6
|
+
module TrailerVote
|
|
7
|
+
module MediaTypes
|
|
8
|
+
|
|
9
|
+
##
|
|
10
|
+
# Media Types for Products
|
|
11
|
+
#
|
|
12
|
+
# Products are all things that are the subject of Audio Fragments (advertisements, trailers, sound bites). This can
|
|
13
|
+
# be a book; a movie; a car; a drink; anything that would be a product in the real world. Recognition is done on the
|
|
14
|
+
# audio fragments, not on products directly.
|
|
15
|
+
#
|
|
16
|
+
# A product has attachments, such as data, {ProductImage}, and recognizable {AudioFragment}.
|
|
17
|
+
#
|
|
18
|
+
class Product < BaseText
|
|
19
|
+
media_type 'product', defaults: { suffix: :json, version: 2 }
|
|
20
|
+
|
|
21
|
+
validations do
|
|
22
|
+
index_scheme = ::MediaTypes::Scheme.new do
|
|
23
|
+
attribute :products do
|
|
24
|
+
collection :_index, allow_empty: true do
|
|
25
|
+
attribute :href, String
|
|
26
|
+
not_strict
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
not_strict
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
version 2 do
|
|
34
|
+
version_2_creation = ::MediaTypes::Scheme.new do
|
|
35
|
+
attribute :name, String
|
|
36
|
+
attribute :description, AllowNil(String)
|
|
37
|
+
|
|
38
|
+
collection :product_identifiers do
|
|
39
|
+
attribute :authority, String
|
|
40
|
+
attribute :identifier, String
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
attribute :data do
|
|
44
|
+
any do
|
|
45
|
+
attribute :type, Types::ProductDataType
|
|
46
|
+
attribute :type_version, Numeric
|
|
47
|
+
|
|
48
|
+
attribute :translations do
|
|
49
|
+
any do
|
|
50
|
+
attribute :name, AllowNil(String)
|
|
51
|
+
attribute :description, AllowNil(String)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
not_strict
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
attribute :raw_data, optional: true do
|
|
60
|
+
# noinspection RubyBlockToMethodReference
|
|
61
|
+
not_strict
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
version_2_base = ::MediaTypes::Scheme.new do
|
|
66
|
+
attribute :updated_at, String
|
|
67
|
+
attribute :lock_version, Numeric
|
|
68
|
+
|
|
69
|
+
merge version_2_creation
|
|
70
|
+
|
|
71
|
+
link :self
|
|
72
|
+
link :images
|
|
73
|
+
link :videos
|
|
74
|
+
link :places
|
|
75
|
+
link :audio_fragments
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
attribute :product do
|
|
79
|
+
merge version_2_base
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
view 'create' do
|
|
83
|
+
attribute :product do
|
|
84
|
+
merge version_2_creation
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
view 'collection' do
|
|
89
|
+
attribute :products do
|
|
90
|
+
collection :_embedded, version_2_base
|
|
91
|
+
not_strict
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
view 'index' do
|
|
96
|
+
merge index_scheme
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
version 1 do
|
|
101
|
+
|
|
102
|
+
version_1_creation = ::MediaTypes::Scheme.new do
|
|
103
|
+
attribute :name, String
|
|
104
|
+
attribute :description, AllowNil(String)
|
|
105
|
+
|
|
106
|
+
collection :product_identifiers do
|
|
107
|
+
attribute :authority, String
|
|
108
|
+
attribute :identifier, String
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
attribute :data do
|
|
112
|
+
any do
|
|
113
|
+
attribute :type, Types::ProductDataType
|
|
114
|
+
attribute :type_version, Numeric
|
|
115
|
+
attribute :name, AllowNil(String)
|
|
116
|
+
attribute :description, AllowNil(String)
|
|
117
|
+
|
|
118
|
+
not_strict
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
attribute :raw_data, optional: true do
|
|
123
|
+
# noinspection RubyBlockToMethodReference
|
|
124
|
+
not_strict
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
version_1_base = ::MediaTypes::Scheme.new do
|
|
129
|
+
attribute :updated_at, String
|
|
130
|
+
attribute :lock_version, Numeric
|
|
131
|
+
|
|
132
|
+
merge version_1_creation
|
|
133
|
+
|
|
134
|
+
link :self
|
|
135
|
+
link :images
|
|
136
|
+
link :videos
|
|
137
|
+
link :places
|
|
138
|
+
link :audio_fragments
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
attribute :product do
|
|
142
|
+
merge version_1_base
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
view 'create' do
|
|
146
|
+
attribute :product do
|
|
147
|
+
merge version_1_creation
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
view 'collection' do
|
|
152
|
+
attribute :products do
|
|
153
|
+
collection :_embedded, version_1_base
|
|
154
|
+
not_strict
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
view 'index' do
|
|
159
|
+
merge index_scheme
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
registrations :product do
|
|
165
|
+
view 'index', :product_urls
|
|
166
|
+
view 'collection', :products
|
|
167
|
+
view 'create', :create_product
|
|
168
|
+
|
|
169
|
+
versions 1, 2
|
|
170
|
+
|
|
171
|
+
type_alias 'product.movie'
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
end
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'media_types'
|
|
4
|
+
|
|
5
|
+
require_relative './base_text'
|
|
6
|
+
require_relative './types/product_image_type'
|
|
7
|
+
require_relative './types/boolean'
|
|
8
|
+
|
|
9
|
+
module TrailerVote
|
|
10
|
+
module MediaTypes
|
|
11
|
+
class ProductImage < BaseText
|
|
12
|
+
media_type 'product.image', defaults: { suffix: :json, version: 1 }
|
|
13
|
+
|
|
14
|
+
validations do
|
|
15
|
+
version 1 do
|
|
16
|
+
version_1_creation = ::MediaTypes::Scheme.new do
|
|
17
|
+
attribute :identifier, String
|
|
18
|
+
attribute :source_url, String
|
|
19
|
+
attribute :deleted_at, AllowNil(String), optional: true
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
version_1_base = ::MediaTypes::Scheme.new do
|
|
23
|
+
attribute :updated_at, String
|
|
24
|
+
|
|
25
|
+
merge version_1_creation
|
|
26
|
+
|
|
27
|
+
attribute :data do
|
|
28
|
+
attribute :processed, Types::Boolean
|
|
29
|
+
attribute :type, Types::ProductImageType
|
|
30
|
+
|
|
31
|
+
not_strict
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
link :self
|
|
35
|
+
link :original, allow_nil: true, optional: true do
|
|
36
|
+
attribute :content_digest, String
|
|
37
|
+
attribute :width, Numeric
|
|
38
|
+
attribute :height, Numeric
|
|
39
|
+
end
|
|
40
|
+
link :thumbnail, allow_nil: true, optional: true do
|
|
41
|
+
attribute :content_digest, String
|
|
42
|
+
attribute :width, Numeric
|
|
43
|
+
attribute :height, Numeric
|
|
44
|
+
end
|
|
45
|
+
link :xlarge, allow_nil: true, optional: true do
|
|
46
|
+
attribute :content_digest, String
|
|
47
|
+
attribute :width, Numeric
|
|
48
|
+
attribute :height, Numeric
|
|
49
|
+
end
|
|
50
|
+
link :large, allow_nil: true, optional: true do
|
|
51
|
+
attribute :content_digest, String
|
|
52
|
+
attribute :width, Numeric
|
|
53
|
+
attribute :height, Numeric
|
|
54
|
+
end
|
|
55
|
+
link :medium, allow_nil: true, optional: true do
|
|
56
|
+
attribute :content_digest, String
|
|
57
|
+
attribute :width, Numeric
|
|
58
|
+
attribute :height, Numeric
|
|
59
|
+
end
|
|
60
|
+
link :small, allow_nil: true, optional: true do
|
|
61
|
+
attribute :content_digest, String
|
|
62
|
+
attribute :width, Numeric
|
|
63
|
+
attribute :height, Numeric
|
|
64
|
+
end
|
|
65
|
+
link :xsmall, allow_nil: true, optional: true do
|
|
66
|
+
attribute :content_digest, String
|
|
67
|
+
attribute :width, Numeric
|
|
68
|
+
attribute :height, Numeric
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
attribute :product_image do
|
|
73
|
+
merge version_1_base
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
view 'create' do
|
|
77
|
+
attribute :product_image do
|
|
78
|
+
merge version_1_creation
|
|
79
|
+
not_strict
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
view 'collection' do
|
|
84
|
+
attribute :product_images do
|
|
85
|
+
collection :_embedded, version_1_base
|
|
86
|
+
not_strict
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
view :index do
|
|
91
|
+
attribute :product_images do
|
|
92
|
+
collection :_index do
|
|
93
|
+
attribute :href, String
|
|
94
|
+
not_strict
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
not_strict
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
registrations :product_image do
|
|
104
|
+
view 'create', :create_product_image
|
|
105
|
+
view 'index', :product_image_urls
|
|
106
|
+
view 'collection', :product_images
|
|
107
|
+
|
|
108
|
+
type_alias 'product-image'
|
|
109
|
+
type_alias 'image'
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative './base_text'
|
|
4
|
+
require 'media_types/scheme/any_of'
|
|
5
|
+
|
|
6
|
+
module TrailerVote
|
|
7
|
+
module MediaTypes
|
|
8
|
+
|
|
9
|
+
##
|
|
10
|
+
# Media Types for Product Lookups
|
|
11
|
+
#
|
|
12
|
+
# The product lookup is used to find products by means of an authority and identifier. An identifier **MUST** be
|
|
13
|
+
# unique for that authority. For example, on TMDb each movie has (at least) one identifier, but no two movies share
|
|
14
|
+
# a TMDb identifier.
|
|
15
|
+
#
|
|
16
|
+
# Each product on TrailerVote can have any number of authority-identifier pairs, and a client **SHOULD** lookup a
|
|
17
|
+
# product which each pair known simultaneously. For example, many movies on TMDb are also on IMDB and have an IMDB
|
|
18
|
+
# identifier.
|
|
19
|
+
#
|
|
20
|
+
class ProductLookup < BaseText
|
|
21
|
+
media_type 'product.lookup', defaults: { suffix: :json, version: 1 }
|
|
22
|
+
|
|
23
|
+
validations do
|
|
24
|
+
version 1 do
|
|
25
|
+
collection 'product_identifiers', expected_type: nil do
|
|
26
|
+
attribute :authority, String
|
|
27
|
+
attribute :identifier
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
registrations(:product_lookup) do
|
|
33
|
+
type_alias 'product-lookup'
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative './base_text'
|
|
4
|
+
|
|
5
|
+
module TrailerVote
|
|
6
|
+
module MediaTypes
|
|
7
|
+
class ProductPlaceLink < BaseText
|
|
8
|
+
media_type 'product_place_link', defaults: { suffix: :json, version: 1 }
|
|
9
|
+
|
|
10
|
+
validations do
|
|
11
|
+
version 1 do
|
|
12
|
+
|
|
13
|
+
attribute :product_place_link do
|
|
14
|
+
link :place
|
|
15
|
+
link :product
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
view 'create' do
|
|
19
|
+
attribute :place do
|
|
20
|
+
attribute :id, String
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
registrations do
|
|
27
|
+
view 'collection', :product_place_links
|
|
28
|
+
view 'create', :create_product_place_link
|
|
29
|
+
view 'index', :product_place_link_urls
|
|
30
|
+
|
|
31
|
+
type_alias 'place_product_link'
|
|
32
|
+
type_alias 'place-product-link'
|
|
33
|
+
type_alias 'product-place-link'
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'media_types'
|
|
4
|
+
|
|
5
|
+
require_relative './base_text'
|
|
6
|
+
require_relative './types/boolean'
|
|
7
|
+
require_relative './types/product_movie_type'
|
|
8
|
+
require_relative './types/product_movie_handler'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
module TrailerVote
|
|
12
|
+
module MediaTypes
|
|
13
|
+
class ProductVideo < BaseText
|
|
14
|
+
media_type 'product.video', defaults: { suffix: :json, version: 1 }
|
|
15
|
+
|
|
16
|
+
validations do
|
|
17
|
+
version 1 do
|
|
18
|
+
version_1_creation = ::MediaTypes::Scheme.new do
|
|
19
|
+
attribute :identifier, String
|
|
20
|
+
attribute :source_url, String
|
|
21
|
+
attribute :deleted_at, AllowNil(String), optional: true
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
version_1_base = ::MediaTypes::Scheme.new do
|
|
25
|
+
attribute :updated_at, String
|
|
26
|
+
|
|
27
|
+
merge version_1_creation
|
|
28
|
+
|
|
29
|
+
attribute :data do
|
|
30
|
+
attribute :processed, Types::Boolean
|
|
31
|
+
attribute :transcoded, Types::Boolean
|
|
32
|
+
attribute :type, Types::ProductMovieType
|
|
33
|
+
attribute :as, Types::ProductMovieHandler
|
|
34
|
+
|
|
35
|
+
not_strict
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
link :self
|
|
39
|
+
link :audio_fragment do
|
|
40
|
+
attribute :content_digest, String
|
|
41
|
+
end
|
|
42
|
+
link :direct, allow_nil: true, optional: true
|
|
43
|
+
|
|
44
|
+
# link :original do
|
|
45
|
+
# attribute :content_digest, String
|
|
46
|
+
# attribute :width, Numeric
|
|
47
|
+
# attribute :height, Numeric
|
|
48
|
+
# end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
attribute :product_video do
|
|
52
|
+
merge version_1_base
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
view 'create' do
|
|
56
|
+
attribute :video do
|
|
57
|
+
merge version_1_creation
|
|
58
|
+
not_strict
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
view 'collection' do
|
|
63
|
+
attribute :videos do
|
|
64
|
+
collection :_embedded, version_1_base
|
|
65
|
+
not_strict
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
view :index do
|
|
70
|
+
attribute :product_videos do
|
|
71
|
+
collection :_index do
|
|
72
|
+
attribute :href, String
|
|
73
|
+
not_strict
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
not_strict
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
registrations :product_video do
|
|
83
|
+
view 'create', :create_product_video
|
|
84
|
+
view 'index', :product_video_urls
|
|
85
|
+
view 'collection', :product_videos
|
|
86
|
+
|
|
87
|
+
type_alias 'product-video'
|
|
88
|
+
type_alias 'video'
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|