Class: EVSS::IntentToFile::IntentToFileResponse

Inherits:
Response show all
Defined in:
lib/evss/intent_to_file/intent_to_file_response.rb

Overview

Model for an ITF response containing a intent to file

Constant Summary

Constants included from Common::Client::Concerns::ServiceStatus

Common::Client::Concerns::ServiceStatus::RESPONSE_STATUS

Instance Attribute Summary collapse

Attributes inherited from Common::Base

#errors_hash, #metadata

Instance Method Summary collapse

Methods inherited from Response

#metadata, #ok?, #response_status

Methods inherited from Common::Base

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

Constructor Details

#initialize(status, response = nil) ⇒ IntentToFileResponse

Returns a new instance of IntentToFileResponse.



19
20
21
# File 'lib/evss/intent_to_file/intent_to_file_response.rb', line 19

def initialize(status, response = nil)
  super(status, response.body) if response
end

Instance Attribute Details

#intent_to_fileEVSS::IntentToFile::IntentToFile

Returns An intent to file.

Returns:



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/evss/intent_to_file/intent_to_file_response.rb', line 16

class IntentToFileResponse < EVSS::Response
  attribute :intent_to_file, EVSS::IntentToFile::IntentToFile

  def initialize(status, response = nil)
    super(status, response.body) if response
  end

  ##
  # @return [Boolean] Is the ITF eliglible for caching
  #
  def cache?
    ok? && !intent_to_file.expires_within_one_day?
  end
end

Instance Method Details

#cache?Boolean

Returns Is the ITF eliglible for caching.

Returns:

  • (Boolean)

    Is the ITF eliglible for caching



26
27
28
# File 'lib/evss/intent_to_file/intent_to_file_response.rb', line 26

def cache?
  ok? && !intent_to_file.expires_within_one_day?
end