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,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
@@ -1,33 +1,33 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'base_text'
4
-
5
- module TrailerVote
6
- module MediaTypes
7
- class InteractivePlayer < BaseText
8
- media_type 'interactive_player'
9
-
10
- defaults do
11
- suffix :json
12
- version 1
13
- end
14
-
15
- validations do
16
- version 1 do
17
- attribute :interactive_player do
18
- attribute :title, AllowNil(String)
19
-
20
- link :self
21
- link :advert
22
- link :direct
23
- link :product
24
- end
25
- end
26
- end
27
-
28
- registrations :interactive_player do
29
- type_alias 'interactive-player'
30
- end
31
- end
32
- end
33
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'base_text'
4
+
5
+ module TrailerVote
6
+ module MediaTypes
7
+ class InteractivePlayer < BaseText
8
+ media_type 'interactive_player'
9
+
10
+ defaults do
11
+ suffix :json
12
+ version 1
13
+ end
14
+
15
+ validations do
16
+ version 1 do
17
+ attribute :interactive_player do
18
+ attribute :title, AllowNil(String)
19
+
20
+ link :self
21
+ link :advert
22
+ link :direct
23
+ link :product
24
+ end
25
+ end
26
+ end
27
+
28
+ registrations :interactive_player do
29
+ type_alias 'interactive-player'
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,64 +1,64 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'base_text'
4
- require_relative 'types/iso8601'
5
-
6
- module TrailerVote
7
- module MediaTypes
8
- class Issue < BaseText
9
- media_type 'issue', defaults: { suffix: :json, version: 1 }
10
-
11
- validations do
12
- index_scheme = ::MediaTypes::Scheme.new do
13
- attribute :issues do
14
- collection :_index, allow_empty: true do
15
- attribute :href, Types::HttpUrl
16
- not_strict
17
- end
18
-
19
- not_strict
20
- end
21
- end
22
-
23
- version 1 do
24
- version_1_base = ::MediaTypes::Scheme.new do
25
- attribute :error_name, String
26
- attribute :error_message, String
27
-
28
- attribute :rescue_context do
29
- attribute :caller, String
30
- attribute :args, ::Hash, allow_empty: true do
31
- not_strict
32
- end
33
- end
34
- end
35
-
36
- attribute :issue do
37
- merge version_1_base
38
- attribute :updated_at, Types::Iso8601
39
-
40
- link :self
41
- end
42
-
43
- view 'create' do
44
- attribute :issue do
45
- merge version_1_base
46
- end
47
- end
48
-
49
- view 'index' do
50
- merge index_scheme
51
- end
52
- end
53
- end
54
-
55
- registrations :issue do
56
- view 'create', :create_issue
57
- view 'index', :issue_urls
58
-
59
- versions 1
60
- end
61
-
62
- end
63
- end
64
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'base_text'
4
+ require_relative 'types/iso8601'
5
+
6
+ module TrailerVote
7
+ module MediaTypes
8
+ class Issue < BaseText
9
+ media_type 'issue', defaults: { suffix: :json, version: 1 }
10
+
11
+ validations do
12
+ index_scheme = ::MediaTypes::Scheme.new do
13
+ attribute :issues do
14
+ collection :_index, allow_empty: true do
15
+ attribute :href, Types::HttpUrl
16
+ not_strict
17
+ end
18
+
19
+ not_strict
20
+ end
21
+ end
22
+
23
+ version 1 do
24
+ version_1_base = ::MediaTypes::Scheme.new do
25
+ attribute :error_name, String
26
+ attribute :error_message, String
27
+
28
+ attribute :rescue_context do
29
+ attribute :caller, String
30
+ attribute :args, ::Hash, allow_empty: true do
31
+ not_strict
32
+ end
33
+ end
34
+ end
35
+
36
+ attribute :issue do
37
+ merge version_1_base
38
+ attribute :updated_at, Types::Iso8601
39
+
40
+ link :self
41
+ end
42
+
43
+ view 'create' do
44
+ attribute :issue do
45
+ merge version_1_base
46
+ end
47
+ end
48
+
49
+ view 'index' do
50
+ merge index_scheme
51
+ end
52
+ end
53
+ end
54
+
55
+ registrations :issue do
56
+ view 'create', :create_issue
57
+ view 'index', :issue_urls
58
+
59
+ versions 1
60
+ end
61
+
62
+ end
63
+ end
64
+ end
@@ -1,30 +1,30 @@
1
- # frozen_string_literal: true
2
-
3
- require 'media_types'
4
- require_relative '../types/product_image_type'
5
-
6
- module TrailerVote
7
- module MediaTypes
8
- module Partials
9
- IMAGE_LINKS = ::MediaTypes::Scheme.new do
10
- link :self do
11
- attribute :type, Types::ProductImageType, optional: true
12
- end
13
-
14
- link :original do
15
- attribute :content_digest, String, optional: true
16
- attribute :width, Numeric, optional: true
17
- attribute :height, Numeric, optional: true
18
- end
19
-
20
- %i[thumbnail xlarge large medium small xsmall].each do |size|
21
- link size, optional: true do
22
- attribute :content_digest, String, optional: true
23
- attribute :width, Numeric, optional: true
24
- attribute :height, Numeric, optional: true
25
- end
26
- end
27
- end
28
- end
29
- end
30
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'media_types'
4
+ require_relative '../types/product_image_type'
5
+
6
+ module TrailerVote
7
+ module MediaTypes
8
+ module Partials
9
+ IMAGE_LINKS = ::MediaTypes::Scheme.new do
10
+ link :self do
11
+ attribute :type, Types::ProductImageType, optional: true
12
+ end
13
+
14
+ link :original do
15
+ attribute :content_digest, String, optional: true
16
+ attribute :width, Numeric, optional: true
17
+ attribute :height, Numeric, optional: true
18
+ end
19
+
20
+ %i[thumbnail xlarge large medium small xsmall].each do |size|
21
+ link size, optional: true do
22
+ attribute :content_digest, String, optional: true
23
+ attribute :width, Numeric, optional: true
24
+ attribute :height, Numeric, optional: true
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,38 +1,38 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'base_text'
4
- require_relative 'types/uuid_v4'
5
-
6
- module TrailerVote
7
- module MediaTypes
8
-
9
- ##
10
- # Media Types for Persona
11
- #
12
- # A Persona is a uniquely identified person / a unique device. When someone uses the SDK, the client MUST generate a
13
- # UUID v4 and use that as Persona. This allows the API to link Feedback on Audio Fragments to a Persona, and MAY act
14
- # as likes/dislikes (interests/disinterests).
15
- #
16
- class Persona < BaseText
17
- media_type 'persona', defaults: { suffix: :json, version: 1 }
18
-
19
- validations do
20
- version 1 do
21
- attribute :persona do
22
- attribute :id, Types::UuidV4
23
- link :self
24
- link :feedback
25
- end
26
-
27
- view('create') {}
28
- end
29
- end
30
-
31
- registrations :persona do
32
- view 'create', :create_persona
33
-
34
- versions 1
35
- end
36
- end
37
- end
38
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'base_text'
4
+ require_relative 'types/uuid_v4'
5
+
6
+ module TrailerVote
7
+ module MediaTypes
8
+
9
+ ##
10
+ # Media Types for Persona
11
+ #
12
+ # A Persona is a uniquely identified person / a unique device. When someone uses the SDK, the client MUST generate a
13
+ # UUID v4 and use that as Persona. This allows the API to link Feedback on Audio Fragments to a Persona, and MAY act
14
+ # as likes/dislikes (interests/disinterests).
15
+ #
16
+ class Persona < BaseText
17
+ media_type 'persona', defaults: { suffix: :json, version: 1 }
18
+
19
+ validations do
20
+ version 1 do
21
+ attribute :persona do
22
+ attribute :id, Types::UuidV4
23
+ link :self
24
+ link :feedback
25
+ end
26
+
27
+ view('create') {}
28
+ end
29
+ end
30
+
31
+ registrations :persona do
32
+ view 'create', :create_persona
33
+
34
+ versions 1
35
+ end
36
+ end
37
+ end
38
+ end