Class: Mrt::Ingest::Request
- Inherits:
-
Object
- Object
- Mrt::Ingest::Request
- Defined in:
- lib/mrt/ingest/request.rb
Overview
Represents a request to be sent to an ingest server.
Instance Attribute Summary collapse
-
#creator ⇒ Object
Returns the value of attribute creator.
-
#date ⇒ Object
Returns the value of attribute date.
-
#digest ⇒ Object
Returns the value of attribute digest.
-
#file ⇒ Object
Returns the value of attribute file.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#local_identifier ⇒ Object
Returns the value of attribute local_identifier.
-
#note ⇒ Object
Returns the value of attribute note.
-
#primary_identifier ⇒ Object
Returns the value of attribute primary_identifier.
-
#profile ⇒ Object
Returns the value of attribute profile.
-
#submitter ⇒ Object
Returns the value of attribute submitter.
-
#title ⇒ Object
Returns the value of attribute title.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(profile:, submitter:, type:, creator: nil, date: nil, digest: nil, file: nil, filename: nil, local_identifier: nil, primary_identifier: nil, note: nil, title: nil) ⇒ Request
constructor
rubocop:disable Metrics/MethodLength, Metrics/ParameterLists.
-
#mk_args ⇒ Object
Returns a hash of arguments suitable for sending to a server.
Constructor Details
#initialize(profile:, submitter:, type:, creator: nil, date: nil, digest: nil, file: nil, filename: nil, local_identifier: nil, primary_identifier: nil, note: nil, title: nil) ⇒ Request
rubocop:disable Metrics/MethodLength, Metrics/ParameterLists
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/mrt/ingest/request.rb', line 26 def initialize( profile:, submitter:, type:, creator: nil, date: nil, digest: nil, file: nil, filename: nil, local_identifier: nil, primary_identifier: nil, note: nil, title: nil ) raise ArgumentError, 'profile cannot be nil' unless profile raise ArgumentError, 'profile cannot be submitter' unless submitter raise ArgumentError, 'profile cannot be type' unless type @creator = creator @date = date @digest = digest @file = file @filename = filename @local_identifier = local_identifier @primary_identifier = primary_identifier @profile = profile @note = note @submitter = submitter @title = title @type = type end |
Instance Attribute Details
#creator ⇒ Object
Returns the value of attribute creator.
12 13 14 |
# File 'lib/mrt/ingest/request.rb', line 12 def creator @creator end |
#date ⇒ Object
Returns the value of attribute date.
13 14 15 |
# File 'lib/mrt/ingest/request.rb', line 13 def date @date end |
#digest ⇒ Object
Returns the value of attribute digest.
14 15 16 |
# File 'lib/mrt/ingest/request.rb', line 14 def digest @digest end |
#file ⇒ Object
Returns the value of attribute file.
15 16 17 |
# File 'lib/mrt/ingest/request.rb', line 15 def file @file end |
#filename ⇒ Object
Returns the value of attribute filename.
16 17 18 |
# File 'lib/mrt/ingest/request.rb', line 16 def filename @filename end |
#local_identifier ⇒ Object
Returns the value of attribute local_identifier.
17 18 19 |
# File 'lib/mrt/ingest/request.rb', line 17 def local_identifier @local_identifier end |
#note ⇒ Object
Returns the value of attribute note.
18 19 20 |
# File 'lib/mrt/ingest/request.rb', line 18 def note @note end |
#primary_identifier ⇒ Object
Returns the value of attribute primary_identifier.
19 20 21 |
# File 'lib/mrt/ingest/request.rb', line 19 def primary_identifier @primary_identifier end |
#profile ⇒ Object
Returns the value of attribute profile.
20 21 22 |
# File 'lib/mrt/ingest/request.rb', line 20 def profile @profile end |
#submitter ⇒ Object
Returns the value of attribute submitter.
21 22 23 |
# File 'lib/mrt/ingest/request.rb', line 21 def submitter @submitter end |
#title ⇒ Object
Returns the value of attribute title.
22 23 24 |
# File 'lib/mrt/ingest/request.rb', line 22 def title @title end |
#type ⇒ Object
Returns the value of attribute type.
23 24 25 |
# File 'lib/mrt/ingest/request.rb', line 23 def type @type end |
Instance Method Details
#mk_args ⇒ Object
Returns a hash of arguments suitable for sending to a server. rubocop: disable Metrics/MethodLength
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/mrt/ingest/request.rb', line 52 def mk_args { 'creator' => creator, 'date' => date, 'digestType' => digest_type, 'digestValue' => digest_value, 'file' => file, 'filename' => filename, 'localIdentifier' => local_identifier, 'primaryIdentifier' => primary_identifier, 'profile' => profile, 'note' => note, 'responseForm' => 'json', 'submitter' => submitter, 'title' => title, 'type' => type }.reject { |_k, v| v.nil? || (v == '') } end |