Class: SearchRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/dto/search/search_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#annotationsObject

annotations attribute should be a Hash object



3
4
5
# File 'lib/dto/search/search_request.rb', line 3

def annotations
  @annotations
end

#bodyObject

annotations attribute should be a Hash object



3
4
5
# File 'lib/dto/search/search_request.rb', line 3

def body
  @body
end

#categoryObject

annotations attribute should be a Hash object



3
4
5
# File 'lib/dto/search/search_request.rb', line 3

def category
  @category
end

#endObject

annotations attribute should be a Hash object



3
4
5
# File 'lib/dto/search/search_request.rb', line 3

def end
  @end
end

#external_idObject

annotations attribute should be a Hash object



3
4
5
# File 'lib/dto/search/search_request.rb', line 3

def external_id
  @external_id
end

#headingObject

annotations attribute should be a Hash object



3
4
5
# File 'lib/dto/search/search_request.rb', line 3

def heading
  @heading
end

#locationObject

annotations attribute should be a Hash object



3
4
5
# File 'lib/dto/search/search_request.rb', line 3

def location
  @location
end

#pageObject

annotations attribute should be a Hash object



3
4
5
# File 'lib/dto/search/search_request.rb', line 3

def page
  @page
end

#retvalsObject

annotations attribute should be a Hash object



3
4
5
# File 'lib/dto/search/search_request.rb', line 3

def retvals
  @retvals
end

#rppObject

annotations attribute should be a Hash object



3
4
5
# File 'lib/dto/search/search_request.rb', line 3

def rpp
  @rpp
end

#sourceObject

annotations attribute should be a Hash object



3
4
5
# File 'lib/dto/search/search_request.rb', line 3

def source
  @source
end

#startObject

annotations attribute should be a Hash object



3
4
5
# File 'lib/dto/search/search_request.rb', line 3

def start
  @start
end

#textObject

annotations attribute should be a Hash object



3
4
5
# File 'lib/dto/search/search_request.rb', line 3

def text
  @text
end

#trusted_annotationsObject

annotations attribute should be a Hash object



3
4
5
# File 'lib/dto/search/search_request.rb', line 3

def trusted_annotations
  @trusted_annotations
end

Instance Method Details

#add_retval(retval) ⇒ Object



7
8
9
# File 'lib/dto/search/search_request.rb', line 7

def add_retval(retval)
  @retvals << retval
end

#query_paramsObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/dto/search/search_request.rb', line 11

def query_params
  query = Hash.new
  url_params = ''
  if (rpp != nil)
    query[:rpp] = rpp.to_s;
    url_params += "rpp=#{CGI.escape(query[:rpp])}&"
  end
  if (page != nil)
    query[:page] = page.to_s;
    url_params += "page=#{CGI.escape(query[:page])}&"
  end
  if (source != nil)
    query[:source] = source.to_s;
    url_params += "source=#{CGI.escape(query[:source])}&"
  end
  if (category != nil)
    query[:category] = category.to_s;
    url_params += "category=#{CGI.escape(query[:category])}&"
  end
  if (location != nil)
    query[:location] = location.to_s;
    url_params += "location=#{CGI.escape(query[:location])}&"
  end
  if (heading != nil)
    query[:heading] = heading.to_s;
    url_params += "heading=#{CGI.escape(query[:heading])}&"
  end
  if (body != nil)
    query[:body] = body.to_s;
    url_params += "body=#{CGI.escape(query[:body])}&"
  end
  if (text != nil)
    query[:text] = text.to_s;
    url_params += "text=#{CGI.escape(query[:text])}&"
  end
  if (external_id != nil)
    query[:external_id] = external_id.to_s;
    url_params += "external_id=#{CGI.escape(query[:external_id])}&"
  end
  if (start != nil)
    query[:start] = start.to_s;
    url_params += "start=#{CGI.escape(query[:start])}&"
  end
  if (self.end != nil)
    query[:end] = self.end.to_s;
    url_params += "end=#{CGI.escape(query[:end])}&"
  end

  if (annotations != nil && annotations.size > 0)
#      query[:annotations] = ActiveSupport::JSON.encode(annotations)
    query[:annotations] = annotations
#      query.each do |key, value|
#        url_params += "#{key}=#{value}&"
#      end
    url_params += "annotations=#{CGI.escape(ActiveSupport::JSON.encode(query[:annotations]))}&" #'annotations=#{CGI.escape(ActiveSupport::JSON.encode(search.annotations))}'
  end
  if (trusted_annotations != nil && trusted_annotations.size > 0)
    #query[:trusted_annotations] = ActiveSupport::JSON.encode(trusted_annotations)
    query[:trusted_annotations] = trusted_annotations
    url_params += "trusted_annotations=#{CGI.escape(ActiveSupport::JSON.encode(query[:trusted_annotations]))}&"
  end
  if (retvals != nil)
    query[:retvals] = retvals.join(',')  #queryParams.put("retvals", Utils.join(retvals));
    url_params += "retvals=#{CGI.escape(query[:retvals])}&"
  end
  
  url_params
end