Class: Agris::Api::DocumentQueryResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/agris/api/document_query_response.rb

Instance Method Summary collapse

Constructor Details

#initialize(output_hash, resource_type = nil) ⇒ DocumentQueryResponse

Returns a new instance of DocumentQueryResponse.



5
6
7
8
9
# File 'lib/agris/api/document_query_response.rb', line 5

def initialize(output_hash, resource_type = nil)
  @output_hash = output_hash
  @documents = nil
  @resource_type = resource_type if resource_type
end

Instance Method Details

#documentsObject



15
16
17
# File 'lib/agris/api/document_query_response.rb', line 15

def documents
  @documents ||= parse
end

#last_request_date_timeObject



11
12
13
# File 'lib/agris/api/document_query_response.rb', line 11

def last_request_date_time
  Time.parse(@output_hash[pluralized_resource_name]['system']['lastrequestdatetime'])
end

#remarksObject



19
20
21
# File 'lib/agris/api/document_query_response.rb', line 19

def remarks
  resources.map { |r| r['remarks'] }
end