your_membership 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env +5 -0
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/CHANGELOG.md +10 -0
- data/README.md +12 -10
- data/lib/httparty/patch.rb +33 -33
- data/lib/your_membership/base.rb +197 -197
- data/lib/your_membership/commerce.rb +25 -25
- data/lib/your_membership/config.rb +41 -41
- data/lib/your_membership/convert.rb +24 -24
- data/lib/your_membership/error.rb +21 -21
- data/lib/your_membership/events.rb +60 -60
- data/lib/your_membership/feeds.rb +37 -37
- data/lib/your_membership/member.rb +399 -397
- data/lib/your_membership/members.rb +124 -124
- data/lib/your_membership/people.rb +38 -38
- data/lib/your_membership/profile.rb +92 -85
- data/lib/your_membership/sa.rb +6 -6
- data/lib/your_membership/sa_auth.rb +34 -34
- data/lib/your_membership/sa_certifications.rb +22 -22
- data/lib/your_membership/sa_commerce.rb +22 -22
- data/lib/your_membership/sa_events.rb +66 -66
- data/lib/your_membership/sa_export.rb +195 -195
- data/lib/your_membership/sa_groups.rb +30 -30
- data/lib/your_membership/sa_member.rb +49 -49
- data/lib/your_membership/sa_members.rb +180 -179
- data/lib/your_membership/sa_nonmembers.rb +41 -41
- data/lib/your_membership/sa_people.rb +92 -92
- data/lib/your_membership/session.rb +148 -152
- data/lib/your_membership/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/sa_members_all_getids_timestamp_multiple.yml +51 -0
- data/spec/fixtures/vcr_cassettes/sa_members_all_getids_timestamp_none.yml +51 -0
- data/spec/fixtures/vcr_cassettes/sa_members_all_getids_timestamp_single.yml +51 -0
- data/spec/lib/{profile_spec.rb → your_membership/profile_spec.rb} +232 -197
- data/spec/lib/your_membership/sa_members_spec.rb +38 -0
- data/spec/spec_helper.rb +101 -78
- data/your_membership.gemspec +4 -0
- 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']
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
# Returns
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
# *
|
33
|
-
# * Latest
|
34
|
-
# * Latest
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
response
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
47
|
-
# @param [
|
48
|
-
# @
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
#
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
# for
|
66
|
-
#
|
67
|
-
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#
|
71
|
-
# @param
|
72
|
-
#
|
73
|
-
#
|
74
|
-
|
75
|
-
|
76
|
-
options
|
77
|
-
options[:
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
#
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
# @param [
|
91
|
-
# @
|
92
|
-
#
|
93
|
-
#
|
94
|
-
#
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
#
|
106
|
-
#
|
107
|
-
#
|
108
|
-
#
|
109
|
-
# @param
|
110
|
-
# @
|
111
|
-
#
|
112
|
-
#
|
113
|
-
#
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
#
|
125
|
-
#
|
126
|
-
#
|
127
|
-
#
|
128
|
-
# @param
|
129
|
-
# @param
|
130
|
-
# @param
|
131
|
-
# @param
|
132
|
-
# @param
|
133
|
-
# @
|
134
|
-
#
|
135
|
-
#
|
136
|
-
#
|
137
|
-
#
|
138
|
-
#
|
139
|
-
#
|
140
|
-
#
|
141
|
-
#
|
142
|
-
#
|
143
|
-
#
|
144
|
-
#
|
145
|
-
#
|
146
|
-
|
147
|
-
|
148
|
-
options['
|
149
|
-
options['
|
150
|
-
options['
|
151
|
-
options['
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
#
|
159
|
-
#
|
160
|
-
#
|
161
|
-
#
|
162
|
-
#
|
163
|
-
#
|
164
|
-
# @
|
165
|
-
#
|
166
|
-
|
167
|
-
|
168
|
-
options
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
profile.data['
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
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
|