trailer_vote-media_types 0.9.3 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +12 -12
  3. data/.rubocop.yml +29 -29
  4. data/.travis.yml +19 -19
  5. data/CHANGELOG.md +82 -82
  6. data/Gemfile +6 -6
  7. data/Gemfile.lock +51 -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 +35 -33
  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 +82 -61
  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/partials/image_links.rb +30 -30
  25. data/lib/trailer_vote/media_types/persona.rb +38 -38
  26. data/lib/trailer_vote/media_types/place.rb +106 -106
  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_manifest.rb +33 -0
  34. data/lib/trailer_vote/media_types/push_trivial_campaign.rb +32 -0
  35. data/lib/trailer_vote/media_types/sentiment_feedback.rb +100 -100
  36. data/lib/trailer_vote/media_types/types/boolean.rb +15 -15
  37. data/lib/trailer_vote/media_types/types/formatted_url.rb +51 -51
  38. data/lib/trailer_vote/media_types/types/http_url.rb +23 -23
  39. data/lib/trailer_vote/media_types/types/influx_db_connection_url.rb +10 -10
  40. data/lib/trailer_vote/media_types/types/iso8601.rb +10 -10
  41. data/lib/trailer_vote/media_types/types/product_data_type.rb +15 -15
  42. data/lib/trailer_vote/media_types/types/product_image_type.rb +25 -25
  43. data/lib/trailer_vote/media_types/types/product_movie_handler.rb +16 -16
  44. data/lib/trailer_vote/media_types/types/product_movie_type.rb +17 -17
  45. data/lib/trailer_vote/media_types/types/uuid_v4.rb +10 -10
  46. data/lib/trailer_vote/media_types/types/vote_value.rb +17 -17
  47. data/lib/trailer_vote/media_types/version.rb +7 -7
  48. data/trailer_vote-media_types.gemspec +41 -41
  49. metadata +8 -5
@@ -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
@@ -0,0 +1,33 @@
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
+
9
+ ##
10
+ # Media Type for Push Manifest
11
+ #
12
+ # The push manifest is a list of active push campaigns
13
+ #
14
+ class PushManifest < BaseText
15
+ media_type 'push_manifest', defaults: { suffix: :json, version: 1 }
16
+
17
+ validations do
18
+ version 1 do
19
+ attribute :push_manifest do
20
+ collection :campaigns do
21
+ link :audio_fragment
22
+ link :campaign
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+ registrations :push_manifest do
29
+ versions 1
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,32 @@
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
+
9
+ ##
10
+ # Media Types for Trivial Push Campaign
11
+ #
12
+ # The trivial push campaign is used to schedule a local push notification at a specified time.
13
+ #
14
+ class PushTrivialCampaign < BaseText
15
+ media_type 'push_campaign_trivial', defaults: { suffix: :json, version: 1 }
16
+
17
+ validations do
18
+ version 1 do
19
+ attribute :push_campaign_trivial do
20
+ link :action
21
+ attribute :message, String
22
+ attribute :schedule_at, Types::Iso8601
23
+ end
24
+ end
25
+ end
26
+
27
+ registrations :push_campaign_trivial do
28
+ versions 1
29
+ end
30
+ end
31
+ end
32
+ end
@@ -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