Class: Stash::Wrapper::Embargo

Inherits:
Object
  • Object
show all
Includes:
XML::Mapping
Defined in:
lib/stash/wrapper/embargo.rb

Overview

Mapping class for <st:embargo>

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, period:, start_date:, end_date:) ⇒ Embargo

Creates a new Stash::Wrapper::Embargo object

Parameters:

  • type (EmbargoType) —

    The embargo type

  • period (String) —

    The embargo period

  • start_date (Date) —

    The embargo start date

  • end_date (Date) —

    The embargo end date



21
22
23
24
25
26
# File 'lib/stash/wrapper/embargo.rb', line 21

def initialize(type:, period:, start_date:, end_date:)
  self.type = type
  self.period = period
  self.start_date = start_date
  self.end_date = end_date
end

Class Method Details

.none ⇒ Embargo

Creates a new Embargo instance of type EmbargoType::NONE with the current date as start and end.

Returns:



30
31
32
33
# File 'lib/stash/wrapper/embargo.rb', line 30

def self.none
  today = Date.today
  new(type: EmbargoType::NONE, period: EmbargoType::NONE.value, start_date: today, end_date: today)
end