Class: FellowshipOne::PersonListReader
- Defined in:
- lib/readers/person_list_reader.rb
Instance Attribute Summary
Attributes inherited from ApiReader
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ PersonListReader
constructor
Constructor.
Methods inherited from ApiReader
Constructor Details
#initialize(options = {}) ⇒ PersonListReader
Constructor.
Options: :page - (optional) The page number to get. The default is 1. :per_page - (optional) The number of items to return per page. :search_for - (optional) Search for name in the request. :created_date - (optional) Search for those created on or after specified date.
** search params are mutually exclusive and cannot be used with any other search parameters
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/readers/person_list_reader.rb', line 14 def initialize( = {}) page = [:page] || 1 per_page = [:per_page] || 100 @url_data_params = {} @url_data_path = '/v1/People/Search' if [:search_for].nil? and [:communication].nil? and [:created_date].nil? and [:updated_date].nil? and [:hsdid].nil? @url_data_path = '/v1/People' end @url_data_params.merge!({:page => page, :include => 'addresses,communications'}) if page @url_data_params.merge!({:recordsPerPage => per_page}) if per_page @url_data_params.merge!({:hsdid => [:hsdid]}) if [:hsdid] @url_data_params.merge!({:searchFor => [:search_for]}) if [:search_for] @url_data_params.merge!({:communication => [:communication]}) if [:communication] @url_data_params.merge!({:createdDate => [:created_date]}) if [:created_date] @url_data_params.merge!({:lastUpdatedDate => [:updated_date]}) if [:updated_date] end |