Class: EVSS::IntentToFile::IntentToFile

Inherits:
Common::Base show all
Defined in:
lib/evss/intent_to_file/intent_to_file.rb

Overview

Model for an intent to file

Constant Summary collapse

STATUS_TYPES =

The spelling of these status types has been validated with the partner team

%w[
  active
  claim_recieved
  duplicate
  expired
  incomplete
  canceled
].freeze

Instance Attribute Summary collapse

Attributes inherited from Common::Base

#errors_hash, #metadata

Instance Method Summary collapse

Methods inherited from Common::Base

#changed, #changed?, #changes, default_sort, filterable_attributes, max_per_page, per_page, sortable_attributes

Constructor Details

#initialize(args) ⇒ IntentToFile

Returns a new instance of IntentToFile.

Raises:

  • (ArgumentError)


46
47
48
49
50
# File 'lib/evss/intent_to_file/intent_to_file.rb', line 46

def initialize(args)
  raise ArgumentError, "invalid status type: #{args['status']}" unless STATUS_TYPES.include? args['status']

  super(args)
end

Instance Attribute Details

#creation_dateDateTime

Returns Date and time the intent to file was created.

Returns:

  • (DateTime)

    Date and time the intent to file was created



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/evss/intent_to_file/intent_to_file.rb', line 27

class IntentToFile < Common::Base
  # The spelling of these status types has been validated with the partner team
  STATUS_TYPES = %w[
    active
    claim_recieved
    duplicate
    expired
    incomplete
    canceled
  ].freeze

  attribute :id, String
  attribute :creation_date, DateTime
  attribute :expiration_date, DateTime
  attribute :participant_id, Integer
  attribute :source, String
  attribute :status, String
  attribute :type, String

  def initialize(args)
    raise ArgumentError, "invalid status type: #{args['status']}" unless STATUS_TYPES.include? args['status']

    super(args)
  end

  ##
  # @return [Boolean] Does the intent to file expire within one day
  #
  def expires_within_one_day?
    current = Time.current
    one_day_from_current = current + 1.day
    (current..one_day_from_current).cover? expiration_date
  end
end

#expiration_dateDateTime

Returns Date and time the intent to file will expire.

Returns:

  • (DateTime)

    Date and time the intent to file will expire



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/evss/intent_to_file/intent_to_file.rb', line 27

class IntentToFile < Common::Base
  # The spelling of these status types has been validated with the partner team
  STATUS_TYPES = %w[
    active
    claim_recieved
    duplicate
    expired
    incomplete
    canceled
  ].freeze

  attribute :id, String
  attribute :creation_date, DateTime
  attribute :expiration_date, DateTime
  attribute :participant_id, Integer
  attribute :source, String
  attribute :status, String
  attribute :type, String

  def initialize(args)
    raise ArgumentError, "invalid status type: #{args['status']}" unless STATUS_TYPES.include? args['status']

    super(args)
  end

  ##
  # @return [Boolean] Does the intent to file expire within one day
  #
  def expires_within_one_day?
    current = Time.current
    one_day_from_current = current + 1.day
    (current..one_day_from_current).cover? expiration_date
  end
end

#idString

Returns Intent to file ID.

Returns:

  • (String)

    Intent to file ID



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/evss/intent_to_file/intent_to_file.rb', line 27

class IntentToFile < Common::Base
  # The spelling of these status types has been validated with the partner team
  STATUS_TYPES = %w[
    active
    claim_recieved
    duplicate
    expired
    incomplete
    canceled
  ].freeze

  attribute :id, String
  attribute :creation_date, DateTime
  attribute :expiration_date, DateTime
  attribute :participant_id, Integer
  attribute :source, String
  attribute :status, String
  attribute :type, String

  def initialize(args)
    raise ArgumentError, "invalid status type: #{args['status']}" unless STATUS_TYPES.include? args['status']

    super(args)
  end

  ##
  # @return [Boolean] Does the intent to file expire within one day
  #
  def expires_within_one_day?
    current = Time.current
    one_day_from_current = current + 1.day
    (current..one_day_from_current).cover? expiration_date
  end
end

#participant_idInteger

Returns The user’s participant ID.

Returns:

  • (Integer)

    The user’s participant ID



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/evss/intent_to_file/intent_to_file.rb', line 27

class IntentToFile < Common::Base
  # The spelling of these status types has been validated with the partner team
  STATUS_TYPES = %w[
    active
    claim_recieved
    duplicate
    expired
    incomplete
    canceled
  ].freeze

  attribute :id, String
  attribute :creation_date, DateTime
  attribute :expiration_date, DateTime
  attribute :participant_id, Integer
  attribute :source, String
  attribute :status, String
  attribute :type, String

  def initialize(args)
    raise ArgumentError, "invalid status type: #{args['status']}" unless STATUS_TYPES.include? args['status']

    super(args)
  end

  ##
  # @return [Boolean] Does the intent to file expire within one day
  #
  def expires_within_one_day?
    current = Time.current
    one_day_from_current = current + 1.day
    (current..one_day_from_current).cover? expiration_date
  end
end

#sourceString

Returns The intent to file source.

Returns:

  • (String)

    The intent to file source



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/evss/intent_to_file/intent_to_file.rb', line 27

class IntentToFile < Common::Base
  # The spelling of these status types has been validated with the partner team
  STATUS_TYPES = %w[
    active
    claim_recieved
    duplicate
    expired
    incomplete
    canceled
  ].freeze

  attribute :id, String
  attribute :creation_date, DateTime
  attribute :expiration_date, DateTime
  attribute :participant_id, Integer
  attribute :source, String
  attribute :status, String
  attribute :type, String

  def initialize(args)
    raise ArgumentError, "invalid status type: #{args['status']}" unless STATUS_TYPES.include? args['status']

    super(args)
  end

  ##
  # @return [Boolean] Does the intent to file expire within one day
  #
  def expires_within_one_day?
    current = Time.current
    one_day_from_current = current + 1.day
    (current..one_day_from_current).cover? expiration_date
  end
end

#statusString

Returns The intent to file status.

Returns:

  • (String)

    The intent to file status



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/evss/intent_to_file/intent_to_file.rb', line 27

class IntentToFile < Common::Base
  # The spelling of these status types has been validated with the partner team
  STATUS_TYPES = %w[
    active
    claim_recieved
    duplicate
    expired
    incomplete
    canceled
  ].freeze

  attribute :id, String
  attribute :creation_date, DateTime
  attribute :expiration_date, DateTime
  attribute :participant_id, Integer
  attribute :source, String
  attribute :status, String
  attribute :type, String

  def initialize(args)
    raise ArgumentError, "invalid status type: #{args['status']}" unless STATUS_TYPES.include? args['status']

    super(args)
  end

  ##
  # @return [Boolean] Does the intent to file expire within one day
  #
  def expires_within_one_day?
    current = Time.current
    one_day_from_current = current + 1.day
    (current..one_day_from_current).cover? expiration_date
  end
end

#typeString

Returns The intent to file type.

Returns:

  • (String)

    The intent to file type



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/evss/intent_to_file/intent_to_file.rb', line 27

class IntentToFile < Common::Base
  # The spelling of these status types has been validated with the partner team
  STATUS_TYPES = %w[
    active
    claim_recieved
    duplicate
    expired
    incomplete
    canceled
  ].freeze

  attribute :id, String
  attribute :creation_date, DateTime
  attribute :expiration_date, DateTime
  attribute :participant_id, Integer
  attribute :source, String
  attribute :status, String
  attribute :type, String

  def initialize(args)
    raise ArgumentError, "invalid status type: #{args['status']}" unless STATUS_TYPES.include? args['status']

    super(args)
  end

  ##
  # @return [Boolean] Does the intent to file expire within one day
  #
  def expires_within_one_day?
    current = Time.current
    one_day_from_current = current + 1.day
    (current..one_day_from_current).cover? expiration_date
  end
end

Instance Method Details

#expires_within_one_day?Boolean

Returns Does the intent to file expire within one day.

Returns:

  • (Boolean)

    Does the intent to file expire within one day



55
56
57
58
59
# File 'lib/evss/intent_to_file/intent_to_file.rb', line 55

def expires_within_one_day?
  current = Time.current
  one_day_from_current = current + 1.day
  (current..one_day_from_current).cover? expiration_date
end