your_membership 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.env +5 -0
  3. data/.gitignore +1 -0
  4. data/.rspec +1 -0
  5. data/CHANGELOG.md +10 -0
  6. data/README.md +12 -10
  7. data/lib/httparty/patch.rb +33 -33
  8. data/lib/your_membership/base.rb +197 -197
  9. data/lib/your_membership/commerce.rb +25 -25
  10. data/lib/your_membership/config.rb +41 -41
  11. data/lib/your_membership/convert.rb +24 -24
  12. data/lib/your_membership/error.rb +21 -21
  13. data/lib/your_membership/events.rb +60 -60
  14. data/lib/your_membership/feeds.rb +37 -37
  15. data/lib/your_membership/member.rb +399 -397
  16. data/lib/your_membership/members.rb +124 -124
  17. data/lib/your_membership/people.rb +38 -38
  18. data/lib/your_membership/profile.rb +92 -85
  19. data/lib/your_membership/sa.rb +6 -6
  20. data/lib/your_membership/sa_auth.rb +34 -34
  21. data/lib/your_membership/sa_certifications.rb +22 -22
  22. data/lib/your_membership/sa_commerce.rb +22 -22
  23. data/lib/your_membership/sa_events.rb +66 -66
  24. data/lib/your_membership/sa_export.rb +195 -195
  25. data/lib/your_membership/sa_groups.rb +30 -30
  26. data/lib/your_membership/sa_member.rb +49 -49
  27. data/lib/your_membership/sa_members.rb +180 -179
  28. data/lib/your_membership/sa_nonmembers.rb +41 -41
  29. data/lib/your_membership/sa_people.rb +92 -92
  30. data/lib/your_membership/session.rb +148 -152
  31. data/lib/your_membership/version.rb +1 -1
  32. data/spec/fixtures/vcr_cassettes/sa_members_all_getids_timestamp_multiple.yml +51 -0
  33. data/spec/fixtures/vcr_cassettes/sa_members_all_getids_timestamp_none.yml +51 -0
  34. data/spec/fixtures/vcr_cassettes/sa_members_all_getids_timestamp_single.yml +51 -0
  35. data/spec/lib/{profile_spec.rb → your_membership/profile_spec.rb} +232 -197
  36. data/spec/lib/your_membership/sa_members_spec.rb +38 -0
  37. data/spec/spec_helper.rb +101 -78
  38. data/your_membership.gemspec +4 -0
  39. metadata +85 -19
@@ -1,30 +1,30 @@
1
- module YourMembership
2
- module Sa
3
- # YourMembership System Administrator Groups Namespace
4
- class Groups < YourMembership::Base
5
- # Returns a list of group membership log entries by Group ID that may be optionally filtered by timestamp.
6
- # This method will return a maximum of 1,000 results.
7
- #
8
- # @see https://api.yourmembership.com/reference/2_00/Sa_Groups_Group_GetMembershipLog.htm
9
- #
10
- # @param [Integer] group_id The Group ID of the Membership Log records to be returned.
11
- # @param [Hash] options
12
- # @option options [DateTime] :StartDate Filter the returned results by date/time. Only those membership log items which
13
- # have been created or updated after the supplied date/time will be returned.
14
- # @option options [Integer] :ItemID Filter the returned results by sequential ItemID. Only those membership log items
15
- # which have a ItemID greater than the supplied integer will be returned. A typical usage scenario for this
16
- # parameter would be to supply it when making additional calls while 1,000 records are being returned. You would
17
- # supply the last record's ItemID to retrieve the next batch of up to 1,000 records, repeating the process until
18
- # no records are returned.
19
- # @return [Hash] Returns an Hash representing a group's membership Log
20
- def self.group_getMembershipLog(group_id, options = {}) # rubocop:disable Style/MethodName
21
- options[:GroupID] = group_id
22
-
23
- response = post('/', :body => build_XML_request('Sa.Groups.Group.GetMembershipLog', nil, options))
24
-
25
- response_valid? response
26
- response['YourMembership_Response']['Sa.Groups.Group.GetMembershipLog']
27
- end
28
- end
29
- end
30
- end
1
+ module YourMembership
2
+ module Sa
3
+ # YourMembership System Administrator Groups Namespace
4
+ class Groups < YourMembership::Base
5
+ # Returns a list of group membership log entries by Group ID that may be optionally filtered by timestamp.
6
+ # This method will return a maximum of 1,000 results.
7
+ #
8
+ # @see https://api.yourmembership.com/reference/2_00/Sa_Groups_Group_GetMembershipLog.htm
9
+ #
10
+ # @param [Integer] group_id The Group ID of the Membership Log records to be returned.
11
+ # @param [Hash] options
12
+ # @option options [DateTime] :StartDate Filter the returned results by date/time. Only those membership log items which
13
+ # have been created or updated after the supplied date/time will be returned.
14
+ # @option options [Integer] :ItemID Filter the returned results by sequential ItemID. Only those membership log items
15
+ # which have a ItemID greater than the supplied integer will be returned. A typical usage scenario for this
16
+ # parameter would be to supply it when making additional calls while 1,000 records are being returned. You would
17
+ # supply the last record's ItemID to retrieve the next batch of up to 1,000 records, repeating the process until
18
+ # no records are returned.
19
+ # @return [Hash] Returns an Hash representing a group's membership Log
20
+ def self.group_getMembershipLog(group_id, options = {}) # rubocop:disable Style/MethodName
21
+ options[:GroupID] = group_id
22
+
23
+ response = post('/', :body => build_XML_request('Sa.Groups.Group.GetMembershipLog', nil, options))
24
+
25
+ response_valid? response
26
+ response['YourMembership_Response']['Sa.Groups.Group.GetMembershipLog']
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,49 +1,49 @@
1
- module YourMembership
2
- module Sa
3
- # YourMembership System Administrator Member Namespace
4
- class Member < YourMembership::Base
5
- # Returns a list of Certifications for the specified user.
6
- #
7
- # @see https://api.yourmembership.com/reference/2_00/Sa_Member_Certifications_Get.htm
8
- #
9
- # @param [Integer] member_id ID of the person whose certifications to return.
10
- # @param [Hash] options
11
- # @option options [Boolean] :IsArchived Include archived certification records in the returned result. Def: True
12
- # @return [Array] Returns an array of Hashes representing a member's certifications
13
- def self.certifications_get(member_id, options = {})
14
- options[:ID] = member_id
15
-
16
- response = post('/', :body => build_XML_request('Sa.Member.Certifications.Get', nil, options))
17
-
18
- response_valid? response
19
- response_to_array_of_hashes response['YourMembership_Response']['Sa.Member.Certifications.Get'], ['Certification']
20
- end
21
-
22
- # Returns a list of Certification Journal Entries for the specified user that may be optionally filtered by
23
- # date, expiration, and paging.
24
- #
25
- # @see https://api.yourmembership.com/reference/2_00/Sa_Member_Certifications_Journal_Get.htm
26
- #
27
- # @param [Integer] member_id ID of the person whose certifications to return.
28
- # @param [Hash] options
29
- # @option options [Boolean] :ShowExpired Include expired journal entries in the returned result.
30
- # @option options [DateTime] :StartDate Only include Journal Entries that are newer that the supplied date.
31
- # @option options [Integer] :EntryID Filter the returned results by sequential EntryID. Only those Certification
32
- # Journals which have an EntryID greater than the supplied integer will be returned.
33
- # @option options [String] :CertificationID Filter the Journal Entries returned by the specified Certification ID.
34
- # @option options [Integer] :PageSize The number of items that are returned per call of this method.
35
- # Default is 200 entries.
36
- # @option options [Integer] :PageNumber PageNumber can be used to retrieve multiple result sets.
37
- # Page 1 is returned by default.
38
- # @return [Array] Returns an array of Hashes representing a member's certification journal entries.
39
- def self.certifications_journal_get(member_id, options = {})
40
- options[:ID] = member_id
41
-
42
- response = post('/', :body => build_XML_request('Sa.Member.Certifications.Journal.Get', nil, options))
43
-
44
- response_valid? response
45
- response_to_array_of_hashes response['YourMembership_Response']['Sa.Member.Certifications.Journal.Get'], ['Entry']
46
- end
47
- end
48
- end
49
- end
1
+ module YourMembership
2
+ module Sa
3
+ # YourMembership System Administrator Member Namespace
4
+ class Member < YourMembership::Base
5
+ # Returns a list of Certifications for the specified user.
6
+ #
7
+ # @see https://api.yourmembership.com/reference/2_00/Sa_Member_Certifications_Get.htm
8
+ #
9
+ # @param [Integer] member_id ID of the person whose certifications to return.
10
+ # @param [Hash] options
11
+ # @option options [Boolean] :IsArchived Include archived certification records in the returned result. Def: True
12
+ # @return [Array] Returns an array of Hashes representing a member's certifications
13
+ def self.certifications_get(member_id, options = {})
14
+ options[:ID] = member_id
15
+
16
+ response = post('/', :body => build_XML_request('Sa.Member.Certifications.Get', nil, options))
17
+
18
+ response_valid? response
19
+ response_to_array_of_hashes response['YourMembership_Response']['Sa.Member.Certifications.Get'], ['Certification']
20
+ end
21
+
22
+ # Returns a list of Certification Journal Entries for the specified user that may be optionally filtered by
23
+ # date, expiration, and paging.
24
+ #
25
+ # @see https://api.yourmembership.com/reference/2_00/Sa_Member_Certifications_Journal_Get.htm
26
+ #
27
+ # @param [Integer] member_id ID of the person whose certifications to return.
28
+ # @param [Hash] options
29
+ # @option options [Boolean] :ShowExpired Include expired journal entries in the returned result.
30
+ # @option options [DateTime] :StartDate Only include Journal Entries that are newer that the supplied date.
31
+ # @option options [Integer] :EntryID Filter the returned results by sequential EntryID. Only those Certification
32
+ # Journals which have an EntryID greater than the supplied integer will be returned.
33
+ # @option options [String] :CertificationID Filter the Journal Entries returned by the specified Certification ID.
34
+ # @option options [Integer] :PageSize The number of items that are returned per call of this method.
35
+ # Default is 200 entries.
36
+ # @option options [Integer] :PageNumber PageNumber can be used to retrieve multiple result sets.
37
+ # Page 1 is returned by default.
38
+ # @return [Array] Returns an array of Hashes representing a member's certification journal entries.
39
+ def self.certifications_journal_get(member_id, options = {})
40
+ options[:ID] = member_id
41
+
42
+ response = post('/', :body => build_XML_request('Sa.Member.Certifications.Journal.Get', nil, options))
43
+
44
+ response_valid? response
45
+ response_to_array_of_hashes response['YourMembership_Response']['Sa.Member.Certifications.Journal.Get'], ['Entry']
46
+ end
47
+ end
48
+ end
49
+ end
@@ -1,179 +1,180 @@
1
- module YourMembership
2
- module Sa
3
- # YourMembership System Administrator Members Namespace
4
- class Members < YourMembership::Base
5
- # Returns a list of member IDs that may be optionally filtered by timestamp, and/or group membership. This
6
- # method is provided for data synchronization purposes and will return a maximum of 10,000 results. It would
7
- # typically be used in conjunction with subsequent calls to Sa.People.Profile.Get for each <ID> returned.
8
- #
9
- # @see https://api.yourmembership.com/reference/2_00/Sa_Members_All_GetIDs.htm
10
- #
11
- # @param [Hash] options
12
- # @option options [DateTime] :Timestamp Only accounts created after the this time will be returned
13
- # @option options [String] :WebsiteID Filter the returned results by sequential WebsiteID.
14
- # @option options [Array] :Groups Filter the returned results by group membership. [key, value] will translate to
15
- # <key>value</key>
16
- #
17
- # @return [Array] A list of API IDs for members in your community.
18
- def self.all_getIDs(options = {}) # rubocop:disable Style/MethodName
19
- response = post('/', :body => build_XML_request('Sa.Members.All.GetIDs', nil, options))
20
- response_valid? response
21
- response['YourMembership_Response']['Sa.Members.All.GetIDs']['Members']['ID']
22
- end
23
-
24
- # Returns a Hash of recent member activity on your YourMembership Site
25
- # Returns member community activity information for the purpose of creating a navigation control.
26
- #
27
- # @see https://api.yourmembership.com/reference/2_00/Sa_Members_All_RecentActivity.htm
28
- #
29
- # @return [Hash] A subset of data is returned for each of the following:
30
- #
31
- # * Newest member
32
- # * Latest post
33
- # * Latest comment on a post
34
- # * Latest photo
35
- def self.all_recentActivity # rubocop:disable Style/MethodName
36
- response = post('/', :body => build_XML_request('Sa.Members.All.RecentActivity'))
37
- response_valid? response
38
- response['YourMembership_Response']['Sa.Members.All.RecentActivity'].to_h
39
- end
40
-
41
- # Returns a list of order IDs for a specified member that may be optionally filtered by timestamp and status.
42
- # This method will return a maximum of 1,000 results.
43
- #
44
- # @see https://api.yourmembership.com/reference/2_00/Sa_Members_Commerce_Store_GetOrderIDs.htm
45
- #
46
- # @param member_id [String] The id of the person for whom you want to retrieve data
47
- # @param [Hash] options
48
- # @option options [DateTime] :Timestamp Filter the returned results by date/time. Only those orders which were
49
- # placed after the supplied date/time will be returned.
50
- # @option options [Symbol, Integer] :Status Filter the returned results by Status.
51
- # (-1 = :Cancelled; 0 = :open; 1 = :processed; 2 = :shipped or :closed)
52
- #
53
- # @return [Array] A list of Invoice Id Strings
54
- def self.commerce_store_getOrderIDs(member_id, options = {}) # rubocop:disable Style/MethodName
55
- options[:ID] = member_id
56
- if options[:Status]
57
- options[:Status] = YourMembership::Commerce.convert_order_status(options[:Status])
58
- end
59
- response = post('/', :body => build_XML_request('Sa.Members.Commerce.Store.GetOrderIDs', nil, options))
60
- response_valid? response
61
- response_to_array response['YourMembership_Response']['Sa.Members.Commerce.Store.GetOrderIDs']['Orders'], ['Order'], 'InvoiceID'
62
- end
63
-
64
- # Returns Event Registration details for the provided Event and Member ID. Includes all Event Registration details
65
- # for Primary Registrant and Additional Registrants. If the Event Registration contains a related Custom Form, the
66
- # form data will be included in the <DataSet> element as it is stored in our database.
67
- #
68
- # @see https://api.yourmembership.com/reference/2_00/Sa_Members_Events_Event_Registration_Get.htm
69
- #
70
- # @param event_id [Integer] The ID number for the Event you wish to retrieve Event Registration from.
71
- # @param member_id [Integer] Member's API ID
72
- #
73
- # @return [Array] Returns an Array of Hashes that represent registrations by a specific user for a specific event.
74
- def self.events_event_registration_get(event_id, member_id) # rubocop:disable Style/MethodName
75
- options = {}
76
- options[:EventID] = event_id
77
- options[:ID] = member_id
78
-
79
- response = post('/', :body => build_XML_request('Sa.Members.Events.Event.Registration.Get', nil, options))
80
-
81
- response_valid? response
82
- response_to_array_of_hashes response['YourMembership_Response']['Sa.Members.Events.Event.Registration.Get'], ['Registrations', 'Registration']
83
- end
84
-
85
- # Returns a list of a member's referrals.
86
- #
87
- # @see https://api.yourmembership.com/reference/2_00/Sa_Members_Referrals_Get.htm
88
- #
89
- # @param member_id [String] ID of the person whose referrals to return.
90
- # @param [Hash] options
91
- # @option options [DateTime] :Timestamp Filter the returned results by date/time. Only those referred members who
92
- # registered after the supplied date/time will be returned.
93
- #
94
- # @return [Array] Returns an Array of Hashes that represent a Member's referrals
95
- def self.referrals_get(member_id, options = {})
96
- options[:ID] = member_id
97
-
98
- response = post('/', :body => build_XML_request('Sa.Members.Referrals.Get', nil, options))
99
-
100
- response_valid? response
101
- response_to_array_of_hashes response['YourMembership_Response']['Sa.Members.Referrals.Get'], ['Member']
102
- end
103
-
104
- # Returns a list of a member's sub-accounts.
105
- #
106
- # @see https://api.yourmembership.com/reference/2_00/Sa_Members_SubAccounts_Get.htm
107
- #
108
- # @param member_id [String] ID of the person whose sub-accounts to return.
109
- # @param options [Hash]
110
- # @option options [Datetime] :Timestamp Filter the returned results by date/time. Only those members who
111
- # registered after the supplied date/time will be returned.
112
- #
113
- # @return [Array] Returns an Array of Hashes that represent a Member's Subaccounts
114
- def self.subAccounts_get(member_id, options = {}) # rubocop:disable Style/MethodName
115
- options[:ID] = member_id
116
-
117
- response = post('/', :body => build_XML_request('Sa.Members.SubAccounts.Get', nil, options))
118
-
119
- response_valid? response
120
- response_to_array_of_hashes response['YourMembership_Response']['Sa.Members.SubAccounts.Get'], ['Member']
121
- end
122
-
123
- # Create a CEU Journal Entry.
124
- #
125
- # @see https://api.yourmembership.com/reference/2_00/Sa_Members_Certifications_JournalEntry_Create.htm
126
- #
127
- # @param member_id [String] ID of the person who owns this certification journal entry.
128
- # @param ceus_earned [Integer] The number of CEU Credits earned for this journal entry.
129
- # @param ceus_expire_date [DateTime] The ODBC Date the CEU Credits Expire.
130
- # @param description [String] Description of this journal entry.
131
- # @param entry_date [DateTime] Date and time of this journal entry.
132
- # @param options [Hash]
133
- # @option options [String] :CertificationId The ID of the certification this journal entry is a part of. If
134
- # neither CertificationName nor CertificationID are supplied, the journal entry will not be attached to a
135
- # specific certification.
136
- # @option options [String] :CertificationName For Self-Awarded certification journal entries that are not linked
137
- # an existing certification record. This is the same behavior as choosing "Other Certification" and entering a
138
- # Self-Awarded journal entry. If neither CertificationName nor CertificationID are supplied, the journal entry
139
- # will not be attached to a specific certification.
140
- # @option options [Decimal] :ScorePercent The decimal representation of a percentage score.
141
- # For example, 90% would be 0.90.
142
- # @option options [String] :CreditTypeCode Unique code for this new Journal Entry's Credit Type.
143
- # If absent, the default Credit Type Code will be used.
144
- #
145
- # @return [Boolean] Returns true or raises exception.
146
- def self.certifications_journalEntry_create(member_id, ceus_earned, ceus_expire_date, description, entry_date, options = {}) # rubocop:disable Style/MethodName
147
- options['ID'] = member_id
148
- options['CEUsEarned'] = ceus_earned
149
- options['CEUsExpireDate'] = ceus_expire_date
150
- options['Description'] = description
151
- options['EntryDate'] = entry_date
152
-
153
- response = post('/', :body => build_XML_request('Sa.Members.Certifications.JournalEntry.Create', nil, options))
154
- response_valid? response
155
- end
156
-
157
- # Creates a new member profile and returns a member object.
158
- #
159
- # @see https://api.yourmembership.com/reference/2_00/Sa_Members_Profile_Create.htm
160
- #
161
- # @param profile [YourMembership::Profile]
162
- #
163
- # @return [YourMembership::Member] A Member object for the member that was just created.
164
- # @todo: This currently returns an authenticated session for each created user. This may not be the desired
165
- # permanent operation of this function.
166
- def self.profile_create(profile)
167
- options = {}
168
- options['profile'] = profile
169
- response = post('/', :body => build_XML_request('Sa.Members.Profile.Create', nil, options))
170
- response_valid? response
171
- YourMembership::Sa::Auth.authenticate(
172
- YourMembership::Session.create,
173
- profile.data['Username'],
174
- profile.data['Password']
175
- )
176
- end
177
- end
178
- end
179
- end
1
+ module YourMembership
2
+ module Sa
3
+ # YourMembership System Administrator Members Namespace
4
+ class Members < YourMembership::Base
5
+ # Returns a list of member IDs that may be optionally filtered by timestamp, and/or group membership. This
6
+ # method is provided for data synchronization purposes and will return a maximum of 10,000 results. It would
7
+ # typically be used in conjunction with subsequent calls to Sa.People.Profile.Get for each <ID> returned.
8
+ #
9
+ # @see https://api.yourmembership.com/reference/2_00/Sa_Members_All_GetIDs.htm
10
+ #
11
+ # @param [Hash] options
12
+ # @option options [DateTime] :Timestamp Only accounts created after the this time will be returned
13
+ # @option options [String] :WebsiteID Filter the returned results by sequential WebsiteID.
14
+ # @option options [Array] :Groups Filter the returned results by group membership. [key, value] will translate to
15
+ # <key>value</key>
16
+ #
17
+ # @return [Array] A list of API IDs for members in your community.
18
+ def self.all_getIDs(options = {}) # rubocop:disable Style/MethodName
19
+ response = post('/', :body => build_XML_request('Sa.Members.All.GetIDs', nil, options))
20
+ response_valid? response
21
+ members_hash = response['YourMembership_Response']['Sa.Members.All.GetIDs']['Members']
22
+ members_hash ? members_hash.fetch('ID') : []
23
+ end
24
+
25
+ # Returns a Hash of recent member activity on your YourMembership Site
26
+ # Returns member community activity information for the purpose of creating a navigation control.
27
+ #
28
+ # @see https://api.yourmembership.com/reference/2_00/Sa_Members_All_RecentActivity.htm
29
+ #
30
+ # @return [Hash] A subset of data is returned for each of the following:
31
+ #
32
+ # * Newest member
33
+ # * Latest post
34
+ # * Latest comment on a post
35
+ # * Latest photo
36
+ def self.all_recentActivity # rubocop:disable Style/MethodName
37
+ response = post('/', :body => build_XML_request('Sa.Members.All.RecentActivity'))
38
+ response_valid? response
39
+ response['YourMembership_Response']['Sa.Members.All.RecentActivity'].to_h
40
+ end
41
+
42
+ # Returns a list of order IDs for a specified member that may be optionally filtered by timestamp and status.
43
+ # This method will return a maximum of 1,000 results.
44
+ #
45
+ # @see https://api.yourmembership.com/reference/2_00/Sa_Members_Commerce_Store_GetOrderIDs.htm
46
+ #
47
+ # @param member_id [String] The id of the person for whom you want to retrieve data
48
+ # @param [Hash] options
49
+ # @option options [DateTime] :Timestamp Filter the returned results by date/time. Only those orders which were
50
+ # placed after the supplied date/time will be returned.
51
+ # @option options [Symbol, Integer] :Status Filter the returned results by Status.
52
+ # (-1 = :Cancelled; 0 = :open; 1 = :processed; 2 = :shipped or :closed)
53
+ #
54
+ # @return [Array] A list of Invoice Id Strings
55
+ def self.commerce_store_getOrderIDs(member_id, options = {}) # rubocop:disable Style/MethodName
56
+ options[:ID] = member_id
57
+ if options[:Status]
58
+ options[:Status] = YourMembership::Commerce.convert_order_status(options[:Status])
59
+ end
60
+ response = post('/', :body => build_XML_request('Sa.Members.Commerce.Store.GetOrderIDs', nil, options))
61
+ response_valid? response
62
+ response_to_array response['YourMembership_Response']['Sa.Members.Commerce.Store.GetOrderIDs']['Orders'], ['Order'], 'InvoiceID'
63
+ end
64
+
65
+ # Returns Event Registration details for the provided Event and Member ID. Includes all Event Registration details
66
+ # for Primary Registrant and Additional Registrants. If the Event Registration contains a related Custom Form, the
67
+ # form data will be included in the <DataSet> element as it is stored in our database.
68
+ #
69
+ # @see https://api.yourmembership.com/reference/2_00/Sa_Members_Events_Event_Registration_Get.htm
70
+ #
71
+ # @param event_id [Integer] The ID number for the Event you wish to retrieve Event Registration from.
72
+ # @param member_id [Integer] Member's API ID
73
+ #
74
+ # @return [Array] Returns an Array of Hashes that represent registrations by a specific user for a specific event.
75
+ def self.events_event_registration_get(event_id, member_id) # rubocop:disable Style/MethodName
76
+ options = {}
77
+ options[:EventID] = event_id
78
+ options[:ID] = member_id
79
+
80
+ response = post('/', :body => build_XML_request('Sa.Members.Events.Event.Registration.Get', nil, options))
81
+
82
+ response_valid? response
83
+ response_to_array_of_hashes response['YourMembership_Response']['Sa.Members.Events.Event.Registration.Get'], ['Registrations', 'Registration']
84
+ end
85
+
86
+ # Returns a list of a member's referrals.
87
+ #
88
+ # @see https://api.yourmembership.com/reference/2_00/Sa_Members_Referrals_Get.htm
89
+ #
90
+ # @param member_id [String] ID of the person whose referrals to return.
91
+ # @param [Hash] options
92
+ # @option options [DateTime] :Timestamp Filter the returned results by date/time. Only those referred members who
93
+ # registered after the supplied date/time will be returned.
94
+ #
95
+ # @return [Array] Returns an Array of Hashes that represent a Member's referrals
96
+ def self.referrals_get(member_id, options = {})
97
+ options[:ID] = member_id
98
+
99
+ response = post('/', :body => build_XML_request('Sa.Members.Referrals.Get', nil, options))
100
+
101
+ response_valid? response
102
+ response_to_array_of_hashes response['YourMembership_Response']['Sa.Members.Referrals.Get'], ['Member']
103
+ end
104
+
105
+ # Returns a list of a member's sub-accounts.
106
+ #
107
+ # @see https://api.yourmembership.com/reference/2_00/Sa_Members_SubAccounts_Get.htm
108
+ #
109
+ # @param member_id [String] ID of the person whose sub-accounts to return.
110
+ # @param options [Hash]
111
+ # @option options [Datetime] :Timestamp Filter the returned results by date/time. Only those members who
112
+ # registered after the supplied date/time will be returned.
113
+ #
114
+ # @return [Array] Returns an Array of Hashes that represent a Member's Subaccounts
115
+ def self.subAccounts_get(member_id, options = {}) # rubocop:disable Style/MethodName
116
+ options[:ID] = member_id
117
+
118
+ response = post('/', :body => build_XML_request('Sa.Members.SubAccounts.Get', nil, options))
119
+
120
+ response_valid? response
121
+ response_to_array_of_hashes response['YourMembership_Response']['Sa.Members.SubAccounts.Get'], ['Member']
122
+ end
123
+
124
+ # Create a CEU Journal Entry.
125
+ #
126
+ # @see https://api.yourmembership.com/reference/2_00/Sa_Members_Certifications_JournalEntry_Create.htm
127
+ #
128
+ # @param member_id [String] ID of the person who owns this certification journal entry.
129
+ # @param ceus_earned [Integer] The number of CEU Credits earned for this journal entry.
130
+ # @param ceus_expire_date [DateTime] The ODBC Date the CEU Credits Expire.
131
+ # @param description [String] Description of this journal entry.
132
+ # @param entry_date [DateTime] Date and time of this journal entry.
133
+ # @param options [Hash]
134
+ # @option options [String] :CertificationId The ID of the certification this journal entry is a part of. If
135
+ # neither CertificationName nor CertificationID are supplied, the journal entry will not be attached to a
136
+ # specific certification.
137
+ # @option options [String] :CertificationName For Self-Awarded certification journal entries that are not linked
138
+ # an existing certification record. This is the same behavior as choosing "Other Certification" and entering a
139
+ # Self-Awarded journal entry. If neither CertificationName nor CertificationID are supplied, the journal entry
140
+ # will not be attached to a specific certification.
141
+ # @option options [Decimal] :ScorePercent The decimal representation of a percentage score.
142
+ # For example, 90% would be 0.90.
143
+ # @option options [String] :CreditTypeCode Unique code for this new Journal Entry's Credit Type.
144
+ # If absent, the default Credit Type Code will be used.
145
+ #
146
+ # @return [Boolean] Returns true or raises exception.
147
+ def self.certifications_journalEntry_create(member_id, ceus_earned, ceus_expire_date, description, entry_date, options = {}) # rubocop:disable Style/MethodName
148
+ options['ID'] = member_id
149
+ options['CEUsEarned'] = ceus_earned
150
+ options['CEUsExpireDate'] = ceus_expire_date
151
+ options['Description'] = description
152
+ options['EntryDate'] = entry_date
153
+
154
+ response = post('/', :body => build_XML_request('Sa.Members.Certifications.JournalEntry.Create', nil, options))
155
+ response_valid? response
156
+ end
157
+
158
+ # Creates a new member profile and returns a member object.
159
+ #
160
+ # @see https://api.yourmembership.com/reference/2_00/Sa_Members_Profile_Create.htm
161
+ #
162
+ # @param profile [YourMembership::Profile]
163
+ #
164
+ # @return [YourMembership::Member] A Member object for the member that was just created.
165
+ # @todo: This currently returns an authenticated session for each created user. This may not be the desired
166
+ # permanent operation of this function.
167
+ def self.profile_create(profile)
168
+ options = {}
169
+ options['profile'] = profile
170
+ response = post('/', :body => build_XML_request('Sa.Members.Profile.Create', nil, options))
171
+ response_valid? response
172
+ YourMembership::Sa::Auth.authenticate(
173
+ YourMembership::Session.create,
174
+ profile.data['Username'],
175
+ profile.data['Password']
176
+ )
177
+ end
178
+ end
179
+ end
180
+ end