Class: SavedsearchResponse

Inherits:
Response show all
Defined in:
lib/refworks/savedsearch/savedsearch_response.rb

Instance Attribute Summary collapse

Attributes inherited from Response

#body, #parsed_response, #process_time, #result_code, #result_msg, #result_msg_code

Instance Method Summary collapse

Constructor Details

#initialize(raw_response) ⇒ SavedsearchResponse

Returns a new instance of SavedsearchResponse.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/refworks/savedsearch/savedsearch_response.rb', line 4

def initialize(raw_response)
  super(raw_response)
  if result_code != "200"
    @total = "0"
    return
  end

  # If results returned, process the savedsearches and metadata

  srchs = self.parsed_response["refworks"]["RWResult"]["AdvancedSearchStrategy"]

  @savedsearches = Array.new
  if srchs.class == Array
   srchs.each do |srch|
      @savedsearches << Savedsearch.new(srch)
    end
  else
     @savedsearches << Savedsearch.new(srchs)
  end
end

Instance Attribute Details

#savedsearchesObject (readonly)

Returns the value of attribute savedsearches.



2
3
4
# File 'lib/refworks/savedsearch/savedsearch_response.rb', line 2

def savedsearches
  @savedsearches
end