iiif-presentation 0.0.5 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40a8beab9d760a59d1bff41487a2f3329ade03e0
4
- data.tar.gz: debe13d12cbc1634d28958521c6fe75525e049f5
3
+ metadata.gz: 136f2338c1c913c7a28bc3beff44986c274ff9a7
4
+ data.tar.gz: 286915f2245cce194b378b21a8790f39ccf0e16b
5
5
  SHA512:
6
- metadata.gz: cd6967c2793fff9225183b77f4862c6ec01122c6b29866b0f402af1b05fb0401cfbb9577ed0c525bc3ba88a733b9d21bad18ba10c51bff6dc136d93172627a85
7
- data.tar.gz: c584263143abdf9661b1dfde6f45e905f33b66b7bd4e1b26dcc5f466efad64385912e630dabf65b647b73b7b229ee03d045d70cc68ecc169eaf709cae29610f9
6
+ metadata.gz: 3ffb123653fe951624635cf0f7499f1a34e099a5e44b8a63f5fbae19b43751b3ce44337c251bd46c5337ca719d514a2f48fc87484309061bba18e63ccd227a50
7
+ data.tar.gz: 0c8acd7f1e9b253cd32ec90cbc855c9666d94552728e4d72858a7d751207c088aafa21a03522ab58c9308ea44e5e818b8bdcff3a326709103ef4c88bb1e79b3a
data/.travis.yml CHANGED
@@ -2,6 +2,10 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.1.0
5
+ install:
6
+ - "gem install bundler"
7
+ - "bundle install --jobs=3 --retry=3"
8
+
5
9
  gemfile:
6
10
  - gemfiles/rails3.gemfile
7
11
  - gemfiles/rails4.gemfile
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.1.0
@@ -17,7 +17,7 @@ module IIIF
17
17
  ###
18
18
  # Methods that take a block and should return an instance (self or a new'
19
19
  # instance) have been overridden to do so, rather than an'
20
- # ActiveSupport::OrderedHash based on the internal hash
20
+ # IIIF::OrderedHash based on the internal hash
21
21
 
22
22
  SIMPLE_SELF_RETURNERS = %w[delete_if each each_key each_value keep_if]
23
23
 
@@ -1,7 +1,6 @@
1
1
  require 'active_support/inflector'
2
- require 'active_support/ordered_hash'
3
2
 
4
- module ActiveSupport
3
+ module IIIF
5
4
  class OrderedHash < ::Hash
6
5
 
7
6
  # Insert a new key and value at the suppplied index.
@@ -14,7 +13,7 @@ module ActiveSupport
14
13
  # @param [Object] key
15
14
  # @param [Object] value
16
15
  def insert(index, key, value)
17
- tmp = ActiveSupport::OrderedHash.new
16
+ tmp = IIIF::OrderedHash.new
18
17
  index = self.length + 1 + index if index < 0
19
18
  if index < 0
20
19
  m = "Index #{index} is too small for current length (#{length})"
@@ -15,6 +15,8 @@ abstract_resource
15
15
  require File.join(File.dirname(__FILE__), 'presentation', f)
16
16
  end
17
17
 
18
+ require_relative 'ordered_hash'
19
+
18
20
  module IIIF
19
21
  module Presentation
20
22
  CONTEXT ||= 'http://iiif.io/api/presentation/2/context.json'
data/lib/iiif/service.rb CHANGED
@@ -19,7 +19,7 @@ module IIIF
19
19
  def int_only_keys; %w{ }; end
20
20
 
21
21
  def initialize(hsh={})
22
- @data = ActiveSupport::OrderedHash[hsh]
22
+ @data = IIIF::OrderedHash[hsh]
23
23
  self.define_methods_for_any_type_keys
24
24
  self.define_methods_for_array_only_keys
25
25
  self.define_methods_for_string_only_keys
@@ -34,11 +34,11 @@ module IIIF
34
34
  def parse(s)
35
35
  ordered_hash = nil
36
36
  if s.kind_of?(String) && File.exists?(s)
37
- ordered_hash = ActiveSupport::OrderedHash[JSON.parse(IO.read(s))]
37
+ ordered_hash = IIIF::OrderedHash[JSON.parse(IO.read(s))]
38
38
  elsif s.kind_of?(String) && !File.exists?(s)
39
- ordered_hash = ActiveSupport::OrderedHash[JSON.parse(s)]
39
+ ordered_hash = IIIF::OrderedHash[JSON.parse(s)]
40
40
  elsif s.kind_of?(Hash)
41
- ordered_hash = ActiveSupport::OrderedHash[s]
41
+ ordered_hash = IIIF::OrderedHash[s]
42
42
  else
43
43
  m = '#parse takes a path to a file, a JSON String, or a Hash, '
44
44
  m += "argument was a #{s.class}."
@@ -111,7 +111,7 @@ module IIIF
111
111
  self.validate
112
112
  end
113
113
 
114
- export_hash = ActiveSupport::OrderedHash.new
114
+ export_hash = IIIF::OrderedHash.new
115
115
 
116
116
  if sort_json_ld_keys
117
117
  self.keys.select { |k| k.start_with?('@') }.sort!.each do |k|
@@ -130,7 +130,7 @@ module IIIF
130
130
  export_hash[k] = self.data[k].to_ordered_hash(sub_opts)
131
131
 
132
132
  elsif self.data[k].kind_of?(Hash)
133
- export_hash[k] = ActiveSupport::OrderedHash.new
133
+ export_hash[k] = IIIF::OrderedHash.new
134
134
  self.data[k].each do |sub_k, v|
135
135
 
136
136
  if v.respond_to?(:to_ordered_hash)
@@ -158,7 +158,7 @@ module IIIF
158
158
  export_hash[k] << member.to_ordered_hash(sub_opts)
159
159
 
160
160
  elsif member.kind_of?(Hash)
161
- hsh = ActiveSupport::OrderedHash.new
161
+ hsh = IIIF::OrderedHash.new
162
162
  export_hash[k] << hsh
163
163
  member.each do |sub_k,v|
164
164
 
@@ -196,7 +196,7 @@ module IIIF
196
196
  export_hash
197
197
  end
198
198
 
199
- def self.from_ordered_hash(hsh, default_klass=ActiveSupport::OrderedHash)
199
+ def self.from_ordered_hash(hsh, default_klass=IIIF::OrderedHash)
200
200
  # Create a new object (new_object)
201
201
  type = nil
202
202
  if hsh.has_key?('@type')
@@ -24,9 +24,9 @@ describe IIIF::Service do
24
24
  s = described_class.parse(h)
25
25
  expect(s['label']).to eq 'Book 1'
26
26
  end
27
- it 'ActiveSupport::OrderedHash' do
27
+ it 'IIIF::OrderedHash' do
28
28
  h = JSON.parse(IO.read(manifest_from_spec_path))
29
- oh = ActiveSupport::OrderedHash[h]
29
+ oh = IIIF::OrderedHash[h]
30
30
  s = described_class.parse(oh)
31
31
  expect(s['label']).to eq 'Book 1'
32
32
  end
@@ -95,7 +95,7 @@ describe IIIF::Service do
95
95
  expect(parsed.class).to be expected_klass
96
96
  end
97
97
  it 'turns keys without "@type" into an OrderedHash' do
98
- expected_klass = ActiveSupport::OrderedHash
98
+ expected_klass = IIIF::OrderedHash
99
99
  parsed = described_class.from_ordered_hash(fixture)
100
100
  expect(parsed['some_other_thing'].class).to be expected_klass
101
101
  end
@@ -7,7 +7,7 @@ describe IIIF::HashBehaviours do
7
7
  include IIIF::HashBehaviours
8
8
  attr_accessor :data # Accessible for easier expects...not sure you'd do this in a real class
9
9
  def initialize()
10
- @data = ActiveSupport::OrderedHash.new
10
+ @data = IIIF::OrderedHash.new
11
11
  end
12
12
  end
13
13
  end
@@ -1,4 +1,4 @@
1
- describe ActiveSupport::OrderedHash do
1
+ describe IIIF::OrderedHash do
2
2
 
3
3
  describe '#camelize_keys' do
4
4
  before(:each) do
@@ -58,7 +58,7 @@ describe ActiveSupport::OrderedHash do
58
58
  let (:init_data) { [ ['wubble', 'fred'], ['baz', 'qux'], ['grault','garply'] ] }
59
59
 
60
60
  subject do
61
- hsh = ActiveSupport::OrderedHash.new
61
+ hsh = described_class.new
62
62
  init_data.each { |e| hsh[e[0]] = e[1] }
63
63
  hsh
64
64
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iiif-presentation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Stroop
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-07 00:00:00.000000000 Z
11
+ date: 2016-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -168,8 +168,8 @@ files:
168
168
  - gemfiles/rails3.gemfile
169
169
  - gemfiles/rails4.gemfile
170
170
  - iiif-presentation.gemspec
171
- - lib/active_support/ordered_hash.rb
172
171
  - lib/iiif/hash_behaviours.rb
172
+ - lib/iiif/ordered_hash.rb
173
173
  - lib/iiif/presentation.rb
174
174
  - lib/iiif/presentation/abstract_resource.rb
175
175
  - lib/iiif/presentation/annotation.rb
@@ -190,8 +190,8 @@ files:
190
190
  - spec/integration/iiif/presentation/image_resource_spec.rb
191
191
  - spec/integration/iiif/service_spec.rb
192
192
  - spec/spec_helper.rb
193
- - spec/unit/active_support/ordered_hash_spec.rb
194
193
  - spec/unit/iiif/hash_behaviours_spec.rb
194
+ - spec/unit/iiif/ordered_hash_spec.rb
195
195
  - spec/unit/iiif/presentation/abstract_resource_spec.rb
196
196
  - spec/unit/iiif/presentation/annotation_list_spec.rb
197
197
  - spec/unit/iiif/presentation/annotation_spec.rb
@@ -229,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
229
  version: '0'
230
230
  requirements: []
231
231
  rubyforge_project:
232
- rubygems_version: 2.4.6
232
+ rubygems_version: 2.5.1
233
233
  signing_key:
234
234
  specification_version: 4
235
235
  summary: API for working with IIIF Presentation manifests.
@@ -241,8 +241,8 @@ test_files:
241
241
  - spec/integration/iiif/presentation/image_resource_spec.rb
242
242
  - spec/integration/iiif/service_spec.rb
243
243
  - spec/spec_helper.rb
244
- - spec/unit/active_support/ordered_hash_spec.rb
245
244
  - spec/unit/iiif/hash_behaviours_spec.rb
245
+ - spec/unit/iiif/ordered_hash_spec.rb
246
246
  - spec/unit/iiif/presentation/abstract_resource_spec.rb
247
247
  - spec/unit/iiif/presentation/annotation_list_spec.rb
248
248
  - spec/unit/iiif/presentation/annotation_spec.rb