Class: ChurchCommunityBuilder::Search

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

Class Method Summary collapse

Class Method Details

.all_individual_profilesObject

Returns a list of all individual profiles in the Church Community Builder system.



6
7
8
9
10
# File 'lib/api/search.rb', line 6

def self.all_individual_profiles
  options = {url_data_params: {srv: 'individual_profiles'}}
  reader = IndividualListReader.new(options)
  IndividualList.new(reader.load_feed)
end

.search_for_all_campusesObject

This is currently undocumented, but found via spelunking



65
66
67
68
69
# File 'lib/api/search.rb', line 65

def self.search_for_all_campuses
  options = {url_data_params: {srv: 'campus_list'}}
  reader = CampusListReader.new(options)
  CampusList.new(reader.load_feed)
end

.search_for_all_fundsObject

This is currently undocumented, but found via spelunking



73
74
75
76
# File 'lib/api/search.rb', line 73

def self.search_for_all_funds
  reader = FundListReader.new
  FundList.new(reader.load_feed)
end

.search_for_all_valid_individualsObject

Returns a list of all individuals in the Church Community Builder system.



24
25
26
27
28
# File 'lib/api/search.rb', line 24

def self.search_for_all_valid_individuals
  options = {url_data_params: {srv: 'valid_individuals'}}
  reader = IndividualListReader.new(options)
  ValidIndividualList.new(reader.load_feed)
end

.search_for_batch_by_date(modified_since = nil) ⇒ Object

Leaving ‘modified_since’ as ‘nil’ will return all batches in the system.

Specifying a date will return all batches created or modified since that date.

Date format should be YYYY-MM-DD



37
38
39
40
41
# File 'lib/api/search.rb', line 37

def self.search_for_batch_by_date(modified_since = nil)
  options = {url_data_params: {srv: 'batch_profiles', modified_since: modified_since} }
  reader = BatchListReader.new(options)
  BatchList.new(reader.load_feed)
end

.search_for_batch_by_date_range(start_date, end_date = nil) ⇒ Object

Returns a BatchList of all batches posted in specified date range. End date is optional.

Date format should be YYYY-MM-DD



47
48
49
50
51
52
# File 'lib/api/search.rb', line 47

def self.search_for_batch_by_date_range(start_date, end_date = nil)
  options = {url_data_params: {srv: 'batch_profiles_in_date_range', date_start: start_date, date_end: end_date}}
  options[:url_data_params].delete(:date_end) if end_date.nil?
  reader = BatchListReader.new(options)
  BatchList.new(reader.load_feed)
end

.search_for_batch_by_id(batch_id) ⇒ Object



54
55
56
57
58
59
60
61
# File 'lib/api/search.rb', line 54

def self.search_for_batch_by_id(batch_id)
  # options = {:url_data_params => {srv: "batch_profile_from_id", 
  #                                 id: batch_id
  #                                 } 
  #           }
  reader = BatchReader.new(batch_id)
  Batch.new(reader.load_feed)
end

.search_for_person_by_name(last_name = nil, first_name = nil) ⇒ Object

Search CCB for individuals based off of the search parameters Note: Searches are performed as a LIKE query in the CCB database. If the value provided for the criterion is found anywhere in the field, it will be considered a match.



17
18
19
20
21
# File 'lib/api/search.rb', line 17

def self.search_for_person_by_name(last_name = nil,first_name = nil)
  options = {url_data_params: {srv: 'individual_search', last_name: last_name, first_name: first_name}}
  reader = IndividualListReader.new(options)
  IndividualList.new(reader.load_feed)
end