pbcore 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pbcore/version.rb +1 -1
- data/pbcore.gemspec +10 -2
- data/spec/factories/annotation.rb +9 -0
- data/spec/factories/asset_date.rb +23 -0
- data/spec/factories/asset_type.rb +7 -0
- data/spec/factories/audience_level.rb +7 -0
- data/spec/factories/audience_rating.rb +7 -0
- data/spec/factories/contributor.rb +9 -0
- data/spec/factories/contributor/contributor.rb +6 -0
- data/spec/factories/contributor/role.rb +6 -0
- data/spec/factories/coverage.rb +22 -0
- data/spec/factories/coverage/coverage.rb +22 -0
- data/spec/factories/coverage/type.rb +8 -0
- data/spec/factories/creator.rb +8 -0
- data/spec/factories/creator/creator.rb +12 -0
- data/spec/factories/creator/role.rb +8 -0
- data/spec/factories/description.rb +11 -0
- data/spec/factories/description_document.rb +28 -0
- data/spec/factories/extension.rb +11 -0
- data/spec/factories/extension/embedded.rb +7 -0
- data/spec/factories/extension/wrap.rb +11 -0
- data/spec/factories/extension/wrap/authority_used.rb +7 -0
- data/spec/factories/extension/wrap/element.rb +7 -0
- data/spec/factories/extension/wrap/value.rb +7 -0
- data/spec/factories/genre.rb +8 -0
- data/spec/factories/identifier.rb +10 -0
- data/spec/factories/instantiation.rb +34 -0
- data/spec/factories/instantiation/alternative_modes.rb +11 -0
- data/spec/factories/instantiation/annotation.rb +12 -0
- data/spec/factories/instantiation/channel_configuration.rb +11 -0
- data/spec/factories/instantiation/colors.rb +11 -0
- data/spec/factories/instantiation/data_rate.rb +12 -0
- data/spec/factories/instantiation/date.rb +12 -0
- data/spec/factories/instantiation/digital.rb +11 -0
- data/spec/factories/instantiation/dimensions.rb +12 -0
- data/spec/factories/instantiation/duration.rb +11 -0
- data/spec/factories/instantiation/essence_track.rb +29 -0
- data/spec/factories/instantiation/essence_track/annotation.rb +12 -0
- data/spec/factories/instantiation/essence_track/aspect_ratio.rb +16 -0
- data/spec/factories/instantiation/essence_track/bit_depth.rb +12 -0
- data/spec/factories/instantiation/essence_track/data_rate.rb +12 -0
- data/spec/factories/instantiation/essence_track/duration.rb +11 -0
- data/spec/factories/instantiation/essence_track/encoding.rb +11 -0
- data/spec/factories/instantiation/essence_track/frame_rate.rb +12 -0
- data/spec/factories/instantiation/essence_track/frame_size.rb +12 -0
- data/spec/factories/instantiation/essence_track/identifier.rb +11 -0
- data/spec/factories/instantiation/essence_track/language.rb +9 -0
- data/spec/factories/instantiation/essence_track/playback_speed.rb +12 -0
- data/spec/factories/instantiation/essence_track/sampling_rate.rb +12 -0
- data/spec/factories/instantiation/essence_track/standard.rb +11 -0
- data/spec/factories/instantiation/essence_track/time_start.rb +11 -0
- data/spec/factories/instantiation/essence_track/type.rb +11 -0
- data/spec/factories/instantiation/extension.rb +16 -0
- data/spec/factories/instantiation/file_size.rb +12 -0
- data/spec/factories/instantiation/generations.rb +11 -0
- data/spec/factories/instantiation/identifier.rb +17 -0
- data/spec/factories/instantiation/language.rb +13 -0
- data/spec/factories/instantiation/location.rb +11 -0
- data/spec/factories/instantiation/media_type.rb +11 -0
- data/spec/factories/instantiation/physical.rb +11 -0
- data/spec/factories/instantiation/relation.rb +12 -0
- data/spec/factories/instantiation/relation/identifier.rb +10 -0
- data/spec/factories/instantiation/relation/type.rb +9 -0
- data/spec/factories/instantiation/rights.rb +20 -0
- data/spec/factories/instantiation/rights/link.rb +7 -0
- data/spec/factories/instantiation/rights/summary.rb +7 -0
- data/spec/factories/instantiation/standard.rb +12 -0
- data/spec/factories/instantiation/time_start.rb +11 -0
- data/spec/factories/instantiation/tracks.rb +11 -0
- data/spec/factories/instantiation_document.rb +44 -0
- data/spec/factories/pbcore_content_element.rb +10 -0
- data/spec/factories/pbcore_element.rb +8 -0
- data/spec/factories/publisher.rb +10 -0
- data/spec/factories/publisher/publisher.rb +12 -0
- data/spec/factories/publisher/role.rb +8 -0
- data/spec/factories/relation.rb +8 -0
- data/spec/factories/relation/identifier.rb +10 -0
- data/spec/factories/relation/type.rb +9 -0
- data/spec/factories/rights_summary.rb +25 -0
- data/spec/factories/rights_summary/link.rb +11 -0
- data/spec/factories/rights_summary/summary.rb +11 -0
- data/spec/factories/subject.rb +11 -0
- data/spec/factories/title.rb +12 -0
- metadata +83 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d5d477ef608efd8f417e4c31d6619485aa287e3a208a0cebfbe13a4e1e30b39
|
4
|
+
data.tar.gz: fc5dd5b45fd58f6207f133b65e1e413c076dc29f2a4c099f6bf7553e315344fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bfb1b44e3a55d15969e14ebbfa20ccc5a4fb281ed7993b70610c84ca063a937659f515a294f5b920e071826087e117ba499e8a4c7c45163df3fc11fb24ba486
|
7
|
+
data.tar.gz: a4b577fb1e5b6a023fa515844980f960a1414aec25af4d8898b74e422fe14261071d41cfe3be701d861d47832efbe57b1174d77fed325e56ce2d9b2c06ed8bbf
|
data/lib/pbcore/version.rb
CHANGED
data/pbcore.gemspec
CHANGED
@@ -17,10 +17,18 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.license = "MIT"
|
18
18
|
|
19
19
|
# Specify which files should be added to the gem when it is released.
|
20
|
-
#
|
20
|
+
# Excludes: Tests
|
21
|
+
# Includes:
|
22
|
+
# * All other files committed to git (using `git ls-files -z`).
|
23
|
+
# * Factories and their dependencies.
|
21
24
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
22
|
-
`git ls-files -z`.split("\x0").reject
|
25
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
keep = [ 'spec/support/date_time_helpers' ]
|
27
|
+
keep += Dir.glob('spec/factories/**/*')
|
28
|
+
f.match(%r{^(spec)/}) unless keep.any?(f)
|
29
|
+
end
|
23
30
|
end
|
31
|
+
|
24
32
|
spec.bindir = "exe"
|
25
33
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
34
|
spec.require_paths = ["lib"]
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'pbcore'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :pbcore_asset_date, class: PBCore::AssetDate, parent: :pbcore_content_element do
|
5
|
+
value { DateTimeHelpers.rand_date_time }
|
6
|
+
type { Faker::Lorem.word }
|
7
|
+
|
8
|
+
transient do
|
9
|
+
# `format` should be a valid format string accepted by DateTime#strftime.
|
10
|
+
# Pass a nil or false to skip converting the value from a DateTime object
|
11
|
+
# to ta string.
|
12
|
+
format { nil }
|
13
|
+
end
|
14
|
+
|
15
|
+
after :build do |pbcore_asset_date, evaluator|
|
16
|
+
# If a format is specified, use DateTime to parse the given date and
|
17
|
+
# re-format it.
|
18
|
+
if evaluator.format
|
19
|
+
pbcore_asset_date.value = DateTime.parse(pbcore_asset_date.value).strftime(evaluator.format)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'pbcore'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :pbcore_coverage, class: PBCore::Coverage, parent: :pbcore_element do
|
5
|
+
|
6
|
+
|
7
|
+
coverage { build(:pbcore_coverage_coverage) }
|
8
|
+
type { build(:pbcore_coverage_type) }
|
9
|
+
|
10
|
+
trait :spatial do
|
11
|
+
coverage { build :pbcore_coverage_coverage, :spatial }
|
12
|
+
type { build :pbcore_coverage_type, :spatial }
|
13
|
+
end
|
14
|
+
|
15
|
+
trait :temporal do
|
16
|
+
coverage { build :pbcore_coverage_coverage, :temporal }
|
17
|
+
type { build :pbcre_coverage_type, :temporal }
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'pbcore'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :pbcore_coverage_coverage, class: PBCore::Coverage::Coverage, parent: :pbcore_content_element do
|
5
|
+
|
6
|
+
# TODO: Use controlled vocabularies listed here:
|
7
|
+
# http://pbcore.org/elements/coverage
|
8
|
+
value { Faker::Lorem.words.join(' ') }
|
9
|
+
|
10
|
+
trait :spatial do
|
11
|
+
source { "latitude, longitude" }
|
12
|
+
value { "#{Faker::Address.latitude}, #{Faker::Address.longitude}" }
|
13
|
+
end
|
14
|
+
|
15
|
+
trait :temporal do
|
16
|
+
source { nil }
|
17
|
+
value { rand(1950..2018) }
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
factory :pbcore_creator_creator, class: PBCore::Creator::Creator, parent: :pbcore_content_element do
|
3
|
+
|
4
|
+
affiliation { Faker::Lorem.words.join(' ') }
|
5
|
+
affiliation_ref { Faker::Internet.url }
|
6
|
+
affiliation_source { Faker::Internet.url }
|
7
|
+
affiliation_version { FakeVersionHelper.fake_version }
|
8
|
+
affiliation_annotation { Faker::Company.bs }
|
9
|
+
value { Faker::Movies::Lebowski.character }
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'pbcore'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :pbcore_description_document, class: PBCore::DescriptionDocument, parent: :pbcore_element do
|
5
|
+
|
6
|
+
|
7
|
+
identifiers { build_list(:pbcore_identifier, rand(1..3)) }
|
8
|
+
titles { build_list(:pbcore_title, rand(1..3)) }
|
9
|
+
descriptions { build_list(:pbcore_description, rand(1..3)) }
|
10
|
+
asset_dates { build_list(:pbcore_asset_date, rand(1..3)) }
|
11
|
+
asset_types { build_list(:pbcore_asset_type, rand(1..3)) }
|
12
|
+
subjects { build_list(:pbcore_subject, rand(1..3)) }
|
13
|
+
genres { build_list(:pbcore_genre, rand(1..3)) }
|
14
|
+
relations { build_list(:pbcore_relation, rand(1..3)) }
|
15
|
+
coverages { build_list(:pbcore_coverage, rand(1..3)) }
|
16
|
+
audience_levels { build_list(:pbcore_audience_level, rand(1..3)) }
|
17
|
+
audience_ratings { build_list(:pbcore_audience_rating, rand(1..3)) }
|
18
|
+
contributors { build_list(:pbcore_contributor, rand(1..3)) }
|
19
|
+
creators { build_list(:pbcore_creator, rand(1..3)) }
|
20
|
+
publishers { build_list(:pbcore_publisher, rand(1..3)) }
|
21
|
+
rights_summaries { build_list(:pbcore_rights_summary, rand(1..3)) }
|
22
|
+
annotations { build_list(:pbcore_annotation, rand(1..3)) }
|
23
|
+
extensions { build_list(:pbcore_extension, rand(1..3)) }
|
24
|
+
instantiations { build_list(:pbcore_instantiation, rand(1..3)) }
|
25
|
+
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'pbcore'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :pbcore_extension, class: PBCore::Extension, parent: :pbcore_element do
|
5
|
+
# NOTE: <extensionWrap> and <extensionEmbedded> are mutually exclusive child
|
6
|
+
# elements of <pbcoreExtension>. However, in the factory we always choose
|
7
|
+
# <extensionWrap> by default because we can't produce round-trippable XML
|
8
|
+
# for <extensionEmbedded> because of how SAXMachine parsing works.
|
9
|
+
wrap { build(:pbcore_extension_wrap) }
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'pbcore'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :pbcore_extension_wrap, class: PBCore::Extension::Wrap, parent: :pbcore_element do
|
5
|
+
|
6
|
+
extension_element { build(:pbcore_extension_wrap_element) }
|
7
|
+
extension_value { build(:pbcore_extension_wrap_value) }
|
8
|
+
authority_used { build(:pbcore_extension_wrap_authority_used) }
|
9
|
+
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'pbcore'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :pbcore_instantiation, class: PBCore::Instantiation, parent: :pbcore_element do
|
5
|
+
identifiers { build_list(:pbcore_instantiation_identifier, rand(1..3)) }
|
6
|
+
dates { build_list(:pbcore_instantiation_date, rand(1..3)) }
|
7
|
+
dimensions { build_list(:pbcore_instantiation_dimensions, rand(1..3)) }
|
8
|
+
digital { build(:pbcore_instantiation_digital) }
|
9
|
+
physical { build(:pbcore_instantiation_physical) }
|
10
|
+
standard { build(:pbcore_instantiation_standard) }
|
11
|
+
location { build(:pbcore_instantiation_location) }
|
12
|
+
media_type { build(:pbcore_instantiation_media_type) }
|
13
|
+
generations { build_list(:pbcore_instantiation_generations, rand(1..3)) }
|
14
|
+
time_start { build(:pbcore_instantiation_time_start) }
|
15
|
+
duration { build(:pbcore_instantiation_duration) }
|
16
|
+
colors { build(:pbcore_instantiation_colors) }
|
17
|
+
rights { build_list(:pbcore_instantiation_rights, rand(1..3)) }
|
18
|
+
tracks { build(:pbcore_instantiation_tracks) }
|
19
|
+
channel_configuration { build(:pbcore_instantiation_channel_configuration) }
|
20
|
+
alternative_modes { build(:pbcore_instantiation_alternative_modes) }
|
21
|
+
annotations { build_list(:pbcore_instantiation_annotation, rand(1..3)) }
|
22
|
+
essence_tracks { build_list(:pbcore_instantiation_essence_track, rand(1..3)) }
|
23
|
+
extensions { build_list(:pbcore_instantiation_extension, rand(1..3)) }
|
24
|
+
languages { build_list(:pbcore_instantiation_language, rand(1..3)) }
|
25
|
+
relations { build_list(:pbcore_instantiation_relation, rand(1..3)) }
|
26
|
+
file_size { build(:pbcore_instantiation_file_size) }
|
27
|
+
data_rate { build(:pbcore_instantiation_data_rate) }
|
28
|
+
|
29
|
+
# time attributes
|
30
|
+
start_time { DateTimeHelpers.rand_date_time }
|
31
|
+
end_time { DateTimeHelpers.rand_date_time after: start_time }
|
32
|
+
time_annotation { Faker::Movies::StarWars.quote }
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'pbcore'
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :pbcore_instantiation_annotation, class: PBCore::Instantiation::Annotation, parent: :pbcore_content_element do
|
5
|
+
|
6
|
+
|
7
|
+
value { Faker::Movies::Ghostbusters.quote }
|
8
|
+
type { Faker::Hacker.noun }
|
9
|
+
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|