login_radius 11.0.0 → 11.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +21 -21
- data/README.md +58 -58
- data/lib/login_radius/api/account/account_api.rb +581 -581
- data/lib/login_radius/api/account/role_api.rb +330 -330
- data/lib/login_radius/api/account/sott_api.rb +47 -47
- data/lib/login_radius/api/advanced/configuration_api.rb +57 -57
- data/lib/login_radius/api/advanced/consent_management_api.rb +161 -161
- data/lib/login_radius/api/advanced/custom_object_api.rb +316 -316
- data/lib/login_radius/api/advanced/custom_registration_data_api.rb +195 -195
- data/lib/login_radius/api/advanced/multi_factor_authentication_api.rb +942 -606
- data/lib/login_radius/api/advanced/re_authentication_api.rb +317 -243
- data/lib/login_radius/api/advanced/web_hook_api.rb +101 -101
- data/lib/login_radius/api/authentication/authentication_api.rb +1036 -989
- data/lib/login_radius/api/authentication/one_touch_login_api.rb +160 -160
- data/lib/login_radius/api/authentication/password_less_login_api.rb +202 -158
- data/lib/login_radius/api/authentication/phone_authentication_api.rb +329 -329
- data/lib/login_radius/api/authentication/pin_authentication_api.rb +316 -316
- data/lib/login_radius/api/authentication/risk_based_authentication_api.rb +286 -286
- data/lib/login_radius/api/authentication/smart_login_api.rb +146 -146
- data/lib/login_radius/api/social/native_social_api.rb +255 -255
- data/lib/login_radius/api/social/social_api.rb +784 -806
- data/lib/login_radius/error.rb +7 -7
- data/lib/login_radius/request_client.rb +311 -295
- data/lib/login_radius/response.rb +18 -12
- data/lib/login_radius/version.rb +2 -2
- data/lib/login_radius.rb +30 -30
- data/login_radius.gemspec +25 -28
- metadata +7 -7
@@ -1,806 +1,784 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Created by LoginRadius Development Team
|
4
|
-
# Copyright 2019 LoginRadius Inc. All rights reserved.
|
5
|
-
require_relative '../../request_client'
|
6
|
-
|
7
|
-
module LoginRadius
|
8
|
-
# SocialApi module
|
9
|
-
class SocialApi
|
10
|
-
include RequestClient
|
11
|
-
|
12
|
-
attr_accessor :site_name, :api_key, :api_secret
|
13
|
-
|
14
|
-
# Initializes a LoginRadius Account object with an apikey and secret
|
15
|
-
# Takes in a hash containing site_name(required), api_key(required), api_secret(required)
|
16
|
-
def initialize
|
17
|
-
@site_name = ENV['SITE_NAME']
|
18
|
-
@api_key = ENV['API_KEY']
|
19
|
-
@api_secret = ENV['API_SECRET']
|
20
|
-
raise LoginRadius::Error.new, "'site_name' is a required option for Account class initialization." \
|
21
|
-
unless @site_name != '' && @site_name != nil
|
22
|
-
raise LoginRadius::Error.new, "'api_key' is a required option for Account class initialization." \
|
23
|
-
unless @api_key != '' && @api_key != nil
|
24
|
-
raise LoginRadius::Error.new, "'api_secret is a required option for Account class initialization." \
|
25
|
-
unless @api_secret != '' && @api_secret != nil
|
26
|
-
end
|
27
|
-
|
28
|
-
# This API Is used to translate the Request Token returned during authentication into an Access Token that can be used with other API calls.
|
29
|
-
#
|
30
|
-
# @param token - Token generated from a successful oauth from social platform
|
31
|
-
#
|
32
|
-
# @return Response containing Definition of Complete Token data
|
33
|
-
# 20.1
|
34
|
-
def exchange_access_token(token)
|
35
|
-
if isNullOrWhiteSpace(token)
|
36
|
-
raise LoginRadius::Error.new, getValidationMessage('token')
|
37
|
-
end
|
38
|
-
|
39
|
-
query_parameters = {}
|
40
|
-
query_parameters['secret'] = @api_secret
|
41
|
-
query_parameters['token'] = token
|
42
|
-
|
43
|
-
resource_path = 'api/v2/access_token'
|
44
|
-
get_request(resource_path, query_parameters,
|
45
|
-
end
|
46
|
-
|
47
|
-
# The Refresh Access Token API is used to refresh the provider access token after authentication. It will be valid for up to 60 days on LoginRadius depending on the provider. In order to use the access token in other APIs, always refresh the token using this API.<br><br><b>Supported Providers :</b> Facebook,Yahoo,Google,Twitter, Linkedin.<br><br> Contact LoginRadius support team to enable this API.
|
48
|
-
#
|
49
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
50
|
-
# @param expires_in - Allows you to specify a desired expiration time in minutes for the newly issued access token.
|
51
|
-
# @param is_web - Is web or not.
|
52
|
-
#
|
53
|
-
# @return Response containing Definition of Complete Token data
|
54
|
-
# 20.2
|
55
|
-
def refresh_access_token(access_token, expires_in, is_web = false)
|
56
|
-
if isNullOrWhiteSpace(access_token)
|
57
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
58
|
-
end
|
59
|
-
|
60
|
-
query_parameters = {}
|
61
|
-
query_parameters['access_token'] = access_token
|
62
|
-
query_parameters['secret'] = @api_secret
|
63
|
-
unless expires_in == false
|
64
|
-
query_parameters['expiresIn'] = expires_in
|
65
|
-
end
|
66
|
-
unless is_web == false
|
67
|
-
query_parameters['isWeb'] = is_web
|
68
|
-
end
|
69
|
-
|
70
|
-
resource_path = 'api/v2/access_token/refresh'
|
71
|
-
get_request(resource_path, query_parameters,
|
72
|
-
end
|
73
|
-
|
74
|
-
# This API validates access token, if valid then returns a response with its expiry otherwise error.
|
75
|
-
#
|
76
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
77
|
-
#
|
78
|
-
# @return Response containing Definition of Complete Token data
|
79
|
-
# 20.9
|
80
|
-
def validate_access_token(access_token)
|
81
|
-
if isNullOrWhiteSpace(access_token)
|
82
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
83
|
-
end
|
84
|
-
|
85
|
-
query_parameters = {}
|
86
|
-
query_parameters['access_token'] = access_token
|
87
|
-
query_parameters['key'] = @api_key
|
88
|
-
query_parameters['secret'] = @api_secret
|
89
|
-
|
90
|
-
resource_path = 'api/v2/access_token/validate'
|
91
|
-
get_request(resource_path, query_parameters,
|
92
|
-
end
|
93
|
-
|
94
|
-
# This api invalidates the active access token or expires an access token validity.
|
95
|
-
#
|
96
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
97
|
-
#
|
98
|
-
# @return Response containing Definition for Complete Validation data
|
99
|
-
# 20.10
|
100
|
-
def in_validate_access_token(access_token)
|
101
|
-
if isNullOrWhiteSpace(access_token)
|
102
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
103
|
-
end
|
104
|
-
|
105
|
-
query_parameters = {}
|
106
|
-
query_parameters['access_token'] = access_token
|
107
|
-
query_parameters['key'] = @api_key
|
108
|
-
query_parameters['secret'] = @api_secret
|
109
|
-
|
110
|
-
resource_path = 'api/v2/access_token/invalidate'
|
111
|
-
get_request(resource_path, query_parameters,
|
112
|
-
end
|
113
|
-
|
114
|
-
# This api is use to get all active session by Access Token.
|
115
|
-
#
|
116
|
-
# @param token - Token generated from a successful oauth from social platform
|
117
|
-
#
|
118
|
-
# @return Response containing Definition for Complete active sessions
|
119
|
-
# 20.11.1
|
120
|
-
def get_active_session(token)
|
121
|
-
if isNullOrWhiteSpace(token)
|
122
|
-
raise LoginRadius::Error.new, getValidationMessage('token')
|
123
|
-
end
|
124
|
-
|
125
|
-
query_parameters = {}
|
126
|
-
query_parameters['key'] = @api_key
|
127
|
-
query_parameters['secret'] = @api_secret
|
128
|
-
query_parameters['token'] = token
|
129
|
-
|
130
|
-
resource_path = 'api/v2/access_token/activesession'
|
131
|
-
get_request(resource_path, query_parameters,
|
132
|
-
end
|
133
|
-
|
134
|
-
# This api is used to get all active sessions by AccountID(UID).
|
135
|
-
#
|
136
|
-
# @param account_id - UID, the unified identifier for each user account
|
137
|
-
#
|
138
|
-
# @return Response containing Definition for Complete active sessions
|
139
|
-
# 20.11.2
|
140
|
-
def get_active_session_by_account_id(account_id)
|
141
|
-
if isNullOrWhiteSpace(account_id)
|
142
|
-
raise LoginRadius::Error.new, getValidationMessage('account_id')
|
143
|
-
end
|
144
|
-
|
145
|
-
query_parameters = {}
|
146
|
-
query_parameters['accountId'] = account_id
|
147
|
-
query_parameters['key'] = @api_key
|
148
|
-
query_parameters['secret'] = @api_secret
|
149
|
-
|
150
|
-
resource_path = 'api/v2/access_token/activesession'
|
151
|
-
get_request(resource_path, query_parameters,
|
152
|
-
end
|
153
|
-
|
154
|
-
# This api is used to get all active sessions by ProfileId.
|
155
|
-
#
|
156
|
-
# @param profile_id - Social Provider Id
|
157
|
-
#
|
158
|
-
# @return Response containing Definition for Complete active sessions
|
159
|
-
# 20.11.3
|
160
|
-
def get_active_session_by_profile_id(profile_id)
|
161
|
-
if isNullOrWhiteSpace(profile_id)
|
162
|
-
raise LoginRadius::Error.new, getValidationMessage('profile_id')
|
163
|
-
end
|
164
|
-
|
165
|
-
query_parameters = {}
|
166
|
-
query_parameters['key'] = @api_key
|
167
|
-
query_parameters['profileId'] = profile_id
|
168
|
-
query_parameters['secret'] = @api_secret
|
169
|
-
|
170
|
-
resource_path = 'api/v2/access_token/activesession'
|
171
|
-
get_request(resource_path, query_parameters,
|
172
|
-
end
|
173
|
-
|
174
|
-
# <b>Supported Providers:</b> Facebook, Google, Live, Vkontakte.<br><br> This API returns the photo albums associated with the passed in access tokens Social Profile.
|
175
|
-
#
|
176
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
177
|
-
#
|
178
|
-
# @return Response Containing List of Album Data
|
179
|
-
# 22.2.1
|
180
|
-
def get_albums(access_token)
|
181
|
-
if isNullOrWhiteSpace(access_token)
|
182
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
183
|
-
end
|
184
|
-
|
185
|
-
query_parameters = {}
|
186
|
-
query_parameters['access_token'] = access_token
|
187
|
-
|
188
|
-
resource_path = 'api/v2/album'
|
189
|
-
get_request(resource_path, query_parameters,
|
190
|
-
end
|
191
|
-
|
192
|
-
# <b>Supported Providers:</b> Facebook, Google, Live, Vkontakte.<br><br> This API returns the photo albums associated with the passed in access tokens Social Profile.
|
193
|
-
#
|
194
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
195
|
-
# @param next_cursor - Cursor value if not all contacts can be retrieved once.
|
196
|
-
#
|
197
|
-
# @return Response Model containing Albums with next cursor
|
198
|
-
# 22.2.2
|
199
|
-
def get_albums_with_cursor(access_token, next_cursor)
|
200
|
-
if isNullOrWhiteSpace(access_token)
|
201
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
202
|
-
end
|
203
|
-
if isNullOrWhiteSpace(next_cursor)
|
204
|
-
raise LoginRadius::Error.new, getValidationMessage('next_cursor')
|
205
|
-
end
|
206
|
-
|
207
|
-
query_parameters = {}
|
208
|
-
query_parameters['access_token'] = access_token
|
209
|
-
query_parameters['nextCursor'] = next_cursor
|
210
|
-
|
211
|
-
resource_path = 'api/v2/album'
|
212
|
-
get_request(resource_path, query_parameters,
|
213
|
-
end
|
214
|
-
|
215
|
-
# The Audio API is used to get audio files data from the user's social account.<br><br><b>Supported Providers:</b> Live, Vkontakte
|
216
|
-
#
|
217
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
218
|
-
#
|
219
|
-
# @return Response Containing List of Audio Data
|
220
|
-
# 24.2.1
|
221
|
-
def get_audios(access_token)
|
222
|
-
if isNullOrWhiteSpace(access_token)
|
223
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
224
|
-
end
|
225
|
-
|
226
|
-
query_parameters = {}
|
227
|
-
query_parameters['access_token'] = access_token
|
228
|
-
|
229
|
-
resource_path = 'api/v2/audio'
|
230
|
-
get_request(resource_path, query_parameters,
|
231
|
-
end
|
232
|
-
|
233
|
-
# The Audio API is used to get audio files data from the user's social account.<br><br><b>Supported Providers:</b> Live, Vkontakte
|
234
|
-
#
|
235
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
236
|
-
# @param next_cursor - Cursor value if not all contacts can be retrieved once.
|
237
|
-
#
|
238
|
-
# @return Response Model containing Audio with next cursor
|
239
|
-
# 24.2.2
|
240
|
-
def get_audios_with_cursor(access_token, next_cursor)
|
241
|
-
if isNullOrWhiteSpace(access_token)
|
242
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
243
|
-
end
|
244
|
-
if isNullOrWhiteSpace(next_cursor)
|
245
|
-
raise LoginRadius::Error.new, getValidationMessage('next_cursor')
|
246
|
-
end
|
247
|
-
|
248
|
-
query_parameters = {}
|
249
|
-
query_parameters['access_token'] = access_token
|
250
|
-
query_parameters['nextCursor'] = next_cursor
|
251
|
-
|
252
|
-
resource_path = 'api/v2/audio'
|
253
|
-
get_request(resource_path, query_parameters,
|
254
|
-
end
|
255
|
-
|
256
|
-
# The Check In API is used to get check Ins data from the user's social account.<br><br><b>Supported Providers:</b> Facebook, Foursquare, Vkontakte
|
257
|
-
#
|
258
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
259
|
-
#
|
260
|
-
# @return Response Containing List of CheckIn Data
|
261
|
-
# 25.2.1
|
262
|
-
def get_check_ins(access_token)
|
263
|
-
if isNullOrWhiteSpace(access_token)
|
264
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
265
|
-
end
|
266
|
-
|
267
|
-
query_parameters = {}
|
268
|
-
query_parameters['access_token'] = access_token
|
269
|
-
|
270
|
-
resource_path = 'api/v2/checkin'
|
271
|
-
get_request(resource_path, query_parameters,
|
272
|
-
end
|
273
|
-
|
274
|
-
# The Check In API is used to get check Ins data from the user's social account.<br><br><b>Supported Providers:</b> Facebook, Foursquare, Vkontakte
|
275
|
-
#
|
276
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
277
|
-
# @param next_cursor - Cursor value if not all contacts can be retrieved once.
|
278
|
-
#
|
279
|
-
# @return Response Model containing Checkins with next cursor
|
280
|
-
# 25.2.2
|
281
|
-
def get_check_ins_with_cursor(access_token, next_cursor)
|
282
|
-
if isNullOrWhiteSpace(access_token)
|
283
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
284
|
-
end
|
285
|
-
if isNullOrWhiteSpace(next_cursor)
|
286
|
-
raise LoginRadius::Error.new, getValidationMessage('next_cursor')
|
287
|
-
end
|
288
|
-
|
289
|
-
query_parameters = {}
|
290
|
-
query_parameters['access_token'] = access_token
|
291
|
-
query_parameters['nextCursor'] = next_cursor
|
292
|
-
|
293
|
-
resource_path = 'api/v2/checkin'
|
294
|
-
get_request(resource_path, query_parameters,
|
295
|
-
end
|
296
|
-
|
297
|
-
# The Contact API is used to get contacts/friends/connections data from the user's social account.This is one of the APIs that makes up the LoginRadius Friend Invite System. The data will normalized into LoginRadius' standard data format. This API requires setting permissions in your LoginRadius Dashboard. <br><br><b>Note:</b> Facebook restricts access to the list of friends that is returned. When using the Contacts API with Facebook you will only receive friends that have accepted some permissions with your app. <br><br><b>Supported Providers:</b> Facebook, Foursquare, Google, LinkedIn, Live, Twitter, Vkontakte, Yahoo
|
298
|
-
#
|
299
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
300
|
-
# @param next_cursor - Cursor value if not all contacts can be retrieved once.
|
301
|
-
#
|
302
|
-
# @return Response containing Definition of Contact Data with Cursor
|
303
|
-
# 27.1
|
304
|
-
def get_contacts(access_token, next_cursor = '')
|
305
|
-
if isNullOrWhiteSpace(access_token)
|
306
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
307
|
-
end
|
308
|
-
|
309
|
-
query_parameters = {}
|
310
|
-
query_parameters['access_token'] = access_token
|
311
|
-
unless isNullOrWhiteSpace(next_cursor)
|
312
|
-
query_parameters['nextCursor'] = next_cursor
|
313
|
-
end
|
314
|
-
|
315
|
-
resource_path = 'api/v2/contact'
|
316
|
-
get_request(resource_path, query_parameters,
|
317
|
-
end
|
318
|
-
|
319
|
-
# The Event API is used to get the event data from the user's social account.<br><br><b>Supported Providers:</b> Facebook, Live
|
320
|
-
#
|
321
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
322
|
-
#
|
323
|
-
# @return Response Containing List of Events Data
|
324
|
-
# 28.2.1
|
325
|
-
def get_events(access_token)
|
326
|
-
if isNullOrWhiteSpace(access_token)
|
327
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
328
|
-
end
|
329
|
-
|
330
|
-
query_parameters = {}
|
331
|
-
query_parameters['access_token'] = access_token
|
332
|
-
|
333
|
-
resource_path = 'api/v2/event'
|
334
|
-
get_request(resource_path, query_parameters,
|
335
|
-
end
|
336
|
-
|
337
|
-
# The Event API is used to get the event data from the user's social account.<br><br><b>Supported Providers:</b> Facebook, Live
|
338
|
-
#
|
339
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
340
|
-
# @param next_cursor - Cursor value if not all contacts can be retrieved once.
|
341
|
-
#
|
342
|
-
# @return Response Model containing Events with next cursor
|
343
|
-
# 28.2.2
|
344
|
-
def get_events_with_cursor(access_token, next_cursor)
|
345
|
-
if isNullOrWhiteSpace(access_token)
|
346
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
347
|
-
end
|
348
|
-
if isNullOrWhiteSpace(next_cursor)
|
349
|
-
raise LoginRadius::Error.new, getValidationMessage('next_cursor')
|
350
|
-
end
|
351
|
-
|
352
|
-
query_parameters = {}
|
353
|
-
query_parameters['access_token'] = access_token
|
354
|
-
query_parameters['nextCursor'] = next_cursor
|
355
|
-
|
356
|
-
resource_path = 'api/v2/event'
|
357
|
-
get_request(resource_path, query_parameters,
|
358
|
-
end
|
359
|
-
|
360
|
-
# Get the following user list from the user's social account.<br><br><b>Supported Providers:</b> Twitter
|
361
|
-
#
|
362
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
363
|
-
#
|
364
|
-
# @return Response Containing List of Contacts Data
|
365
|
-
# 29.2.1
|
366
|
-
def get_followings(access_token)
|
367
|
-
if isNullOrWhiteSpace(access_token)
|
368
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
369
|
-
end
|
370
|
-
|
371
|
-
query_parameters = {}
|
372
|
-
query_parameters['access_token'] = access_token
|
373
|
-
|
374
|
-
resource_path = 'api/v2/following'
|
375
|
-
get_request(resource_path, query_parameters,
|
376
|
-
end
|
377
|
-
|
378
|
-
# Get the following user list from the user's social account.<br><br><b>Supported Providers:</b> Twitter
|
379
|
-
#
|
380
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
381
|
-
# @param next_cursor - Cursor value if not all contacts can be retrieved once.
|
382
|
-
#
|
383
|
-
# @return Response containing Definition of Contact Data with Cursor
|
384
|
-
# 29.2.2
|
385
|
-
def get_followings_with_cursor(access_token, next_cursor)
|
386
|
-
if isNullOrWhiteSpace(access_token)
|
387
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
388
|
-
end
|
389
|
-
if isNullOrWhiteSpace(next_cursor)
|
390
|
-
raise LoginRadius::Error.new, getValidationMessage('next_cursor')
|
391
|
-
end
|
392
|
-
|
393
|
-
query_parameters = {}
|
394
|
-
query_parameters['access_token'] = access_token
|
395
|
-
query_parameters['nextCursor'] = next_cursor
|
396
|
-
|
397
|
-
resource_path = 'api/v2/following'
|
398
|
-
get_request(resource_path, query_parameters,
|
399
|
-
end
|
400
|
-
|
401
|
-
# The Group API is used to get group data from the user's social account.<br><br><b>Supported Providers:</b> Facebook, Vkontakte
|
402
|
-
#
|
403
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
404
|
-
#
|
405
|
-
# @return Response Containing List of Groups Data
|
406
|
-
# 30.2.1
|
407
|
-
def get_groups(access_token)
|
408
|
-
if isNullOrWhiteSpace(access_token)
|
409
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
410
|
-
end
|
411
|
-
|
412
|
-
query_parameters = {}
|
413
|
-
query_parameters['access_token'] = access_token
|
414
|
-
|
415
|
-
resource_path = 'api/v2/group'
|
416
|
-
get_request(resource_path, query_parameters,
|
417
|
-
end
|
418
|
-
|
419
|
-
# The Group API is used to get group data from the user's social account.<br><br><b>Supported Providers:</b> Facebook, Vkontakte
|
420
|
-
#
|
421
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
422
|
-
# @param next_cursor - Cursor value if not all contacts can be retrieved once.
|
423
|
-
#
|
424
|
-
# @return Response Model containing Groups with next cursor
|
425
|
-
# 30.2.2
|
426
|
-
def get_groups_with_cursor(access_token, next_cursor)
|
427
|
-
if isNullOrWhiteSpace(access_token)
|
428
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
429
|
-
end
|
430
|
-
if isNullOrWhiteSpace(next_cursor)
|
431
|
-
raise LoginRadius::Error.new, getValidationMessage('next_cursor')
|
432
|
-
end
|
433
|
-
|
434
|
-
query_parameters = {}
|
435
|
-
query_parameters['access_token'] = access_token
|
436
|
-
query_parameters['nextCursor'] = next_cursor
|
437
|
-
|
438
|
-
resource_path = 'api/v2/group'
|
439
|
-
get_request(resource_path, query_parameters,
|
440
|
-
end
|
441
|
-
|
442
|
-
# The Like API is used to get likes data from the user's social account.<br><br><b>Supported Providers:</b> Facebook
|
443
|
-
#
|
444
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
445
|
-
#
|
446
|
-
# @return Response Containing List of Likes Data
|
447
|
-
# 31.2.1
|
448
|
-
def get_likes(access_token)
|
449
|
-
if isNullOrWhiteSpace(access_token)
|
450
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
451
|
-
end
|
452
|
-
|
453
|
-
query_parameters = {}
|
454
|
-
query_parameters['access_token'] = access_token
|
455
|
-
|
456
|
-
resource_path = 'api/v2/like'
|
457
|
-
get_request(resource_path, query_parameters,
|
458
|
-
end
|
459
|
-
|
460
|
-
# The Like API is used to get likes data from the user's social account.<br><br><b>Supported Providers:</b> Facebook
|
461
|
-
#
|
462
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
463
|
-
# @param next_cursor - Cursor value if not all contacts can be retrieved once.
|
464
|
-
#
|
465
|
-
# @return Response Model containing Likes with next cursor
|
466
|
-
# 31.2.2
|
467
|
-
def get_likes_with_cursor(access_token, next_cursor)
|
468
|
-
if isNullOrWhiteSpace(access_token)
|
469
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
470
|
-
end
|
471
|
-
if isNullOrWhiteSpace(next_cursor)
|
472
|
-
raise LoginRadius::Error.new, getValidationMessage('next_cursor')
|
473
|
-
end
|
474
|
-
|
475
|
-
query_parameters = {}
|
476
|
-
query_parameters['access_token'] = access_token
|
477
|
-
query_parameters['nextCursor'] = next_cursor
|
478
|
-
|
479
|
-
resource_path = 'api/v2/like'
|
480
|
-
get_request(resource_path, query_parameters,
|
481
|
-
end
|
482
|
-
|
483
|
-
# The Mention API is used to get mentions data from the user's social account.<br><br><b>Supported Providers:</b> Twitter
|
484
|
-
#
|
485
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
486
|
-
#
|
487
|
-
# @return Response Containing List of Status Data
|
488
|
-
# 32.1
|
489
|
-
def get_mentions(access_token)
|
490
|
-
if isNullOrWhiteSpace(access_token)
|
491
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
492
|
-
end
|
493
|
-
|
494
|
-
query_parameters = {}
|
495
|
-
query_parameters['access_token'] = access_token
|
496
|
-
|
497
|
-
resource_path = 'api/v2/mention'
|
498
|
-
get_request(resource_path, query_parameters,
|
499
|
-
end
|
500
|
-
|
501
|
-
# Post Message API is used to post messages to the user's contacts.<br><br><b>Supported Providers:</b> Twitter, LinkedIn <br><br>The Message API is used to post messages to the user?s contacts. This is one of the APIs that makes up the LoginRadius Friend Invite System. After using the Contact API, you can send messages to the retrieved contacts. This API requires setting permissions in your LoginRadius Dashboard.<br><br>GET & POST Message API work the same way except the API method is different
|
502
|
-
#
|
503
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
504
|
-
# @param message - Body of your message
|
505
|
-
# @param subject - Subject of your message
|
506
|
-
# @param to - Recipient's social provider's id
|
507
|
-
#
|
508
|
-
# @return Response containing Definition for Complete Validation data
|
509
|
-
# 33.1
|
510
|
-
def post_message(access_token, message, subject, to)
|
511
|
-
if isNullOrWhiteSpace(access_token)
|
512
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
513
|
-
end
|
514
|
-
if isNullOrWhiteSpace(message)
|
515
|
-
raise LoginRadius::Error.new, getValidationMessage('message')
|
516
|
-
end
|
517
|
-
if isNullOrWhiteSpace(subject)
|
518
|
-
raise LoginRadius::Error.new, getValidationMessage('subject')
|
519
|
-
end
|
520
|
-
if isNullOrWhiteSpace(to)
|
521
|
-
raise LoginRadius::Error.new, getValidationMessage('to')
|
522
|
-
end
|
523
|
-
|
524
|
-
query_parameters = {}
|
525
|
-
query_parameters['access_token'] = access_token
|
526
|
-
query_parameters['message'] = message
|
527
|
-
query_parameters['subject'] = subject
|
528
|
-
query_parameters['to'] = to
|
529
|
-
|
530
|
-
resource_path = 'api/v2/message'
|
531
|
-
post_request(resource_path, query_parameters,
|
532
|
-
end
|
533
|
-
|
534
|
-
# The Page API is used to get the page data from the user's social account.<br><br><b>Supported Providers:</b> Facebook, LinkedIn
|
535
|
-
#
|
536
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
537
|
-
# @param page_name - Name of the page you want to retrieve info from
|
538
|
-
#
|
539
|
-
# @return Response containing Definition of Complete page data
|
540
|
-
# 34.1
|
541
|
-
def get_page(access_token, page_name)
|
542
|
-
if isNullOrWhiteSpace(access_token)
|
543
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
544
|
-
end
|
545
|
-
if isNullOrWhiteSpace(page_name)
|
546
|
-
raise LoginRadius::Error.new, getValidationMessage('page_name')
|
547
|
-
end
|
548
|
-
|
549
|
-
query_parameters = {}
|
550
|
-
query_parameters['access_token'] = access_token
|
551
|
-
query_parameters['pageName'] = page_name
|
552
|
-
|
553
|
-
resource_path = 'api/v2/page'
|
554
|
-
get_request(resource_path, query_parameters,
|
555
|
-
end
|
556
|
-
|
557
|
-
# The Photo API is used to get photo data from the user's social account.<br><br><b>Supported Providers:</b> Facebook, Foursquare, Google, Live, Vkontakte
|
558
|
-
#
|
559
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
560
|
-
# @param album_id - The id of the album you want to retrieve info from
|
561
|
-
#
|
562
|
-
# @return Response Containing List of Photos Data
|
563
|
-
# 35.1
|
564
|
-
def get_photos(access_token, album_id)
|
565
|
-
if isNullOrWhiteSpace(access_token)
|
566
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
567
|
-
end
|
568
|
-
if isNullOrWhiteSpace(album_id)
|
569
|
-
raise LoginRadius::Error.new, getValidationMessage('album_id')
|
570
|
-
end
|
571
|
-
|
572
|
-
query_parameters = {}
|
573
|
-
query_parameters['access_token'] = access_token
|
574
|
-
query_parameters['albumId'] = album_id
|
575
|
-
|
576
|
-
resource_path = 'api/v2/photo'
|
577
|
-
get_request(resource_path, query_parameters,
|
578
|
-
end
|
579
|
-
|
580
|
-
# The Post API is used to get post message data from the user's social account.<br><br><b>Supported Providers:</b> Facebook
|
581
|
-
#
|
582
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
583
|
-
#
|
584
|
-
# @return Response Containing List of Posts Data
|
585
|
-
# 36.1
|
586
|
-
def get_posts(access_token)
|
587
|
-
if isNullOrWhiteSpace(access_token)
|
588
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
589
|
-
end
|
590
|
-
|
591
|
-
query_parameters = {}
|
592
|
-
query_parameters['access_token'] = access_token
|
593
|
-
|
594
|
-
resource_path = 'api/v2/post'
|
595
|
-
get_request(resource_path, query_parameters,
|
596
|
-
end
|
597
|
-
|
598
|
-
# The Status API is used to update the status on the user's wall.<br><br><b>Supported Providers:</b> Facebook, Twitter, LinkedIn
|
599
|
-
#
|
600
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
601
|
-
# @param caption - Message displayed below the description(Requires URL, Under 70 Characters).
|
602
|
-
# @param description - Description of the displayed URL and Image(Requires URL)
|
603
|
-
# @param imageurl - Image to be displayed in the share(Requires URL).
|
604
|
-
# @param status - Main body of the Status update.
|
605
|
-
# @param title - Title of Linked URL
|
606
|
-
# @param url - URL to be included when clicking on the share.
|
607
|
-
# @param shorturl - short url
|
608
|
-
#
|
609
|
-
# @return Response conatining Definition of Validation and Short URL data
|
610
|
-
# 37.2
|
611
|
-
def status_posting(access_token, caption, description, imageurl, status, title, url, shorturl = '0')
|
612
|
-
if isNullOrWhiteSpace(access_token)
|
613
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
614
|
-
end
|
615
|
-
if isNullOrWhiteSpace(caption)
|
616
|
-
raise LoginRadius::Error.new, getValidationMessage('caption')
|
617
|
-
end
|
618
|
-
if isNullOrWhiteSpace(description)
|
619
|
-
raise LoginRadius::Error.new, getValidationMessage('description')
|
620
|
-
end
|
621
|
-
if isNullOrWhiteSpace(imageurl)
|
622
|
-
raise LoginRadius::Error.new, getValidationMessage('imageurl')
|
623
|
-
end
|
624
|
-
if isNullOrWhiteSpace(status)
|
625
|
-
raise LoginRadius::Error.new, getValidationMessage('status')
|
626
|
-
end
|
627
|
-
if isNullOrWhiteSpace(title)
|
628
|
-
raise LoginRadius::Error.new, getValidationMessage('title')
|
629
|
-
end
|
630
|
-
if isNullOrWhiteSpace(url)
|
631
|
-
raise LoginRadius::Error.new, getValidationMessage('url')
|
632
|
-
end
|
633
|
-
|
634
|
-
query_parameters = {}
|
635
|
-
query_parameters['access_token'] = access_token
|
636
|
-
query_parameters['caption'] = caption
|
637
|
-
query_parameters['description'] = description
|
638
|
-
query_parameters['imageurl'] = imageurl
|
639
|
-
query_parameters['status'] = status
|
640
|
-
query_parameters['title'] = title
|
641
|
-
query_parameters['url'] = url
|
642
|
-
unless isNullOrWhiteSpace(shorturl)
|
643
|
-
query_parameters['shorturl'] = shorturl
|
644
|
-
end
|
645
|
-
|
646
|
-
resource_path = 'api/v2/status'
|
647
|
-
post_request(resource_path, query_parameters,
|
648
|
-
end
|
649
|
-
|
650
|
-
# The Trackable status API works very similar to the Status API but it returns a Post id that you can use to track the stats(shares, likes, comments) for a specific share/post/status update. This API requires setting permissions in your LoginRadius Dashboard.<br><br> The Trackable Status API is used to update the status on the user's wall and return an Post ID value. It is commonly referred to as Permission based sharing or Push notifications.<br><br> POST Input Parameter Format: application/x-www-form-urlencoded
|
651
|
-
#
|
652
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
653
|
-
# @param status_model - Model Class containing Definition of payload for Status API
|
654
|
-
#
|
655
|
-
# @return Response containing Definition for Complete status data
|
656
|
-
# 37.6
|
657
|
-
def trackable_status_posting(access_token, status_model)
|
658
|
-
if isNullOrWhiteSpace(access_token)
|
659
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
660
|
-
end
|
661
|
-
if status_model.blank?
|
662
|
-
raise LoginRadius::Error.new, getValidationMessage('status_model')
|
663
|
-
end
|
664
|
-
|
665
|
-
query_parameters = {}
|
666
|
-
query_parameters['access_token'] = access_token
|
667
|
-
|
668
|
-
resource_path = 'api/v2/status/trackable'
|
669
|
-
post_request(resource_path, query_parameters, status_model)
|
670
|
-
end
|
671
|
-
|
672
|
-
# The Trackable status API works very similar to the Status API but it returns a Post id that you can use to track the stats(shares, likes, comments) for a specific share/post/status update. This API requires setting permissions in your LoginRadius Dashboard.<br><br> The Trackable Status API is used to update the status on the user's wall and return an Post ID value. It is commonly referred to as Permission based sharing or Push notifications.
|
673
|
-
#
|
674
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
675
|
-
# @param caption - Message displayed below the description(Requires URL, Under 70 Characters).
|
676
|
-
# @param description - Description of the displayed URL and Image(Requires URL)
|
677
|
-
# @param imageurl - Image to be displayed in the share(Requires URL).
|
678
|
-
# @param status - Main body of the Status update.
|
679
|
-
# @param title - Title of Linked URL
|
680
|
-
# @param url - URL to be included when clicking on the share.
|
681
|
-
#
|
682
|
-
# @return Response containing Definition for Complete status data
|
683
|
-
# 37.7
|
684
|
-
def get_trackable_status_stats(access_token, caption, description, imageurl, status, title, url)
|
685
|
-
if isNullOrWhiteSpace(access_token)
|
686
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
687
|
-
end
|
688
|
-
if isNullOrWhiteSpace(caption)
|
689
|
-
raise LoginRadius::Error.new, getValidationMessage('caption')
|
690
|
-
end
|
691
|
-
if isNullOrWhiteSpace(description)
|
692
|
-
raise LoginRadius::Error.new, getValidationMessage('description')
|
693
|
-
end
|
694
|
-
if isNullOrWhiteSpace(imageurl)
|
695
|
-
raise LoginRadius::Error.new, getValidationMessage('imageurl')
|
696
|
-
end
|
697
|
-
if isNullOrWhiteSpace(status)
|
698
|
-
raise LoginRadius::Error.new, getValidationMessage('status')
|
699
|
-
end
|
700
|
-
if isNullOrWhiteSpace(title)
|
701
|
-
raise LoginRadius::Error.new, getValidationMessage('title')
|
702
|
-
end
|
703
|
-
if isNullOrWhiteSpace(url)
|
704
|
-
raise LoginRadius::Error.new, getValidationMessage('url')
|
705
|
-
end
|
706
|
-
|
707
|
-
query_parameters = {}
|
708
|
-
query_parameters['access_token'] = access_token
|
709
|
-
query_parameters['caption'] = caption
|
710
|
-
query_parameters['description'] = description
|
711
|
-
query_parameters['imageurl'] = imageurl
|
712
|
-
query_parameters['status'] = status
|
713
|
-
query_parameters['title'] = title
|
714
|
-
query_parameters['url'] = url
|
715
|
-
|
716
|
-
resource_path = 'api/v2/status/trackable/js'
|
717
|
-
get_request(resource_path, query_parameters,
|
718
|
-
end
|
719
|
-
|
720
|
-
# The Trackable status API works very similar to the Status API but it returns a Post id that you can use to track the stats(shares, likes, comments) for a specific share/post/status update. This API requires setting permissions in your LoginRadius Dashboard.<br><br> This API is used to retrieve a tracked post based on the passed in post ID value. This API requires setting permissions in your LoginRadius Dashboard.<br><br> <b>Note:</b> To utilize this API you need to find the ID for the post you want to track, which might require using Trackable Status Posting API first.
|
721
|
-
#
|
722
|
-
# @param post_id - Post ID value
|
723
|
-
#
|
724
|
-
# @return Response containing Definition of Complete Status Update data
|
725
|
-
# 37.8
|
726
|
-
def trackable_status_fetching(post_id)
|
727
|
-
if isNullOrWhiteSpace(post_id)
|
728
|
-
raise LoginRadius::Error.new, getValidationMessage('post_id')
|
729
|
-
end
|
730
|
-
|
731
|
-
query_parameters = {}
|
732
|
-
query_parameters['postId'] = post_id
|
733
|
-
query_parameters['secret'] = @api_secret
|
734
|
-
|
735
|
-
resource_path = 'api/v2/status/trackable'
|
736
|
-
get_request(resource_path, query_parameters,
|
737
|
-
end
|
738
|
-
|
739
|
-
# The User Profile API is used to get social profile data from the user's social account after authentication
|
740
|
-
#
|
741
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
742
|
-
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
743
|
-
#
|
744
|
-
# @return Response containing Definition for Complete UserProfile data
|
745
|
-
# 38.
|
746
|
-
def
|
747
|
-
if isNullOrWhiteSpace(access_token)
|
748
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
749
|
-
end
|
750
|
-
|
751
|
-
query_parameters = {}
|
752
|
-
query_parameters['access_token'] = access_token
|
753
|
-
unless isNullOrWhiteSpace(fields)
|
754
|
-
query_parameters['fields'] = fields
|
755
|
-
end
|
756
|
-
|
757
|
-
resource_path = 'api/v2/userprofile'
|
758
|
-
get_request(resource_path, query_parameters,
|
759
|
-
end
|
760
|
-
|
761
|
-
# The
|
762
|
-
#
|
763
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
764
|
-
# @param
|
765
|
-
#
|
766
|
-
# @return Response containing Definition
|
767
|
-
#
|
768
|
-
def
|
769
|
-
if isNullOrWhiteSpace(access_token)
|
770
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
771
|
-
end
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
786
|
-
# @param next_cursor - Cursor value if not all contacts can be retrieved once.
|
787
|
-
#
|
788
|
-
# @return Response containing Definition of Video Data with Cursor
|
789
|
-
# 39.2
|
790
|
-
def get_videos(access_token, next_cursor)
|
791
|
-
if isNullOrWhiteSpace(access_token)
|
792
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
793
|
-
end
|
794
|
-
if isNullOrWhiteSpace(next_cursor)
|
795
|
-
raise LoginRadius::Error.new, getValidationMessage('next_cursor')
|
796
|
-
end
|
797
|
-
|
798
|
-
query_parameters = {}
|
799
|
-
query_parameters['access_token'] = access_token
|
800
|
-
query_parameters['nextCursor'] = next_cursor
|
801
|
-
|
802
|
-
resource_path = 'api/v2/video'
|
803
|
-
get_request(resource_path, query_parameters, nil)
|
804
|
-
end
|
805
|
-
end
|
806
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Created by LoginRadius Development Team
|
4
|
+
# Copyright 2019 LoginRadius Inc. All rights reserved.
|
5
|
+
require_relative '../../request_client'
|
6
|
+
|
7
|
+
module LoginRadius
|
8
|
+
# SocialApi module
|
9
|
+
class SocialApi
|
10
|
+
include RequestClient
|
11
|
+
|
12
|
+
attr_accessor :site_name, :api_key, :api_secret
|
13
|
+
|
14
|
+
# Initializes a LoginRadius Account object with an apikey and secret
|
15
|
+
# Takes in a hash containing site_name(required), api_key(required), api_secret(required)
|
16
|
+
def initialize
|
17
|
+
@site_name = ENV['SITE_NAME']
|
18
|
+
@api_key = ENV['API_KEY']
|
19
|
+
@api_secret = ENV['API_SECRET']
|
20
|
+
raise LoginRadius::Error.new, "'site_name' is a required option for Account class initialization." \
|
21
|
+
unless @site_name != '' && @site_name != nil
|
22
|
+
raise LoginRadius::Error.new, "'api_key' is a required option for Account class initialization." \
|
23
|
+
unless @api_key != '' && @api_key != nil
|
24
|
+
raise LoginRadius::Error.new, "'api_secret is a required option for Account class initialization." \
|
25
|
+
unless @api_secret != '' && @api_secret != nil
|
26
|
+
end
|
27
|
+
|
28
|
+
# This API Is used to translate the Request Token returned during authentication into an Access Token that can be used with other API calls.
|
29
|
+
#
|
30
|
+
# @param token - Token generated from a successful oauth from social platform
|
31
|
+
#
|
32
|
+
# @return Response containing Definition of Complete Token data
|
33
|
+
# 20.1
|
34
|
+
def exchange_access_token(token)
|
35
|
+
if isNullOrWhiteSpace(token)
|
36
|
+
raise LoginRadius::Error.new, getValidationMessage('token')
|
37
|
+
end
|
38
|
+
|
39
|
+
query_parameters = {}
|
40
|
+
query_parameters['secret'] = @api_secret
|
41
|
+
query_parameters['token'] = token
|
42
|
+
|
43
|
+
resource_path = 'api/v2/access_token'
|
44
|
+
get_request(resource_path, query_parameters, {})
|
45
|
+
end
|
46
|
+
|
47
|
+
# The Refresh Access Token API is used to refresh the provider access token after authentication. It will be valid for up to 60 days on LoginRadius depending on the provider. In order to use the access token in other APIs, always refresh the token using this API.<br><br><b>Supported Providers :</b> Facebook,Yahoo,Google,Twitter, Linkedin.<br><br> Contact LoginRadius support team to enable this API.
|
48
|
+
#
|
49
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
50
|
+
# @param expires_in - Allows you to specify a desired expiration time in minutes for the newly issued access token.
|
51
|
+
# @param is_web - Is web or not.
|
52
|
+
#
|
53
|
+
# @return Response containing Definition of Complete Token data
|
54
|
+
# 20.2
|
55
|
+
def refresh_access_token(access_token, expires_in, is_web = false)
|
56
|
+
if isNullOrWhiteSpace(access_token)
|
57
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
58
|
+
end
|
59
|
+
|
60
|
+
query_parameters = {}
|
61
|
+
query_parameters['access_token'] = access_token
|
62
|
+
query_parameters['secret'] = @api_secret
|
63
|
+
unless expires_in == false
|
64
|
+
query_parameters['expiresIn'] = expires_in
|
65
|
+
end
|
66
|
+
unless is_web == false
|
67
|
+
query_parameters['isWeb'] = is_web
|
68
|
+
end
|
69
|
+
|
70
|
+
resource_path = 'api/v2/access_token/refresh'
|
71
|
+
get_request(resource_path, query_parameters, {})
|
72
|
+
end
|
73
|
+
|
74
|
+
# This API validates access token, if valid then returns a response with its expiry otherwise error.
|
75
|
+
#
|
76
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
77
|
+
#
|
78
|
+
# @return Response containing Definition of Complete Token data
|
79
|
+
# 20.9
|
80
|
+
def validate_access_token(access_token)
|
81
|
+
if isNullOrWhiteSpace(access_token)
|
82
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
83
|
+
end
|
84
|
+
|
85
|
+
query_parameters = {}
|
86
|
+
query_parameters['access_token'] = access_token
|
87
|
+
query_parameters['key'] = @api_key
|
88
|
+
query_parameters['secret'] = @api_secret
|
89
|
+
|
90
|
+
resource_path = 'api/v2/access_token/validate'
|
91
|
+
get_request(resource_path, query_parameters, {})
|
92
|
+
end
|
93
|
+
|
94
|
+
# This api invalidates the active access token or expires an access token validity.
|
95
|
+
#
|
96
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
97
|
+
#
|
98
|
+
# @return Response containing Definition for Complete Validation data
|
99
|
+
# 20.10
|
100
|
+
def in_validate_access_token(access_token)
|
101
|
+
if isNullOrWhiteSpace(access_token)
|
102
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
103
|
+
end
|
104
|
+
|
105
|
+
query_parameters = {}
|
106
|
+
query_parameters['access_token'] = access_token
|
107
|
+
query_parameters['key'] = @api_key
|
108
|
+
query_parameters['secret'] = @api_secret
|
109
|
+
|
110
|
+
resource_path = 'api/v2/access_token/invalidate'
|
111
|
+
get_request(resource_path, query_parameters, {})
|
112
|
+
end
|
113
|
+
|
114
|
+
# This api is use to get all active session by Access Token.
|
115
|
+
#
|
116
|
+
# @param token - Token generated from a successful oauth from social platform
|
117
|
+
#
|
118
|
+
# @return Response containing Definition for Complete active sessions
|
119
|
+
# 20.11.1
|
120
|
+
def get_active_session(token)
|
121
|
+
if isNullOrWhiteSpace(token)
|
122
|
+
raise LoginRadius::Error.new, getValidationMessage('token')
|
123
|
+
end
|
124
|
+
|
125
|
+
query_parameters = {}
|
126
|
+
query_parameters['key'] = @api_key
|
127
|
+
query_parameters['secret'] = @api_secret
|
128
|
+
query_parameters['token'] = token
|
129
|
+
|
130
|
+
resource_path = 'api/v2/access_token/activesession'
|
131
|
+
get_request(resource_path, query_parameters, {})
|
132
|
+
end
|
133
|
+
|
134
|
+
# This api is used to get all active sessions by AccountID(UID).
|
135
|
+
#
|
136
|
+
# @param account_id - UID, the unified identifier for each user account
|
137
|
+
#
|
138
|
+
# @return Response containing Definition for Complete active sessions
|
139
|
+
# 20.11.2
|
140
|
+
def get_active_session_by_account_id(account_id)
|
141
|
+
if isNullOrWhiteSpace(account_id)
|
142
|
+
raise LoginRadius::Error.new, getValidationMessage('account_id')
|
143
|
+
end
|
144
|
+
|
145
|
+
query_parameters = {}
|
146
|
+
query_parameters['accountId'] = account_id
|
147
|
+
query_parameters['key'] = @api_key
|
148
|
+
query_parameters['secret'] = @api_secret
|
149
|
+
|
150
|
+
resource_path = 'api/v2/access_token/activesession'
|
151
|
+
get_request(resource_path, query_parameters, {})
|
152
|
+
end
|
153
|
+
|
154
|
+
# This api is used to get all active sessions by ProfileId.
|
155
|
+
#
|
156
|
+
# @param profile_id - Social Provider Id
|
157
|
+
#
|
158
|
+
# @return Response containing Definition for Complete active sessions
|
159
|
+
# 20.11.3
|
160
|
+
def get_active_session_by_profile_id(profile_id)
|
161
|
+
if isNullOrWhiteSpace(profile_id)
|
162
|
+
raise LoginRadius::Error.new, getValidationMessage('profile_id')
|
163
|
+
end
|
164
|
+
|
165
|
+
query_parameters = {}
|
166
|
+
query_parameters['key'] = @api_key
|
167
|
+
query_parameters['profileId'] = profile_id
|
168
|
+
query_parameters['secret'] = @api_secret
|
169
|
+
|
170
|
+
resource_path = 'api/v2/access_token/activesession'
|
171
|
+
get_request(resource_path, query_parameters, {})
|
172
|
+
end
|
173
|
+
|
174
|
+
# <b>Supported Providers:</b> Facebook, Google, Live, Vkontakte.<br><br> This API returns the photo albums associated with the passed in access tokens Social Profile.
|
175
|
+
#
|
176
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
177
|
+
#
|
178
|
+
# @return Response Containing List of Album Data
|
179
|
+
# 22.2.1
|
180
|
+
def get_albums(access_token)
|
181
|
+
if isNullOrWhiteSpace(access_token)
|
182
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
183
|
+
end
|
184
|
+
|
185
|
+
query_parameters = {}
|
186
|
+
query_parameters['access_token'] = access_token
|
187
|
+
|
188
|
+
resource_path = 'api/v2/album'
|
189
|
+
get_request(resource_path, query_parameters, {})
|
190
|
+
end
|
191
|
+
|
192
|
+
# <b>Supported Providers:</b> Facebook, Google, Live, Vkontakte.<br><br> This API returns the photo albums associated with the passed in access tokens Social Profile.
|
193
|
+
#
|
194
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
195
|
+
# @param next_cursor - Cursor value if not all contacts can be retrieved once.
|
196
|
+
#
|
197
|
+
# @return Response Model containing Albums with next cursor
|
198
|
+
# 22.2.2
|
199
|
+
def get_albums_with_cursor(access_token, next_cursor)
|
200
|
+
if isNullOrWhiteSpace(access_token)
|
201
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
202
|
+
end
|
203
|
+
if isNullOrWhiteSpace(next_cursor)
|
204
|
+
raise LoginRadius::Error.new, getValidationMessage('next_cursor')
|
205
|
+
end
|
206
|
+
|
207
|
+
query_parameters = {}
|
208
|
+
query_parameters['access_token'] = access_token
|
209
|
+
query_parameters['nextCursor'] = next_cursor
|
210
|
+
|
211
|
+
resource_path = 'api/v2/album'
|
212
|
+
get_request(resource_path, query_parameters, {})
|
213
|
+
end
|
214
|
+
|
215
|
+
# The Audio API is used to get audio files data from the user's social account.<br><br><b>Supported Providers:</b> Live, Vkontakte
|
216
|
+
#
|
217
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
218
|
+
#
|
219
|
+
# @return Response Containing List of Audio Data
|
220
|
+
# 24.2.1
|
221
|
+
def get_audios(access_token)
|
222
|
+
if isNullOrWhiteSpace(access_token)
|
223
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
224
|
+
end
|
225
|
+
|
226
|
+
query_parameters = {}
|
227
|
+
query_parameters['access_token'] = access_token
|
228
|
+
|
229
|
+
resource_path = 'api/v2/audio'
|
230
|
+
get_request(resource_path, query_parameters, {})
|
231
|
+
end
|
232
|
+
|
233
|
+
# The Audio API is used to get audio files data from the user's social account.<br><br><b>Supported Providers:</b> Live, Vkontakte
|
234
|
+
#
|
235
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
236
|
+
# @param next_cursor - Cursor value if not all contacts can be retrieved once.
|
237
|
+
#
|
238
|
+
# @return Response Model containing Audio with next cursor
|
239
|
+
# 24.2.2
|
240
|
+
def get_audios_with_cursor(access_token, next_cursor)
|
241
|
+
if isNullOrWhiteSpace(access_token)
|
242
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
243
|
+
end
|
244
|
+
if isNullOrWhiteSpace(next_cursor)
|
245
|
+
raise LoginRadius::Error.new, getValidationMessage('next_cursor')
|
246
|
+
end
|
247
|
+
|
248
|
+
query_parameters = {}
|
249
|
+
query_parameters['access_token'] = access_token
|
250
|
+
query_parameters['nextCursor'] = next_cursor
|
251
|
+
|
252
|
+
resource_path = 'api/v2/audio'
|
253
|
+
get_request(resource_path, query_parameters, {})
|
254
|
+
end
|
255
|
+
|
256
|
+
# The Check In API is used to get check Ins data from the user's social account.<br><br><b>Supported Providers:</b> Facebook, Foursquare, Vkontakte
|
257
|
+
#
|
258
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
259
|
+
#
|
260
|
+
# @return Response Containing List of CheckIn Data
|
261
|
+
# 25.2.1
|
262
|
+
def get_check_ins(access_token)
|
263
|
+
if isNullOrWhiteSpace(access_token)
|
264
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
265
|
+
end
|
266
|
+
|
267
|
+
query_parameters = {}
|
268
|
+
query_parameters['access_token'] = access_token
|
269
|
+
|
270
|
+
resource_path = 'api/v2/checkin'
|
271
|
+
get_request(resource_path, query_parameters, {})
|
272
|
+
end
|
273
|
+
|
274
|
+
# The Check In API is used to get check Ins data from the user's social account.<br><br><b>Supported Providers:</b> Facebook, Foursquare, Vkontakte
|
275
|
+
#
|
276
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
277
|
+
# @param next_cursor - Cursor value if not all contacts can be retrieved once.
|
278
|
+
#
|
279
|
+
# @return Response Model containing Checkins with next cursor
|
280
|
+
# 25.2.2
|
281
|
+
def get_check_ins_with_cursor(access_token, next_cursor)
|
282
|
+
if isNullOrWhiteSpace(access_token)
|
283
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
284
|
+
end
|
285
|
+
if isNullOrWhiteSpace(next_cursor)
|
286
|
+
raise LoginRadius::Error.new, getValidationMessage('next_cursor')
|
287
|
+
end
|
288
|
+
|
289
|
+
query_parameters = {}
|
290
|
+
query_parameters['access_token'] = access_token
|
291
|
+
query_parameters['nextCursor'] = next_cursor
|
292
|
+
|
293
|
+
resource_path = 'api/v2/checkin'
|
294
|
+
get_request(resource_path, query_parameters, {})
|
295
|
+
end
|
296
|
+
|
297
|
+
# The Contact API is used to get contacts/friends/connections data from the user's social account.This is one of the APIs that makes up the LoginRadius Friend Invite System. The data will normalized into LoginRadius' standard data format. This API requires setting permissions in your LoginRadius Dashboard. <br><br><b>Note:</b> Facebook restricts access to the list of friends that is returned. When using the Contacts API with Facebook you will only receive friends that have accepted some permissions with your app. <br><br><b>Supported Providers:</b> Facebook, Foursquare, Google, LinkedIn, Live, Twitter, Vkontakte, Yahoo
|
298
|
+
#
|
299
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
300
|
+
# @param next_cursor - Cursor value if not all contacts can be retrieved once.
|
301
|
+
#
|
302
|
+
# @return Response containing Definition of Contact Data with Cursor
|
303
|
+
# 27.1
|
304
|
+
def get_contacts(access_token, next_cursor = '')
|
305
|
+
if isNullOrWhiteSpace(access_token)
|
306
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
307
|
+
end
|
308
|
+
|
309
|
+
query_parameters = {}
|
310
|
+
query_parameters['access_token'] = access_token
|
311
|
+
unless isNullOrWhiteSpace(next_cursor)
|
312
|
+
query_parameters['nextCursor'] = next_cursor
|
313
|
+
end
|
314
|
+
|
315
|
+
resource_path = 'api/v2/contact'
|
316
|
+
get_request(resource_path, query_parameters, {})
|
317
|
+
end
|
318
|
+
|
319
|
+
# The Event API is used to get the event data from the user's social account.<br><br><b>Supported Providers:</b> Facebook, Live
|
320
|
+
#
|
321
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
322
|
+
#
|
323
|
+
# @return Response Containing List of Events Data
|
324
|
+
# 28.2.1
|
325
|
+
def get_events(access_token)
|
326
|
+
if isNullOrWhiteSpace(access_token)
|
327
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
328
|
+
end
|
329
|
+
|
330
|
+
query_parameters = {}
|
331
|
+
query_parameters['access_token'] = access_token
|
332
|
+
|
333
|
+
resource_path = 'api/v2/event'
|
334
|
+
get_request(resource_path, query_parameters, {})
|
335
|
+
end
|
336
|
+
|
337
|
+
# The Event API is used to get the event data from the user's social account.<br><br><b>Supported Providers:</b> Facebook, Live
|
338
|
+
#
|
339
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
340
|
+
# @param next_cursor - Cursor value if not all contacts can be retrieved once.
|
341
|
+
#
|
342
|
+
# @return Response Model containing Events with next cursor
|
343
|
+
# 28.2.2
|
344
|
+
def get_events_with_cursor(access_token, next_cursor)
|
345
|
+
if isNullOrWhiteSpace(access_token)
|
346
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
347
|
+
end
|
348
|
+
if isNullOrWhiteSpace(next_cursor)
|
349
|
+
raise LoginRadius::Error.new, getValidationMessage('next_cursor')
|
350
|
+
end
|
351
|
+
|
352
|
+
query_parameters = {}
|
353
|
+
query_parameters['access_token'] = access_token
|
354
|
+
query_parameters['nextCursor'] = next_cursor
|
355
|
+
|
356
|
+
resource_path = 'api/v2/event'
|
357
|
+
get_request(resource_path, query_parameters, {})
|
358
|
+
end
|
359
|
+
|
360
|
+
# Get the following user list from the user's social account.<br><br><b>Supported Providers:</b> Twitter
|
361
|
+
#
|
362
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
363
|
+
#
|
364
|
+
# @return Response Containing List of Contacts Data
|
365
|
+
# 29.2.1
|
366
|
+
def get_followings(access_token)
|
367
|
+
if isNullOrWhiteSpace(access_token)
|
368
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
369
|
+
end
|
370
|
+
|
371
|
+
query_parameters = {}
|
372
|
+
query_parameters['access_token'] = access_token
|
373
|
+
|
374
|
+
resource_path = 'api/v2/following'
|
375
|
+
get_request(resource_path, query_parameters, {})
|
376
|
+
end
|
377
|
+
|
378
|
+
# Get the following user list from the user's social account.<br><br><b>Supported Providers:</b> Twitter
|
379
|
+
#
|
380
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
381
|
+
# @param next_cursor - Cursor value if not all contacts can be retrieved once.
|
382
|
+
#
|
383
|
+
# @return Response containing Definition of Contact Data with Cursor
|
384
|
+
# 29.2.2
|
385
|
+
def get_followings_with_cursor(access_token, next_cursor)
|
386
|
+
if isNullOrWhiteSpace(access_token)
|
387
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
388
|
+
end
|
389
|
+
if isNullOrWhiteSpace(next_cursor)
|
390
|
+
raise LoginRadius::Error.new, getValidationMessage('next_cursor')
|
391
|
+
end
|
392
|
+
|
393
|
+
query_parameters = {}
|
394
|
+
query_parameters['access_token'] = access_token
|
395
|
+
query_parameters['nextCursor'] = next_cursor
|
396
|
+
|
397
|
+
resource_path = 'api/v2/following'
|
398
|
+
get_request(resource_path, query_parameters, {})
|
399
|
+
end
|
400
|
+
|
401
|
+
# The Group API is used to get group data from the user's social account.<br><br><b>Supported Providers:</b> Facebook, Vkontakte
|
402
|
+
#
|
403
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
404
|
+
#
|
405
|
+
# @return Response Containing List of Groups Data
|
406
|
+
# 30.2.1
|
407
|
+
def get_groups(access_token)
|
408
|
+
if isNullOrWhiteSpace(access_token)
|
409
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
410
|
+
end
|
411
|
+
|
412
|
+
query_parameters = {}
|
413
|
+
query_parameters['access_token'] = access_token
|
414
|
+
|
415
|
+
resource_path = 'api/v2/group'
|
416
|
+
get_request(resource_path, query_parameters, {})
|
417
|
+
end
|
418
|
+
|
419
|
+
# The Group API is used to get group data from the user's social account.<br><br><b>Supported Providers:</b> Facebook, Vkontakte
|
420
|
+
#
|
421
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
422
|
+
# @param next_cursor - Cursor value if not all contacts can be retrieved once.
|
423
|
+
#
|
424
|
+
# @return Response Model containing Groups with next cursor
|
425
|
+
# 30.2.2
|
426
|
+
def get_groups_with_cursor(access_token, next_cursor)
|
427
|
+
if isNullOrWhiteSpace(access_token)
|
428
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
429
|
+
end
|
430
|
+
if isNullOrWhiteSpace(next_cursor)
|
431
|
+
raise LoginRadius::Error.new, getValidationMessage('next_cursor')
|
432
|
+
end
|
433
|
+
|
434
|
+
query_parameters = {}
|
435
|
+
query_parameters['access_token'] = access_token
|
436
|
+
query_parameters['nextCursor'] = next_cursor
|
437
|
+
|
438
|
+
resource_path = 'api/v2/group'
|
439
|
+
get_request(resource_path, query_parameters, {})
|
440
|
+
end
|
441
|
+
|
442
|
+
# The Like API is used to get likes data from the user's social account.<br><br><b>Supported Providers:</b> Facebook
|
443
|
+
#
|
444
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
445
|
+
#
|
446
|
+
# @return Response Containing List of Likes Data
|
447
|
+
# 31.2.1
|
448
|
+
def get_likes(access_token)
|
449
|
+
if isNullOrWhiteSpace(access_token)
|
450
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
451
|
+
end
|
452
|
+
|
453
|
+
query_parameters = {}
|
454
|
+
query_parameters['access_token'] = access_token
|
455
|
+
|
456
|
+
resource_path = 'api/v2/like'
|
457
|
+
get_request(resource_path, query_parameters, {})
|
458
|
+
end
|
459
|
+
|
460
|
+
# The Like API is used to get likes data from the user's social account.<br><br><b>Supported Providers:</b> Facebook
|
461
|
+
#
|
462
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
463
|
+
# @param next_cursor - Cursor value if not all contacts can be retrieved once.
|
464
|
+
#
|
465
|
+
# @return Response Model containing Likes with next cursor
|
466
|
+
# 31.2.2
|
467
|
+
def get_likes_with_cursor(access_token, next_cursor)
|
468
|
+
if isNullOrWhiteSpace(access_token)
|
469
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
470
|
+
end
|
471
|
+
if isNullOrWhiteSpace(next_cursor)
|
472
|
+
raise LoginRadius::Error.new, getValidationMessage('next_cursor')
|
473
|
+
end
|
474
|
+
|
475
|
+
query_parameters = {}
|
476
|
+
query_parameters['access_token'] = access_token
|
477
|
+
query_parameters['nextCursor'] = next_cursor
|
478
|
+
|
479
|
+
resource_path = 'api/v2/like'
|
480
|
+
get_request(resource_path, query_parameters, {})
|
481
|
+
end
|
482
|
+
|
483
|
+
# The Mention API is used to get mentions data from the user's social account.<br><br><b>Supported Providers:</b> Twitter
|
484
|
+
#
|
485
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
486
|
+
#
|
487
|
+
# @return Response Containing List of Status Data
|
488
|
+
# 32.1
|
489
|
+
def get_mentions(access_token)
|
490
|
+
if isNullOrWhiteSpace(access_token)
|
491
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
492
|
+
end
|
493
|
+
|
494
|
+
query_parameters = {}
|
495
|
+
query_parameters['access_token'] = access_token
|
496
|
+
|
497
|
+
resource_path = 'api/v2/mention'
|
498
|
+
get_request(resource_path, query_parameters, {})
|
499
|
+
end
|
500
|
+
|
501
|
+
# Post Message API is used to post messages to the user's contacts.<br><br><b>Supported Providers:</b> Twitter, LinkedIn <br><br>The Message API is used to post messages to the user?s contacts. This is one of the APIs that makes up the LoginRadius Friend Invite System. After using the Contact API, you can send messages to the retrieved contacts. This API requires setting permissions in your LoginRadius Dashboard.<br><br>GET & POST Message API work the same way except the API method is different
|
502
|
+
#
|
503
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
504
|
+
# @param message - Body of your message
|
505
|
+
# @param subject - Subject of your message
|
506
|
+
# @param to - Recipient's social provider's id
|
507
|
+
#
|
508
|
+
# @return Response containing Definition for Complete Validation data
|
509
|
+
# 33.1
|
510
|
+
def post_message(access_token, message, subject, to)
|
511
|
+
if isNullOrWhiteSpace(access_token)
|
512
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
513
|
+
end
|
514
|
+
if isNullOrWhiteSpace(message)
|
515
|
+
raise LoginRadius::Error.new, getValidationMessage('message')
|
516
|
+
end
|
517
|
+
if isNullOrWhiteSpace(subject)
|
518
|
+
raise LoginRadius::Error.new, getValidationMessage('subject')
|
519
|
+
end
|
520
|
+
if isNullOrWhiteSpace(to)
|
521
|
+
raise LoginRadius::Error.new, getValidationMessage('to')
|
522
|
+
end
|
523
|
+
|
524
|
+
query_parameters = {}
|
525
|
+
query_parameters['access_token'] = access_token
|
526
|
+
query_parameters['message'] = message
|
527
|
+
query_parameters['subject'] = subject
|
528
|
+
query_parameters['to'] = to
|
529
|
+
|
530
|
+
resource_path = 'api/v2/message'
|
531
|
+
post_request(resource_path, query_parameters, {})
|
532
|
+
end
|
533
|
+
|
534
|
+
# The Page API is used to get the page data from the user's social account.<br><br><b>Supported Providers:</b> Facebook, LinkedIn
|
535
|
+
#
|
536
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
537
|
+
# @param page_name - Name of the page you want to retrieve info from
|
538
|
+
#
|
539
|
+
# @return Response containing Definition of Complete page data
|
540
|
+
# 34.1
|
541
|
+
def get_page(access_token, page_name)
|
542
|
+
if isNullOrWhiteSpace(access_token)
|
543
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
544
|
+
end
|
545
|
+
if isNullOrWhiteSpace(page_name)
|
546
|
+
raise LoginRadius::Error.new, getValidationMessage('page_name')
|
547
|
+
end
|
548
|
+
|
549
|
+
query_parameters = {}
|
550
|
+
query_parameters['access_token'] = access_token
|
551
|
+
query_parameters['pageName'] = page_name
|
552
|
+
|
553
|
+
resource_path = 'api/v2/page'
|
554
|
+
get_request(resource_path, query_parameters, {})
|
555
|
+
end
|
556
|
+
|
557
|
+
# The Photo API is used to get photo data from the user's social account.<br><br><b>Supported Providers:</b> Facebook, Foursquare, Google, Live, Vkontakte
|
558
|
+
#
|
559
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
560
|
+
# @param album_id - The id of the album you want to retrieve info from
|
561
|
+
#
|
562
|
+
# @return Response Containing List of Photos Data
|
563
|
+
# 35.1
|
564
|
+
def get_photos(access_token, album_id)
|
565
|
+
if isNullOrWhiteSpace(access_token)
|
566
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
567
|
+
end
|
568
|
+
if isNullOrWhiteSpace(album_id)
|
569
|
+
raise LoginRadius::Error.new, getValidationMessage('album_id')
|
570
|
+
end
|
571
|
+
|
572
|
+
query_parameters = {}
|
573
|
+
query_parameters['access_token'] = access_token
|
574
|
+
query_parameters['albumId'] = album_id
|
575
|
+
|
576
|
+
resource_path = 'api/v2/photo'
|
577
|
+
get_request(resource_path, query_parameters, {})
|
578
|
+
end
|
579
|
+
|
580
|
+
# The Post API is used to get post message data from the user's social account.<br><br><b>Supported Providers:</b> Facebook
|
581
|
+
#
|
582
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
583
|
+
#
|
584
|
+
# @return Response Containing List of Posts Data
|
585
|
+
# 36.1
|
586
|
+
def get_posts(access_token)
|
587
|
+
if isNullOrWhiteSpace(access_token)
|
588
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
589
|
+
end
|
590
|
+
|
591
|
+
query_parameters = {}
|
592
|
+
query_parameters['access_token'] = access_token
|
593
|
+
|
594
|
+
resource_path = 'api/v2/post'
|
595
|
+
get_request(resource_path, query_parameters, {})
|
596
|
+
end
|
597
|
+
|
598
|
+
# The Status API is used to update the status on the user's wall.<br><br><b>Supported Providers:</b> Facebook, Twitter, LinkedIn
|
599
|
+
#
|
600
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
601
|
+
# @param caption - Message displayed below the description(Requires URL, Under 70 Characters).
|
602
|
+
# @param description - Description of the displayed URL and Image(Requires URL)
|
603
|
+
# @param imageurl - Image to be displayed in the share(Requires URL).
|
604
|
+
# @param status - Main body of the Status update.
|
605
|
+
# @param title - Title of Linked URL
|
606
|
+
# @param url - URL to be included when clicking on the share.
|
607
|
+
# @param shorturl - short url
|
608
|
+
#
|
609
|
+
# @return Response conatining Definition of Validation and Short URL data
|
610
|
+
# 37.2
|
611
|
+
def status_posting(access_token, caption, description, imageurl, status, title, url, shorturl = '0')
|
612
|
+
if isNullOrWhiteSpace(access_token)
|
613
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
614
|
+
end
|
615
|
+
if isNullOrWhiteSpace(caption)
|
616
|
+
raise LoginRadius::Error.new, getValidationMessage('caption')
|
617
|
+
end
|
618
|
+
if isNullOrWhiteSpace(description)
|
619
|
+
raise LoginRadius::Error.new, getValidationMessage('description')
|
620
|
+
end
|
621
|
+
if isNullOrWhiteSpace(imageurl)
|
622
|
+
raise LoginRadius::Error.new, getValidationMessage('imageurl')
|
623
|
+
end
|
624
|
+
if isNullOrWhiteSpace(status)
|
625
|
+
raise LoginRadius::Error.new, getValidationMessage('status')
|
626
|
+
end
|
627
|
+
if isNullOrWhiteSpace(title)
|
628
|
+
raise LoginRadius::Error.new, getValidationMessage('title')
|
629
|
+
end
|
630
|
+
if isNullOrWhiteSpace(url)
|
631
|
+
raise LoginRadius::Error.new, getValidationMessage('url')
|
632
|
+
end
|
633
|
+
|
634
|
+
query_parameters = {}
|
635
|
+
query_parameters['access_token'] = access_token
|
636
|
+
query_parameters['caption'] = caption
|
637
|
+
query_parameters['description'] = description
|
638
|
+
query_parameters['imageurl'] = imageurl
|
639
|
+
query_parameters['status'] = status
|
640
|
+
query_parameters['title'] = title
|
641
|
+
query_parameters['url'] = url
|
642
|
+
unless isNullOrWhiteSpace(shorturl)
|
643
|
+
query_parameters['shorturl'] = shorturl
|
644
|
+
end
|
645
|
+
|
646
|
+
resource_path = 'api/v2/status'
|
647
|
+
post_request(resource_path, query_parameters, {})
|
648
|
+
end
|
649
|
+
|
650
|
+
# The Trackable status API works very similar to the Status API but it returns a Post id that you can use to track the stats(shares, likes, comments) for a specific share/post/status update. This API requires setting permissions in your LoginRadius Dashboard.<br><br> The Trackable Status API is used to update the status on the user's wall and return an Post ID value. It is commonly referred to as Permission based sharing or Push notifications.<br><br> POST Input Parameter Format: application/x-www-form-urlencoded
|
651
|
+
#
|
652
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
653
|
+
# @param status_model - Model Class containing Definition of payload for Status API
|
654
|
+
#
|
655
|
+
# @return Response containing Definition for Complete status data
|
656
|
+
# 37.6
|
657
|
+
def trackable_status_posting(access_token, status_model)
|
658
|
+
if isNullOrWhiteSpace(access_token)
|
659
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
660
|
+
end
|
661
|
+
if status_model.blank?
|
662
|
+
raise LoginRadius::Error.new, getValidationMessage('status_model')
|
663
|
+
end
|
664
|
+
|
665
|
+
query_parameters = {}
|
666
|
+
query_parameters['access_token'] = access_token
|
667
|
+
|
668
|
+
resource_path = 'api/v2/status/trackable'
|
669
|
+
post_request(resource_path, query_parameters, status_model)
|
670
|
+
end
|
671
|
+
|
672
|
+
# The Trackable status API works very similar to the Status API but it returns a Post id that you can use to track the stats(shares, likes, comments) for a specific share/post/status update. This API requires setting permissions in your LoginRadius Dashboard.<br><br> The Trackable Status API is used to update the status on the user's wall and return an Post ID value. It is commonly referred to as Permission based sharing or Push notifications.
|
673
|
+
#
|
674
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
675
|
+
# @param caption - Message displayed below the description(Requires URL, Under 70 Characters).
|
676
|
+
# @param description - Description of the displayed URL and Image(Requires URL)
|
677
|
+
# @param imageurl - Image to be displayed in the share(Requires URL).
|
678
|
+
# @param status - Main body of the Status update.
|
679
|
+
# @param title - Title of Linked URL
|
680
|
+
# @param url - URL to be included when clicking on the share.
|
681
|
+
#
|
682
|
+
# @return Response containing Definition for Complete status data
|
683
|
+
# 37.7
|
684
|
+
def get_trackable_status_stats(access_token, caption, description, imageurl, status, title, url)
|
685
|
+
if isNullOrWhiteSpace(access_token)
|
686
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
687
|
+
end
|
688
|
+
if isNullOrWhiteSpace(caption)
|
689
|
+
raise LoginRadius::Error.new, getValidationMessage('caption')
|
690
|
+
end
|
691
|
+
if isNullOrWhiteSpace(description)
|
692
|
+
raise LoginRadius::Error.new, getValidationMessage('description')
|
693
|
+
end
|
694
|
+
if isNullOrWhiteSpace(imageurl)
|
695
|
+
raise LoginRadius::Error.new, getValidationMessage('imageurl')
|
696
|
+
end
|
697
|
+
if isNullOrWhiteSpace(status)
|
698
|
+
raise LoginRadius::Error.new, getValidationMessage('status')
|
699
|
+
end
|
700
|
+
if isNullOrWhiteSpace(title)
|
701
|
+
raise LoginRadius::Error.new, getValidationMessage('title')
|
702
|
+
end
|
703
|
+
if isNullOrWhiteSpace(url)
|
704
|
+
raise LoginRadius::Error.new, getValidationMessage('url')
|
705
|
+
end
|
706
|
+
|
707
|
+
query_parameters = {}
|
708
|
+
query_parameters['access_token'] = access_token
|
709
|
+
query_parameters['caption'] = caption
|
710
|
+
query_parameters['description'] = description
|
711
|
+
query_parameters['imageurl'] = imageurl
|
712
|
+
query_parameters['status'] = status
|
713
|
+
query_parameters['title'] = title
|
714
|
+
query_parameters['url'] = url
|
715
|
+
|
716
|
+
resource_path = 'api/v2/status/trackable/js'
|
717
|
+
get_request(resource_path, query_parameters, {})
|
718
|
+
end
|
719
|
+
|
720
|
+
# The Trackable status API works very similar to the Status API but it returns a Post id that you can use to track the stats(shares, likes, comments) for a specific share/post/status update. This API requires setting permissions in your LoginRadius Dashboard.<br><br> This API is used to retrieve a tracked post based on the passed in post ID value. This API requires setting permissions in your LoginRadius Dashboard.<br><br> <b>Note:</b> To utilize this API you need to find the ID for the post you want to track, which might require using Trackable Status Posting API first.
|
721
|
+
#
|
722
|
+
# @param post_id - Post ID value
|
723
|
+
#
|
724
|
+
# @return Response containing Definition of Complete Status Update data
|
725
|
+
# 37.8
|
726
|
+
def trackable_status_fetching(post_id)
|
727
|
+
if isNullOrWhiteSpace(post_id)
|
728
|
+
raise LoginRadius::Error.new, getValidationMessage('post_id')
|
729
|
+
end
|
730
|
+
|
731
|
+
query_parameters = {}
|
732
|
+
query_parameters['postId'] = post_id
|
733
|
+
query_parameters['secret'] = @api_secret
|
734
|
+
|
735
|
+
resource_path = 'api/v2/status/trackable'
|
736
|
+
get_request(resource_path, query_parameters, {})
|
737
|
+
end
|
738
|
+
|
739
|
+
# The User Profile API is used to get the latest updated social profile data from the user's social account after authentication. The social profile will be retrieved via oAuth and OpenID protocols. The data is normalized into LoginRadius' standard data format. This API should be called using the access token retrieved from the refresh access token API.
|
740
|
+
#
|
741
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
742
|
+
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
743
|
+
#
|
744
|
+
# @return Response containing Definition for Complete UserProfile data
|
745
|
+
# 38.2
|
746
|
+
def get_refreshed_social_user_profile(access_token, fields = '')
|
747
|
+
if isNullOrWhiteSpace(access_token)
|
748
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
749
|
+
end
|
750
|
+
|
751
|
+
query_parameters = {}
|
752
|
+
query_parameters['access_token'] = access_token
|
753
|
+
unless isNullOrWhiteSpace(fields)
|
754
|
+
query_parameters['fields'] = fields
|
755
|
+
end
|
756
|
+
|
757
|
+
resource_path = 'api/v2/userprofile/refresh'
|
758
|
+
get_request(resource_path, query_parameters, {})
|
759
|
+
end
|
760
|
+
|
761
|
+
# The Video API is used to get video files data from the user's social account.<br><br><b>Supported Providers:</b> Facebook, Google, Live, Vkontakte
|
762
|
+
#
|
763
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
764
|
+
# @param next_cursor - Cursor value if not all contacts can be retrieved once.
|
765
|
+
#
|
766
|
+
# @return Response containing Definition of Video Data with Cursor
|
767
|
+
# 39.2
|
768
|
+
def get_videos(access_token, next_cursor)
|
769
|
+
if isNullOrWhiteSpace(access_token)
|
770
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
771
|
+
end
|
772
|
+
if isNullOrWhiteSpace(next_cursor)
|
773
|
+
raise LoginRadius::Error.new, getValidationMessage('next_cursor')
|
774
|
+
end
|
775
|
+
|
776
|
+
query_parameters = {}
|
777
|
+
query_parameters['access_token'] = access_token
|
778
|
+
query_parameters['nextCursor'] = next_cursor
|
779
|
+
|
780
|
+
resource_path = 'api/v2/video'
|
781
|
+
get_request(resource_path, query_parameters, {})
|
782
|
+
end
|
783
|
+
end
|
784
|
+
end
|