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,39 +1,61 @@
1
- module LoginRadiusRaas
2
- module BasicApi
3
- #
1
+ module LoginRadius
2
+ module SocialApi
3
+
4
+
5
+ def authentication
6
+ return authentication = {
7
+ :appkey => appkey,
8
+ :appsecret => appsecret
9
+ }
10
+ end
11
+
12
+
13
+
14
+ #
4
15
  # LoginRadius function - Fetch LoginRadius access token after authentication. It will be valid for the specific duration of time specified in the response.
5
16
  # @param string LoginRadius API token
6
17
  #
7
18
  # @return mixed string|object LoginRadius access token.
8
19
  #
9
20
  #
10
- def get_access_token!(token)
11
- return api_client("api/v2/access_token", {:token=>token,:secret=>appsecret});
12
- end
13
-
14
- def get_access_token(token)
15
- return get_access_token!(token)
16
- rescue LoginRadiusRaas::Exception => e
21
+
22
+
23
+ def getAccessToken(token)
24
+ return getRequest("api/v2/access_token", {:token=>token,:secret=>appsecret},"api");
25
+ rescue LoginRadiusRaas::Exception => e
17
26
  return false
18
- end
19
-
27
+ end
28
+
29
+
20
30
  #
21
- # LoginRadius function - To fetch 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.
31
+ # LoginRadius function - Validate LoginRadius access token.This API validates access token, if valid then returns a response with its expiry otherwise error.
32
+ # @param string LoginRadius API token
33
+ # @return mixed string|object LoginRadius access token.
22
34
  #
23
- # @param string accessToken LoginRadius access token
24
- # @param boolean raw If true, raw data is fetched
25
35
  #
26
- # @return object User profile data.
36
+
37
+
38
+ def getValidateAccessToken(token)
39
+ return getRequest("api/v2/access_token/validate", {:access_token=>token,:key=>appkey,:secret=>appsecret},"api");
40
+ rescue LoginRadiusRaas::Exception => e
41
+ return false
42
+ end
43
+
44
+
27
45
  #
28
- def get_user_profile!(accessToken, raw)
29
- return api_client("api/v2/userprofile" + get_row_data(raw), {:access_token=>accessToken});
30
- end
31
-
32
- def get_user_profile(accessToken, raw = false)
33
- return get_user_profile!(accessToken, raw)
34
- rescue LoginRadiusRaas::Exception => e
46
+ # LoginRadius function - Invalidate LoginRadius access token.This api invalidates the active access token or expires an access token validity.
47
+ # @param string LoginRadius API token
48
+ # @return mixed string|object LoginRadius access token.
49
+ #
50
+ #
51
+
52
+
53
+ def getInvalidateAccessToken(token)
54
+ return getRequest("api/v2/access_token/invalidate", {:access_token=>token,:key=>appkey,:secret=>appsecret},"api");
55
+ rescue LoginRadiusRaas::Exception => e
35
56
  return false
36
57
  end
58
+
37
59
 
38
60
  #
39
61
  # LoginRadius function - To get the Albums data from the user's social account. The data will be normalized into LoginRadius' data format.
@@ -44,36 +66,34 @@ module LoginRadiusRaas
44
66
  # @return object User's albums data.
45
67
  #
46
68
  #
47
- def get_albums!(accessToken, raw)
48
- return api_client("api/v2/album" + get_row_data(raw), {:access_token=>accessToken});
49
- end
50
-
51
- def get_albums(accessToken, raw = false)
52
- return get_albums!(accessToken, raw)
53
- rescue LoginRadiusRaas::Exception => e
69
+
70
+
71
+ def getAlbums(accessToken, raw = false)
72
+ return getRequest("api/v2/album" + get_row_data(raw), {:access_token=>accessToken},"api");
73
+ rescue LoginRadiusRaas::Exception => e
54
74
  return false
55
75
  end
56
76
 
57
- #
58
- # LoginRadius function - To fetch photo data from the user's social account. The data will be normalized into LoginRadius' data format.
77
+
78
+ #
79
+ # LoginRadius function - To fetch user's audio files data from the user's social account. The data will be normalized into LoginRadius' data format.
59
80
  #
60
81
  # @param string accessToken LoginRadius access token
61
- # @param string albumId ID of the album to fetch photos from
62
82
  # @param boolean raw If true, raw data is fetched
63
83
  #
64
- # @return object User's photo data.
84
+ # @return object User's audio files data.
85
+ #
65
86
  #
66
- def get_photos!(accessToken, albumId, raw)
67
- return api_client("api/v2/photo" + get_row_data(raw), {:access_token=>accessToken,:albumid=>albumId});
68
- end
69
87
 
70
- def get_photos(accessToken, albumId, raw = false)
71
- return get_photos!(accessToken, albumId, raw)
72
- rescue LoginRadiusRaas::Exception => e
88
+
89
+ def getAudios(accessToken, raw = false)
90
+ return getRequest("api/v2/audio" + get_row_data(raw), {:access_token=>accessToken},"api");
91
+ rescue LoginRadiusRaas::Exception => e
73
92
  return false
74
- end
75
-
76
- #
93
+ end
94
+
95
+
96
+ #
77
97
  # LoginRadius function - To fetch check-ins data from the user's social account. The data will be normalized into LoginRadius' data format.
78
98
  #
79
99
  # @param string accessToken LoginRadius access token
@@ -82,190 +102,206 @@ module LoginRadiusRaas
82
102
  # @return object User's check-ins.
83
103
  #
84
104
  #
85
- def get_checkins!(accessToken, raw)
86
- return api_client("api/v2/checkin" + get_row_data(raw), {:access_token=>accessToken});
87
- end
88
105
 
89
- def get_checkins(accessToken, raw = false)
90
- return get_checkins!(accessToken, raw)
91
- rescue LoginRadiusRaas::Exception => e
106
+
107
+ def getCheckins(accessToken, raw = false)
108
+ return getRequest("api/v2/checkin" + get_row_data(raw), {:access_token=>accessToken},"api");
109
+ rescue LoginRadiusRaas::Exception => e
92
110
  return false
93
- end
94
-
111
+ end
112
+
113
+
114
+ #
115
+ # LoginRadius function - To get the followed company's data in the user's social account. The data will be normalized into LoginRadius' data format.
95
116
  #
96
- # LoginRadius function - To fetch user's audio files data from the user's social account. The data will be normalized into LoginRadius' data format.
117
+ # @param string $accessToken LoginRadius access token
118
+ # @param boolean $raw If true, raw data is fetched
97
119
  #
98
- # @param string accessToken LoginRadius access token
99
- # @param boolean raw If true, raw data is fetched
120
+ # @return object Companies followed by user.
100
121
  #
101
- # @return object User's audio files data.
122
+
123
+ def getCompanies(accessToken, raw = false)
124
+ return getRequest("api/v2/company" + get_row_data(raw), {:access_token=>accessToken},"api");
125
+ rescue LoginRadiusRaas::Exception => e
126
+ return false
127
+ end
128
+
129
+
130
+ #
131
+ # LoginRadius function - To fetch user's contacts/friends/connections data from the user's social account. The data will normalized into LoginRadius' data format.
102
132
  #
133
+ # @param string $accessToken LoginRadius access token
134
+ # @param integer $nextCursor Offset to start fetching contacts from
135
+ # @param boolean $raw If true, raw data is fetched
103
136
  #
104
- def get_audio!(accessToken, raw)
105
- return api_client("api/v2/audio" + get_row_data(raw), {:access_token=>accessToken});
106
- end
137
+ # @return object User's contacts/friends/followers.
138
+ #
139
+ #
140
+
107
141
 
108
- def get_audio(accessToken, raw = false)
109
- return get_audio!(accessToken, raw)
110
- rescue LoginRadiusRaas::Exception => e
142
+ def getContacts(accessToken, nextCursor = '0', raw = false)
143
+ return getRequest("api/v2/contact" + get_row_data(raw), {:access_token=>accessToken,:nextcursor=>nextCursor},"api");
144
+ rescue LoginRadiusRaas::Exception => e
111
145
  return false
112
146
  end
113
147
 
114
- #
115
- # LoginRadius function - Post messages to the user's contacts. After using the Contact API, you can send messages to the retrieved contacts.
148
+ #
149
+ # LoginRadius function - To get the event data from the user's social account. The data will be normalized into LoginRadius' data format.
116
150
  #
117
151
  # @param string $accessToken LoginRadius access token
118
- # @param string $to Social ID of the receiver
119
- # @param string $subject Subject of the message
120
- # @param string $message Message
121
- #
122
- # @return bool True on success, false otherwise
152
+ # @param boolean $raw If true, raw data is fetched
123
153
  #
154
+ # @return object User's event data.
124
155
  #
125
- def send_message!(accessToken, to, subject, message)
126
- param = {
127
- :access_token => accessToken,
128
- :to => to,
129
- :subject => subject,
130
- :message => message
131
- }
132
- return api_client("api/v2/message", param,{});
133
- end
156
+
134
157
 
135
- def send_message(accessToken, to, subject, message)
136
- return send_message!(accessToken, to, subject, message)
137
- rescue LoginRadiusRaas::Exception => e
158
+ def getEvents(accessToken, raw = false)
159
+ return getRequest("api/v2/event" + get_row_data(raw), {:access_token=>accessToken},"api");
160
+ rescue LoginRadiusRaas::Exception => e
138
161
  return false
139
- end
162
+ end
140
163
 
141
- #
142
- # LoginRadius function - To fetch user's contacts/friends/connections data from the user's social account. The data will normalized into LoginRadius' data format.
164
+
165
+ #
166
+ # LoginRadius function - To fetch information of the people, user is following on Twitter.
143
167
  #
144
168
  # @param string $accessToken LoginRadius access token
145
- # @param integer $nextCursor Offset to start fetching contacts from
146
169
  # @param boolean $raw If true, raw data is fetched
147
170
  #
148
- # @return object User's contacts/friends/followers.
149
- #
171
+ # @return object Information of the people, user is following.
150
172
  #
151
- def get_contacts!(accessToken, nextCursor, raw)
152
- return api_client("api/v2/contact" + get_row_data(raw), {:access_token=>accessToken,:nextcursor=>nextCursor});
153
- end
154
173
 
155
- def get_contacts(accessToken, nextCursor = '0', raw = false)
156
- return get_contacts!(accessToken, nextCursor, raw)
157
- rescue LoginRadiusRaas::Exception => e
174
+ def getFollowing(accessToken, raw = false)
175
+ return getRequest("api/v2/following" + get_row_data(raw), {:access_token=>accessToken},"api");
176
+ rescue LoginRadiusRaas::Exception => e
158
177
  return false
159
178
  end
160
179
 
161
- #
162
- # LoginRadius function - To get mention data from the user's social account. The data will be normalized into LoginRadius' data format.
180
+ #
181
+ # LoginRadius function - To get group data from the user's social account. The data will be normalized into LoginRadius' data format.
163
182
  #
164
183
  # @param string $accessToken LoginRadius access token
165
184
  # @param boolean $raw If true, raw data is fetched
166
185
  #
167
- # @return object User's twitter mentions.
186
+ # @return object Group data.
168
187
  #
169
- def get_mentions!(accessToken, raw)
170
- return api_client("api/v2/mention" + get_row_data(raw), {:access_token=>accessToken});
171
- end
172
188
 
173
- def get_mentions(accessToken, raw = false)
174
- return get_mentions!(accessToken, raw)
175
- rescue LoginRadiusRaas::Exception => e
189
+ def getGroups(accessToken, raw = false)
190
+ return getRequest("api/v2/group" + get_row_data(raw), {:access_token=>accessToken},"api");
191
+ rescue LoginRadiusRaas::Exception => e
176
192
  return false
177
193
  end
178
194
 
195
+ #
196
+ # LoginRadius function - To get likes data from the user's social account. The data will be normalized into LoginRadius' data format.
179
197
  #
180
- # LoginRadius function - To fetch information of the people, user is following on Twitter.
198
+ # @param string $accessToken LoginRadius access token
199
+ # @param boolean $raw If true, raw data is fetched
200
+ #
201
+ # @return object likes data.
202
+ #
203
+
204
+ def getLikes(accessToken, raw = false)
205
+ return getRequest("api/v2/like" + get_row_data(raw), {:access_token=>accessToken},"api");
206
+ rescue LoginRadiusRaas::Exception => e
207
+ return false
208
+ end
209
+
210
+
211
+ #
212
+ # LoginRadius function - To get mention data from the user's social account. The data will be normalized into LoginRadius' data format.
181
213
  #
182
214
  # @param string $accessToken LoginRadius access token
183
215
  # @param boolean $raw If true, raw data is fetched
184
216
  #
185
- # @return object Information of the people, user is following.
217
+ # @return object User's twitter mentions.
186
218
  #
187
- def get_following!(accessToken, raw)
188
- return api_client("api/v2/following" + get_row_data(raw), {:access_token=>accessToken});
189
- end
190
219
 
191
- def get_following(accessToken, raw = false)
192
- return get_following!(accessToken, raw)
193
- rescue LoginRadiusRaas::Exception => e
220
+
221
+ def getMentions(accessToken, raw = false)
222
+ return getRequest("api/v2/mention" + get_row_data(raw), {:access_token=>accessToken},"api");
223
+ rescue LoginRadiusRaas::Exception => e
194
224
  return false
195
225
  end
196
226
 
197
- #
198
- # LoginRadius function - To get the event data from the user's social account. The data will be normalized into LoginRadius' data format.
227
+
228
+ #
229
+ # LoginRadius function - Post messages to the user's contacts. After using the Contact API, you can send messages to the retrieved contacts.
199
230
  #
200
231
  # @param string $accessToken LoginRadius access token
201
- # @param boolean $raw If true, raw data is fetched
232
+ # @param string $to Social ID of the receiver
233
+ # @param string $subject Subject of the message
234
+ # @param string $message Message
202
235
  #
203
- # @return object User's event data.
236
+ # @return bool True on success, false otherwise
204
237
  #
205
- def get_events!(accessToken, raw)
206
- return api_client("api/v2/event" + get_row_data(raw), {:access_token=>accessToken});
207
- end
208
238
 
209
- def get_events(accessToken, raw = false)
210
- return get_events!(accessToken, raw)
211
- rescue LoginRadiusRaas::Exception => e
239
+
240
+ def postMessage(accessToken, to, subject, message)
241
+ param = {
242
+ :access_token => accessToken,
243
+ :to => to,
244
+ :subject => subject,
245
+ :message => message
246
+ }
247
+ return postRequest("api/v2/message", param,{},nil,"api");
248
+ rescue LoginRadiusRaas::Exception => e
212
249
  return false
213
250
  end
214
251
 
215
- #
216
- # LoginRadius function - To get posted messages from the user's social account. The data will be normalized into LoginRadius' data format.
252
+
253
+ #
254
+ # LoginRadius function - To get the page data from the user's social account. The data will be normalized into LoginRadius' data format.
217
255
  #
218
256
  # @param string $accessToken LoginRadius access token
257
+ # @param string $pageName Page name
219
258
  # @param boolean $raw If true, raw data is fetched
220
259
  #
221
- # @return object User's posted messages.
260
+ # @return object Page data.
222
261
  #
223
- def get_posts!(accessToken, raw)
224
- return api_client("api/v2/post" + get_row_data(raw), {:access_token=>accessToken});
225
- end
226
-
227
- def get_posts(accessToken, raw = false)
228
- return get_posts!(accessToken, raw)
229
- rescue LoginRadiusRaas::Exception => e
262
+
263
+ def getPages(accessToken, pageName)
264
+ return getRequest("api/v2/page", {:access_token=>accessToken,:pagename=>pageName},"api");
265
+ rescue LoginRadiusRaas::Exception => e
230
266
  return false
231
267
  end
232
268
 
269
+
233
270
  #
234
- # LoginRadius function - To get the followed company's data in the user's social account. The data will be normalized into LoginRadius' data format.
271
+ # LoginRadius function - To fetch photo data from the user's social account. The data will be normalized into LoginRadius' data format.
235
272
  #
236
- # @param string $accessToken LoginRadius access token
237
- # @param boolean $raw If true, raw data is fetched
273
+ # @param string accessToken LoginRadius access token
274
+ # @param string albumId ID of the album to fetch photos from
275
+ # @param boolean raw If true, raw data is fetched
238
276
  #
239
- # @return object Companies followed by user.
277
+ # @return object User's photo data.
240
278
  #
241
- def get_followed_companies!(accessToken, raw)
242
- return api_client("api/v2/company" + get_row_data(raw), {:access_token=>accessToken});
243
- end
279
+
244
280
 
245
- def get_followed_companies(accessToken, raw = false)
246
- return get_followed_companies!(accessToken, raw)
247
- rescue LoginRadiusRaas::Exception => e
281
+ def getPhotos(accessToken, albumId)
282
+ return getRequest("api/v2/photo", {:access_token=>accessToken,:albumid=>albumId},"api");
283
+ rescue LoginRadiusRaas::Exception => e
248
284
  return false
249
285
  end
250
286
 
287
+
251
288
  #
252
- # LoginRadius function - To get group data from the user's social account. The data will be normalized into LoginRadius' data format.
289
+ # LoginRadius function - To get posted messages from the user's social account. The data will be normalized into LoginRadius' data format.
253
290
  #
254
291
  # @param string $accessToken LoginRadius access token
255
292
  # @param boolean $raw If true, raw data is fetched
256
293
  #
257
- # @return object Group data.
294
+ # @return object User's posted messages.
258
295
  #
259
- def get_groups!(accessToken, raw)
260
- return api_client("api/v2/group" + get_row_data(raw), {:access_token=>accessToken});
261
- end
262
296
 
263
- def get_groups(accessToken, raw = false)
264
- return get_groups!(accessToken, raw)
265
- rescue LoginRadiusRaas::Exception => e
297
+
298
+ def getPosts(accessToken, raw = false)
299
+ return getRequest("api/v2/post" + get_row_data(raw), {:access_token=>accessToken},"api");
300
+ rescue LoginRadiusRaas::Exception => e
266
301
  return false
267
302
  end
268
303
 
304
+
269
305
  #
270
306
  # LoginRadius function - To get the status messages from the user's social account. The data will be normalized into LoginRadius' data format.
271
307
  #
@@ -274,16 +310,15 @@ module LoginRadiusRaas
274
310
  #
275
311
  # @return object Status messages.
276
312
  #
277
- def get_status!(accessToken, raw)
278
- return api_client("api/v2/status" + get_row_data(raw), {:access_token=>accessToken});
279
- end
280
313
 
281
- def get_status(accessToken, raw = false)
282
- return get_status!(accessToken, raw)
283
- rescue LoginRadiusRaas::Exception => e
314
+
315
+ def getStatus(accessToken, raw = false)
316
+ return getRequest("api/v2/status" + get_row_data(raw), {:access_token=>accessToken},"api");
317
+ rescue LoginRadiusRaas::Exception => e
284
318
  return false
285
319
  end
286
320
 
321
+
287
322
  #
288
323
  # LoginRadius function - To update the status on the user's wall.
289
324
  #
@@ -297,7 +332,9 @@ module LoginRadiusRaas
297
332
  #
298
333
  # @return boolean Returns true if successful, false otherwise.
299
334
  #
300
- def post_status!(accessToken, title, url, imageurl, status, caption, description)
335
+
336
+
337
+ def postStatus(accessToken, title, url, imageurl, status, caption, description)
301
338
  param = {
302
339
  :access_token => accessToken,
303
340
  :title => title,
@@ -307,69 +344,45 @@ module LoginRadiusRaas
307
344
  :caption => caption,
308
345
  :description => description
309
346
  }
310
- return api_client("api/v2/status", param, {});
311
- end
312
-
313
- def post_status(accessToken, title, url, imageurl, status, caption, description)
314
- return post_status!(accessToken, title, url, imageurl, status, caption, description)
315
- rescue LoginRadiusRaas::Exception => e
347
+ return postRequest("api/v2/status", param, {},nil,"api");
348
+ rescue LoginRadiusRaas::Exception => e
316
349
  return false
317
350
  end
318
351
 
352
+ #
353
+ # LoginRadius function - To fetch 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.
319
354
  #
320
- # LoginRadius function - To get videos data from the user's social account. The data will be normalized into LoginRadius' data format.
321
- #
322
- # @param string $accessToken LoginRadius access token
323
- # @param boolean $raw If true, raw data is fetched
355
+ # @param string accessToken LoginRadius access token
356
+ # @param boolean raw If true, raw data is fetched
324
357
  #
325
- # @return object Videos data.
358
+ # @return object User profile data.
326
359
  #
327
- def get_videos!(accessToken, raw)
328
- return api_client("api/v2/video" + get_row_data(raw), {:access_token=>accessToken});
329
- end
330
360
 
331
- def get_videos(accessToken, raw = false)
332
- return get_videos!(accessToken, raw)
333
- rescue LoginRadiusRaas::Exception => e
361
+ def getUserProfile(accessToken, raw = false)
362
+ return getRequest("api/v2/userprofile" + get_row_data(raw), {:access_token=>accessToken},"api");
363
+ rescue LoginRadiusRaas::Exception => e
334
364
  return false
335
365
  end
336
366
 
367
+
337
368
  #
338
- # LoginRadius function - To get likes data from the user's social account. The data will be normalized into LoginRadius' data format.
369
+ # LoginRadius function - To get videos data from the user's social account. The data will be normalized into LoginRadius' data format.
339
370
  #
340
371
  # @param string $accessToken LoginRadius access token
341
372
  # @param boolean $raw If true, raw data is fetched
342
373
  #
343
- # @return object likes data.
374
+ # @return object Videos data.
344
375
  #
345
- def get_likes!(accessToken, raw)
346
- return api_client("api/v2/like" + get_row_data(raw), {:access_token=>accessToken});
347
- end
348
-
349
- def get_likes(accessToken, raw = false)
350
- return get_likes!(accessToken, raw)
351
- rescue LoginRadiusRaas::Exception => e
376
+
377
+ def getVideos(accessToken, raw = false)
378
+ return getRequest("api/v2/video" + get_row_data(raw), {:access_token=>accessToken},"api");
379
+ rescue LoginRadiusRaas::Exception => e
352
380
  return false
353
381
  end
354
382
 
355
- #
356
- # LoginRadius function - To get the page data from the user's social account. The data will be normalized into LoginRadius' data format.
357
- #
358
- # @param string $accessToken LoginRadius access token
359
- # @param string $pageName Page name
360
- # @param boolean $raw If true, raw data is fetched
361
- #
362
- # @return object Page data.
363
- #
364
- def get_pages!(accessToken, pageName, raw)
365
- return api_client("api/v2/page" + get_row_data(raw), {:access_token=>accessToken,:pagename=>pageName});
366
- end
383
+
367
384
 
368
- def get_pages(accessToken, pageName, raw = false)
369
- return get_pages!(accessToken, pageName, raw)
370
- rescue LoginRadiusRaas::Exception => e
371
- return false
372
- end
385
+
373
386
 
374
387
  #
375
388
  # LoginRadius function - To fetch data from the LoginRadius Raw API URL.