Class: YourMembership::Sa::Members

Inherits:
Base
  • Object
show all
Defined in:
lib/your_membership/sa_members.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 IDs that may be optionally filtered by timestamp, and/or group membership. 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 members in your community.

See Also:



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

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

.all_recentActivityHash

Returns a Hash of recent member activity on your YourMembership Site Returns member community activity information for the purpose of creating a navigation control.

Returns:

  • (Hash)

    A subset of data is returned for each of the following:

    • Newest member

    • Latest post

    • Latest comment on a post

    • Latest photo

See Also:



36
37
38
39
40
# File 'lib/your_membership/sa_members.rb', line 36

def self.all_recentActivity # rubocop:disable Style/MethodName
  response = post('/', :body => build_XML_request('Sa.Members.All.RecentActivity'))
  response_valid? response
  response['YourMembership_Response']['Sa.Members.All.RecentActivity'].to_h
end

.certifications_journalEntry_create(member_id, ceus_earned, ceus_expire_date, description, entry_date, options = {}) ⇒ Boolean

Create a CEU Journal Entry.

Parameters:

  • member_id (String)

    ID of the person who owns this certification journal entry.

  • ceus_earned (Integer)

    The number of CEU Credits earned for this journal entry.

  • ceus_expire_date (DateTime)

    The ODBC Date the CEU Credits Expire.

  • description (String)

    Description of this journal entry.

  • entry_date (DateTime)

    Date and time of this journal entry.

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

Options Hash (options):

  • :CertificationId (String)

    The ID of the certification this journal entry is a part of. If neither CertificationName nor CertificationID are supplied, the journal entry will not be attached to a specific certification.

  • :CertificationName (String)

    For Self-Awarded certification journal entries that are not linked an existing certification record. This is the same behavior as choosing “Other Certification” and entering a Self-Awarded journal entry. If neither CertificationName nor CertificationID are supplied, the journal entry will not be attached to a specific certification.

  • :ScorePercent (Decimal)

    The decimal representation of a percentage score. For example, 90% would be 0.90.

  • :CreditTypeCode (String)

    Unique code for this new Journal Entry’s Credit Type. If absent, the default Credit Type Code will be used.

Returns:

  • (Boolean)

    Returns true or raises exception.

See Also:



147
148
149
150
151
152
153
154
155
156
# File 'lib/your_membership/sa_members.rb', line 147

def self.certifications_journalEntry_create(member_id, ceus_earned, ceus_expire_date, description, , options = {}) # rubocop:disable Style/MethodName
  options['ID'] = member_id
  options['CEUsEarned'] = ceus_earned
  options['CEUsExpireDate'] = ceus_expire_date
  options['Description'] = description
  options['EntryDate'] = 

  response = post('/', :body => build_XML_request('Sa.Members.Certifications.JournalEntry.Create', nil, options))
  response_valid? response
end

.commerce_store_getOrderIDs(member_id, options = {}) ⇒ Array

Returns a list of order IDs for a specified member that may be optionally filtered by timestamp and status. This method will return a maximum of 1,000 results.

Parameters:

  • member_id (String)

    The id of the person for whom you want to retrieve data

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

Options Hash (options):

  • :Timestamp (DateTime)

    Filter the returned results by date/time. Only those orders which were placed after the supplied date/time will be returned.

  • :Status (Symbol, Integer)

    Filter the returned results by Status. (-1 = :Cancelled; 0 = :open; 1 = :processed; 2 = :shipped or :closed)

Returns:

  • (Array)

    A list of Invoice Id Strings

See Also:



55
56
57
58
59
60
61
62
63
# File 'lib/your_membership/sa_members.rb', line 55

def self.commerce_store_getOrderIDs(member_id, options = {}) # rubocop:disable Style/MethodName
  options[:ID] = member_id
  if options[:Status]
    options[:Status] = YourMembership::Commerce.convert_order_status(options[:Status])
  end
  response = post('/', :body => build_XML_request('Sa.Members.Commerce.Store.GetOrderIDs', nil, options))
  response_valid? response
  response_to_array response['YourMembership_Response']['Sa.Members.Commerce.Store.GetOrderIDs']['Orders'], ['Order'], 'InvoiceID'
end

.events_event_registration_get(event_id, member_id) ⇒ Array

Returns Event Registration details for the provided Event and Member ID. Includes all Event Registration details for Primary Registrant and Additional Registrants. If the Event Registration contains a related Custom Form, the form data will be included in the <DataSet> element as it is stored in our database.

Parameters:

  • event_id (Integer)

    The ID number for the Event you wish to retrieve Event Registration from.

  • member_id (Integer)

    Member’s API ID

Returns:

  • (Array)

    Returns an Array of Hashes that represent registrations by a specific user for a specific event.

See Also:



75
76
77
78
79
80
81
82
83
84
# File 'lib/your_membership/sa_members.rb', line 75

def self.events_event_registration_get(event_id, member_id) # rubocop:disable Style/MethodName
  options = {}
  options[:EventID] = event_id
  options[:ID] = member_id

  response = post('/', :body => build_XML_request('Sa.Members.Events.Event.Registration.Get', nil, options))

  response_valid? response
  response_to_array_of_hashes response['YourMembership_Response']['Sa.Members.Events.Event.Registration.Get'], ['Registrations', 'Registration']
end

.profile_create(profile) ⇒ YourMembership::Member

Creates a new member profile and returns a member object.

@todo: This currently returns an authenticated session for each created user. This may not be the desired

permanent operation of this function.

Parameters:

Returns:

See Also:



167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/your_membership/sa_members.rb', line 167

def self.profile_create(profile)
  options = {}
  options['profile'] = profile
  response = post('/', :body => build_XML_request('Sa.Members.Profile.Create', nil, options))
  response_valid? response
  YourMembership::Sa::Auth.authenticate(
    YourMembership::Session.create,
    profile.data['Username'],
    profile.data['Password'],
    profile.data['PasswordHash']
  )
end

.referrals_get(member_id, options = {}) ⇒ Array

Returns a list of a member’s referrals.

Parameters:

  • member_id (String)

    ID of the person whose referrals to return.

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

Options Hash (options):

  • :Timestamp (DateTime)

    Filter the returned results by date/time. Only those referred members who registered after the supplied date/time will be returned.

Returns:

  • (Array)

    Returns an Array of Hashes that represent a Member’s referrals

See Also:



96
97
98
99
100
101
102
103
# File 'lib/your_membership/sa_members.rb', line 96

def self.referrals_get(member_id, options = {})
  options[:ID] = member_id

  response = post('/', :body => build_XML_request('Sa.Members.Referrals.Get', nil, options))

  response_valid? response
  response_to_array_of_hashes response['YourMembership_Response']['Sa.Members.Referrals.Get'], ['Member']
end

.subAccounts_get(member_id, options = {}) ⇒ Array

Returns a list of a member’s sub-accounts.

Parameters:

  • member_id (String)

    ID of the person whose sub-accounts to return.

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

Options Hash (options):

  • :Timestamp (Datetime)

    Filter the returned results by date/time. Only those members who registered after the supplied date/time will be returned.

Returns:

  • (Array)

    Returns an Array of Hashes that represent a Member’s Subaccounts

See Also:



115
116
117
118
119
120
121
122
# File 'lib/your_membership/sa_members.rb', line 115

def self.subAccounts_get(member_id, options = {}) # rubocop:disable Style/MethodName
  options[:ID] = member_id

  response = post('/', :body => build_XML_request('Sa.Members.SubAccounts.Get', nil, options))

  response_valid? response
  response_to_array_of_hashes response['YourMembership_Response']['Sa.Members.SubAccounts.Get'], ['Member']
end