sdr-replication 0.3.2 → 0.4.0

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: 618ba388b806ffc0b0603d5345a59e96a8b5d8fa
4
- data.tar.gz: e8fab0f2d4979ecf235865f26a8f63e882d71e60
3
+ metadata.gz: a245a916715c6dbba2d403aa8e9aefebfa64fe9a
4
+ data.tar.gz: 62b455ca2bfa6857cd28a867549e57e33715e278
5
5
  SHA512:
6
- metadata.gz: 789266670ba3858b9229f1c4ecc58d695d5a35f1b448d2da1fc7f74163eea039c3f58642ff69018f73bf33e4264aa5554e737f75937115fdb3f5c04e2f80d374
7
- data.tar.gz: 7ec0ffb38e1124cb260b3c7fda6d6af942ffd59b97909fd6b701da3e12d4566883a0db0353c7b9d48c386f1f68683e3640111c127f6b70686477340dd82950c1
6
+ metadata.gz: 8f836f2c9470dedafe3dc0596a12c02a522115c1c7e1a3f6a6df74300b396fa86796f0a52eec9d9f44a6ec7303770995408a6b486be227e0f2ee2f96c7e60071
7
+ data.tar.gz: a3979bca598b31c52a580de7768d91bfcc19d73dfbc6201dd12a217a6e9b38f02a2d8e211f8ef3c1e22344f46b4b0a413d9ce589997f2ed05ade006b60b7f2fb
@@ -45,7 +45,7 @@ module Replication
45
45
  end
46
46
 
47
47
  # Get the item record from the specified table for the specified primary key.
48
- # @param [String] table name of the database table
48
+ # @param [Symbol, String] table name of the database table
49
49
  # @param [String] id primary key for the item in the database table
50
50
  # @return [Hash] the row (in key,value hash) from the specified table for the specified identifier.
51
51
  # Response body contains the item data in JSON format, which is converted to a hash.
@@ -62,14 +62,14 @@ module Replication
62
62
  end
63
63
  end
64
64
 
65
- # Retrieve an existing database record or add a new one using the data provided.
66
- # @param [String] table name of the database table
65
+ # update an existing database record or add a new one using the data provided in the hash.
66
+ # @param [Symbol, String] table name of the database table
67
67
  # @param [Hash] hash the item data to be added to the database table
68
68
  # @return [Hash] result containing the item data as if a GET were performed.
69
69
  # The HTTP response code for success is 201 (Created).
70
70
  # @see http://en.wikipedia.org/wiki/POST_(HTTP)
71
71
  # @see http://tools.ietf.org/html/rfc2616#page-54
72
- def find_or_create_item(table,hash)
72
+ def add_or_update_item(table,hash)
73
73
  payload = hash.to_json
74
74
  headers = {:content_type => :json, :accept => :json}
75
75
  # Don't raise RestClient::Exception but return the response
@@ -83,7 +83,7 @@ module Replication
83
83
  end
84
84
 
85
85
  # Update the database columns for the specified item using the hash data.
86
- # @param [String] table name of the database table
86
+ # @param [Symbol, String] table name of the database table
87
87
  # @param [String] id primary key for the item in the database table
88
88
  # @param [Hash] hash the item data to be updated in the database table
89
89
  # @return (Boolean) true if the HTTP response code is 204, per specification for PATCH or PUT request types.
@@ -71,7 +71,7 @@ module Replication
71
71
  end
72
72
 
73
73
  # @return [Boolean] Update the replicas table of the Archive Catalog
74
- def update_replica_data
74
+ def catalog_replica_data
75
75
  replica_data = {
76
76
  :replica_id => @replica_id,
77
77
  :home_repository => @home_repository,
@@ -80,7 +80,7 @@ module Replication
80
80
  :payload_fixity_type => @payload_fixity_type,
81
81
  :payload_fixity => @payload_fixity
82
82
  }
83
- ArchiveCatalog.find_or_create_item(:replicas, replica_data)
83
+ ArchiveCatalog.add_or_update_item(:replicas, replica_data)
84
84
  true
85
85
  end
86
86
 
@@ -67,7 +67,7 @@ module Replication
67
67
  end
68
68
 
69
69
  # @return [Boolean] Update digital_objects and sdr_objects tables in Archive Catalog
70
- def update_object_data
70
+ def catalog_object_data
71
71
 
72
72
  identity_metadata = parse_identity_metadata
73
73
  relationship_metadata = parse_relationship_metadata
@@ -86,8 +86,8 @@ module Replication
86
86
  }
87
87
 
88
88
  if version_id == 1
89
- ArchiveCatalog.find_or_create_item(:digital_objects,digital_object_data)
90
- ArchiveCatalog.find_or_create_item(:sdr_objects,sdr_object_data)
89
+ ArchiveCatalog.add_or_update_item(:digital_objects,digital_object_data)
90
+ ArchiveCatalog.add_or_update_item(:sdr_objects,sdr_object_data)
91
91
  else
92
92
  ArchiveCatalog.update_item(:sdr_objects, digital_object_id, sdr_object_data)
93
93
  end
@@ -96,7 +96,7 @@ module Replication
96
96
  end
97
97
 
98
98
  # @return [Boolean] Update sdr_object_versions and sdr_version_stats tables in Archive Catalog
99
- def update_version_data
99
+ def catalog_version_data
100
100
 
101
101
  version_inventory = self.version_inventory
102
102
  sdr_object_version_data = {
@@ -105,7 +105,7 @@ module Replication
105
105
  :replica_id => composite_key,
106
106
  :ingest_date => version_inventory.inventory_datetime
107
107
  }
108
- ArchiveCatalog.find_or_create_item(:sdr_object_versions, sdr_object_version_data)
108
+ ArchiveCatalog.add_or_update_item(:sdr_object_versions, sdr_object_version_data)
109
109
 
110
110
 
111
111
  content = version_inventory.group('content')
@@ -121,7 +121,7 @@ module Replication
121
121
  :metadata_bytes => metadata.byte_count,
122
122
  :metadata_blocks => metadata.block_count
123
123
  }
124
- ArchiveCatalog.find_or_create_item(:sdr_version_stats, sdr_version_full)
124
+ ArchiveCatalog.add_or_update_item(:sdr_version_stats, sdr_version_full)
125
125
 
126
126
  version_additions = self.version_additions
127
127
  content = version_additions.group('content')
@@ -137,7 +137,7 @@ module Replication
137
137
  :metadata_bytes => metadata.byte_count,
138
138
  :metadata_blocks => metadata.block_count
139
139
  }
140
- ArchiveCatalog.find_or_create_item(:sdr_version_stats, sdr_version_delta)
140
+ ArchiveCatalog.add_or_update_item(:sdr_version_stats, sdr_version_delta)
141
141
 
142
142
  true
143
143
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sdr-replication
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Anderson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-30 00:00:00.000000000 Z
11
+ date: 2014-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json_pure