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.
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,139 +1,139 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'base_text'
4
- require_relative 'types/influx_db_connection_url'
5
- require_relative 'types/formatted_url'
6
-
7
- module TrailerVote
8
- module MediaTypes
9
-
10
- ##
11
- # Media Types for Configuration
12
- #
13
- class Configuration < BaseText
14
- media_type 'configuration', defaults: { suffix: :json, version: 5 }
15
-
16
- validations do
17
-
18
- version 5 do
19
- attribute :configuration do
20
- link :self
21
- link :place
22
- link :push_manifest
23
- link :products
24
- link :product_lookup
25
- link :persona do
26
- attribute :href, Types.makeFormattedUrl(:uuid)
27
- attribute :templated, TrueClass
28
- end
29
- link :lookup do
30
- attribute :href, Types.makeFormattedUrl(:authority, :identifier)
31
- attribute :templated, TrueClass
32
- end
33
- link :analytics do
34
- attribute :href, Types::InfluxDbConnectionUrl
35
- end
36
- link :telemetrics do
37
- attribute :href, Types::InfluxDbConnectionUrl
38
- end
39
- link :issues
40
- link :persona_config do
41
- attribute :href, Types.makeFormattedUrl(:persona)
42
- attribute :templated, TrueClass
43
- end
44
- attribute :customer_config
45
- end
46
- end
47
-
48
- version 4 do
49
- attribute :configuration do
50
- link :self
51
- link :place
52
- link :push_manifest
53
- link :products
54
- link :product_lookup
55
- link :persona do
56
- attribute :href, Types.makeFormattedUrl(:uuid)
57
- attribute :templated, TrueClass
58
- end
59
- link :analytics do
60
- attribute :href, Types::InfluxDbConnectionUrl
61
- end
62
- link :telemetrics do
63
- attribute :href, Types::InfluxDbConnectionUrl
64
- end
65
- link :issues
66
- link :persona_config do
67
- attribute :href, Types.makeFormattedUrl(:persona)
68
- attribute :templated, TrueClass
69
- end
70
- attribute :customer_config
71
- end
72
- end
73
-
74
- version 3 do
75
- attribute :configuration do
76
- link :self
77
- link :place
78
- link :push_manifest
79
- link :products
80
- link :product_lookup
81
- link :persona do
82
- attribute :href, Types.makeFormattedUrl(:uuid)
83
- attribute :templated, TrueClass
84
- end
85
- link :analytics do
86
- attribute :href, Types::InfluxDbConnectionUrl
87
- end
88
- link :telemetrics do
89
- attribute :href, Types::InfluxDbConnectionUrl
90
- end
91
- link :issues
92
- end
93
- end
94
-
95
- version 2 do
96
- attribute :configuration do
97
- link :self
98
- link :place
99
- link :products
100
- link :product_lookup
101
- link :persona do
102
- attribute :href, Types.makeFormattedUrl(:uuid)
103
- attribute :templated, TrueClass
104
- end
105
- link :analytics do
106
- attribute :href, Types::InfluxDbConnectionUrl
107
- end
108
- link :telemetrics do
109
- attribute :href, Types::InfluxDbConnectionUrl
110
- end
111
- link :issues
112
- end
113
- end
114
-
115
- version 1 do
116
- attribute :configuration do
117
- link :place
118
- link :products
119
- link :feedback do
120
- attribute :href, Types.makeFormattedUrl(:uuid)
121
- attribute :templated, TrueClass
122
- end
123
- link :persona do
124
- attribute :href, Types.makeFormattedUrl(:uuid)
125
- attribute :templated, TrueClass
126
- end
127
- link :analytics do
128
- attribute :href, AllowNil(Types::InfluxDbConnectionUrl)
129
- end
130
- end
131
- end
132
- end
133
-
134
- registrations :configuration do
135
- versions 1, 2, 3
136
- end
137
- end
138
- end
139
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'base_text'
4
+ require_relative 'types/influx_db_connection_url'
5
+ require_relative 'types/formatted_url'
6
+
7
+ module TrailerVote
8
+ module MediaTypes
9
+
10
+ ##
11
+ # Media Types for Configuration
12
+ #
13
+ class Configuration < BaseText
14
+ media_type 'configuration', defaults: { suffix: :json, version: 5 }
15
+
16
+ validations do
17
+
18
+ version 5 do
19
+ attribute :configuration do
20
+ link :self
21
+ link :place
22
+ link :push_manifest
23
+ link :products
24
+ link :product_lookup
25
+ link :persona do
26
+ attribute :href, Types.makeFormattedUrl(:uuid)
27
+ attribute :templated, TrueClass
28
+ end
29
+ link :lookup do
30
+ attribute :href, Types.makeFormattedUrl(:authority, :identifier)
31
+ attribute :templated, TrueClass
32
+ end
33
+ link :analytics do
34
+ attribute :href, Types::InfluxDbConnectionUrl
35
+ end
36
+ link :telemetrics do
37
+ attribute :href, Types::InfluxDbConnectionUrl
38
+ end
39
+ link :issues
40
+ link :persona_config do
41
+ attribute :href, Types.makeFormattedUrl(:persona)
42
+ attribute :templated, TrueClass
43
+ end
44
+ attribute :customer_config
45
+ end
46
+ end
47
+
48
+ version 4 do
49
+ attribute :configuration do
50
+ link :self
51
+ link :place
52
+ link :push_manifest
53
+ link :products
54
+ link :product_lookup
55
+ link :persona do
56
+ attribute :href, Types.makeFormattedUrl(:uuid)
57
+ attribute :templated, TrueClass
58
+ end
59
+ link :analytics do
60
+ attribute :href, Types::InfluxDbConnectionUrl
61
+ end
62
+ link :telemetrics do
63
+ attribute :href, Types::InfluxDbConnectionUrl
64
+ end
65
+ link :issues
66
+ link :persona_config do
67
+ attribute :href, Types.makeFormattedUrl(:persona)
68
+ attribute :templated, TrueClass
69
+ end
70
+ attribute :customer_config
71
+ end
72
+ end
73
+
74
+ version 3 do
75
+ attribute :configuration do
76
+ link :self
77
+ link :place
78
+ link :push_manifest
79
+ link :products
80
+ link :product_lookup
81
+ link :persona do
82
+ attribute :href, Types.makeFormattedUrl(:uuid)
83
+ attribute :templated, TrueClass
84
+ end
85
+ link :analytics do
86
+ attribute :href, Types::InfluxDbConnectionUrl
87
+ end
88
+ link :telemetrics do
89
+ attribute :href, Types::InfluxDbConnectionUrl
90
+ end
91
+ link :issues
92
+ end
93
+ end
94
+
95
+ version 2 do
96
+ attribute :configuration do
97
+ link :self
98
+ link :place
99
+ link :products
100
+ link :product_lookup
101
+ link :persona do
102
+ attribute :href, Types.makeFormattedUrl(:uuid)
103
+ attribute :templated, TrueClass
104
+ end
105
+ link :analytics do
106
+ attribute :href, Types::InfluxDbConnectionUrl
107
+ end
108
+ link :telemetrics do
109
+ attribute :href, Types::InfluxDbConnectionUrl
110
+ end
111
+ link :issues
112
+ end
113
+ end
114
+
115
+ version 1 do
116
+ attribute :configuration do
117
+ link :place
118
+ link :products
119
+ link :feedback do
120
+ attribute :href, Types.makeFormattedUrl(:uuid)
121
+ attribute :templated, TrueClass
122
+ end
123
+ link :persona do
124
+ attribute :href, Types.makeFormattedUrl(:uuid)
125
+ attribute :templated, TrueClass
126
+ end
127
+ link :analytics do
128
+ attribute :href, AllowNil(Types::InfluxDbConnectionUrl)
129
+ end
130
+ end
131
+ end
132
+ end
133
+
134
+ registrations :configuration do
135
+ versions 1, 2, 3
136
+ end
137
+ end
138
+ end
139
+ end
@@ -1,31 +1,31 @@
1
- # frozen_string_literal: true
2
-
3
- require 'trailer_vote/media_types/base_text'
4
-
5
- module TrailerVote
6
- module MediaTypes
7
- ##
8
- # Media Types for errors
9
- #
10
- # All errors given back to any TrailerVote service have this media type. In order to ensure correct error
11
- # content-type negotiation, clients SHOULD include the media type with a reduced quality param q in the Accept
12
- # header of each request. The RECOMMENDED value for q is 0.1.
13
- #
14
- class Errors < BaseText
15
- media_type 'errors', defaults: { suffix: :json, version: 1 }
16
-
17
- validations do
18
- version 1 do
19
- collection :errors do
20
- attribute :message, String
21
- attribute :code, AllowNil(String)
22
- end
23
- end
24
- end
25
-
26
- registrations :errors do
27
- versions 1
28
- end
29
- end
30
- end
31
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'trailer_vote/media_types/base_text'
4
+
5
+ module TrailerVote
6
+ module MediaTypes
7
+ ##
8
+ # Media Types for errors
9
+ #
10
+ # All errors given back to any TrailerVote service have this media type. In order to ensure correct error
11
+ # content-type negotiation, clients SHOULD include the media type with a reduced quality param q in the Accept
12
+ # header of each request. The RECOMMENDED value for q is 0.1.
13
+ #
14
+ class Errors < BaseText
15
+ media_type 'errors', defaults: { suffix: :json, version: 1 }
16
+
17
+ validations do
18
+ version 1 do
19
+ collection :errors do
20
+ attribute :message, String
21
+ attribute :code, AllowNil(String)
22
+ end
23
+ end
24
+ end
25
+
26
+ registrations :errors do
27
+ versions 1
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,50 +1,50 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'base_text'
4
- require_relative 'types/uuid_v4'
5
- require_relative 'types/vote_value'
6
- require_relative 'types/iso8601'
7
-
8
- module TrailerVote
9
- module MediaTypes
10
- class Feedback < BaseText
11
- media_type 'feedback', defaults: { suffix: :json, version: 1 }
12
-
13
- validations do
14
- version 1 do
15
- version_1_base = ::MediaTypes::Scheme.new do
16
- attribute :value, Types::VoteValue
17
- attribute :updated_at, Types::Iso8601
18
-
19
- link :audio_fragment
20
- link :product
21
- link :persona
22
- end
23
-
24
- attribute :feedback do
25
- merge version_1_base
26
- end
27
-
28
- view 'collection' do
29
- attribute :feedback do
30
- collection :_embedded, version_1_base, allow_empty: true
31
- not_strict
32
- end
33
- end
34
-
35
- view 'create' do
36
- attribute :feedback do
37
- attribute :persona, Types::UuidV4
38
- attribute :value, Types::VoteValue
39
- end
40
- end
41
- end
42
- end
43
-
44
- registrations :feedback do
45
- view 'create', :create_feedback
46
- view 'collection', :feedback_collection
47
- end
48
- end
49
- end
50
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'base_text'
4
+ require_relative 'types/uuid_v4'
5
+ require_relative 'types/vote_value'
6
+ require_relative 'types/iso8601'
7
+
8
+ module TrailerVote
9
+ module MediaTypes
10
+ class Feedback < BaseText
11
+ media_type 'feedback', defaults: { suffix: :json, version: 1 }
12
+
13
+ validations do
14
+ version 1 do
15
+ version_1_base = ::MediaTypes::Scheme.new do
16
+ attribute :value, Types::VoteValue
17
+ attribute :updated_at, Types::Iso8601
18
+
19
+ link :audio_fragment
20
+ link :product
21
+ link :persona
22
+ end
23
+
24
+ attribute :feedback do
25
+ merge version_1_base
26
+ end
27
+
28
+ view 'collection' do
29
+ attribute :feedback do
30
+ collection :_embedded, version_1_base, allow_empty: true
31
+ not_strict
32
+ end
33
+ end
34
+
35
+ view 'create' do
36
+ attribute :feedback do
37
+ attribute :persona, Types::UuidV4
38
+ attribute :value, Types::VoteValue
39
+ end
40
+ end
41
+ end
42
+ end
43
+
44
+ registrations :feedback do
45
+ view 'create', :create_feedback
46
+ view 'collection', :feedback_collection
47
+ end
48
+ end
49
+ end
50
+ end
@@ -1,49 +1,49 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'base_text'
4
- require_relative 'types/vote_value'
5
- require_relative 'types/iso8601'
6
- require_relative 'partials/image_links'
7
-
8
- module TrailerVote
9
- module MediaTypes
10
- class FeedbackListing < BaseText
11
- media_type 'feedback_listing'
12
-
13
- defaults do
14
- suffix :json
15
- version 1
16
- end
17
-
18
- validations do
19
- version 1 do
20
- attribute :feedback_listing do
21
- collection :items, allow_empty: true do
22
- attribute :title, AllowNil(String)
23
- attribute :value, Types::VoteValue
24
- attribute :updated_at, Types::Iso8601
25
-
26
- link :audio_fragment
27
- link :product
28
- link :persona
29
- link :feedback
30
- link :interactive_player
31
-
32
- attribute :image, expected_type: AllowNil(::Hash), allow_empty: true, optional: true do
33
- attribute :_embedded, expected_type: AllowNil(::Hash), allow_empty: true do
34
- merge Partials::IMAGE_LINKS
35
- end
36
- end
37
- end
38
-
39
- link :self
40
- end
41
- end
42
- end
43
-
44
- registrations :feedback_listing do
45
- type_alias 'feedback-listing'
46
- end
47
- end
48
- end
49
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'base_text'
4
+ require_relative 'types/vote_value'
5
+ require_relative 'types/iso8601'
6
+ require_relative 'partials/image_links'
7
+
8
+ module TrailerVote
9
+ module MediaTypes
10
+ class FeedbackListing < BaseText
11
+ media_type 'feedback_listing'
12
+
13
+ defaults do
14
+ suffix :json
15
+ version 1
16
+ end
17
+
18
+ validations do
19
+ version 1 do
20
+ attribute :feedback_listing do
21
+ collection :items, allow_empty: true do
22
+ attribute :title, AllowNil(String)
23
+ attribute :value, Types::VoteValue
24
+ attribute :updated_at, Types::Iso8601
25
+
26
+ link :audio_fragment
27
+ link :product
28
+ link :persona
29
+ link :feedback
30
+ link :interactive_player
31
+
32
+ attribute :image, expected_type: AllowNil(::Hash), allow_empty: true, optional: true do
33
+ attribute :_embedded, expected_type: AllowNil(::Hash), allow_empty: true do
34
+ merge Partials::IMAGE_LINKS
35
+ end
36
+ end
37
+ end
38
+
39
+ link :self
40
+ end
41
+ end
42
+ end
43
+
44
+ registrations :feedback_listing do
45
+ type_alias 'feedback-listing'
46
+ end
47
+ end
48
+ end
49
+ end
@@ -1,67 +1,67 @@
1
- # frozen_string_literal: true
2
-
3
- require 'media_types'
4
-
5
- module TrailerVote
6
- module MediaTypes
7
-
8
- ##
9
- # Media Types for Fingerprints
10
- #
11
- # Clients **MUST** match the version of their audio fingerprinter and this media type version. This is a binary
12
- # media type and returns a file or {Errors}.
13
- #
14
- class FingerprintBinary
15
- include ::MediaTypes::Dsl
16
-
17
- def self.base_format
18
- 'application/vnd.trailervote.fingerprint.v%<version>s'
19
- end
20
-
21
- media_type 'fingerprint', defaults: { version: '~' }
22
-
23
- class Current < FingerprintBinary
24
- media_type 'fingerprint', defaults: { version: 'C' }
25
-
26
- class << self
27
- def register(version:, **___)
28
- mime_type = FingerprintBinary.to_constructable.version(version).to_s
29
-
30
- Array(
31
- ::MediaTypes::Registerable.new(
32
- mime_type,
33
- symbol: :fingerprint_bin,
34
- aliases: []
35
- ).tap { |registerable| ::MediaTypes.register(registerable) }
36
- )
37
- end
38
- end
39
- end
40
-
41
- class Deprecated < FingerprintBinary
42
- def self.base_format
43
- 'application/vnd.trailervote.fingerprint.deprecated'
44
- end
45
-
46
- media_type 'fingerprint.deprecated', defaults: { version: nil }
47
-
48
- class << self
49
-
50
- def register(versions:, **___)
51
- aliases = versions.map do |version|
52
- FingerprintBinary.to_constructable.version(version).to_s
53
- end
54
-
55
- Array(
56
- ::MediaTypes::Registerable.new(
57
- base_format,
58
- symbol: :fingerprint_deprecated_bin,
59
- aliases: aliases
60
- ).tap { |registerable| ::MediaTypes.register(registerable) }
61
- )
62
- end
63
- end
64
- end
65
- end
66
- end
67
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'media_types'
4
+
5
+ module TrailerVote
6
+ module MediaTypes
7
+
8
+ ##
9
+ # Media Types for Fingerprints
10
+ #
11
+ # Clients **MUST** match the version of their audio fingerprinter and this media type version. This is a binary
12
+ # media type and returns a file or {Errors}.
13
+ #
14
+ class FingerprintBinary
15
+ include ::MediaTypes::Dsl
16
+
17
+ def self.base_format
18
+ 'application/vnd.trailervote.fingerprint.v%<version>s'
19
+ end
20
+
21
+ media_type 'fingerprint', defaults: { version: '~' }
22
+
23
+ class Current < FingerprintBinary
24
+ media_type 'fingerprint', defaults: { version: 'C' }
25
+
26
+ class << self
27
+ def register(version:, **___)
28
+ mime_type = FingerprintBinary.to_constructable.version(version).to_s
29
+
30
+ Array(
31
+ ::MediaTypes::Registerable.new(
32
+ mime_type,
33
+ symbol: :fingerprint_bin,
34
+ aliases: []
35
+ ).tap { |registerable| ::MediaTypes.register(registerable) }
36
+ )
37
+ end
38
+ end
39
+ end
40
+
41
+ class Deprecated < FingerprintBinary
42
+ def self.base_format
43
+ 'application/vnd.trailervote.fingerprint.deprecated'
44
+ end
45
+
46
+ media_type 'fingerprint.deprecated', defaults: { version: nil }
47
+
48
+ class << self
49
+
50
+ def register(versions:, **___)
51
+ aliases = versions.map do |version|
52
+ FingerprintBinary.to_constructable.version(version).to_s
53
+ end
54
+
55
+ Array(
56
+ ::MediaTypes::Registerable.new(
57
+ base_format,
58
+ symbol: :fingerprint_deprecated_bin,
59
+ aliases: aliases
60
+ ).tap { |registerable| ::MediaTypes.register(registerable) }
61
+ )
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end