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
data/Rakefile CHANGED
@@ -1,12 +1,12 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rake/testtask'
5
-
6
- Rake::TestTask.new(:test) do |t|
7
- t.libs << 'test'
8
- t.libs << 'lib'
9
- t.test_files = FileList['test/**/*_test.rb']
10
- end
11
-
12
- task default: :test
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rake/testtask'
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << 'test'
8
+ t.libs << 'lib'
9
+ t.test_files = FileList['test/**/*_test.rb']
10
+ end
11
+
12
+ task default: :test
data/bin/console CHANGED
@@ -1,16 +1,16 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'bundler/setup'
5
- require 'trailer_vote/media_types'
6
- require 'awesome_print'
7
-
8
- # You can add fixtures and/or initialization code here to make experimenting
9
- # with your gem easier. You can also use a different console, if you like.
10
-
11
- # (If you use this, don't forget to add pry to your Gemfile!)
12
- # require "pry"
13
- # Pry.start
14
-
15
- require 'irb'
16
- IRB.start(__FILE__)
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'trailer_vote/media_types'
6
+ require 'awesome_print'
7
+
8
+ # You can add fixtures and/or initialization code here to make experimenting
9
+ # with your gem easier. You can also use a different console, if you like.
10
+
11
+ # (If you use this, don't forget to add pry to your Gemfile!)
12
+ # require "pry"
13
+ # Pry.start
14
+
15
+ require 'irb'
16
+ IRB.start(__FILE__)
data/bin/setup CHANGED
@@ -1,8 +1,8 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -34,6 +34,7 @@ require_relative './media_types/push_recipe_ios'
34
34
  require_relative './media_types/ordered_fragment'
35
35
  require_relative './media_types/release_push_campaign'
36
36
  require_relative './media_types/manifest_update'
37
+ require_relative './media_types/vista_config'
37
38
 
38
39
  module TrailerVote
39
40
  module MediaTypes
@@ -1,108 +1,108 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'base_text'
4
- require_relative 'types/http_url'
5
- require_relative 'types/iso8601'
6
-
7
- module TrailerVote
8
- module MediaTypes
9
-
10
- ##
11
- # Media Types for Audio Fragments
12
- #
13
- # Audio Fragments are recognizable using {FingerprintBinary}. It might be an advertisement, a trailer or a sound
14
- # bite. They belong to a {Product}. Audio fragments are used for recognition, e.g. showing an advertisement when
15
- # it's recognised, and used for feedback, i.e. a requirement to record and store {Feedback}.
16
- #
17
- class AudioFragment < BaseText
18
-
19
- # @!method to_constructable
20
- # Returns the construtable media type
21
- #
22
- # @see https://www.rubydoc.info/gems/media_types/MediaTypes/Constructable ::MediaTypes::Constructable
23
- # @return [::MediaTypes::Constructable] a constructable
24
- #
25
- media_type 'audio_fragment', defaults: { suffix: :json, version: 1 }
26
-
27
- # @!method valid?(data, constructed_media_type, **opts)
28
- # Validates the +data+ against the validation for +constructed_media_type+.
29
- #
30
- # @see https://www.rubydoc.info/gems/media_types/MediaTypes/Scheme#valid%3F-instance_method ::MediaTypes::Scheme#valid?
31
- # @see https://www.rubydoc.info/gems/media_types/MediaTypes/Constructable#valid%3F-instance_method ::MediaTypes::Constructable#valid?
32
- #
33
- # @param [Object] data the data to validate
34
- # @param [Constructable, String] constructed_media_type something that resolved into a media type with validations
35
- # @param [Hash] opts passed on to {::MediaTypes::Scheme#valid?}
36
- #
37
- # @return [TrueClass, FalseClass] true if valid, false otherwise
38
- #
39
- # @!method validate!(data, constructed_media_type, **opts)
40
- # Validates the +data+ against the validation for +constructed_media_type+. Raises if invalid
41
- #
42
- # @see https://www.rubydoc.info/gems/media_types/MediaTypes/Scheme#validate-instance_method ::MediaTypes::Scheme#validate
43
- # @see https://www.rubydoc.info/gems/media_types/MediaTypes/Constructable#validate!-instance_method ::MediaTypes::Constructable#validate!
44
- # @see https://www.rubydoc.info/gems/media_types/MediaTypes/Scheme/ValidationError ::MediaTypes::Scheme::ValidationError
45
- #
46
- # @param [Object] data the data to validate
47
- # @param [Constructable, String] constructed_media_type something that resolved into a media type with validations
48
- # @param [Hash] opts passed on to {::MediaTypes::Scheme#validate}
49
- #
50
- # @raise ::MediaTypes::Scheme::ValidationError an error if the scheme is not valid
51
- # @return [TrueClass] true if valid
52
- #
53
- validations do
54
- version 1 do
55
- version_1_base = ::MediaTypes::Scheme.new do
56
- attribute :content_addressable, String
57
- attribute :expires_at, AllowNil(Types::Iso8601)
58
-
59
- link :self
60
- link :product
61
- link :feedback
62
- link :advert
63
- link :direct
64
- end
65
-
66
- attribute :audio_fragment do
67
- merge version_1_base
68
- end
69
-
70
- view 'index' do
71
- attribute :audio_fragments do
72
- collection :_index, allow_empty: true do
73
- attribute :href, Types::HttpUrl
74
- not_strict
75
- end
76
-
77
- not_strict
78
- end
79
- end
80
-
81
- view 'collection' do
82
- attribute :audio_fragments do
83
- collection :_embedded, version_1_base, allow_empty: true
84
- not_strict
85
- end
86
- end
87
- end
88
- end
89
-
90
- # @!method register
91
- # Registers all the known permutations of versions, views, suffixes and aliases for this media type via
92
- # {::MediaTypes.register}
93
- #
94
- # @see https://www.rubydoc.info/gems/media_types/MediaTypes#register-class-method ::Mediatypes.register
95
- # @see https://www.rubydoc.info/gems/media_types/MediaTypes/Registerable ::Mediatypes::Registerable
96
- #
97
- # @return [Array<::MediaTypes::Registerable>]
98
- registrations :audio_fragment do
99
- view 'index', :audio_fragment_urls
100
- view 'collection', :audio_fragments
101
-
102
- versions 1
103
-
104
- type_alias 'audio-fragment'
105
- end
106
- end
107
- end
108
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'base_text'
4
+ require_relative 'types/http_url'
5
+ require_relative 'types/iso8601'
6
+
7
+ module TrailerVote
8
+ module MediaTypes
9
+
10
+ ##
11
+ # Media Types for Audio Fragments
12
+ #
13
+ # Audio Fragments are recognizable using {FingerprintBinary}. It might be an advertisement, a trailer or a sound
14
+ # bite. They belong to a {Product}. Audio fragments are used for recognition, e.g. showing an advertisement when
15
+ # it's recognised, and used for feedback, i.e. a requirement to record and store {Feedback}.
16
+ #
17
+ class AudioFragment < BaseText
18
+
19
+ # @!method to_constructable
20
+ # Returns the construtable media type
21
+ #
22
+ # @see https://www.rubydoc.info/gems/media_types/MediaTypes/Constructable ::MediaTypes::Constructable
23
+ # @return [::MediaTypes::Constructable] a constructable
24
+ #
25
+ media_type 'audio_fragment', defaults: { suffix: :json, version: 1 }
26
+
27
+ # @!method valid?(data, constructed_media_type, **opts)
28
+ # Validates the +data+ against the validation for +constructed_media_type+.
29
+ #
30
+ # @see https://www.rubydoc.info/gems/media_types/MediaTypes/Scheme#valid%3F-instance_method ::MediaTypes::Scheme#valid?
31
+ # @see https://www.rubydoc.info/gems/media_types/MediaTypes/Constructable#valid%3F-instance_method ::MediaTypes::Constructable#valid?
32
+ #
33
+ # @param [Object] data the data to validate
34
+ # @param [Constructable, String] constructed_media_type something that resolved into a media type with validations
35
+ # @param [Hash] opts passed on to {::MediaTypes::Scheme#valid?}
36
+ #
37
+ # @return [TrueClass, FalseClass] true if valid, false otherwise
38
+ #
39
+ # @!method validate!(data, constructed_media_type, **opts)
40
+ # Validates the +data+ against the validation for +constructed_media_type+. Raises if invalid
41
+ #
42
+ # @see https://www.rubydoc.info/gems/media_types/MediaTypes/Scheme#validate-instance_method ::MediaTypes::Scheme#validate
43
+ # @see https://www.rubydoc.info/gems/media_types/MediaTypes/Constructable#validate!-instance_method ::MediaTypes::Constructable#validate!
44
+ # @see https://www.rubydoc.info/gems/media_types/MediaTypes/Scheme/ValidationError ::MediaTypes::Scheme::ValidationError
45
+ #
46
+ # @param [Object] data the data to validate
47
+ # @param [Constructable, String] constructed_media_type something that resolved into a media type with validations
48
+ # @param [Hash] opts passed on to {::MediaTypes::Scheme#validate}
49
+ #
50
+ # @raise ::MediaTypes::Scheme::ValidationError an error if the scheme is not valid
51
+ # @return [TrueClass] true if valid
52
+ #
53
+ validations do
54
+ version 1 do
55
+ version_1_base = ::MediaTypes::Scheme.new do
56
+ attribute :content_addressable, String
57
+ attribute :expires_at, AllowNil(Types::Iso8601)
58
+
59
+ link :self
60
+ link :product
61
+ link :feedback
62
+ link :advert
63
+ link :direct
64
+ end
65
+
66
+ attribute :audio_fragment do
67
+ merge version_1_base
68
+ end
69
+
70
+ view 'index' do
71
+ attribute :audio_fragments do
72
+ collection :_index, allow_empty: true do
73
+ attribute :href, Types::HttpUrl
74
+ not_strict
75
+ end
76
+
77
+ not_strict
78
+ end
79
+ end
80
+
81
+ view 'collection' do
82
+ attribute :audio_fragments do
83
+ collection :_embedded, version_1_base, allow_empty: true
84
+ not_strict
85
+ end
86
+ end
87
+ end
88
+ end
89
+
90
+ # @!method register
91
+ # Registers all the known permutations of versions, views, suffixes and aliases for this media type via
92
+ # {::MediaTypes.register}
93
+ #
94
+ # @see https://www.rubydoc.info/gems/media_types/MediaTypes#register-class-method ::Mediatypes.register
95
+ # @see https://www.rubydoc.info/gems/media_types/MediaTypes/Registerable ::Mediatypes::Registerable
96
+ #
97
+ # @return [Array<::MediaTypes::Registerable>]
98
+ registrations :audio_fragment do
99
+ view 'index', :audio_fragment_urls
100
+ view 'collection', :audio_fragments
101
+
102
+ versions 1
103
+
104
+ type_alias 'audio-fragment'
105
+ end
106
+ end
107
+ end
108
+ end
@@ -1,22 +1,22 @@
1
- # frozen_string_literal: true
2
-
3
- require 'media_types'
4
-
5
- module TrailerVote
6
- module MediaTypes
7
- class BaseText
8
- include ::MediaTypes::Dsl
9
-
10
- class << self
11
-
12
- protected
13
-
14
- BASE_TEXT_FORMAT = 'application/vnd.trailervote.%<type>s.v%<version>s.%<view>s+%<suffix>s'
15
-
16
- def base_format
17
- BASE_TEXT_FORMAT
18
- end
19
- end
20
- end
21
- end
22
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'media_types'
4
+
5
+ module TrailerVote
6
+ module MediaTypes
7
+ class BaseText
8
+ include ::MediaTypes::Dsl
9
+
10
+ class << self
11
+
12
+ protected
13
+
14
+ BASE_TEXT_FORMAT = 'application/vnd.trailervote.%<type>s.v%<version>s.%<view>s+%<suffix>s'
15
+
16
+ def base_format
17
+ BASE_TEXT_FORMAT
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,42 +1,42 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'base_text'
4
- require_relative 'partials/image_links'
5
-
6
- module TrailerVote
7
- module MediaTypes
8
-
9
- class Carousel < BaseText
10
- media_type 'carousel'
11
-
12
- defaults do
13
- suffix :json
14
- version 1
15
- end
16
-
17
- validations do
18
- version 1 do
19
- attribute :carousel do
20
- collection :items do
21
- attribute :title, AllowNil(String)
22
- attribute :image, expected_type: AllowNil(::Hash), allow_empty: true, optional: true do
23
- attribute :_embedded, expected_type: AllowNil(::Hash), allow_empty: true do
24
- merge Partials::IMAGE_LINKS
25
- end
26
- end
27
-
28
- link :product
29
- link :video
30
- link :direct
31
- link :interactive_player
32
- end
33
-
34
- link :self
35
- end
36
- end
37
- end
38
-
39
- registrations(:carousel) {}
40
- end
41
- end
42
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'base_text'
4
+ require_relative 'partials/image_links'
5
+
6
+ module TrailerVote
7
+ module MediaTypes
8
+
9
+ class Carousel < BaseText
10
+ media_type 'carousel'
11
+
12
+ defaults do
13
+ suffix :json
14
+ version 1
15
+ end
16
+
17
+ validations do
18
+ version 1 do
19
+ attribute :carousel do
20
+ collection :items do
21
+ attribute :title, AllowNil(String)
22
+ attribute :image, expected_type: AllowNil(::Hash), allow_empty: true, optional: true do
23
+ attribute :_embedded, expected_type: AllowNil(::Hash), allow_empty: true do
24
+ merge Partials::IMAGE_LINKS
25
+ end
26
+ end
27
+
28
+ link :product
29
+ link :video
30
+ link :direct
31
+ link :interactive_player
32
+ end
33
+
34
+ link :self
35
+ end
36
+ end
37
+ end
38
+
39
+ registrations(:carousel) {}
40
+ end
41
+ end
42
+ end
@@ -1,35 +1,35 @@
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 Client Configuration
11
- #
12
- # The client configuration media type is used when a client, such as the SDK clients, want to configure the
13
- # TrailerVote services. When accepted, the TrailerVote services may use the passed configurations to return specific
14
- # responses based on that configuration. For example, the {Configuration} from the root endpoint changed based on
15
- # the values.
16
- #
17
- class ClientConfiguration < BaseText
18
- media_type 'client_configuration', defaults: { suffix: :json, version: 1 }
19
-
20
- validations do
21
- version 1 do
22
- attribute :configuration do
23
- attribute :place, Types::HttpUrl
24
- attribute :persona, Types::HttpUrl
25
- end
26
- end
27
- end
28
-
29
- registrations :client_configuration do
30
- versions 1
31
- type_alias 'client-configuration'
32
- end
33
- end
34
- end
35
- 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
+
9
+ ##
10
+ # Media Types for Client Configuration
11
+ #
12
+ # The client configuration media type is used when a client, such as the SDK clients, want to configure the
13
+ # TrailerVote services. When accepted, the TrailerVote services may use the passed configurations to return specific
14
+ # responses based on that configuration. For example, the {Configuration} from the root endpoint changed based on
15
+ # the values.
16
+ #
17
+ class ClientConfiguration < BaseText
18
+ media_type 'client_configuration', defaults: { suffix: :json, version: 1 }
19
+
20
+ validations do
21
+ version 1 do
22
+ attribute :configuration do
23
+ attribute :place, Types::HttpUrl
24
+ attribute :persona, Types::HttpUrl
25
+ end
26
+ end
27
+ end
28
+
29
+ registrations :client_configuration do
30
+ versions 1
31
+ type_alias 'client-configuration'
32
+ end
33
+ end
34
+ end
35
+ end