Class: SmithsonianArkMinter

Inherits:
ArkMinter show all
Defined in:
backend/app/lib/ark/smithsonian_ark_minter.rb

Instance Method Summary collapse

Methods inherited from ArkMinter

generate_version_key, #is_still_current?, #shoulder_for_repo, #version_key_for

Instance Method Details

#ark_recognized?(ark) ⇒ Boolean

Looks like an ARK that ends in a UUID.

Returns:

  • (Boolean)


14
15
16
# File 'backend/app/lib/ark/smithsonian_ark_minter.rb', line 14

def ark_recognized?(ark)
  ark =~ %r{/ark:/.*\h{8}-\h{4}-\h{4}-\h{4}-\h{12}$}
end

#mint!(obj, row_defaults) ⇒ Object



5
6
7
8
9
10
11
# File 'backend/app/lib/ark/smithsonian_ark_minter.rb', line 5

def mint!(obj, row_defaults)
  DB.open do |db|
    ark_shoulder = shoulder_for_repo(obj.repo_id)

    db[:ark_name].insert(row_defaults.merge(:ark_value => build_generated_ark(ark_shoulder)))
  end
end