Class: Accession
- Defined in:
- backend/app/model/accession.rb,
frontend/app/models/accession.rb,
public/app/models/accession.rb
Constant Summary
Constants inherited from Record
Instance Attribute Summary collapse
-
#access_restrictions_note ⇒ Object
readonly
Returns the value of attribute access_restrictions_note.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#provenance ⇒ Object
readonly
Returns the value of attribute provenance.
-
#related_accessions ⇒ Object
readonly
Returns the value of attribute related_accessions.
-
#related_resources ⇒ Object
readonly
Returns the value of attribute related_resources.
-
#resource_link ⇒ Object
Returns the value of attribute resource_link.
-
#script ⇒ Object
readonly
Returns the value of attribute script.
-
#use_restrictions_note ⇒ Object
readonly
Returns the value of attribute use_restrictions_note.
Attributes inherited from Record
#agents, #classifications, #container_display, #container_summary_for_badge, #container_titles_and_uris, #criteria, #dates, #display_string, #extents, #external_documents, #full, #highlights, #identifier, #json, #lang_materials, #level, #linked_digital_objects, #notes, #other_level, #primary_type, #raw, #repository_information, #resolved_repository, #resolved_resource, #resolved_top_container, #subjects, #uri
Instance Method Summary collapse
-
#access_restrictions_apply? ⇒ Boolean
-
#acquisition_type ⇒ Object
-
#content_description ⇒ Object
-
#deaccessions ⇒ Object
-
#initialize(*args) ⇒ Accession
constructor
A new instance of Accession.
-
#inventory ⇒ Object
-
#populate_from_accession(accession) ⇒ Object
-
#ref_id ⇒ Object
-
#restrictions_apply? ⇒ Boolean
-
#use_restrictions_apply? ⇒ Boolean
Methods inherited from Record
#[], #apply_highlighting, #dig, #note, #parse_full_title, #request_item
Constructor Details
#initialize(*args) ⇒ Accession
Returns a new instance of Accession.
7 8 9 10 11 12 13 14 |
# File 'public/app/models/accession.rb', line 7 def initialize(*args) super = = @use_restrictions_note = json['use_restrictions_note'] @access_restrictions_note = json['access_restrictions_note'] end |
Instance Attribute Details
#access_restrictions_note ⇒ Object (readonly)
Returns the value of attribute access_restrictions_note
3 4 5 |
# File 'public/app/models/accession.rb', line 3 def access_restrictions_note @access_restrictions_note end |
#language ⇒ Object (readonly)
Returns the value of attribute language
3 4 5 |
# File 'public/app/models/accession.rb', line 3 def language @language end |
#provenance ⇒ Object (readonly)
Returns the value of attribute provenance
3 4 5 |
# File 'public/app/models/accession.rb', line 3 def provenance @provenance end |
#related_accessions ⇒ Object (readonly)
Returns the value of attribute related_accessions
3 4 5 |
# File 'public/app/models/accession.rb', line 3 def end |
#related_resources ⇒ Object (readonly)
Returns the value of attribute related_resources
3 4 5 |
# File 'public/app/models/accession.rb', line 3 def end |
#resource_link ⇒ Object
Returns the value of attribute resource_link
2 3 4 |
# File 'frontend/app/models/accession.rb', line 2 def resource_link @resource_link end |
#script ⇒ Object (readonly)
Returns the value of attribute script
3 4 5 |
# File 'public/app/models/accession.rb', line 3 def script @script end |
#use_restrictions_note ⇒ Object (readonly)
Returns the value of attribute use_restrictions_note
3 4 5 |
# File 'public/app/models/accession.rb', line 3 def use_restrictions_note @use_restrictions_note end |
Instance Method Details
#access_restrictions_apply? ⇒ Boolean
63 64 65 |
# File 'public/app/models/accession.rb', line 63 def access_restrictions_apply? json['access_restrictions'] end |
#acquisition_type ⇒ Object
16 17 18 19 20 |
# File 'public/app/models/accession.rb', line 16 def acquisition_type if json['acquisition_type'] I18n.t("enumerations.accession_acquisition_type.#{json['acquisition_type']}", :default => json['acquisition_type']) end end |
#content_description ⇒ Object
27 28 29 |
# File 'public/app/models/accession.rb', line 27 def content_description json['content_description'] end |
#deaccessions ⇒ Object
22 23 24 25 |
# File 'public/app/models/accession.rb', line 22 def deaccessions return '' unless AppConfig[:pui_display_deaccessions] ASUtils.wrap(json['deaccessions']) end |
#inventory ⇒ Object
31 32 33 |
# File 'public/app/models/accession.rb', line 31 def inventory json['inventory'] end |
#populate_from_accession(accession) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'frontend/app/models/accession.rb', line 24 def populate_from_accession(accession) values = accession.to_hash(:raw) # Recursively remove bits that don't make sense to copy (like "lock_version" properties) values = JSONSchemaUtils.map_hash_with_schema(values, JSONModel(:accession).schema, [proc { |hash, schema| hash = hash.clone hash.delete_if {|k, v| k.to_s =~ /^(id_[0-9]|lock_version)$/} hash }]) prepare_for_clone(values) self.update(values) end |
#ref_id ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'frontend/app/models/accession.rb', line 11 def ref_id ref_id = "" (0..3).each do |i| next if self.send("id_#{i.to_s}").blank? ref_id << " - " unless i === 0 ref_id << self.send("id_#{i.to_s}") end ref_id end |
#restrictions_apply? ⇒ Boolean
51 52 53 |
# File 'public/app/models/accession.rb', line 51 def restrictions_apply? json['restrictions_apply'] end |
#use_restrictions_apply? ⇒ Boolean
67 68 69 |
# File 'public/app/models/accession.rb', line 67 def use_restrictions_apply? json['use_restrictions'] end |