Class: FellowshipOne::HouseholdListReader
- Defined in:
- lib/readers/household_list_reader.rb
Instance Attribute Summary
Attributes inherited from ApiReader
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ HouseholdListReader
constructor
Constructor.
Methods inherited from ApiReader
Constructor Details
#initialize(options = {}) ⇒ HouseholdListReader
Constructor.
Options: :page - (optional) The page number to get. :per_page - (optional) The number of items to return per page. :household_id - The household ID to pull the info for. :search_for - (optional) Search for name in the request.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/readers/household_list_reader.rb', line 12 def initialize( = {}) raise 'Household ID not specified' if [:household_id].nil? and [:search_for].nil? page = [:page] || 1 per_page = [:per_page] || 100 @url_data_params = {} @url_data_path = [:search_for].nil? ? "/v1/Households/#{[:household_id].to_i}/People" : '/v1/Households/Search' @url_data_params.merge!({:page => page}) if page @url_data_params.merge!({:recordsPerPage => per_page}) if per_page @url_data_params.merge!({:search_for => [:search_for]}) if [:search_for] end |