trailer_vote-media_types 2.1.0 → 2.2.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 +4 -4
- data/.gitignore +12 -12
- data/.rubocop.yml +29 -29
- data/.travis.yml +18 -18
- data/CHANGELOG.md +82 -82
- data/Gemfile +6 -6
- data/Gemfile.lock +5 -5
- data/README.md +118 -118
- data/Rakefile +12 -12
- data/bin/console +16 -16
- data/bin/setup +8 -8
- data/lib/trailer_vote/media_types/audio_fragment.rb +108 -108
- data/lib/trailer_vote/media_types/base_text.rb +22 -22
- data/lib/trailer_vote/media_types/carousel.rb +42 -42
- data/lib/trailer_vote/media_types/client_configuration.rb +35 -35
- data/lib/trailer_vote/media_types/configuration.rb +139 -139
- data/lib/trailer_vote/media_types/errors.rb +31 -31
- data/lib/trailer_vote/media_types/feedback.rb +50 -50
- data/lib/trailer_vote/media_types/feedback_listing.rb +49 -49
- data/lib/trailer_vote/media_types/fingerprint_binary.rb +67 -67
- data/lib/trailer_vote/media_types/interactive_player.rb +33 -33
- data/lib/trailer_vote/media_types/issue.rb +64 -64
- data/lib/trailer_vote/media_types/ordered_fragment.rb +35 -35
- data/lib/trailer_vote/media_types/partials/image_links.rb +30 -30
- data/lib/trailer_vote/media_types/persona.rb +47 -47
- data/lib/trailer_vote/media_types/place.rb +143 -143
- data/lib/trailer_vote/media_types/product.rb +191 -191
- data/lib/trailer_vote/media_types/product_image.rb +96 -96
- data/lib/trailer_vote/media_types/product_lookup.rb +37 -37
- data/lib/trailer_vote/media_types/product_place_link.rb +36 -36
- data/lib/trailer_vote/media_types/product_video.rb +100 -100
- data/lib/trailer_vote/media_types/products_listing.rb +43 -43
- data/lib/trailer_vote/media_types/push_consent.rb +44 -44
- data/lib/trailer_vote/media_types/push_manifest.rb +44 -44
- data/lib/trailer_vote/media_types/push_token_android.rb +41 -41
- data/lib/trailer_vote/media_types/push_token_index.rb +42 -42
- data/lib/trailer_vote/media_types/push_token_ios.rb +41 -41
- data/lib/trailer_vote/media_types/push_trivial_campaign.rb +23 -1
- data/lib/trailer_vote/media_types/release_push_campaign.rb +29 -2
- data/lib/trailer_vote/media_types/sentiment_feedback.rb +100 -100
- data/lib/trailer_vote/media_types/types/boolean.rb +15 -15
- data/lib/trailer_vote/media_types/types/formatted_url.rb +51 -51
- data/lib/trailer_vote/media_types/types/http_url.rb +23 -23
- data/lib/trailer_vote/media_types/types/influx_db_connection_url.rb +10 -10
- data/lib/trailer_vote/media_types/types/iso8601.rb +10 -10
- data/lib/trailer_vote/media_types/types/local_time.rb +11 -11
- data/lib/trailer_vote/media_types/types/product_data_type.rb +15 -15
- data/lib/trailer_vote/media_types/types/product_image_type.rb +25 -25
- data/lib/trailer_vote/media_types/types/product_movie_handler.rb +16 -16
- data/lib/trailer_vote/media_types/types/product_movie_type.rb +17 -17
- data/lib/trailer_vote/media_types/types/uuid_v4.rb +10 -10
- data/lib/trailer_vote/media_types/types/vote_value.rb +17 -17
- data/lib/trailer_vote/media_types/version.rb +1 -1
- data/trailer_vote-media_types.gemspec +2 -2
- metadata +7 -7
|
@@ -1,143 +1,143 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative 'base_text'
|
|
4
|
-
require_relative 'types/uuid_v4'
|
|
5
|
-
require_relative 'types/iso8601'
|
|
6
|
-
|
|
7
|
-
module TrailerVote
|
|
8
|
-
module MediaTypes
|
|
9
|
-
|
|
10
|
-
##
|
|
11
|
-
# Media Types for places
|
|
12
|
-
#
|
|
13
|
-
# Each set of credentials has a Place associated to it. A place might be the HQ of an enterprise, or a physical
|
|
14
|
-
# location on the map. You can always access all the data of your place and all the children, as the places in our
|
|
15
|
-
# system are configured to be a tree.
|
|
16
|
-
#
|
|
17
|
-
class Place < BaseText
|
|
18
|
-
media_type 'place', defaults: { suffix: :json, version: 4 }
|
|
19
|
-
|
|
20
|
-
validations do
|
|
21
|
-
index_scheme = ::MediaTypes::Scheme.new do
|
|
22
|
-
attribute :places do
|
|
23
|
-
collection :_index, allow_empty: true do
|
|
24
|
-
attribute :href, String
|
|
25
|
-
not_strict
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
not_strict
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
version 4 do
|
|
33
|
-
attribute :place do
|
|
34
|
-
attribute :name, String
|
|
35
|
-
attribute :parent_place, AllowNil(Types::UuidV4)
|
|
36
|
-
attribute :expires_at, AllowNil(String)
|
|
37
|
-
attribute :updated_at, Types::Iso8601
|
|
38
|
-
|
|
39
|
-
link :self
|
|
40
|
-
link :products_archive
|
|
41
|
-
link :fragments_archive
|
|
42
|
-
link :parent, allow_nil: true
|
|
43
|
-
link :children
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
view 'index' do
|
|
47
|
-
merge index_scheme
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
version 3 do
|
|
52
|
-
attribute :place do
|
|
53
|
-
attribute :name, String
|
|
54
|
-
attribute :parent_place, AllowNil(Types::UuidV4)
|
|
55
|
-
attribute :expires_at, AllowNil(String)
|
|
56
|
-
attribute :updated_at, Types::Iso8601
|
|
57
|
-
|
|
58
|
-
link :self
|
|
59
|
-
link :products_archive
|
|
60
|
-
link :parent, allow_nil: true
|
|
61
|
-
link :children
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
view 'index' do
|
|
65
|
-
merge index_scheme
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
version 2 do
|
|
70
|
-
version_2_base = ::MediaTypes::Scheme.new do
|
|
71
|
-
attribute :name, String
|
|
72
|
-
attribute :parent_place, AllowNil(Types::UuidV4)
|
|
73
|
-
attribute :expires_at, AllowNil(String)
|
|
74
|
-
attribute :updated_at, Types::Iso8601
|
|
75
|
-
|
|
76
|
-
link :self
|
|
77
|
-
link :products_archive
|
|
78
|
-
link :parent, allow_nil: true
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
attribute :place do
|
|
82
|
-
merge version_2_base
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
view 'create' do
|
|
86
|
-
attribute :place do
|
|
87
|
-
attribute :name, String
|
|
88
|
-
attribute :parent_place, String
|
|
89
|
-
attribute :expires_at, AllowNil(Types::Iso8601)
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
view 'collection' do
|
|
94
|
-
attribute :places do
|
|
95
|
-
collection :_embedded, version_2_base
|
|
96
|
-
not_strict
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
view 'index' do
|
|
101
|
-
merge index_scheme
|
|
102
|
-
end
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
version 1 do
|
|
106
|
-
version_1_base = ::MediaTypes::Scheme.new do
|
|
107
|
-
attribute :name, String
|
|
108
|
-
attribute :parent_place, AllowNil(String)
|
|
109
|
-
attribute :expires_at, AllowNil(String)
|
|
110
|
-
attribute :updated_at, Types::Iso8601
|
|
111
|
-
|
|
112
|
-
link :self
|
|
113
|
-
link :products
|
|
114
|
-
link :parent, allow_nil: true
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
attribute :place do
|
|
118
|
-
merge version_1_base
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
view 'collection' do
|
|
122
|
-
attribute :places do
|
|
123
|
-
collection :_embedded, version_1_base
|
|
124
|
-
not_strict
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
view 'index' do
|
|
129
|
-
merge index_scheme
|
|
130
|
-
end
|
|
131
|
-
end
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
registrations :place do
|
|
135
|
-
view 'create', :create_place
|
|
136
|
-
view 'index', :place_urls
|
|
137
|
-
view 'collection', :places
|
|
138
|
-
|
|
139
|
-
versions 1, 2, 3, 4
|
|
140
|
-
end
|
|
141
|
-
end
|
|
142
|
-
end
|
|
143
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'base_text'
|
|
4
|
+
require_relative 'types/uuid_v4'
|
|
5
|
+
require_relative 'types/iso8601'
|
|
6
|
+
|
|
7
|
+
module TrailerVote
|
|
8
|
+
module MediaTypes
|
|
9
|
+
|
|
10
|
+
##
|
|
11
|
+
# Media Types for places
|
|
12
|
+
#
|
|
13
|
+
# Each set of credentials has a Place associated to it. A place might be the HQ of an enterprise, or a physical
|
|
14
|
+
# location on the map. You can always access all the data of your place and all the children, as the places in our
|
|
15
|
+
# system are configured to be a tree.
|
|
16
|
+
#
|
|
17
|
+
class Place < BaseText
|
|
18
|
+
media_type 'place', defaults: { suffix: :json, version: 4 }
|
|
19
|
+
|
|
20
|
+
validations do
|
|
21
|
+
index_scheme = ::MediaTypes::Scheme.new do
|
|
22
|
+
attribute :places do
|
|
23
|
+
collection :_index, allow_empty: true do
|
|
24
|
+
attribute :href, String
|
|
25
|
+
not_strict
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
not_strict
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
version 4 do
|
|
33
|
+
attribute :place do
|
|
34
|
+
attribute :name, String
|
|
35
|
+
attribute :parent_place, AllowNil(Types::UuidV4)
|
|
36
|
+
attribute :expires_at, AllowNil(String)
|
|
37
|
+
attribute :updated_at, Types::Iso8601
|
|
38
|
+
|
|
39
|
+
link :self
|
|
40
|
+
link :products_archive
|
|
41
|
+
link :fragments_archive
|
|
42
|
+
link :parent, allow_nil: true
|
|
43
|
+
link :children
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
view 'index' do
|
|
47
|
+
merge index_scheme
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
version 3 do
|
|
52
|
+
attribute :place do
|
|
53
|
+
attribute :name, String
|
|
54
|
+
attribute :parent_place, AllowNil(Types::UuidV4)
|
|
55
|
+
attribute :expires_at, AllowNil(String)
|
|
56
|
+
attribute :updated_at, Types::Iso8601
|
|
57
|
+
|
|
58
|
+
link :self
|
|
59
|
+
link :products_archive
|
|
60
|
+
link :parent, allow_nil: true
|
|
61
|
+
link :children
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
view 'index' do
|
|
65
|
+
merge index_scheme
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
version 2 do
|
|
70
|
+
version_2_base = ::MediaTypes::Scheme.new do
|
|
71
|
+
attribute :name, String
|
|
72
|
+
attribute :parent_place, AllowNil(Types::UuidV4)
|
|
73
|
+
attribute :expires_at, AllowNil(String)
|
|
74
|
+
attribute :updated_at, Types::Iso8601
|
|
75
|
+
|
|
76
|
+
link :self
|
|
77
|
+
link :products_archive
|
|
78
|
+
link :parent, allow_nil: true
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
attribute :place do
|
|
82
|
+
merge version_2_base
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
view 'create' do
|
|
86
|
+
attribute :place do
|
|
87
|
+
attribute :name, String
|
|
88
|
+
attribute :parent_place, String
|
|
89
|
+
attribute :expires_at, AllowNil(Types::Iso8601)
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
view 'collection' do
|
|
94
|
+
attribute :places do
|
|
95
|
+
collection :_embedded, version_2_base
|
|
96
|
+
not_strict
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
view 'index' do
|
|
101
|
+
merge index_scheme
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
version 1 do
|
|
106
|
+
version_1_base = ::MediaTypes::Scheme.new do
|
|
107
|
+
attribute :name, String
|
|
108
|
+
attribute :parent_place, AllowNil(String)
|
|
109
|
+
attribute :expires_at, AllowNil(String)
|
|
110
|
+
attribute :updated_at, Types::Iso8601
|
|
111
|
+
|
|
112
|
+
link :self
|
|
113
|
+
link :products
|
|
114
|
+
link :parent, allow_nil: true
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
attribute :place do
|
|
118
|
+
merge version_1_base
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
view 'collection' do
|
|
122
|
+
attribute :places do
|
|
123
|
+
collection :_embedded, version_1_base
|
|
124
|
+
not_strict
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
view 'index' do
|
|
129
|
+
merge index_scheme
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
registrations :place do
|
|
135
|
+
view 'create', :create_place
|
|
136
|
+
view 'index', :place_urls
|
|
137
|
+
view 'collection', :places
|
|
138
|
+
|
|
139
|
+
versions 1, 2, 3, 4
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
end
|
|
@@ -1,191 +1,191 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative 'base_text'
|
|
4
|
-
require_relative 'types/product_data_type'
|
|
5
|
-
require_relative 'types/iso8601'
|
|
6
|
-
require_relative 'types/http_url'
|
|
7
|
-
|
|
8
|
-
module TrailerVote
|
|
9
|
-
module MediaTypes
|
|
10
|
-
|
|
11
|
-
##
|
|
12
|
-
# Media Types for Products
|
|
13
|
-
#
|
|
14
|
-
# Products are all things that are the subject of Audio Fragments (advertisements, trailers, sound bites). This can
|
|
15
|
-
# be a book; a movie; a car; a drink; anything that would be a product in the real world. Recognition is done on the
|
|
16
|
-
# audio fragments, not on products directly.
|
|
17
|
-
#
|
|
18
|
-
# A product has attachments, such as data, {ProductImage}, and recognizable {AudioFragment}.
|
|
19
|
-
#
|
|
20
|
-
class Product < BaseText
|
|
21
|
-
media_type 'product', defaults: { suffix: :json, version: 2 }
|
|
22
|
-
|
|
23
|
-
validations do
|
|
24
|
-
index_scheme = ::MediaTypes::Scheme.new do
|
|
25
|
-
attribute :products do
|
|
26
|
-
collection :_index, allow_empty: true do
|
|
27
|
-
attribute :href, Types::HttpUrl
|
|
28
|
-
not_strict
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
not_strict
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
version 2 do
|
|
36
|
-
version_2_creation = ::MediaTypes::Scheme.new do
|
|
37
|
-
attribute :name, String
|
|
38
|
-
attribute :description, AllowNil(String)
|
|
39
|
-
|
|
40
|
-
collection :product_identifiers do
|
|
41
|
-
attribute :authority, String
|
|
42
|
-
attribute :identifier, String
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
attribute :data do
|
|
46
|
-
any do
|
|
47
|
-
attribute :type, Types::ProductDataType
|
|
48
|
-
attribute :type_version, Numeric
|
|
49
|
-
|
|
50
|
-
attribute :translations do
|
|
51
|
-
any do
|
|
52
|
-
attribute :name, AllowNil(String), optional: true
|
|
53
|
-
attribute :description, AllowNil(String), optional: true
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
# Movie type properties
|
|
58
|
-
collection :genres, String, optional: true, allow_empty: true
|
|
59
|
-
attribute :mpaa_rating, AnyOf('G', 'PG', 'PG-13', 'R', 'NC-17', 'NR', NilClass), optional: true
|
|
60
|
-
attribute :run_time, AllowNil(Numeric), optional: true
|
|
61
|
-
attribute :release_date, AllowNil(Types::Iso8601), optional: true
|
|
62
|
-
attribute :default_image_url, AllowNil(String), optional: true
|
|
63
|
-
|
|
64
|
-
not_strict
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
attribute :raw_data, optional: true do
|
|
69
|
-
# noinspection RubyBlockToMethodReference
|
|
70
|
-
not_strict
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
version_2_base = ::MediaTypes::Scheme.new do
|
|
75
|
-
attribute :updated_at, Types::Iso8601
|
|
76
|
-
attribute :lock_version, Numeric
|
|
77
|
-
|
|
78
|
-
merge version_2_creation
|
|
79
|
-
|
|
80
|
-
link :self
|
|
81
|
-
link :images
|
|
82
|
-
link :videos
|
|
83
|
-
link :places
|
|
84
|
-
link :audio_fragments
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
attribute :product do
|
|
88
|
-
merge version_2_base
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
view 'create' do
|
|
92
|
-
attribute :product do
|
|
93
|
-
merge version_2_creation
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
view 'collection' do
|
|
98
|
-
attribute :products do
|
|
99
|
-
collection :_embedded, version_2_base
|
|
100
|
-
not_strict
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
view 'index' do
|
|
105
|
-
merge index_scheme
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
version 1 do
|
|
110
|
-
|
|
111
|
-
version_1_creation = ::MediaTypes::Scheme.new do
|
|
112
|
-
attribute :name, String
|
|
113
|
-
attribute :description, AllowNil(String)
|
|
114
|
-
|
|
115
|
-
collection :product_identifiers do
|
|
116
|
-
attribute :authority, String
|
|
117
|
-
attribute :identifier, String
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
attribute :data do
|
|
121
|
-
any do
|
|
122
|
-
attribute :type, Types::ProductDataType
|
|
123
|
-
attribute :type_version, Numeric
|
|
124
|
-
attribute :name, AllowNil(String)
|
|
125
|
-
attribute :description, AllowNil(String)
|
|
126
|
-
|
|
127
|
-
# Movie type properties
|
|
128
|
-
collection :genres, String, optional: true, allow_empty: true
|
|
129
|
-
attribute :mpaa_rating, AnyOf('G', 'PG', 'PG-13', 'R', 'NC-17', 'NR', NilClass), optional: true
|
|
130
|
-
attribute :run_time, AllowNil(Numeric), optional: true
|
|
131
|
-
attribute :release_date, AllowNil(Types::Iso8601), optional: true
|
|
132
|
-
attribute :default_image_url, AllowNil(String), optional: true
|
|
133
|
-
|
|
134
|
-
not_strict
|
|
135
|
-
end
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
attribute :raw_data, optional: true do
|
|
139
|
-
# noinspection RubyBlockToMethodReference
|
|
140
|
-
not_strict
|
|
141
|
-
end
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
version_1_base = ::MediaTypes::Scheme.new do
|
|
145
|
-
attribute :updated_at, Types::Iso8601
|
|
146
|
-
attribute :lock_version, Numeric
|
|
147
|
-
|
|
148
|
-
merge version_1_creation
|
|
149
|
-
|
|
150
|
-
link :self
|
|
151
|
-
link :images
|
|
152
|
-
link :videos
|
|
153
|
-
link :places
|
|
154
|
-
link :audio_fragments
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
attribute :product do
|
|
158
|
-
merge version_1_base
|
|
159
|
-
end
|
|
160
|
-
|
|
161
|
-
view 'create' do
|
|
162
|
-
attribute :product do
|
|
163
|
-
merge version_1_creation
|
|
164
|
-
end
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
view 'collection' do
|
|
168
|
-
attribute :products do
|
|
169
|
-
collection :_embedded, version_1_base
|
|
170
|
-
not_strict
|
|
171
|
-
end
|
|
172
|
-
end
|
|
173
|
-
|
|
174
|
-
view 'index' do
|
|
175
|
-
merge index_scheme
|
|
176
|
-
end
|
|
177
|
-
end
|
|
178
|
-
end
|
|
179
|
-
|
|
180
|
-
registrations :product do
|
|
181
|
-
view 'index', :product_urls
|
|
182
|
-
view 'collection', :products
|
|
183
|
-
view 'create', :create_product
|
|
184
|
-
|
|
185
|
-
versions 1, 2
|
|
186
|
-
|
|
187
|
-
type_alias 'product.movie'
|
|
188
|
-
end
|
|
189
|
-
end
|
|
190
|
-
end
|
|
191
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'base_text'
|
|
4
|
+
require_relative 'types/product_data_type'
|
|
5
|
+
require_relative 'types/iso8601'
|
|
6
|
+
require_relative 'types/http_url'
|
|
7
|
+
|
|
8
|
+
module TrailerVote
|
|
9
|
+
module MediaTypes
|
|
10
|
+
|
|
11
|
+
##
|
|
12
|
+
# Media Types for Products
|
|
13
|
+
#
|
|
14
|
+
# Products are all things that are the subject of Audio Fragments (advertisements, trailers, sound bites). This can
|
|
15
|
+
# be a book; a movie; a car; a drink; anything that would be a product in the real world. Recognition is done on the
|
|
16
|
+
# audio fragments, not on products directly.
|
|
17
|
+
#
|
|
18
|
+
# A product has attachments, such as data, {ProductImage}, and recognizable {AudioFragment}.
|
|
19
|
+
#
|
|
20
|
+
class Product < BaseText
|
|
21
|
+
media_type 'product', defaults: { suffix: :json, version: 2 }
|
|
22
|
+
|
|
23
|
+
validations do
|
|
24
|
+
index_scheme = ::MediaTypes::Scheme.new do
|
|
25
|
+
attribute :products do
|
|
26
|
+
collection :_index, allow_empty: true do
|
|
27
|
+
attribute :href, Types::HttpUrl
|
|
28
|
+
not_strict
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
not_strict
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
version 2 do
|
|
36
|
+
version_2_creation = ::MediaTypes::Scheme.new do
|
|
37
|
+
attribute :name, String
|
|
38
|
+
attribute :description, AllowNil(String)
|
|
39
|
+
|
|
40
|
+
collection :product_identifiers do
|
|
41
|
+
attribute :authority, String
|
|
42
|
+
attribute :identifier, String
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
attribute :data do
|
|
46
|
+
any do
|
|
47
|
+
attribute :type, Types::ProductDataType
|
|
48
|
+
attribute :type_version, Numeric
|
|
49
|
+
|
|
50
|
+
attribute :translations do
|
|
51
|
+
any do
|
|
52
|
+
attribute :name, AllowNil(String), optional: true
|
|
53
|
+
attribute :description, AllowNil(String), optional: true
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Movie type properties
|
|
58
|
+
collection :genres, String, optional: true, allow_empty: true
|
|
59
|
+
attribute :mpaa_rating, AnyOf('G', 'PG', 'PG-13', 'R', 'NC-17', 'NR', NilClass), optional: true
|
|
60
|
+
attribute :run_time, AllowNil(Numeric), optional: true
|
|
61
|
+
attribute :release_date, AllowNil(Types::Iso8601), optional: true
|
|
62
|
+
attribute :default_image_url, AllowNil(String), optional: true
|
|
63
|
+
|
|
64
|
+
not_strict
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
attribute :raw_data, optional: true do
|
|
69
|
+
# noinspection RubyBlockToMethodReference
|
|
70
|
+
not_strict
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
version_2_base = ::MediaTypes::Scheme.new do
|
|
75
|
+
attribute :updated_at, Types::Iso8601
|
|
76
|
+
attribute :lock_version, Numeric
|
|
77
|
+
|
|
78
|
+
merge version_2_creation
|
|
79
|
+
|
|
80
|
+
link :self
|
|
81
|
+
link :images
|
|
82
|
+
link :videos
|
|
83
|
+
link :places
|
|
84
|
+
link :audio_fragments
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
attribute :product do
|
|
88
|
+
merge version_2_base
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
view 'create' do
|
|
92
|
+
attribute :product do
|
|
93
|
+
merge version_2_creation
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
view 'collection' do
|
|
98
|
+
attribute :products do
|
|
99
|
+
collection :_embedded, version_2_base
|
|
100
|
+
not_strict
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
view 'index' do
|
|
105
|
+
merge index_scheme
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
version 1 do
|
|
110
|
+
|
|
111
|
+
version_1_creation = ::MediaTypes::Scheme.new do
|
|
112
|
+
attribute :name, String
|
|
113
|
+
attribute :description, AllowNil(String)
|
|
114
|
+
|
|
115
|
+
collection :product_identifiers do
|
|
116
|
+
attribute :authority, String
|
|
117
|
+
attribute :identifier, String
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
attribute :data do
|
|
121
|
+
any do
|
|
122
|
+
attribute :type, Types::ProductDataType
|
|
123
|
+
attribute :type_version, Numeric
|
|
124
|
+
attribute :name, AllowNil(String)
|
|
125
|
+
attribute :description, AllowNil(String)
|
|
126
|
+
|
|
127
|
+
# Movie type properties
|
|
128
|
+
collection :genres, String, optional: true, allow_empty: true
|
|
129
|
+
attribute :mpaa_rating, AnyOf('G', 'PG', 'PG-13', 'R', 'NC-17', 'NR', NilClass), optional: true
|
|
130
|
+
attribute :run_time, AllowNil(Numeric), optional: true
|
|
131
|
+
attribute :release_date, AllowNil(Types::Iso8601), optional: true
|
|
132
|
+
attribute :default_image_url, AllowNil(String), optional: true
|
|
133
|
+
|
|
134
|
+
not_strict
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
attribute :raw_data, optional: true do
|
|
139
|
+
# noinspection RubyBlockToMethodReference
|
|
140
|
+
not_strict
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
version_1_base = ::MediaTypes::Scheme.new do
|
|
145
|
+
attribute :updated_at, Types::Iso8601
|
|
146
|
+
attribute :lock_version, Numeric
|
|
147
|
+
|
|
148
|
+
merge version_1_creation
|
|
149
|
+
|
|
150
|
+
link :self
|
|
151
|
+
link :images
|
|
152
|
+
link :videos
|
|
153
|
+
link :places
|
|
154
|
+
link :audio_fragments
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
attribute :product do
|
|
158
|
+
merge version_1_base
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
view 'create' do
|
|
162
|
+
attribute :product do
|
|
163
|
+
merge version_1_creation
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
view 'collection' do
|
|
168
|
+
attribute :products do
|
|
169
|
+
collection :_embedded, version_1_base
|
|
170
|
+
not_strict
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
view 'index' do
|
|
175
|
+
merge index_scheme
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
registrations :product do
|
|
181
|
+
view 'index', :product_urls
|
|
182
|
+
view 'collection', :products
|
|
183
|
+
view 'create', :create_product
|
|
184
|
+
|
|
185
|
+
versions 1, 2
|
|
186
|
+
|
|
187
|
+
type_alias 'product.movie'
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
end
|