Class: Sipity::Forms::AssignADoiForm

Inherits:
BaseForm
  • Object
show all
Defined in:
app/forms/sipity/forms/assign_a_doi_form.rb

Overview

Responsible for capturing and validating the assignment of a DOI that already exists but has not yet been assigned to the SIP

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseForm

#persisted?, #submit, #to_key, #to_param

Constructor Details

#initialize(attributes = {}) ⇒ AssignADoiForm


8
9
10
11
# File 'app/forms/sipity/forms/assign_a_doi_form.rb', line 8

def initialize(attributes = {})
  self.sip = attributes.fetch(:sip)
  self.identifier = attributes.fetch(:identifier, nil)
end

Instance Attribute Details

#identifierObject

Returns the value of attribute identifier


13
14
15
# File 'app/forms/sipity/forms/assign_a_doi_form.rb', line 13

def identifier
  @identifier
end

#sipObject

Returns the value of attribute sip


13
14
15
# File 'app/forms/sipity/forms/assign_a_doi_form.rb', line 13

def sip
  @sip
end

Instance Method Details

#assign_a_doi_formObject

TODO: Get this out of here. There is an object that is a better owner of this method. But for now it is here based on a view implementation.


21
22
23
# File 'app/forms/sipity/forms/assign_a_doi_form.rb', line 21

def assign_a_doi_form
  self
end

#identifier_keyObject


25
26
27
# File 'app/forms/sipity/forms/assign_a_doi_form.rb', line 25

def identifier_key
  Models::AdditionalAttribute::DOI_PREDICATE_NAME
end

#request_a_doi_formObject

TODO: Get this out of here. There is an object that is a better owner of this method. But for now it is here based on a view implementation.


31
32
33
# File 'app/forms/sipity/forms/assign_a_doi_form.rb', line 31

def request_a_doi_form
  RequestADoiForm.new(sip: sip)
end