Module: RepsClient::PickListMethods

Includes:
Modelish::Validations
Included in:
Client
Defined in:
lib/reps_client/pick_list.rb

Instance Method Summary collapse

Instance Method Details

#get_pick_lists(community_id) ⇒ Hash<Symbol,Array>

Retrieves “pick list values” for a particular community from the REPS service. A pick list contains the possible values for an enumeration (e.g. the possible choices from a drop-down list in a “Contact Us” form).

There are four types of pick lists:

  • ‘:prefix` - Array<RepsClient::Prefix> values with name prefixes/salutations (e.g. “Ms.”)

  • ‘:suffix` - Array<RepsClient::Suffix> values with name suffixes (e.g. “Jr.”)

  • ‘:relationship_type` - Array<RepsClient::Suffix> values with relationship of contact to prospect

  • ‘:source` - Array<rRepsClient::Source> values

Parameters:

  • community_id (Integer)

    the REPS community id for a particular location

Returns:

  • (Hash<Symbol,Array>)

    the map of pick list types to pick lists



81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/reps_client/pick_list.rb', line 81

def get_pick_lists(community_id)
  PickListMethods.validate_required!(:community_id => community_id)

  response = send_soap_request(:get_pick_lists, :community_id => community_id,
                               :order! => [:enterprise_key,:community_id])
  lists = response.to_hash[:get_pick_lists_response][:get_pick_lists_result][:diffgram][:pick_lists]

  result = {}
  [:prefix, :suffix, :relationship_type, :source].each do |k|
    result[k] = process_pick_list(k, lists)
  end

  result
end