trailer_vote-media_types 2.3.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) 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 +8 -8
  7. data/Gemfile.lock +49 -51
  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.rb +1 -0
  13. data/lib/trailer_vote/media_types/audio_fragment.rb +108 -108
  14. data/lib/trailer_vote/media_types/base_text.rb +22 -22
  15. data/lib/trailer_vote/media_types/carousel.rb +42 -42
  16. data/lib/trailer_vote/media_types/client_configuration.rb +35 -35
  17. data/lib/trailer_vote/media_types/configuration.rb +139 -139
  18. data/lib/trailer_vote/media_types/errors.rb +31 -31
  19. data/lib/trailer_vote/media_types/feedback.rb +50 -50
  20. data/lib/trailer_vote/media_types/feedback_listing.rb +49 -49
  21. data/lib/trailer_vote/media_types/fingerprint_binary.rb +67 -67
  22. data/lib/trailer_vote/media_types/interactive_player.rb +33 -33
  23. data/lib/trailer_vote/media_types/issue.rb +64 -64
  24. data/lib/trailer_vote/media_types/ordered_fragment.rb +35 -35
  25. data/lib/trailer_vote/media_types/partials/image_links.rb +30 -30
  26. data/lib/trailer_vote/media_types/persona.rb +47 -47
  27. data/lib/trailer_vote/media_types/place.rb +143 -143
  28. data/lib/trailer_vote/media_types/product.rb +191 -191
  29. data/lib/trailer_vote/media_types/product_image.rb +96 -96
  30. data/lib/trailer_vote/media_types/product_lookup.rb +37 -37
  31. data/lib/trailer_vote/media_types/product_place_link.rb +36 -36
  32. data/lib/trailer_vote/media_types/product_video.rb +100 -100
  33. data/lib/trailer_vote/media_types/products_listing.rb +43 -43
  34. data/lib/trailer_vote/media_types/push_consent.rb +44 -44
  35. data/lib/trailer_vote/media_types/push_manifest.rb +44 -44
  36. data/lib/trailer_vote/media_types/push_token_android.rb +41 -41
  37. data/lib/trailer_vote/media_types/push_token_index.rb +42 -42
  38. data/lib/trailer_vote/media_types/push_token_ios.rb +41 -41
  39. data/lib/trailer_vote/media_types/push_trivial_campaign.rb +219 -219
  40. data/lib/trailer_vote/media_types/release_push_campaign.rb +77 -77
  41. data/lib/trailer_vote/media_types/sentiment_feedback.rb +100 -100
  42. data/lib/trailer_vote/media_types/types/boolean.rb +15 -15
  43. data/lib/trailer_vote/media_types/types/formatted_url.rb +51 -51
  44. data/lib/trailer_vote/media_types/types/http_url.rb +23 -23
  45. data/lib/trailer_vote/media_types/types/influx_db_connection_url.rb +10 -10
  46. data/lib/trailer_vote/media_types/types/iso8601.rb +10 -10
  47. data/lib/trailer_vote/media_types/types/local_time.rb +11 -11
  48. data/lib/trailer_vote/media_types/types/product_data_type.rb +15 -15
  49. data/lib/trailer_vote/media_types/types/product_image_type.rb +25 -25
  50. data/lib/trailer_vote/media_types/types/product_movie_handler.rb +16 -16
  51. data/lib/trailer_vote/media_types/types/product_movie_type.rb +17 -17
  52. data/lib/trailer_vote/media_types/types/uuid_v4.rb +10 -10
  53. data/lib/trailer_vote/media_types/types/vote_value.rb +17 -17
  54. data/lib/trailer_vote/media_types/version.rb +7 -7
  55. data/lib/trailer_vote/media_types/vista_config.rb +37 -0
  56. data/trailer_vote-media_types.gemspec +43 -43
  57. metadata +6 -5
@@ -1,100 +1,100 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'base_text'
4
- require_relative 'partials/image_links'
5
- require_relative 'types/product_image_type'
6
- require_relative 'types/iso8601'
7
-
8
- module TrailerVote
9
- module MediaTypes
10
- class SentimentFeedback < BaseText
11
- media_type 'sentiment_feedback', defaults: { suffix: :json, version: 2 }
12
-
13
- validations do
14
-
15
- version 2 do
16
- attribute :sentiment_feedback do
17
- attribute :title, String
18
- attribute :description, AllowNil(String)
19
-
20
- attribute :image, expected_type: AllowNil(::Hash), allow_empty: true, optional: true do
21
- attribute :_embedded do
22
- attribute :identifier, String
23
- attribute :updated_at, Types::Iso8601
24
- attribute :type, Types::ProductImageType
25
-
26
- merge Partials::IMAGE_LINKS
27
- end
28
- end
29
-
30
- link :self
31
- link :feedback
32
- end
33
- end
34
-
35
- version 1 do
36
- attribute :sentiment_feedback do
37
- attribute :title, String
38
- attribute :description, AllowNil(String)
39
-
40
- attribute :images do
41
- collection :_embedded, allow_empty: true do
42
- attribute :identifier, String
43
- attribute :updated_at, Types::Iso8601
44
- attribute :asset_type, Types::ProductImageTypeV1
45
-
46
- link :self
47
- link :original do
48
- attribute :content_digest, String
49
- attribute :width, Numeric
50
- attribute :height, Numeric
51
- end
52
- link :thumbnail, optional: true do
53
- attribute :content_digest, String
54
- attribute :width, Numeric
55
- attribute :height, Numeric
56
- end
57
- link :xlarge, optional: true do
58
- attribute :content_digest, String
59
- attribute :width, Numeric
60
- attribute :height, Numeric
61
- end
62
- link :large, optional: true do
63
- attribute :content_digest, String
64
- attribute :width, Numeric
65
- attribute :height, Numeric
66
- end
67
- link :medium, optional: true do
68
- attribute :content_digest, String
69
- attribute :width, Numeric
70
- attribute :height, Numeric
71
- end
72
- link :small, optional: true do
73
- attribute :content_digest, String
74
- attribute :width, Numeric
75
- attribute :height, Numeric
76
- end
77
- link :xsmall, optional: true do
78
- attribute :content_digest, String
79
- attribute :width, Numeric
80
- attribute :height, Numeric
81
- end
82
-
83
- not_strict
84
- end
85
- end
86
-
87
- link :self
88
- link :feedback
89
- end
90
- end
91
- end
92
-
93
- registrations :sentiment_feedback do
94
- type_alias 'feedback.sentiment'
95
-
96
- versions 1,2
97
- end
98
- end
99
- end
100
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'base_text'
4
+ require_relative 'partials/image_links'
5
+ require_relative 'types/product_image_type'
6
+ require_relative 'types/iso8601'
7
+
8
+ module TrailerVote
9
+ module MediaTypes
10
+ class SentimentFeedback < BaseText
11
+ media_type 'sentiment_feedback', defaults: { suffix: :json, version: 2 }
12
+
13
+ validations do
14
+
15
+ version 2 do
16
+ attribute :sentiment_feedback do
17
+ attribute :title, String
18
+ attribute :description, AllowNil(String)
19
+
20
+ attribute :image, expected_type: AllowNil(::Hash), allow_empty: true, optional: true do
21
+ attribute :_embedded do
22
+ attribute :identifier, String
23
+ attribute :updated_at, Types::Iso8601
24
+ attribute :type, Types::ProductImageType
25
+
26
+ merge Partials::IMAGE_LINKS
27
+ end
28
+ end
29
+
30
+ link :self
31
+ link :feedback
32
+ end
33
+ end
34
+
35
+ version 1 do
36
+ attribute :sentiment_feedback do
37
+ attribute :title, String
38
+ attribute :description, AllowNil(String)
39
+
40
+ attribute :images do
41
+ collection :_embedded, allow_empty: true do
42
+ attribute :identifier, String
43
+ attribute :updated_at, Types::Iso8601
44
+ attribute :asset_type, Types::ProductImageTypeV1
45
+
46
+ link :self
47
+ link :original do
48
+ attribute :content_digest, String
49
+ attribute :width, Numeric
50
+ attribute :height, Numeric
51
+ end
52
+ link :thumbnail, optional: true do
53
+ attribute :content_digest, String
54
+ attribute :width, Numeric
55
+ attribute :height, Numeric
56
+ end
57
+ link :xlarge, optional: true do
58
+ attribute :content_digest, String
59
+ attribute :width, Numeric
60
+ attribute :height, Numeric
61
+ end
62
+ link :large, optional: true do
63
+ attribute :content_digest, String
64
+ attribute :width, Numeric
65
+ attribute :height, Numeric
66
+ end
67
+ link :medium, optional: true do
68
+ attribute :content_digest, String
69
+ attribute :width, Numeric
70
+ attribute :height, Numeric
71
+ end
72
+ link :small, optional: true do
73
+ attribute :content_digest, String
74
+ attribute :width, Numeric
75
+ attribute :height, Numeric
76
+ end
77
+ link :xsmall, optional: true do
78
+ attribute :content_digest, String
79
+ attribute :width, Numeric
80
+ attribute :height, Numeric
81
+ end
82
+
83
+ not_strict
84
+ end
85
+ end
86
+
87
+ link :self
88
+ link :feedback
89
+ end
90
+ end
91
+ end
92
+
93
+ registrations :sentiment_feedback do
94
+ type_alias 'feedback.sentiment'
95
+
96
+ versions 1,2
97
+ end
98
+ end
99
+ end
100
+ end
@@ -1,15 +1,15 @@
1
- # frozen_string_literal: true
2
-
3
- require 'media_types'
4
-
5
- module TrailerVote
6
- module MediaTypes
7
- module Types
8
- # noinspection RubyConstantNamingConvention
9
- Boolean = ::MediaTypes::Scheme.AnyOf(
10
- TrueClass,
11
- FalseClass
12
- )
13
- end
14
- end
15
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'media_types'
4
+
5
+ module TrailerVote
6
+ module MediaTypes
7
+ module Types
8
+ # noinspection RubyConstantNamingConvention
9
+ Boolean = ::MediaTypes::Scheme.AnyOf(
10
+ TrueClass,
11
+ FalseClass
12
+ )
13
+ end
14
+ end
15
+ end
@@ -1,51 +1,51 @@
1
- # frozen_string_literal: true
2
-
3
- module TrailerVote
4
- module MediaTypes
5
- module Types
6
- module_function
7
-
8
- class FormattedUrl
9
-
10
- class UnexpectedFormatVariable < ::MediaTypes::Scheme::ValidationError
11
- def initialize(variables:, actual:)
12
- self.variables = variables
13
- self.actual = actual
14
- end
15
-
16
- def message
17
- format(
18
- 'Expected a formatted url only containing %<variables>s, instead got %<actual>s',
19
- variables: variables,
20
- actual: actual
21
- )
22
- end
23
-
24
- private
25
-
26
- attr_accessor :variables, :actual
27
- end
28
-
29
- def initialize(*variables)
30
- @variables = variables.map { |variable| "{#{variable}}" }
31
- variable_options = @variables.map { |variable| Regexp.escape(variable) }
32
- sections_first = "(?>#{variable_options.push('[^\s\/$.?#\{\}]').join('|')})"
33
- sections_not_first = "(?>#{variable_options.push('[^\\s\\{\\}]').join('|')})"
34
-
35
- @test = %r{^https?:\/\/#{sections_first}#{sections_not_first}*$}
36
- end
37
-
38
- def ===(other)
39
- return true if @test.match?(other)
40
- raise UnexpectedFormatVariable.new(variables: @variables, actual: other)
41
- end
42
- end
43
-
44
- # noinspection RubyInstanceMethodNamingConvention
45
- #
46
- def makeFormattedUrl(*variables) # rubocop:disable Naming/MethodName
47
- FormattedUrl.new(*variables)
48
- end
49
- end
50
- end
51
- end
1
+ # frozen_string_literal: true
2
+
3
+ module TrailerVote
4
+ module MediaTypes
5
+ module Types
6
+ module_function
7
+
8
+ class FormattedUrl
9
+
10
+ class UnexpectedFormatVariable < ::MediaTypes::Scheme::ValidationError
11
+ def initialize(variables:, actual:)
12
+ self.variables = variables
13
+ self.actual = actual
14
+ end
15
+
16
+ def message
17
+ format(
18
+ 'Expected a formatted url only containing %<variables>s, instead got %<actual>s',
19
+ variables: variables,
20
+ actual: actual
21
+ )
22
+ end
23
+
24
+ private
25
+
26
+ attr_accessor :variables, :actual
27
+ end
28
+
29
+ def initialize(*variables)
30
+ @variables = variables.map { |variable| "{#{variable}}" }
31
+ variable_options = @variables.map { |variable| Regexp.escape(variable) }
32
+ sections_first = "(?>#{variable_options.push('[^\s\/$.?#\{\}]').join('|')})"
33
+ sections_not_first = "(?>#{variable_options.push('[^\\s\\{\\}]').join('|')})"
34
+
35
+ @test = %r{^https?:\/\/#{sections_first}#{sections_not_first}*$}
36
+ end
37
+
38
+ def ===(other)
39
+ return true if @test.match?(other)
40
+ raise UnexpectedFormatVariable.new(variables: @variables, actual: other)
41
+ end
42
+ end
43
+
44
+ # noinspection RubyInstanceMethodNamingConvention
45
+ #
46
+ def makeFormattedUrl(*variables) # rubocop:disable Naming/MethodName
47
+ FormattedUrl.new(*variables)
48
+ end
49
+ end
50
+ end
51
+ end
@@ -1,23 +1,23 @@
1
- # frozen_string_literal: true
2
-
3
- module TrailerVote
4
- module MediaTypes
5
- module Types
6
- # noinspection RubyConstantNamingConvention
7
- #
8
- # https://mathiasbynens.be/demo/url-regex
9
- #
10
- # RFC compliant for http, https and ftp:
11
- # _^(?:(?:https?|ftp)://)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})
12
- # (?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})
13
- # (?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.
14
- # (?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)(?:\.
15
- # (?:[a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}-\x{ffff}]{2,})))(?::\d{2,5})?
16
- # (?:/[^\s]*)?$_iuS
17
- #
18
- # The one used here actually passes all valid urls, but just doesn't reject ALL invalid ones
19
- #
20
- HttpUrl = %r{^https?:\/\/[^\s\/$.?#].[^\s]*$} # rubocop:disable Naming/ConstantName
21
- end
22
- end
23
- end
1
+ # frozen_string_literal: true
2
+
3
+ module TrailerVote
4
+ module MediaTypes
5
+ module Types
6
+ # noinspection RubyConstantNamingConvention
7
+ #
8
+ # https://mathiasbynens.be/demo/url-regex
9
+ #
10
+ # RFC compliant for http, https and ftp:
11
+ # _^(?:(?:https?|ftp)://)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})
12
+ # (?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})
13
+ # (?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.
14
+ # (?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)(?:\.
15
+ # (?:[a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}-\x{ffff}]{2,})))(?::\d{2,5})?
16
+ # (?:/[^\s]*)?$_iuS
17
+ #
18
+ # The one used here actually passes all valid urls, but just doesn't reject ALL invalid ones
19
+ #
20
+ HttpUrl = %r{^https?:\/\/[^\s\/$.?#].[^\s]*$} # rubocop:disable Naming/ConstantName
21
+ end
22
+ end
23
+ end
@@ -1,10 +1,10 @@
1
- # frozen_string_literal: true
2
-
3
- module TrailerVote
4
- module MediaTypes
5
- module Types
6
- # noinspection RubyConstantNamingConvention
7
- InfluxDbConnectionUrl = %r{^https?:\/\/[^\s\/$.?#].[^\s]*$} # rubocop:disable Naming/ConstantName
8
- end
9
- end
10
- end
1
+ # frozen_string_literal: true
2
+
3
+ module TrailerVote
4
+ module MediaTypes
5
+ module Types
6
+ # noinspection RubyConstantNamingConvention
7
+ InfluxDbConnectionUrl = %r{^https?:\/\/[^\s\/$.?#].[^\s]*$} # rubocop:disable Naming/ConstantName
8
+ end
9
+ end
10
+ end
@@ -1,10 +1,10 @@
1
- # frozen_string_literal: true
2
-
3
- module TrailerVote
4
- module MediaTypes
5
- module Types
6
- # noinspection RubyConstantNamingConvention
7
- Iso8601 = /^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/ # rubocop:disable Naming/ConstantName
8
- end
9
- end
10
- end
1
+ # frozen_string_literal: true
2
+
3
+ module TrailerVote
4
+ module MediaTypes
5
+ module Types
6
+ # noinspection RubyConstantNamingConvention
7
+ Iso8601 = /^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/ # rubocop:disable Naming/ConstantName
8
+ end
9
+ end
10
+ end
@@ -1,11 +1,11 @@
1
- # frozen_string_literal: true
2
-
3
- module TrailerVote
4
- module MediaTypes
5
- module Types
6
- # noinspection RubyConstantNamingConvention
7
- # |60 seconds notation needed to support leap second
8
- LocalTime = /^(0[0-9]|1[0-9]|2[0-3]|[0-9]):([0-5][0-9]):([0-5][0-9]|60)$/ # rubocop:disable Naming/ConstantName, Style/MutableConstant
9
- end
10
- end
11
- end
1
+ # frozen_string_literal: true
2
+
3
+ module TrailerVote
4
+ module MediaTypes
5
+ module Types
6
+ # noinspection RubyConstantNamingConvention
7
+ # |60 seconds notation needed to support leap second
8
+ LocalTime = /^(0[0-9]|1[0-9]|2[0-3]|[0-9]):([0-5][0-9]):([0-5][0-9]|60)$/ # rubocop:disable Naming/ConstantName, Style/MutableConstant
9
+ end
10
+ end
11
+ end