login_radius 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,283 +0,0 @@
1
- module LoginRadiusRaas
2
- module UserApi
3
- #
4
- # This API is used to create a new user on your site. This API bypasses the normal email verification process and manually creates the user for your system.
5
- #
6
- # params = {:emailid => "example@example.com",
7
- # :password => "FakePass",
8
- # :firstname => "Joe",
9
- # :lastname => "Smith",
10
- # :gender => "M",
11
- # :birthdate => "11-08-1987",
12
- # :Country => "USA",
13
- # :city => "Chicago",
14
- # :state => "Illinois ",
15
- # :phonenumber => "1232333232",
16
- # :address1 => "23/43, II Street",
17
- # :address2 => "Near Paris garden",
18
- # :company => "Orange Inc.",
19
- # :postalcode => "43435",
20
- # :emailsubscription => "true",
21
- # :customfields => {
22
- # :example_field1 => "some data 1",
23
- # :example_field2 => "some data 2",
24
- # :example_field3 => "some data 3"
25
- # }
26
- # }
27
- #
28
- # return all user profile
29
- #
30
- def user_create_profile!(params)
31
- api_client("raas/v1/user", {}, params, 'json');
32
- end
33
-
34
- def user_create_profile(params={})
35
- user_create_profile!(params)
36
- rescue LoginRadiusRaas::Exception => e
37
- false
38
- end
39
-
40
- #
41
- # This API used to register user from server side, verification email will be send to provided email address
42
- #
43
- # params = {"emailid => "example@example.com",
44
- # :password => "FakePass",
45
- # :firstname => "Joe",
46
- # :lastname => "Smith",
47
- # :gender => "M",
48
- # :birthdate => "11-08-1987",
49
- # :Country => "USA",
50
- # :city => "Chicago",
51
- # :state => "Illinois ",
52
- # :phonenumber => "1232333232",
53
- # :address1 => "23/43, II Street",
54
- # :address2 => "Near Paris garden",
55
- # :company => "Orange Inc.",
56
- # :postalcode => "43435",
57
- # :emailsubscription => "true",
58
- # :customfields => {
59
- # :example_field1 => "some data 1",
60
- # :example_field2 => "some data 2",
61
- # :example_field3 => "some data 3"
62
- # },
63
- # :EmailVerificationUrl => "http://yoursite.com/verifyemail"
64
- # }
65
- #
66
- # return "isPosted": "true"
67
- #
68
- def user_registration!(params)
69
- api_client("raas/v1/user/register", {}, params, 'json');
70
- end
71
-
72
- def user_registration(params)
73
- user_registration!(params)
74
- rescue LoginRadiusRaas::Exception => e
75
- false
76
- end
77
-
78
- #
79
- # This API is used to Modify/Update details of an existing user.
80
- #
81
- # params = {
82
- # :firstname => 'first name',
83
- # :lastname => 'last name',
84
- # :gender => 'm',
85
- # :birthdate => 'MM-DD-YYYY',
86
- # ....................
87
- # ....................
88
- # }
89
- #
90
- # return {“isPosted”: “true”}
91
- #
92
- def user_edit_profile!(userId, params)
93
- api_client("raas/v1/user", {:userid => userId}, params, 'json');
94
- end
95
-
96
- def user_edit_profile(userId, params={})
97
- user_edit_profile!(userId, params)
98
- rescue LoginRadiusRaas::Exception => e
99
- false
100
- end
101
-
102
- #
103
- # This API is used to check email of an existing user.
104
- #
105
- # email = example@provider.com
106
- #
107
- # return {“isExist”: “true”}
108
- #
109
-
110
- def check_email!(email)
111
- api_client("raas/client/auth/checkEmail", {:email => email});
112
- end
113
-
114
- def check_email(email)
115
- check_email!(email)
116
- rescue LoginRadiusRaas::Exception => e
117
- false
118
- end
119
-
120
- #
121
- # This API is used to get token for forgot password of an existing user.
122
- #
123
- # email = example@provider.com
124
- #
125
- # return object of token and provider list
126
- #
127
-
128
- def user_forgot_password_token!(email)
129
- api_client("raas/v1/user", {:email => email});
130
- end
131
-
132
- def user_forgot_password_token(email)
133
- user_forgot_password_token!(email)
134
- rescue LoginRadiusRaas::Exception => e
135
- false
136
- end
137
-
138
- #
139
- # This API deletes the RaaS account of the user and allowing them to begin the registration process
140
- #
141
- # return [{"isPosted": "true"}]
142
- #
143
- def user_delete!(uid)
144
- api_client("raas/v1/user/delete", {:UID => uid});
145
- end
146
-
147
- def user_delete(uid)
148
- user_delete!(uid)
149
- rescue LoginRadiusRaas::Exception => e
150
- false
151
- end
152
-
153
- #
154
- # This API is used to create a user using the currently logged in social provider.
155
- #
156
- # params = {
157
- # :accountid => uid,
158
- # :password => 'xxxxxxxxxx',
159
- # :emailid => 'example@doamin.com'
160
- # }
161
- #
162
- # return {“isPosted”: “true”}
163
- #
164
- def user_set_password!(params)
165
- api_client("raas/v1/account/profile", {}, params, 'json');
166
- end
167
-
168
- def user_set_password(params={})
169
- user_set_password!(params)
170
- rescue LoginRadiusRaas::Exception => e
171
- false
172
- end
173
-
174
- #
175
- # This API is used to Update/Change the user’s password.
176
- #
177
- # userId => 'xxxxxxxxxx';
178
- # oldpassword => 'xxxxxxxxxx';
179
- # newpassword => 'xxxxxxxxxx';
180
- #
181
- # return {“isPosted”: “true”}
182
- #
183
- def user_change_password!(uid, oldPassword, newPassword)
184
- data = {:oldpassword => oldPassword, :newpassword => newPassword}
185
- api_client("raas/v1/account/password", {:accountid => uid}, data)
186
- end
187
-
188
- def user_change_password(uid, oldPassword, newPassword)
189
- user_change_password!(uid, oldPassword, newPassword)
190
- rescue LoginRadiusRaas::Exception => e
191
- false
192
- end
193
-
194
- #
195
- # This API is used to set the password of user, used in admin section.
196
- #
197
- # userId = 'xxxxxx'; // RaaS account ID only not Social Account ID
198
- # password = 'xxxxxxxxxx';
199
- # return {“isPosted”: “true”}
200
- #
201
- def user_set_password_by_admin!(userId, password)
202
- parameter = {:userid => userId, :action => 'set'}
203
- api_client('raas/v1/user/password', parameter, {:password => password});
204
- end
205
-
206
- def user_set_password_by_admin(userId, password)
207
- user_set_password_by_admin!(userId, password)
208
- rescue LoginRadiusRaas::Exception => e
209
- false
210
- end
211
-
212
- #
213
- # This API is used to authenticate users and returns the profile data associated with the authenticated user.
214
- #
215
- # username = 'username';//email id
216
- # password = 'xxxxxxxxxx';
217
- #
218
- # return all user profile
219
- #
220
- def user_authentication!(username, password)
221
- api_client('raas/v1/user', {:username => username, :password => password});
222
- end
223
-
224
- def user_authentication(username, password)
225
- user_authentication!(username, password)
226
- rescue LoginRadiusRaas::Exception => e
227
- false
228
- end
229
-
230
- #
231
- # This API retrieves the profile data associated with the specific user using the users unique UserID
232
- #
233
- # userId = 'xxxxxxxxxx';
234
- #
235
- # return all user profile
236
- #
237
- def user_get_profile_by_id!(userId)
238
- api_client('raas/v1/user', {:userid => userId});
239
- end
240
-
241
- def user_get_profile_by_id(userId)
242
- user_get_profile_by_id!(userId)
243
- rescue LoginRadiusRaas::Exception => e
244
- false
245
- end
246
-
247
- #
248
- # This API retrieves the profile data associated with the specific user using the users unique Email Address
249
- #
250
- # email = 'xxxxxxxxxx@xxxxxxxx.xxx';
251
- #
252
- # return all user profile
253
- #
254
- def user_get_profile_by_email!(email)
255
- api_client('raas/v1/user', {:emailid => email});
256
- end
257
-
258
- def user_get_profile_by_email(email)
259
- user_get_profile_by_email!(email)
260
- rescue LoginRadiusRaas::Exception => e
261
- false
262
- end
263
-
264
- #
265
- # This API is used to block or un-block a user using the users unique UserID (UID).
266
- #
267
- # uid = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
268
- # action = true/false(boolean)
269
- #
270
- # return all user profile
271
- #/
272
- def user_set_status!(uid, action)
273
- api_client('raas/v1/user/status', {:accountid => uid}, {:isblock => action});
274
- end
275
-
276
- def user_set_status(uid, action = true)
277
- user_set_status!(uid, action)
278
- rescue LoginRadiusRaas::Exception => e
279
- false
280
- end
281
-
282
- end
283
- end