Class: Landslider::WsSearch

Inherits:
Object
  • Object
show all
Defined in:
lib/landslider/entities/ws_search.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ WsSearch

Returns a new instance of WsSearch

Options Hash (params):

  • :first_result_position (Integer)

    Sets the starting index of records you want to retrieve. defaults to 1

  • :total_results_requested (Integer)

    Sets the maximum number of records to retrieve. defaults to 25



9
10
11
12
# File 'lib/landslider/entities/ws_search.rb', line 9

def initialize(params = {})
    @first_result_position = params.fetch(:first_result_position) if params.key?(:first_result_position)
    @total_results_requested = params.fetch(:total_results_requested) if params.key?(:total_results_requested)
end

Instance Attribute Details

#allow_duplicate_criterion=(value) ⇒ Object (writeonly)



31
32
33
# File 'lib/landslider/entities/ws_search.rb', line 31

def allow_duplicate_criterion=(value)
  @allow_duplicate_criterion = value
end

#first_result_position=(value) ⇒ Object (writeonly)

Sets the starting index of records you want to retrieve. defaults to 1



16
17
18
# File 'lib/landslider/entities/ws_search.rb', line 16

def first_result_position=(value)
  @first_result_position = value
end

#return_deleted_records=(value) ⇒ Object (writeonly)



31
32
33
# File 'lib/landslider/entities/ws_search.rb', line 31

def return_deleted_records=(value)
  @return_deleted_records = value
end

#search_criteria=(value) ⇒ Object (writeonly)

WsSearchCriterion is only documented to work with these APIs

  • getAccounts

  • getOpportunities

  • getProductFamilies

  • GetDurationTypes



39
40
41
# File 'lib/landslider/entities/ws_search.rb', line 39

def search_criteria=(value)
  @search_criteria = value
end

#source_id=(value) ⇒ Object (writeonly)

system source id search?



28
29
30
# File 'lib/landslider/entities/ws_search.rb', line 28

def source_id=(value)
  @source_id = value
end

#total_results_requested=(value) ⇒ Object (writeonly)

Sets the maximum number of records to retrieve. defaults to 25



20
21
22
# File 'lib/landslider/entities/ws_search.rb', line 20

def total_results_requested=(value)
  @total_results_requested = value
end

#updated_on=(value) ⇒ Object (writeonly)

Sets a Date to search records updated on or after



24
25
26
# File 'lib/landslider/entities/ws_search.rb', line 24

def updated_on=(value)
  @updated_on = value
end

Instance Method Details

#soapify_for(msg) ⇒ Handsoap::XmlMason::Node

Adds the search xml



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/landslider/entities/ws_search.rb', line 44

def soapify_for(msg)
	msg.add 'firstResultPosition', @first_result_position || DEFAULT_FIRST_RESULT_POSITION
	msg.add 'totalResultsRequested', @total_results_requested || DEFAULT_TOTAL_RESULTS_REQUESTED
	msg.add 'updatedOn', @updated_on unless @updated_on.nil?
	unless @search_criteria.nil?
		if @search_criteria.kind_of?(Array)

			msg.add 'allowDuplicateCriterion', true
			@search_criteria.each do |sc|
				sc.soapify_for(msg)
			end
		else
			@search_criteria.soapify_for(msg)
		end
	end

end