trailer_vote-media_types 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +12 -12
  3. data/.rubocop.yml +29 -29
  4. data/.travis.yml +18 -18
  5. data/CHANGELOG.md +82 -82
  6. data/Gemfile +6 -6
  7. data/Gemfile.lock +5 -5
  8. data/README.md +118 -118
  9. data/Rakefile +12 -12
  10. data/bin/console +16 -16
  11. data/bin/setup +8 -8
  12. data/lib/trailer_vote/media_types/audio_fragment.rb +108 -108
  13. data/lib/trailer_vote/media_types/base_text.rb +22 -22
  14. data/lib/trailer_vote/media_types/carousel.rb +42 -42
  15. data/lib/trailer_vote/media_types/client_configuration.rb +35 -35
  16. data/lib/trailer_vote/media_types/configuration.rb +139 -139
  17. data/lib/trailer_vote/media_types/errors.rb +31 -31
  18. data/lib/trailer_vote/media_types/feedback.rb +50 -50
  19. data/lib/trailer_vote/media_types/feedback_listing.rb +49 -49
  20. data/lib/trailer_vote/media_types/fingerprint_binary.rb +67 -67
  21. data/lib/trailer_vote/media_types/interactive_player.rb +33 -33
  22. data/lib/trailer_vote/media_types/issue.rb +64 -64
  23. data/lib/trailer_vote/media_types/ordered_fragment.rb +35 -35
  24. data/lib/trailer_vote/media_types/partials/image_links.rb +30 -30
  25. data/lib/trailer_vote/media_types/persona.rb +47 -47
  26. data/lib/trailer_vote/media_types/place.rb +143 -143
  27. data/lib/trailer_vote/media_types/product.rb +191 -191
  28. data/lib/trailer_vote/media_types/product_image.rb +96 -96
  29. data/lib/trailer_vote/media_types/product_lookup.rb +37 -37
  30. data/lib/trailer_vote/media_types/product_place_link.rb +36 -36
  31. data/lib/trailer_vote/media_types/product_video.rb +100 -100
  32. data/lib/trailer_vote/media_types/products_listing.rb +43 -43
  33. data/lib/trailer_vote/media_types/push_consent.rb +44 -44
  34. data/lib/trailer_vote/media_types/push_manifest.rb +44 -44
  35. data/lib/trailer_vote/media_types/push_token_android.rb +41 -41
  36. data/lib/trailer_vote/media_types/push_token_index.rb +42 -42
  37. data/lib/trailer_vote/media_types/push_token_ios.rb +41 -41
  38. data/lib/trailer_vote/media_types/push_trivial_campaign.rb +23 -1
  39. data/lib/trailer_vote/media_types/release_push_campaign.rb +29 -2
  40. data/lib/trailer_vote/media_types/sentiment_feedback.rb +100 -100
  41. data/lib/trailer_vote/media_types/types/boolean.rb +15 -15
  42. data/lib/trailer_vote/media_types/types/formatted_url.rb +51 -51
  43. data/lib/trailer_vote/media_types/types/http_url.rb +23 -23
  44. data/lib/trailer_vote/media_types/types/influx_db_connection_url.rb +10 -10
  45. data/lib/trailer_vote/media_types/types/iso8601.rb +10 -10
  46. data/lib/trailer_vote/media_types/types/local_time.rb +11 -11
  47. data/lib/trailer_vote/media_types/types/product_data_type.rb +15 -15
  48. data/lib/trailer_vote/media_types/types/product_image_type.rb +25 -25
  49. data/lib/trailer_vote/media_types/types/product_movie_handler.rb +16 -16
  50. data/lib/trailer_vote/media_types/types/product_movie_type.rb +17 -17
  51. data/lib/trailer_vote/media_types/types/uuid_v4.rb +10 -10
  52. data/lib/trailer_vote/media_types/types/vote_value.rb +17 -17
  53. data/lib/trailer_vote/media_types/version.rb +1 -1
  54. data/trailer_vote-media_types.gemspec +2 -2
  55. metadata +7 -7
@@ -1,96 +1,96 @@
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
- require_relative 'types/iso8601'
9
- require_relative 'types/http_url'
10
-
11
- module TrailerVote
12
- module MediaTypes
13
- class ProductImage < BaseText
14
- media_type 'product.image', defaults: { suffix: :json, version: 1 }
15
-
16
- validations do
17
- version_1_creation = ::MediaTypes::Scheme.new do
18
- attribute :identifier, String
19
- attribute :source_url, AnyOf(Types::HttpUrl, String)
20
- attribute :expires_at, AllowNil(Types::Iso8601), optional: true
21
-
22
- attribute :content_language, AllowNil(String), optional: true
23
- attribute :content_region, AllowNil(String), optional: true
24
- end
25
-
26
- version_1_base = ::MediaTypes::Scheme.new do
27
- attribute :updated_at, Types::Iso8601
28
-
29
- merge version_1_creation
30
-
31
- attribute :data do
32
- attribute :processed, Types::Boolean
33
- attribute :type, Types::ProductImageType
34
-
35
- not_strict
36
- end
37
-
38
- link :self do
39
- attribute :type, Types::ProductImageType
40
- end
41
-
42
- %i[original thumbnail xlarge large medium small xsmall].each do |size|
43
- link size, allow_nil: true, optional: true do
44
- attribute :content_digest, String
45
- attribute :width, Numeric
46
- attribute :height, Numeric
47
- end
48
- end
49
- end
50
-
51
- version 1 do
52
- attribute :product_image do
53
- merge version_1_base
54
- end
55
-
56
- view 'create' do
57
- attribute :product_image do
58
- merge version_1_creation
59
- not_strict
60
- end
61
- end
62
-
63
- view 'collection' do
64
- attribute :product_images do
65
- collection :_embedded, version_1_base, allow_empty: true
66
- not_strict
67
- end
68
- end
69
-
70
- view :index do
71
- attribute :product_images do
72
- collection :_index, allow_empty: true do
73
- attribute :href, Types::HttpUrl
74
- attribute :type, Types::ProductImageType
75
- not_strict
76
- end
77
-
78
- not_strict
79
- end
80
- end
81
- end
82
- end
83
-
84
- registrations :product_image do
85
- view 'create', :create_product_image
86
- view 'index', :product_image_urls
87
- view 'collection', :product_images
88
-
89
- versions 1
90
-
91
- type_alias 'product-image'
92
- type_alias 'image'
93
- end
94
- end
95
- end
96
- end
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
+ require_relative 'types/iso8601'
9
+ require_relative 'types/http_url'
10
+
11
+ module TrailerVote
12
+ module MediaTypes
13
+ class ProductImage < BaseText
14
+ media_type 'product.image', defaults: { suffix: :json, version: 1 }
15
+
16
+ validations do
17
+ version_1_creation = ::MediaTypes::Scheme.new do
18
+ attribute :identifier, String
19
+ attribute :source_url, AnyOf(Types::HttpUrl, String)
20
+ attribute :expires_at, AllowNil(Types::Iso8601), optional: true
21
+
22
+ attribute :content_language, AllowNil(String), optional: true
23
+ attribute :content_region, AllowNil(String), optional: true
24
+ end
25
+
26
+ version_1_base = ::MediaTypes::Scheme.new do
27
+ attribute :updated_at, Types::Iso8601
28
+
29
+ merge version_1_creation
30
+
31
+ attribute :data do
32
+ attribute :processed, Types::Boolean
33
+ attribute :type, Types::ProductImageType
34
+
35
+ not_strict
36
+ end
37
+
38
+ link :self do
39
+ attribute :type, Types::ProductImageType
40
+ end
41
+
42
+ %i[original thumbnail xlarge large medium small xsmall].each do |size|
43
+ link size, allow_nil: true, optional: true do
44
+ attribute :content_digest, String
45
+ attribute :width, Numeric
46
+ attribute :height, Numeric
47
+ end
48
+ end
49
+ end
50
+
51
+ version 1 do
52
+ attribute :product_image do
53
+ merge version_1_base
54
+ end
55
+
56
+ view 'create' do
57
+ attribute :product_image do
58
+ merge version_1_creation
59
+ not_strict
60
+ end
61
+ end
62
+
63
+ view 'collection' do
64
+ attribute :product_images do
65
+ collection :_embedded, version_1_base, allow_empty: true
66
+ not_strict
67
+ end
68
+ end
69
+
70
+ view :index do
71
+ attribute :product_images do
72
+ collection :_index, allow_empty: true do
73
+ attribute :href, Types::HttpUrl
74
+ attribute :type, Types::ProductImageType
75
+ not_strict
76
+ end
77
+
78
+ not_strict
79
+ end
80
+ end
81
+ end
82
+ end
83
+
84
+ registrations :product_image do
85
+ view 'create', :create_product_image
86
+ view 'index', :product_image_urls
87
+ view 'collection', :product_images
88
+
89
+ versions 1
90
+
91
+ type_alias 'product-image'
92
+ type_alias 'image'
93
+ end
94
+ end
95
+ end
96
+ end
@@ -1,37 +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, String
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
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, String
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
@@ -1,36 +1,36 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'base_text'
4
- require_relative 'types/http_url'
5
-
6
- module TrailerVote
7
- module MediaTypes
8
- class ProductPlaceLink < BaseText
9
- media_type 'product_place_link', defaults: { suffix: :json, version: 1 }
10
-
11
- validations do
12
- version 1 do
13
-
14
- attribute :product_place_link do
15
- link :place
16
- link :product
17
- end
18
-
19
- view 'create' do
20
- attribute :place, Types::HttpUrl
21
- end
22
- end
23
- end
24
-
25
- registrations :product_place_link do
26
- view 'collection', :product_place_links
27
- view 'create', :create_product_place_link
28
- view 'index', :product_place_link_urls
29
-
30
- type_alias 'place_product_link'
31
- type_alias 'place-product-link'
32
- type_alias 'product-place-link'
33
- end
34
- end
35
- end
36
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'base_text'
4
+ require_relative 'types/http_url'
5
+
6
+ module TrailerVote
7
+ module MediaTypes
8
+ class ProductPlaceLink < BaseText
9
+ media_type 'product_place_link', defaults: { suffix: :json, version: 1 }
10
+
11
+ validations do
12
+ version 1 do
13
+
14
+ attribute :product_place_link do
15
+ link :place
16
+ link :product
17
+ end
18
+
19
+ view 'create' do
20
+ attribute :place, Types::HttpUrl
21
+ end
22
+ end
23
+ end
24
+
25
+ registrations :product_place_link do
26
+ view 'collection', :product_place_links
27
+ view 'create', :create_product_place_link
28
+ view 'index', :product_place_link_urls
29
+
30
+ type_alias 'place_product_link'
31
+ type_alias 'place-product-link'
32
+ type_alias 'product-place-link'
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,100 +1,100 @@
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
- require_relative 'types/iso8601'
10
- require_relative 'types/http_url'
11
-
12
- module TrailerVote
13
- module MediaTypes
14
- class ProductVideo < BaseText
15
- media_type 'product.video', defaults: { suffix: :json, version: 1 }
16
-
17
- validations do
18
- version 1 do
19
- version_1_creation = ::MediaTypes::Scheme.new do
20
- attribute :identifier, String
21
- attribute :source_url, AnyOf(Types::HttpUrl, String)
22
- attribute :expires_at, AllowNil(Types::Iso8601), optional: true
23
-
24
- attribute :content_language, AllowNil(String), optional: true
25
- attribute :content_region, AllowNil(String), optional: true
26
- end
27
-
28
- version_1_base = ::MediaTypes::Scheme.new do
29
- attribute :updated_at, Types::Iso8601
30
-
31
- merge version_1_creation
32
-
33
- attribute :data do
34
- attribute :processed, Types::Boolean
35
- attribute :transcoded, Types::Boolean
36
- attribute :type, Types::ProductMovieType
37
- attribute :as, Types::ProductMovieHandler
38
-
39
- not_strict
40
- end
41
-
42
- link :self do
43
- attribute :type, Types::ProductMovieType
44
- end
45
-
46
- link :audio_fragment do
47
- attribute :content_digest, String
48
- end
49
- link :direct, allow_nil: true
50
-
51
- # link :original do
52
- # attribute :content_digest, String
53
- # attribute :width, Numeric
54
- # attribute :height, Numeric
55
- # end
56
- end
57
-
58
- attribute :product_video do
59
- merge version_1_base
60
- end
61
-
62
- view 'create' do
63
- attribute :product_video do
64
- merge version_1_creation
65
- not_strict
66
- end
67
- end
68
-
69
- view 'collection' do
70
- attribute :product_videos do
71
- collection :_embedded, version_1_base, allow_empty: true
72
- not_strict
73
- end
74
- end
75
-
76
- view :index do
77
- attribute :product_videos do
78
- collection :_index, allow_empty: true do
79
- attribute :href, Types::HttpUrl
80
- attribute :type, Types::ProductMovieType
81
- not_strict
82
- end
83
-
84
- not_strict
85
- end
86
- end
87
- end
88
- end
89
-
90
- registrations :product_video do
91
- view 'create', :create_product_video
92
- view 'index', :product_video_urls
93
- view 'collection', :product_videos
94
-
95
- type_alias 'product-video'
96
- type_alias 'video'
97
- end
98
- end
99
- end
100
- end
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
+ require_relative 'types/iso8601'
10
+ require_relative 'types/http_url'
11
+
12
+ module TrailerVote
13
+ module MediaTypes
14
+ class ProductVideo < BaseText
15
+ media_type 'product.video', defaults: { suffix: :json, version: 1 }
16
+
17
+ validations do
18
+ version 1 do
19
+ version_1_creation = ::MediaTypes::Scheme.new do
20
+ attribute :identifier, String
21
+ attribute :source_url, AnyOf(Types::HttpUrl, String)
22
+ attribute :expires_at, AllowNil(Types::Iso8601), optional: true
23
+
24
+ attribute :content_language, AllowNil(String), optional: true
25
+ attribute :content_region, AllowNil(String), optional: true
26
+ end
27
+
28
+ version_1_base = ::MediaTypes::Scheme.new do
29
+ attribute :updated_at, Types::Iso8601
30
+
31
+ merge version_1_creation
32
+
33
+ attribute :data do
34
+ attribute :processed, Types::Boolean
35
+ attribute :transcoded, Types::Boolean
36
+ attribute :type, Types::ProductMovieType
37
+ attribute :as, Types::ProductMovieHandler
38
+
39
+ not_strict
40
+ end
41
+
42
+ link :self do
43
+ attribute :type, Types::ProductMovieType
44
+ end
45
+
46
+ link :audio_fragment do
47
+ attribute :content_digest, String
48
+ end
49
+ link :direct, allow_nil: true
50
+
51
+ # link :original do
52
+ # attribute :content_digest, String
53
+ # attribute :width, Numeric
54
+ # attribute :height, Numeric
55
+ # end
56
+ end
57
+
58
+ attribute :product_video do
59
+ merge version_1_base
60
+ end
61
+
62
+ view 'create' do
63
+ attribute :product_video do
64
+ merge version_1_creation
65
+ not_strict
66
+ end
67
+ end
68
+
69
+ view 'collection' do
70
+ attribute :product_videos do
71
+ collection :_embedded, version_1_base, allow_empty: true
72
+ not_strict
73
+ end
74
+ end
75
+
76
+ view :index do
77
+ attribute :product_videos do
78
+ collection :_index, allow_empty: true do
79
+ attribute :href, Types::HttpUrl
80
+ attribute :type, Types::ProductMovieType
81
+ not_strict
82
+ end
83
+
84
+ not_strict
85
+ end
86
+ end
87
+ end
88
+ end
89
+
90
+ registrations :product_video do
91
+ view 'create', :create_product_video
92
+ view 'index', :product_video_urls
93
+ view 'collection', :product_videos
94
+
95
+ type_alias 'product-video'
96
+ type_alias 'video'
97
+ end
98
+ end
99
+ end
100
+ end
@@ -1,43 +1,43 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'base_text'
4
- require_relative 'partials/image_links'
5
- require_relative 'types/iso8601'
6
-
7
- module TrailerVote
8
- module MediaTypes
9
- class ProductsListing < BaseText
10
- media_type 'products_listing'
11
-
12
- defaults do
13
- suffix :json
14
- version 1
15
- end
16
-
17
- validations do
18
- version 1 do
19
- attribute :products_listing do
20
- collection :items, allow_empty: true do
21
- attribute :title, AllowNil(String)
22
- attribute :publish_date, AllowNil(Types::Iso8601)
23
-
24
- link :product
25
-
26
- attribute :image, expected_type: AllowNil(::Hash), allow_empty: true, optional: true do
27
- attribute :_embedded, expected_type: AllowNil(::Hash), allow_empty: true do
28
- merge Partials::IMAGE_LINKS
29
- end
30
- end
31
- end
32
-
33
- link :self
34
- end
35
- end
36
- end
37
-
38
- registrations :products_listing do
39
- type_alias 'products-listing'
40
- end
41
- end
42
- end
43
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'base_text'
4
+ require_relative 'partials/image_links'
5
+ require_relative 'types/iso8601'
6
+
7
+ module TrailerVote
8
+ module MediaTypes
9
+ class ProductsListing < BaseText
10
+ media_type 'products_listing'
11
+
12
+ defaults do
13
+ suffix :json
14
+ version 1
15
+ end
16
+
17
+ validations do
18
+ version 1 do
19
+ attribute :products_listing do
20
+ collection :items, allow_empty: true do
21
+ attribute :title, AllowNil(String)
22
+ attribute :publish_date, AllowNil(Types::Iso8601)
23
+
24
+ link :product
25
+
26
+ attribute :image, expected_type: AllowNil(::Hash), allow_empty: true, optional: true do
27
+ attribute :_embedded, expected_type: AllowNil(::Hash), allow_empty: true do
28
+ merge Partials::IMAGE_LINKS
29
+ end
30
+ end
31
+ end
32
+
33
+ link :self
34
+ end
35
+ end
36
+ end
37
+
38
+ registrations :products_listing do
39
+ type_alias 'products-listing'
40
+ end
41
+ end
42
+ end
43
+ end