trailer_vote-media_types 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +3 -3
- data/README.md +10 -0
- data/lib/trailer_vote/media_types/audio_fragment.rb +5 -3
- data/lib/trailer_vote/media_types/carousel.rb +2 -2
- data/lib/trailer_vote/media_types/client_configuration.rb +4 -3
- data/lib/trailer_vote/media_types/configuration.rb +9 -4
- data/lib/trailer_vote/media_types/feedback.rb +5 -4
- data/lib/trailer_vote/media_types/feedback_listing.rb +5 -4
- data/lib/trailer_vote/media_types/interactive_player.rb +1 -1
- data/lib/trailer_vote/media_types/persona.rb +2 -2
- data/lib/trailer_vote/media_types/place.rb +8 -7
- data/lib/trailer_vote/media_types/product.rb +5 -4
- data/lib/trailer_vote/media_types/product_image.rb +9 -7
- data/lib/trailer_vote/media_types/product_lookup.rb +2 -2
- data/lib/trailer_vote/media_types/product_place_link.rb +3 -4
- data/lib/trailer_vote/media_types/product_video.rb +10 -9
- data/lib/trailer_vote/media_types/products_listing.rb +4 -3
- data/lib/trailer_vote/media_types/sentiment_feedback.rb +6 -5
- data/lib/trailer_vote/media_types/types/formatted_url.rb +51 -0
- data/lib/trailer_vote/media_types/types/https_url.rb +23 -0
- data/lib/trailer_vote/media_types/types/influx_db_connection_url.rb +10 -0
- data/lib/trailer_vote/media_types/types/iso8601.rb +10 -0
- data/lib/trailer_vote/media_types/version.rb +1 -1
- data/trailer_vote-media_types.gemspec +1 -1
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 926ad35dab8657d957fee399fca27858da92ff86
|
4
|
+
data.tar.gz: ed70f02bdf523fee98124088ce13dce593da415f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84cf671dc44bbff7f2be93740f3b0abdf4ba8c0e510e342f9324a360a8acc355e680fe96164d825db911b17f7c31a18d6914ac2c6f53a2937da91760942b3d54
|
7
|
+
data.tar.gz: 75dfc602858601f3810ec46c98ec5760f3235be6b2448a86425a1677cd6848aa4b3d9a0f9d721fb6d6e107e369473ca3a7a2d9ae22e2913993b283c086cda384
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
# 0.6.0
|
2
|
+
|
3
|
+
- Update `media_types` to `0.6.0` so that the integrations become available downstream.
|
4
|
+
- Rename all `deleted_at` to `expires_at` (#1)
|
5
|
+
- Add `Types::HttpsUrl`, `Types::InfluxDbConnectionUrl`, `Types.makeFormattedUrl`, `Types.Iso8601` to check format of string attributes. (#2)
|
6
|
+
- Add documentation for `updated_at` fields (#4)
|
7
|
+
- Add expected type for `ProductLookup` `identifier` (#5)
|
8
|
+
- Remove optional nil for analytics and metrics url by changing the type (#3)
|
9
|
+
|
1
10
|
# 0.5.0
|
2
11
|
|
3
12
|
:baby: initial public release. Not considered stable until version 1.0.0.
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
trailer_vote-media_types (0.
|
5
|
-
media_types (~> 0.
|
4
|
+
trailer_vote-media_types (0.6.0)
|
5
|
+
media_types (~> 0.6.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
@@ -12,7 +12,7 @@ GEM
|
|
12
12
|
builder (3.2.3)
|
13
13
|
docile (1.3.1)
|
14
14
|
json (2.1.0)
|
15
|
-
media_types (0.
|
15
|
+
media_types (0.6.0)
|
16
16
|
minitest (5.11.3)
|
17
17
|
minitest-ci (3.4.0)
|
18
18
|
minitest (>= 5.0.6)
|
data/README.md
CHANGED
@@ -15,6 +15,16 @@ And then execute:
|
|
15
15
|
Or install it yourself as:
|
16
16
|
|
17
17
|
$ gem install trailer_vote-media_types
|
18
|
+
|
19
|
+
## Notes
|
20
|
+
|
21
|
+
### `updated_at` vs `Last-Modified` headers
|
22
|
+
|
23
|
+
When this is used in conjunction with a TrailerVote service, the `updated_at` attributes inside the body of a response will take precedence over any `Last-Modified` header. The `updated_at` value **SHOULD** reflect the last time the resource was updated, whereas the `Last-Modified` value may change when the representation is updated.
|
24
|
+
|
25
|
+
### Are ids missing?
|
26
|
+
|
27
|
+
No, the `id` or `uuid` attributes are not missing. As per the [TrailerVote API considerations](https://docs.trailervote.com/reference) clients **SHOULD** not need to construct URLs. Both internally and externally, where possible, we refer to resources by their fully qualified URL which _is_ their identifier, instead of something like a UUID.
|
18
28
|
|
19
29
|
## Usage
|
20
30
|
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '
|
3
|
+
require_relative 'base_text'
|
4
|
+
require_relative 'types/https_url'
|
5
|
+
require_relative 'types/iso8601'
|
4
6
|
|
5
7
|
module TrailerVote
|
6
8
|
module MediaTypes
|
@@ -52,7 +54,7 @@ module TrailerVote
|
|
52
54
|
version 1 do
|
53
55
|
version_1_base = ::MediaTypes::Scheme.new do
|
54
56
|
attribute :content_addressable, String
|
55
|
-
attribute :
|
57
|
+
attribute :expires_at, AllowNil(Types::Iso8601)
|
56
58
|
|
57
59
|
link :self
|
58
60
|
link :product
|
@@ -68,7 +70,7 @@ module TrailerVote
|
|
68
70
|
view 'index' do
|
69
71
|
attribute :audio_fragments do
|
70
72
|
collection :_index, allow_empty: true do
|
71
|
-
attribute :href,
|
73
|
+
attribute :href, Types::HttpsUrl
|
72
74
|
not_strict
|
73
75
|
end
|
74
76
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '
|
3
|
+
require_relative 'base_text'
|
4
|
+
require_relative 'types/https_url'
|
4
5
|
|
5
6
|
module TrailerVote
|
6
7
|
module MediaTypes
|
@@ -19,8 +20,8 @@ module TrailerVote
|
|
19
20
|
validations do
|
20
21
|
version 1 do
|
21
22
|
attribute :configuration do
|
22
|
-
attribute :place,
|
23
|
-
attribute :persona,
|
23
|
+
attribute :place, Types::HttpsUrl
|
24
|
+
attribute :persona, Types::HttpsUrl
|
24
25
|
end
|
25
26
|
end
|
26
27
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '
|
3
|
+
require_relative 'base_text'
|
4
|
+
require_relative 'types/influx_db_connection_url'
|
5
|
+
require_relative 'types/formatted_url'
|
4
6
|
|
5
7
|
module TrailerVote
|
6
8
|
module MediaTypes
|
@@ -19,13 +21,14 @@ module TrailerVote
|
|
19
21
|
link :products
|
20
22
|
link :product_lookup
|
21
23
|
link :persona do
|
24
|
+
attribute :href, Types.makeFormattedUrl(:uuid)
|
22
25
|
attribute :templated, TrueClass
|
23
26
|
end
|
24
27
|
link :analytics do
|
25
|
-
attribute :href,
|
28
|
+
attribute :href, Types::InfluxDbConnectionUrl
|
26
29
|
end
|
27
30
|
link :telemetrics do
|
28
|
-
attribute :href,
|
31
|
+
attribute :href, Types::InfluxDbConnectionUrl
|
29
32
|
end
|
30
33
|
end
|
31
34
|
end
|
@@ -34,13 +37,15 @@ module TrailerVote
|
|
34
37
|
attribute :configuration do
|
35
38
|
link :place
|
36
39
|
link :feedback do
|
40
|
+
attribute :href, Types.makeFormattedUrl(:uuid)
|
37
41
|
attribute :templated, TrueClass
|
38
42
|
end
|
39
43
|
link :persona do
|
44
|
+
attribute :href, Types.makeFormattedUrl(:uuid)
|
40
45
|
attribute :templated, TrueClass
|
41
46
|
end
|
42
47
|
link :analytics do
|
43
|
-
attribute :href, AllowNil(
|
48
|
+
attribute :href, AllowNil(Types::InfluxDbConnectionUrl)
|
44
49
|
end
|
45
50
|
end
|
46
51
|
end
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '
|
4
|
-
require_relative '
|
5
|
-
require_relative '
|
3
|
+
require_relative 'base_text'
|
4
|
+
require_relative 'types/uuid_v4'
|
5
|
+
require_relative 'types/vote_value'
|
6
|
+
require_relative 'types/iso8601'
|
6
7
|
|
7
8
|
module TrailerVote
|
8
9
|
module MediaTypes
|
@@ -13,7 +14,7 @@ module TrailerVote
|
|
13
14
|
version 1 do
|
14
15
|
version_1_base = ::MediaTypes::Scheme.new do
|
15
16
|
attribute :value, Types::VoteValue
|
16
|
-
attribute :updated_at,
|
17
|
+
attribute :updated_at, Types::Iso8601
|
17
18
|
|
18
19
|
link :audio_fragment
|
19
20
|
link :product
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '
|
4
|
-
require_relative '
|
5
|
-
require_relative '
|
3
|
+
require_relative 'base_text'
|
4
|
+
require_relative 'types/vote_value'
|
5
|
+
require_relative 'types/iso8601'
|
6
|
+
require_relative 'partials/image_links'
|
6
7
|
|
7
8
|
module TrailerVote
|
8
9
|
module MediaTypes
|
@@ -20,7 +21,7 @@ module TrailerVote
|
|
20
21
|
collection :items, allow_empty: true do
|
21
22
|
attribute :title, AllowNil(String)
|
22
23
|
attribute :value, Types::VoteValue
|
23
|
-
attribute :updated_at,
|
24
|
+
attribute :updated_at, Types::Iso8601
|
24
25
|
|
25
26
|
link :audio_fragment
|
26
27
|
link :product
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '
|
4
|
-
require_relative '
|
3
|
+
require_relative 'base_text'
|
4
|
+
require_relative 'types/uuid_v4'
|
5
|
+
require_relative 'types/iso8601'
|
5
6
|
|
6
7
|
module TrailerVote
|
7
8
|
module MediaTypes
|
@@ -32,8 +33,8 @@ module TrailerVote
|
|
32
33
|
version_2_base = ::MediaTypes::Scheme.new do
|
33
34
|
attribute :name, String
|
34
35
|
attribute :parent_place, AllowNil(Types::UuidV4)
|
35
|
-
attribute :
|
36
|
-
attribute :updated_at,
|
36
|
+
attribute :expires_at, AllowNil(String)
|
37
|
+
attribute :updated_at, Types::Iso8601
|
37
38
|
|
38
39
|
link :self
|
39
40
|
link :products_archive
|
@@ -48,7 +49,7 @@ module TrailerVote
|
|
48
49
|
attribute :place do
|
49
50
|
attribute :name, String
|
50
51
|
attribute :parent_place, String
|
51
|
-
attribute :
|
52
|
+
attribute :expires_at, AllowNil(Types::Iso8601)
|
52
53
|
end
|
53
54
|
end
|
54
55
|
|
@@ -68,8 +69,8 @@ module TrailerVote
|
|
68
69
|
version_1_base = ::MediaTypes::Scheme.new do
|
69
70
|
attribute :name, String
|
70
71
|
attribute :parent_place, AllowNil(String)
|
71
|
-
attribute :
|
72
|
-
attribute :updated_at,
|
72
|
+
attribute :expires_at, AllowNil(String)
|
73
|
+
attribute :updated_at, Types::Iso8601
|
73
74
|
|
74
75
|
link :self
|
75
76
|
link :products
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '
|
4
|
-
require_relative '
|
3
|
+
require_relative 'base_text'
|
4
|
+
require_relative 'types/product_data_type'
|
5
|
+
require_relative 'types/iso8601'
|
5
6
|
|
6
7
|
module TrailerVote
|
7
8
|
module MediaTypes
|
@@ -63,7 +64,7 @@ module TrailerVote
|
|
63
64
|
end
|
64
65
|
|
65
66
|
version_2_base = ::MediaTypes::Scheme.new do
|
66
|
-
attribute :updated_at,
|
67
|
+
attribute :updated_at, Types::Iso8601
|
67
68
|
attribute :lock_version, Numeric
|
68
69
|
|
69
70
|
merge version_2_creation
|
@@ -126,7 +127,7 @@ module TrailerVote
|
|
126
127
|
end
|
127
128
|
|
128
129
|
version_1_base = ::MediaTypes::Scheme.new do
|
129
|
-
attribute :updated_at,
|
130
|
+
attribute :updated_at, Types::Iso8601
|
130
131
|
attribute :lock_version, Numeric
|
131
132
|
|
132
133
|
merge version_1_creation
|
@@ -2,9 +2,11 @@
|
|
2
2
|
|
3
3
|
require 'media_types'
|
4
4
|
|
5
|
-
require_relative '
|
6
|
-
require_relative '
|
7
|
-
require_relative '
|
5
|
+
require_relative 'base_text'
|
6
|
+
require_relative 'types/product_image_type'
|
7
|
+
require_relative 'types/boolean'
|
8
|
+
require_relative 'types/iso8601'
|
9
|
+
require_relative 'types/https_url'
|
8
10
|
|
9
11
|
module TrailerVote
|
10
12
|
module MediaTypes
|
@@ -15,12 +17,12 @@ module TrailerVote
|
|
15
17
|
version 1 do
|
16
18
|
version_1_creation = ::MediaTypes::Scheme.new do
|
17
19
|
attribute :identifier, String
|
18
|
-
attribute :source_url,
|
19
|
-
attribute :
|
20
|
+
attribute :source_url, Types::HttpsUrl
|
21
|
+
attribute :expires_at, AllowNil(Types::Iso8601), optional: true
|
20
22
|
end
|
21
23
|
|
22
24
|
version_1_base = ::MediaTypes::Scheme.new do
|
23
|
-
attribute :updated_at,
|
25
|
+
attribute :updated_at, Types::Iso8601
|
24
26
|
|
25
27
|
merge version_1_creation
|
26
28
|
|
@@ -90,7 +92,7 @@ module TrailerVote
|
|
90
92
|
view :index do
|
91
93
|
attribute :product_images do
|
92
94
|
collection :_index do
|
93
|
-
attribute :href,
|
95
|
+
attribute :href, Types::HttpsUrl
|
94
96
|
not_strict
|
95
97
|
end
|
96
98
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '
|
3
|
+
require_relative 'base_text'
|
4
4
|
require 'media_types/scheme/any_of'
|
5
5
|
|
6
6
|
module TrailerVote
|
@@ -24,7 +24,7 @@ module TrailerVote
|
|
24
24
|
version 1 do
|
25
25
|
collection 'product_identifiers', expected_type: nil do
|
26
26
|
attribute :authority, String
|
27
|
-
attribute :identifier
|
27
|
+
attribute :identifier, String
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '
|
3
|
+
require_relative 'base_text'
|
4
|
+
require_relative 'types/https_url'
|
4
5
|
|
5
6
|
module TrailerVote
|
6
7
|
module MediaTypes
|
@@ -16,9 +17,7 @@ module TrailerVote
|
|
16
17
|
end
|
17
18
|
|
18
19
|
view 'create' do
|
19
|
-
attribute :place
|
20
|
-
attribute :id, String
|
21
|
-
end
|
20
|
+
attribute :place, Types::HttpsUrl
|
22
21
|
end
|
23
22
|
end
|
24
23
|
end
|
@@ -2,11 +2,12 @@
|
|
2
2
|
|
3
3
|
require 'media_types'
|
4
4
|
|
5
|
-
require_relative '
|
6
|
-
require_relative '
|
7
|
-
require_relative '
|
8
|
-
require_relative '
|
9
|
-
|
5
|
+
require_relative 'base_text'
|
6
|
+
require_relative 'types/boolean'
|
7
|
+
require_relative 'types/product_movie_type'
|
8
|
+
require_relative 'types/product_movie_handler'
|
9
|
+
require_relative 'types/iso8601'
|
10
|
+
require_relative 'types/https_url'
|
10
11
|
|
11
12
|
module TrailerVote
|
12
13
|
module MediaTypes
|
@@ -17,12 +18,12 @@ module TrailerVote
|
|
17
18
|
version 1 do
|
18
19
|
version_1_creation = ::MediaTypes::Scheme.new do
|
19
20
|
attribute :identifier, String
|
20
|
-
attribute :source_url,
|
21
|
-
attribute :
|
21
|
+
attribute :source_url, Types::HttpsUrl
|
22
|
+
attribute :expires_at, AllowNil(Types::Iso8601), optional: true
|
22
23
|
end
|
23
24
|
|
24
25
|
version_1_base = ::MediaTypes::Scheme.new do
|
25
|
-
attribute :updated_at,
|
26
|
+
attribute :updated_at, Types::Iso8601
|
26
27
|
|
27
28
|
merge version_1_creation
|
28
29
|
|
@@ -69,7 +70,7 @@ module TrailerVote
|
|
69
70
|
view :index do
|
70
71
|
attribute :product_videos do
|
71
72
|
collection :_index do
|
72
|
-
attribute :href,
|
73
|
+
attribute :href, Types::HttpsUrl
|
73
74
|
not_strict
|
74
75
|
end
|
75
76
|
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '
|
4
|
-
require_relative '
|
3
|
+
require_relative 'base_text'
|
4
|
+
require_relative 'partials/image_links'
|
5
|
+
require_relative 'types/iso8601'
|
5
6
|
|
6
7
|
module TrailerVote
|
7
8
|
module MediaTypes
|
@@ -18,7 +19,7 @@ module TrailerVote
|
|
18
19
|
attribute :products_listing do
|
19
20
|
collection :items, allow_empty: true do
|
20
21
|
attribute :title, AllowNil(String)
|
21
|
-
attribute :publish_date, AllowNil(
|
22
|
+
attribute :publish_date, AllowNil(Types::Iso8601)
|
22
23
|
|
23
24
|
link :product
|
24
25
|
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '
|
4
|
-
require_relative '
|
5
|
-
require_relative '
|
3
|
+
require_relative 'base_text'
|
4
|
+
require_relative 'partials/image_links'
|
5
|
+
require_relative 'types/product_image_type'
|
6
|
+
require_relative 'types/iso8601'
|
6
7
|
|
7
8
|
module TrailerVote
|
8
9
|
module MediaTypes
|
@@ -19,7 +20,7 @@ module TrailerVote
|
|
19
20
|
attribute :image, expected_type: AllowNil(::Hash), allow_empty: true, optional: true do
|
20
21
|
attribute :_embedded do
|
21
22
|
attribute :identifier, String
|
22
|
-
attribute :updated_at,
|
23
|
+
attribute :updated_at, Types::Iso8601
|
23
24
|
attribute :asset_type, Types::ProductImageType
|
24
25
|
|
25
26
|
merge Partials::IMAGE_LINKS
|
@@ -39,7 +40,7 @@ module TrailerVote
|
|
39
40
|
attribute :images do
|
40
41
|
collection :_embedded, allow_empty: true do
|
41
42
|
attribute :identifier, String
|
42
|
-
attribute :updated_at,
|
43
|
+
attribute :updated_at, Types::Iso8601
|
43
44
|
attribute :asset_type, Types::ProductImageTypeV1
|
44
45
|
|
45
46
|
link :self
|
@@ -0,0 +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
|
@@ -0,0 +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
|
+
HttpsUrl = %r{^https:\/\/[^\s\/$.?#].[^\s]*$} # rubocop:disable Naming/ConstantName
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +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
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_runtime_dependency 'media_types', '~> 0.
|
22
|
+
spec.add_runtime_dependency 'media_types', '~> 0.6.0'
|
23
23
|
|
24
24
|
spec.add_development_dependency 'awesome_print'
|
25
25
|
spec.add_development_dependency 'bundler', '~> 1.16'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trailer_vote-media_types
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Derk-Jan Karrenbeld
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: media_types
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.6.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.6.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: awesome_print
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -175,6 +175,10 @@ files:
|
|
175
175
|
- lib/trailer_vote/media_types/products_listing.rb
|
176
176
|
- lib/trailer_vote/media_types/sentiment_feedback.rb
|
177
177
|
- lib/trailer_vote/media_types/types/boolean.rb
|
178
|
+
- lib/trailer_vote/media_types/types/formatted_url.rb
|
179
|
+
- lib/trailer_vote/media_types/types/https_url.rb
|
180
|
+
- lib/trailer_vote/media_types/types/influx_db_connection_url.rb
|
181
|
+
- lib/trailer_vote/media_types/types/iso8601.rb
|
178
182
|
- lib/trailer_vote/media_types/types/product_data_type.rb
|
179
183
|
- lib/trailer_vote/media_types/types/product_image_type.rb
|
180
184
|
- lib/trailer_vote/media_types/types/product_movie_handler.rb
|