cdmbl 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 213955e102d8ea7d3297acbd197665be36444305
4
- data.tar.gz: 6e6157fa118ac1bf33ce8713063478dfc3773685
3
+ metadata.gz: c1a2f19c0067241fa3a48fae51ef1037eaff9eae
4
+ data.tar.gz: 0d7976ba3295a2bd5a078f6ce82b332346f4e585
5
5
  SHA512:
6
- metadata.gz: 3d44c11d1a889e9c53807562ff4b97c0d61e1069ba62cdaad2ff1569c667e5d85fe98d11e9bb8d78a40a31e03d2cba92c92755010e27bf738a505a9cc524f40f
7
- data.tar.gz: 3a410e460ace3fe256c99b67abc4bbb557c6d0708c58d893a30f132de4774c5df2c683d60c8815bee9d73b7e470d37d3eb7c3732b03993feb7cb9f8b5529d289
6
+ metadata.gz: 43df324f1b75b2d86ea15b170450cf57fc1a304968f0174716074749865f39d5f8c99a46a560b7842361abeb61053e76fdb2835b4600912284804d712a6d04bc
7
+ data.tar.gz: f7f1ecaf33619f6bdad8a50d5cef9f92a35c543f2758e2eb396214e04510268cf320141f22f0f2ec0761f38ef4912972d02e1698dfcf46d0b58d24a66be79f42
@@ -0,0 +1,8 @@
1
+ module CDMBL
2
+ # An example callback
3
+ class DefaultCdmNotification
4
+ def self.call!(collection, id, endpoint)
5
+ puts "A CCONTENTdm API request notification"
6
+ end
7
+ end
8
+ end
@@ -1,6 +1,6 @@
1
1
  module CDMBL
2
2
  # An example callback
3
- class DefaultCallback
3
+ class DefaultCompletedCallback
4
4
  def self.call!(solr_client)
5
5
  puts "A callback task"
6
6
  end
@@ -0,0 +1,8 @@
1
+ module CDMBL
2
+ # An example callback
3
+ class DefaultOaiNotification
4
+ def self.call!(solr_client)
5
+ puts "An OAI callback task"
6
+ end
7
+ end
8
+ end
@@ -11,7 +11,7 @@ module CDMBL
11
11
  if etl_run.next_resumption_token && recursive
12
12
  ETLWorker.perform_async(solr_config, next_etl_config)
13
13
  else
14
- CDMBL::Callback.call!(solr_client)
14
+ CDMBL::CompletedCallback.call!(solr_client)
15
15
  end
16
16
  end
17
17
 
@@ -65,7 +65,7 @@ module CDMBL
65
65
  end
66
66
 
67
67
  def cdm_request(collection, id)
68
- Rails.logger.info("CDMBL: Requesting #{collection}/#{id} from #{cdm_endpoint}")
68
+ CDMBL::CdmNotification.call!(collection, id, cdm_endpoint)
69
69
  cdm_item.new(base_url: cdm_endpoint, collection: collection, id: id).metadata
70
70
  end
71
71
 
@@ -7,6 +7,12 @@ module CDMBL
7
7
  value
8
8
  end
9
9
  end
10
+
11
+ class IDFormatter
12
+ def self.format(value)
13
+ value.split('/').join(':')
14
+ end
15
+ end
10
16
 
11
17
  class Titlieze
12
18
  def self.format(value)
data/lib/cdmbl/hooks.rb CHANGED
@@ -2,8 +2,12 @@ module CDMBL
2
2
  def self.const_missing(name)
3
3
  if name.to_s == 'Solr'
4
4
  hook(pattern: name.to_s, default: DefaultSolr)
5
- elsif name.to_s == 'Callback'
6
- hook(pattern: name.to_s, default: DefaultCallback)
5
+ elsif name.to_s == 'CompletedCallback'
6
+ hook(pattern: name.to_s, default: DefaultCompletedCallback)
7
+ elsif name.to_s == 'OaiNotification'
8
+ hook(pattern: name.to_s, default: DefaultOaiNotification)
9
+ elsif name.to_s == 'CdmNotification'
10
+ hook(pattern: name.to_s, default: DefaultCdmNotification)
7
11
  end
8
12
  end
9
13
 
@@ -34,7 +34,7 @@ module CDMBL
34
34
  end
35
35
 
36
36
  def request(location)
37
- Rails.logger.info("CDMBL: Requesting Identifiers from #{location}")
37
+ CDMBL::OaiNotification.call!(location)
38
38
  client.get_response(URI(location)).body
39
39
  end
40
40
  end
@@ -48,7 +48,7 @@ module CDMBL
48
48
  def self.default_mappings
49
49
  [
50
50
  {dest_path: 'location_llsi', origin_path: '/', formatters: [LocationFormatter]},
51
- {dest_path: 'id', origin_path: 'id', formatters: [StripFormatter]},
51
+ {dest_path: 'id', origin_path: 'id', formatters: [StripFormatter, IDFormatter]},
52
52
  {dest_path: 'setspec_ssi', origin_path: '/', formatters: [AddSetSpecFormatter, SetSpecFormatter]},
53
53
  {dest_path: 'collection_name_ssi', origin_path: '/', formatters: [AddSetSpecFormatter, CollectionNameFormatter]},
54
54
  {dest_path: 'collection_name_tei', origin_path: '/', formatters: [AddSetSpecFormatter, CollectionNameFormatter]},
data/lib/cdmbl/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module CDMBL
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
data/lib/cdmbl.rb CHANGED
@@ -11,6 +11,8 @@ require 'cdmbl/default_solr'
11
11
  require 'cdmbl/loader'
12
12
  require 'cdmbl/etl_run'
13
13
  require 'cdmbl/etl_worker'
14
- require 'cdmbl/default_callback'
14
+ require 'cdmbl/default_completed_callback'
15
+ require 'cdmbl/default_cdm_notification'
16
+ require 'cdmbl/default_oai_notification'
15
17
  require 'cdmbl/hooks'
16
18
  require 'cdmbl/oai_filter'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cdmbl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - chadfennell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-19 00:00:00.000000000 Z
11
+ date: 2016-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hash_at_path
@@ -208,7 +208,9 @@ files:
208
208
  - bin/setup
209
209
  - cdmbl.gemspec
210
210
  - lib/cdmbl.rb
211
- - lib/cdmbl/default_callback.rb
211
+ - lib/cdmbl/default_cdm_notification.rb
212
+ - lib/cdmbl/default_completed_callback.rb
213
+ - lib/cdmbl/default_oai_notification.rb
212
214
  - lib/cdmbl/default_solr.rb
213
215
  - lib/cdmbl/etl_run.rb
214
216
  - lib/cdmbl/etl_worker.rb