Class: YourMembership::Sa::People

Inherits:
Base
  • Object
show all
Defined in:
lib/your_membership/sa_people.rb

Overview

YourMembership System Administrator Members Namespace

Class Method Summary collapse

Methods inherited from Base

build_XML_request, new_call_id, post, response_to_array, response_to_array_of_hashes, response_valid?, response_ym_error?

Class Method Details

.all_getIDs(options = {}) ⇒ Array

Returns a list of member and non-member IDs that may be optionally filtered by timestamp. This method is provided for data synchronization purposes and will return a maximum of 10,000 results. It would typically be used in conjunction with subsequent calls to Sa.People.Profile.Get for each ID returned

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :Timestamp (DateTime)

    Only accounts created after the this time will be returned

  • :WebsiteID (String)

    Filter the returned results by sequential WebsiteID.

  • :Groups (Array)

    Filter the returned results by group membership. [key, value] will translate to <key>value</key>

Returns:

  • (Array)

    A list of API IDs for non-members in your community.

See Also:



18
19
20
21
22
# File 'lib/your_membership/sa_people.rb', line 18

def self.all_getIDs(options = {}) # rubocop:disable Style/MethodName
  response = post('/', :body => build_XML_request('Sa.People.All.GetIDs', nil, options))
  response_valid? response
  response['YourMembership_Response']['Sa.People.All.GetIDs']['People']['ID']
end

.profile_findID(options = {}) ⇒ String, Array

Finds and returns a member or non-member <ID> using Import ID, Constituent ID or Website/Profile ID as criteria. If a single ID cannot be uniquely identified based on the criteria supplied then error code 406 is returned.

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :ImportID (String)

    Import ID of the person whose ID you are trying to find.

  • :ConstituentID (String)

    Constituent ID of the person whose ID you are trying to find.

  • :WebsiteID (Integer)

    Website/Profile ID of the person whose ID you are trying to find.

  • :Username (String)

    Username of the person whose ID you are trying to find.

  • :Email (String)

    Email Address of the person whose <ID> you are trying to find. May return multiple <ID>‘s as Email Address is not unique.

Returns:

  • (String)

    if a single record is found (normal for all calls except for :Email)

  • (Array)

    if multiple records are found (possible only for :Email searches)

See Also:



39
40
41
42
43
# File 'lib/your_membership/sa_people.rb', line 39

def self.profile_findID(options = {}) # rubocop:disable Style/MethodName
  response = post('/', :body => build_XML_request('Sa.People.Profile.FindID', nil, options))
  response_valid? response
  response['YourMembership_Response']['Sa.People.Profile.FindID']['ID']
end

.profile_get(id) ⇒ YourMembership::Profile

Returns a person’s profile data.

Parameters:

  • id (String)

    ID of the person whose profile data to return.

Returns:

See Also:



51
52
53
54
55
56
57
# File 'lib/your_membership/sa_people.rb', line 51

def self.profile_get(id)
  options = {}
  options[:ID] = id
  response = post('/', :body => build_XML_request('Sa.People.Profile.Get', nil, options))
  response_valid? response
  YourMembership::Profile.new response['YourMembership_Response']['Sa.People.Profile.Get']
end

.profile_groups_get(id) ⇒ Hash

Returns a person’s group relationship data. There are three types of relationships that members may have with particular groups; “Administrator”, “Member” and “Representative”. Groups are listed within nodes respective of their relationship type.

Parameters:

  • id (String)

    ID of the person whose profile data to return.

Returns:

  • (Hash)

    Returns a Hash that represents the person’s group relationships

See Also:



67
68
69
70
71
72
73
74
# File 'lib/your_membership/sa_people.rb', line 67

def self.profile_groups_get(id)
  options = {}
  options[:ID] = id
  response = post('/', :body => build_XML_request('Sa.People.Profile.Groups.Get', nil, options))

  response_valid? response
  response['YourMembership_Response']['Sa.People.Profile.Groups.Get']
end

.profile_update(id, profile) ⇒ Boolean

Updates an existing person’s profile.

Parameters:

  • id (String)

    ID of the person whose profile is to be updated.

  • profile (YourMembership::Profile)

    The profile object containing the fields to be updated

Returns:

  • (Boolean)

    Will raise and exception or return TRUE

See Also:



83
84
85
86
87
88
89
# File 'lib/your_membership/sa_people.rb', line 83

def self.profile_update(id, profile)
  options = {}
  options['ID'] = id
  options['profile'] = profile
  response = post('/', :body => build_XML_request('Sa.People.Profile.Update', nil, options))
  response_valid? response
end