mangoapps-ex-sdk-ruby 0.15.2 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +33 -232
- data/lib/mangoapps/config.rb +2 -3
- data/lib/mangoapps/modules/attachments/get_folder_files.rb +2 -3
- data/lib/mangoapps/modules/attachments/get_folders.rb +1 -2
- data/lib/mangoapps/modules/feeds/feeds.rb +2 -3
- data/lib/mangoapps/modules/learn/course_catalog.rb +1 -2
- data/lib/mangoapps/modules/learn/course_categories.rb +1 -2
- data/lib/mangoapps/modules/libraries/get_libraries.rb +2 -3
- data/lib/mangoapps/modules/libraries/get_library_categories.rb +2 -3
- data/lib/mangoapps/modules/libraries/get_library_items.rb +2 -3
- data/lib/mangoapps/modules/notifications/notifications.rb +2 -3
- data/lib/mangoapps/modules/posts/get_all_posts.rb +2 -3
- data/lib/mangoapps/modules/recognitions/award_categories.rb +1 -2
- data/lib/mangoapps/modules/recognitions/get_awards_list.rb +2 -3
- data/lib/mangoapps/modules/recognitions.rb +0 -6
- data/lib/mangoapps/modules/tasks/get_tasks.rb +1 -2
- data/lib/mangoapps/modules/trackers/get_trackers.rb +1 -2
- data/lib/mangoapps/modules/wikis/get_wikis.rb +2 -3
- data/lib/mangoapps/version.rb +1 -1
- metadata +1 -4
- data/lib/mangoapps/modules/recognitions/get_award_feeds.rb +0 -14
- data/lib/mangoapps/modules/recognitions/get_team_awards.rb +0 -13
- data/lib/mangoapps/modules/recognitions/gift_cards.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11ec5f600950bbb7e3c35ac5ef1599ee71c378d9457b5ff9938857e67507309f
|
4
|
+
data.tar.gz: e31fd5d4b7bfb516a6db7bdb9dbcc58426781134996a6a2db81f7f8bba6eb432
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a23c6ceb964c0cc6cebf86b08798bd6b78b99761295ce44ccff298e0124b0e3cd122c021676df2913d47ea053a4417c48080ac79704047dd3b6e0200e62210a
|
7
|
+
data.tar.gz: 66a89777b6a5d803dd5628de4491946283a80a7251096c10e93f829398a9c2fd839a3d360de28ba558f97807f443a1962d4212125945744e10be1c84e586d6c8
|
data/README.md
CHANGED
@@ -61,9 +61,8 @@ MANGOAPPS_SCOPE=openid profile email
|
|
61
61
|
|
62
62
|
# Internal API Authentication (Option 2 - Alternative to OAuth)
|
63
63
|
# Contact MangoApps support team to get your Internal API Key and Secret
|
64
|
-
MANGOAPPS_INTERNAL_API_KEY=
|
65
|
-
MANGOAPPS_INTERNAL_API_SECRET=
|
66
|
-
MANGOAPPS_TEST_HEADER=test1111
|
64
|
+
MANGOAPPS_INTERNAL_API_KEY=your_internal_api_key
|
65
|
+
MANGOAPPS_INTERNAL_API_SECRET=your_internal_api_secret
|
67
66
|
```
|
68
67
|
|
69
68
|
**Note**: The `.env` file is only used for testing. In production, you should handle token storage and management according to your application's security requirements.
|
@@ -102,9 +101,8 @@ client = MangoApps::Client.new(config)
|
|
102
101
|
# Note: Contact MangoApps support team to get your Internal API Key and Secret
|
103
102
|
config = MangoApps::Config.new(
|
104
103
|
domain: "yourdomain.mangoapps.com",
|
105
|
-
internal_api_key: "
|
106
|
-
internal_api_secret: "
|
107
|
-
test_header: "test1111" # Optional
|
104
|
+
internal_api_key: "your_internal_api_key",
|
105
|
+
internal_api_secret: "your_internal_api_secret"
|
108
106
|
)
|
109
107
|
client = MangoApps::Client.new(config)
|
110
108
|
```
|
@@ -149,11 +147,11 @@ courses = client.course_catalog
|
|
149
147
|
puts "Available courses: #{courses.courses.length}"
|
150
148
|
|
151
149
|
# Get activity feeds
|
152
|
-
feeds = client.feeds
|
150
|
+
feeds = client.feeds(offset: 0, limit: 20, all_comments: 'Y')
|
153
151
|
puts "Activity feeds: #{feeds.feeds.length} (unread: #{feeds.unread_counts.unread_feeds_count})"
|
154
152
|
|
155
153
|
# Get all posts
|
156
|
-
posts = client.get_all_posts(filter_by: "all")
|
154
|
+
posts = client.get_all_posts(filter_by: "all", offset: 0, limit: 20)
|
157
155
|
puts "All posts: #{posts.feeds.length}"
|
158
156
|
|
159
157
|
# Get post details by ID
|
@@ -164,32 +162,32 @@ if posts.feeds.any?
|
|
164
162
|
end
|
165
163
|
|
166
164
|
# Get user libraries
|
167
|
-
libraries = client.get_libraries
|
165
|
+
libraries = client.get_libraries(offset: 0, limit: 20)
|
168
166
|
puts "User libraries: #{libraries.libraries.length}"
|
169
167
|
|
170
168
|
# Get library categories by ID
|
171
169
|
if libraries.libraries.any?
|
172
170
|
library_id = libraries.libraries.first.id
|
173
|
-
library_details = client.get_library_categories(library_id)
|
171
|
+
library_details = client.get_library_categories(library_id, offset: 0, limit: 20)
|
174
172
|
puts "Library details: #{library_details.library.name}"
|
175
173
|
|
176
174
|
# Get library items from first category
|
177
175
|
if library_details.library.categories.any?
|
178
176
|
category_id = library_details.library.categories.first.id
|
179
|
-
library_items = client.get_library_items(library_id, category_id)
|
177
|
+
library_items = client.get_library_items(library_id, category_id, offset: 0, limit: 20)
|
180
178
|
puts "Library items: #{library_items.library_items.length} items in #{library_items.category_name}"
|
181
179
|
end
|
182
180
|
end
|
183
181
|
|
184
182
|
# Get user trackers
|
185
|
-
trackers = client.get_trackers
|
183
|
+
trackers = client.get_trackers(page: 1, limit: 20)
|
186
184
|
puts "User trackers: #{trackers.trackers.length}"
|
187
185
|
|
188
|
-
# Get user folders
|
186
|
+
# Get user folders (no pagination)
|
189
187
|
folders = client.get_folders
|
190
188
|
puts "User folders: #{folders.folders.length}"
|
191
189
|
|
192
|
-
# Get files from first folder with content
|
190
|
+
# Get files from first folder with content (no pagination)
|
193
191
|
if folders.folders.any?
|
194
192
|
folder_with_content = folders.folders.find { |f| f.child_count.to_i > 0 }
|
195
193
|
if folder_with_content
|
@@ -211,7 +209,7 @@ if tasks.tasks.task.any?
|
|
211
209
|
end
|
212
210
|
|
213
211
|
# Get user wikis
|
214
|
-
wikis = client.get_wikis(mode: "my",
|
212
|
+
wikis = client.get_wikis(mode: "my", offset: 0, limit: 5)
|
215
213
|
puts "User wikis: #{wikis.wikis.length}"
|
216
214
|
|
217
215
|
# Get detailed information for the first wiki
|
@@ -309,29 +307,35 @@ client = MangoApps::Client.new(config)
|
|
309
307
|
|
310
308
|
### 5. Pagination Support
|
311
309
|
|
312
|
-
|
310
|
+
Most list APIs support optional pagination parameters for efficient data retrieval:
|
313
311
|
|
314
312
|
```ruby
|
315
313
|
# Basic usage with default pagination
|
316
314
|
posts = client.get_all_posts
|
317
315
|
courses = client.course_catalog
|
318
316
|
|
319
|
-
# Pagination with custom
|
320
|
-
posts = client.get_all_posts(
|
317
|
+
# Pagination with custom offset and limit (offset-based)
|
318
|
+
posts = client.get_all_posts(filter_by: "all", offset: 20, limit: 10)
|
321
319
|
courses = client.course_catalog(page: 1, limit: 5)
|
322
320
|
|
323
|
-
#
|
324
|
-
posts = client.get_all_posts(filter_by: "all", page: 1, limit: 20)
|
321
|
+
# Pagination with custom page and limit (page-based)
|
325
322
|
tasks = client.get_tasks(filter: "Pending_Tasks", page: 1, limit: 10)
|
323
|
+
trackers = client.get_trackers(page: 1, limit: 15)
|
326
324
|
|
327
|
-
# Library items with pagination
|
328
|
-
items = client.get_library_items(library_id, category_id,
|
325
|
+
# Library items with offset-based pagination
|
326
|
+
items = client.get_library_items(library_id, category_id, offset: 0, limit: 15)
|
329
327
|
```
|
330
328
|
|
329
|
+
**Pagination Types:**
|
330
|
+
- **Offset-based APIs**: `get_all_posts`, `get_libraries`, `get_library_categories`, `get_library_items`, `notifications`, `get_wikis`, `feeds`
|
331
|
+
- **Page-based APIs**: `course_catalog`, `get_tasks`, `get_trackers`
|
332
|
+
- **Non-paginated APIs**: `course_categories`, `award_categories`, `get_awards_list`, `get_folders`, `get_folder_files`
|
333
|
+
|
331
334
|
**Default Pagination Values:**
|
332
|
-
-
|
335
|
+
- Offset-based: `offset: 0, limit: 20`
|
336
|
+
- Page-based: `page: 1, limit: 20`
|
333
337
|
- Tasks: `page: 1, limit: 5` (smaller default for task management)
|
334
|
-
- Posts: `
|
338
|
+
- Posts: `offset: 0, limit: 20` with `filter_by: "all"`
|
335
339
|
|
336
340
|
### 6. Internal API Authentication (Alternative to OAuth)
|
337
341
|
|
@@ -343,8 +347,8 @@ For applications that need direct API access without OAuth flow, you can use int
|
|
343
347
|
# Configure with internal API credentials
|
344
348
|
config = MangoApps::Config.new(
|
345
349
|
domain: "yourdomain.mangoapps.com",
|
346
|
-
internal_api_key: "
|
347
|
-
internal_api_secret: "
|
350
|
+
internal_api_key: "your_internal_api_key",
|
351
|
+
internal_api_secret: "your_internal_api_secret",
|
348
352
|
)
|
349
353
|
client = MangoApps::Client.new(config)
|
350
354
|
|
@@ -369,7 +373,6 @@ The SDK automatically adds the required headers for internal API authentication:
|
|
369
373
|
# These headers are automatically added to all requests:
|
370
374
|
# - Internal-Api-Key: your_api_key
|
371
375
|
# - Internal-Api-Secret: your_api_secret
|
372
|
-
# - Test: your_test_header (if provided)
|
373
376
|
```
|
374
377
|
|
375
378
|
#### When to Use Internal API vs OAuth
|
@@ -428,16 +431,13 @@ end
|
|
428
431
|
|
429
432
|
#### Course Categories
|
430
433
|
```ruby
|
431
|
-
# Get all course categories
|
434
|
+
# Get all course categories (no pagination)
|
432
435
|
categories = client.course_categories
|
433
436
|
|
434
437
|
# Access category data with clean dot notation
|
435
438
|
categories.all_categories.each do |category|
|
436
439
|
puts "#{category.name} - Position: #{category.position}"
|
437
440
|
end
|
438
|
-
|
439
|
-
# Get specific category details
|
440
|
-
category = client.course_category(category_id)
|
441
441
|
```
|
442
442
|
|
443
443
|
#### Course Details
|
@@ -536,26 +536,7 @@ else
|
|
536
536
|
end
|
537
537
|
```
|
538
538
|
|
539
|
-
#### Tango Gift Cards
|
540
|
-
```ruby
|
541
|
-
# Get tango gift cards information
|
542
|
-
gift_cards = client.tango_gift_cards
|
543
539
|
|
544
|
-
# Access gift card data with clean dot notation
|
545
|
-
puts "Available points: #{gift_cards.tango_cards.available_points}"
|
546
|
-
puts "Terms: #{gift_cards.tango_cards.terms}"
|
547
|
-
```
|
548
|
-
|
549
|
-
#### Gift Cards
|
550
|
-
```ruby
|
551
|
-
# Get gift cards information
|
552
|
-
gift_cards = client.gift_cards
|
553
|
-
|
554
|
-
# Access gift card data with clean dot notation
|
555
|
-
gift_cards.cards.each do |card|
|
556
|
-
puts "#{card.brand_name} (Key: #{card.brand_key}) - Enabled: #{card.enabled}"
|
557
|
-
end
|
558
|
-
```
|
559
540
|
|
560
541
|
#### Get Awards List
|
561
542
|
```ruby
|
@@ -590,24 +571,6 @@ response.feeds.each do |feed|
|
|
590
571
|
end
|
591
572
|
```
|
592
573
|
|
593
|
-
#### Get Team Awards
|
594
|
-
```ruby
|
595
|
-
# Get team awards for a specific project/team
|
596
|
-
response = client.get_team_awards(project_id: 117747)
|
597
|
-
|
598
|
-
# Access team core value tags with counts
|
599
|
-
response.core_value_tags.each do |tag|
|
600
|
-
puts "#{tag.name} (ID: #{tag.id}) - Count: #{tag.count}"
|
601
|
-
end
|
602
|
-
|
603
|
-
# Access team award feeds
|
604
|
-
response.feeds.each do |feed|
|
605
|
-
puts "#{feed.feed_property.title} - Points: #{feed.recognition_points}"
|
606
|
-
puts "From: #{feed.from_user.name}"
|
607
|
-
puts "Team: #{feed.group_name} (ID: #{feed.group_id})"
|
608
|
-
puts "Body: #{feed.body}"
|
609
|
-
end
|
610
|
-
```
|
611
574
|
|
612
575
|
#### My Priority Items
|
613
576
|
```ruby
|
@@ -1170,109 +1133,6 @@ if wiki_details.wiki.hashtags
|
|
1170
1133
|
end
|
1171
1134
|
```
|
1172
1135
|
|
1173
|
-
#### Award Feeds Management
|
1174
|
-
```ruby
|
1175
|
-
# Get award feeds with comprehensive recognition data
|
1176
|
-
award_feeds = client.get_award_feeds
|
1177
|
-
|
1178
|
-
# Access award feeds data
|
1179
|
-
puts "🏆 Award Feeds:"
|
1180
|
-
puts " Transaction ID: #{award_feeds.transaction_id || 'None'}"
|
1181
|
-
puts " Limit: #{award_feeds.limit || 'None'}"
|
1182
|
-
puts " Current priority: #{award_feeds.current_priority || 'None'}"
|
1183
|
-
puts " Enable mobile pin: #{award_feeds.enable_mobile_pin}"
|
1184
|
-
puts " MangoApps version: #{award_feeds.mangoapps_version}"
|
1185
|
-
puts " Comments order: #{award_feeds.comments_order}"
|
1186
|
-
puts " Private message reply order: #{award_feeds.private_message_reply_order || 'None'}"
|
1187
|
-
puts " Photo shape: #{award_feeds.photo_shape || 'None'}"
|
1188
|
-
puts " Moderation feed IDs: #{award_feeds.moderation_feed_ids || 'None'}"
|
1189
|
-
puts " Moderation HTML: #{award_feeds.moderation_html || 'None'}"
|
1190
|
-
puts ""
|
1191
|
-
|
1192
|
-
# Show unread counts
|
1193
|
-
if award_feeds.unread_counts
|
1194
|
-
unread_counts = award_feeds.unread_counts
|
1195
|
-
puts "📊 Unread Counts:"
|
1196
|
-
puts " Direct messages: #{unread_counts.direct_messages_count}"
|
1197
|
-
puts " What's new: #{unread_counts.whats_new_count}"
|
1198
|
-
puts " Unread feeds: #{unread_counts.unread_feeds_count}"
|
1199
|
-
puts " Mentions: #{unread_counts.mention_count}"
|
1200
|
-
puts " Primary unread: #{unread_counts.primary_unread_count}"
|
1201
|
-
puts " Secondary unread: #{unread_counts.secondary_unread_count}"
|
1202
|
-
puts " Unread notifications: #{unread_counts.unread_notification_count}"
|
1203
|
-
puts ""
|
1204
|
-
end
|
1205
|
-
|
1206
|
-
# Display award feeds
|
1207
|
-
puts "🏆 Award Feed List:"
|
1208
|
-
award_feeds.feeds.each do |feed|
|
1209
|
-
puts " • Feed ID: #{feed.id} | Type: #{feed.feed_type}"
|
1210
|
-
puts " Category: #{feed.category} | Sub-category: #{feed.sub_category}"
|
1211
|
-
puts " Recognition points: #{feed.recognition_points}"
|
1212
|
-
puts " From: #{feed.from_user.name if feed.from_user} | To: #{feed.to_users.length if feed.to_users} users"
|
1213
|
-
puts " Reactions: Like: #{feed.like_count}, Superlike: #{feed.superlike_count}"
|
1214
|
-
puts " Comments: #{feed.comment_count} | Attachments: #{feed.attachment_count}"
|
1215
|
-
puts " Created: #{Time.at(feed.created_at.to_i).strftime('%Y-%m-%d %H:%M:%S')}"
|
1216
|
-
puts " Updated: #{Time.at(feed.updated_at.to_i).strftime('%Y-%m-%d %H:%M:%S')}"
|
1217
|
-
|
1218
|
-
# Show award details
|
1219
|
-
if feed.feed_property
|
1220
|
-
puts " Award: #{feed.feed_property.title}"
|
1221
|
-
puts " Labels: #{feed.feed_property.label_1}, #{feed.feed_property.label_2}"
|
1222
|
-
puts " Image URL: #{feed.feed_property.image_url[0..50]}..." if feed.feed_property.image_url
|
1223
|
-
puts " Status: #{feed.feed_property.status} | Result format: #{feed.feed_property.result_format}"
|
1224
|
-
end
|
1225
|
-
|
1226
|
-
# Show from user
|
1227
|
-
if feed.from_user
|
1228
|
-
puts " From user: #{feed.from_user.name} (ID: #{feed.from_user.id})"
|
1229
|
-
puts " Email: #{feed.from_user.email}"
|
1230
|
-
puts " Photo: #{feed.from_user.photo[0..50]}..." if feed.from_user.photo
|
1231
|
-
end
|
1232
|
-
|
1233
|
-
# Show to users
|
1234
|
-
if feed.to_users
|
1235
|
-
puts " To users: #{feed.to_users.length} users"
|
1236
|
-
feed.to_users.each do |user|
|
1237
|
-
puts " - #{user.name} (ID: #{user.id})"
|
1238
|
-
end
|
1239
|
-
end
|
1240
|
-
|
1241
|
-
# Show feed story users
|
1242
|
-
if feed.feed_story_users
|
1243
|
-
puts " Story users: #{feed.feed_story_users.length} users"
|
1244
|
-
feed.feed_story_users.each do |user|
|
1245
|
-
puts " - #{user.name} (ID: #{user.id})"
|
1246
|
-
end
|
1247
|
-
end
|
1248
|
-
|
1249
|
-
# Show core value tags
|
1250
|
-
if feed.core_value_tags
|
1251
|
-
puts " Core value tags: #{feed.core_value_tags.length} tags"
|
1252
|
-
feed.core_value_tags.each do |tag|
|
1253
|
-
puts " - #{tag.name} (ID: #{tag.id}, Color: #{tag.color})"
|
1254
|
-
end
|
1255
|
-
end
|
1256
|
-
|
1257
|
-
# Show reaction data
|
1258
|
-
if feed.reaction_data
|
1259
|
-
puts " Reaction data: #{feed.reaction_data.length} reaction types"
|
1260
|
-
feed.reaction_data.each do |reaction|
|
1261
|
-
puts " - #{reaction.label}: #{reaction.count} (Reacted: #{reaction.reacted})"
|
1262
|
-
end
|
1263
|
-
end
|
1264
|
-
|
1265
|
-
# Show comments
|
1266
|
-
if feed.comments
|
1267
|
-
puts " Comments: #{feed.comments.length} comments"
|
1268
|
-
feed.comments.first(3).each do |comment|
|
1269
|
-
puts " - #{comment.body[0..50]}... by #{comment.user.name if comment.user}"
|
1270
|
-
end
|
1271
|
-
end
|
1272
|
-
|
1273
|
-
puts ""
|
1274
|
-
end
|
1275
|
-
```
|
1276
1136
|
|
1277
1137
|
## Available Modules
|
1278
1138
|
|
@@ -1291,11 +1151,8 @@ end
|
|
1291
1151
|
- **Award Categories**: `client.award_categories` - Get recognition award categories
|
1292
1152
|
- **Get Awards List**: `client.get_awards_list(category_id: id)` - Get awards for a specific category
|
1293
1153
|
- **Get Profile Awards**: `client.get_profile_awards` - Get user's personal awards and activity
|
1294
|
-
- **Get Team Awards**: `client.get_team_awards(project_id: id)` - Get team awards and activity
|
1295
|
-
- **Get Award Feeds**: `client.get_award_feeds` - Get award feeds with comprehensive recognition data
|
1296
1154
|
- **Core Value Tags**: `client.core_value_tags` - Get core value tags for recognition
|
1297
1155
|
- **Leaderboard Info**: `client.leaderboard_info` - Get user and team leaderboard information
|
1298
|
-
- **Gift Cards**: `client.gift_cards` - Get available gift cards for recognition rewards
|
1299
1156
|
|
1300
1157
|
#### Notifications Module
|
1301
1158
|
- **My Priority Items**: `client.my_priority_items` - Get user's priority items including requests, events, quizzes, surveys, tasks, and todos
|
@@ -1519,22 +1376,6 @@ profile_awards.feeds.each do |feed|
|
|
1519
1376
|
end
|
1520
1377
|
puts ""
|
1521
1378
|
|
1522
|
-
# Get team awards
|
1523
|
-
team_id = 117747 # All Users team
|
1524
|
-
team_awards = client.get_team_awards(project_id: team_id)
|
1525
|
-
|
1526
|
-
# Display team awards
|
1527
|
-
puts "🏆 Team Awards (Team ID: #{team_id}):"
|
1528
|
-
puts " Team Core Value Tags:"
|
1529
|
-
team_awards.core_value_tags.each do |tag|
|
1530
|
-
puts " • #{tag.name} (ID: #{tag.id}) - Count: #{tag.count}"
|
1531
|
-
end
|
1532
|
-
puts " Team Recent Awards:"
|
1533
|
-
team_awards.feeds.each do |feed|
|
1534
|
-
puts " • #{feed.feed_property.title} - Points: #{feed.recognition_points}"
|
1535
|
-
puts " From: #{feed.from_user.name} | Team: #{feed.group_name}"
|
1536
|
-
end
|
1537
|
-
puts ""
|
1538
1379
|
|
1539
1380
|
# Get user priority items
|
1540
1381
|
priority_items = client.my_priority_items
|
@@ -1779,29 +1620,6 @@ if wikis.wikis.any?
|
|
1779
1620
|
end
|
1780
1621
|
puts ""
|
1781
1622
|
|
1782
|
-
# Get award feeds
|
1783
|
-
award_feeds = client.get_award_feeds
|
1784
|
-
|
1785
|
-
# Display award feeds
|
1786
|
-
puts "🏆 Award Feeds:"
|
1787
|
-
puts " Unread counts:"
|
1788
|
-
if award_feeds.unread_counts
|
1789
|
-
puts " Direct messages: #{award_feeds.unread_counts.direct_messages_count}"
|
1790
|
-
puts " What's new: #{award_feeds.unread_counts.whats_new_count}"
|
1791
|
-
puts " Unread feeds: #{award_feeds.unread_counts.unread_feeds_count}"
|
1792
|
-
puts " Mentions: #{award_feeds.unread_counts.mention_count}"
|
1793
|
-
puts " Primary unread: #{award_feeds.unread_counts.primary_unread_count}"
|
1794
|
-
puts " Secondary unread: #{award_feeds.unread_counts.secondary_unread_count}"
|
1795
|
-
puts " Unread notifications: #{award_feeds.unread_counts.unread_notification_count}"
|
1796
|
-
end
|
1797
|
-
puts " Recent Award Feeds:"
|
1798
|
-
award_feeds.feeds.first(3).each do |feed|
|
1799
|
-
puts " • #{feed.feed_property.title if feed.feed_property} - Points: #{feed.recognition_points}"
|
1800
|
-
puts " From: #{feed.from_user.name if feed.from_user} | To: #{feed.to_users.length if feed.to_users} users"
|
1801
|
-
puts " Reactions: Like: #{feed.like_count}, Superlike: #{feed.superlike_count}"
|
1802
|
-
puts " Comments: #{feed.comment_count} | Created: #{Time.at(feed.created_at.to_i).strftime('%Y-%m-%d')}"
|
1803
|
-
end
|
1804
|
-
puts ""
|
1805
1623
|
|
1806
1624
|
# Get core value tags
|
1807
1625
|
tags = client.core_value_tags
|
@@ -1833,23 +1651,6 @@ else
|
|
1833
1651
|
puts "📊 No leaderboard data configured"
|
1834
1652
|
end
|
1835
1653
|
|
1836
|
-
# Get tango gift cards information
|
1837
|
-
tango_gift_cards = client.tango_gift_cards
|
1838
|
-
|
1839
|
-
# Display tango gift card information
|
1840
|
-
puts "🎁 Tango Gift Cards:"
|
1841
|
-
puts " Available points: #{tango_gift_cards.tango_cards.available_points}"
|
1842
|
-
puts " Terms: #{tango_gift_cards.tango_cards.terms[0..100]}..." if tango_gift_cards.tango_cards.terms
|
1843
|
-
puts ""
|
1844
|
-
|
1845
|
-
# Get gift cards information
|
1846
|
-
gift_cards = client.gift_cards
|
1847
|
-
|
1848
|
-
# Display available gift cards
|
1849
|
-
puts "🎁 Available Gift Cards:"
|
1850
|
-
gift_cards.cards.each do |card|
|
1851
|
-
puts " • #{card.brand_name} (Key: #{card.brand_key}) - Enabled: #{card.enabled}"
|
1852
|
-
end
|
1853
1654
|
```
|
1854
1655
|
|
1855
1656
|
### Error Handling with Clean Responses
|
@@ -1998,7 +1799,7 @@ This SDK uses **real TDD** - no mocking, only actual OAuth testing:
|
|
1998
1799
|
|
1999
1800
|
- ✅ **Learn Module**: Course catalog, categories, course details, and my learning (4 endpoints)
|
2000
1801
|
- ✅ **Users Module**: User profile and authentication (1 endpoint)
|
2001
|
-
- ✅ **Recognitions Module**: Award categories, get awards list, get profile awards,
|
1802
|
+
- ✅ **Recognitions Module**: Award categories, get awards list, get profile awards, core value tags, and leaderboard info (5 endpoints)
|
2002
1803
|
- ✅ **Notifications Module**: My priority items for requests, events, quizzes, surveys, tasks, and todos, and user notifications with unread counts (2 endpoints)
|
2003
1804
|
- ✅ **Feeds Module**: User activity feeds with unread counts and feed details (1 endpoint)
|
2004
1805
|
- ✅ **Posts Module**: Get all posts with filtering options and get post by ID (2 endpoints)
|
@@ -2014,7 +1815,7 @@ This SDK uses **real TDD** - no mocking, only actual OAuth testing:
|
|
2014
1815
|
- ✅ **Pagination Support**: Optional page and limit parameters for all list APIs
|
2015
1816
|
- ✅ **HTTPS Security**: Automatic HTTPS enforcement with redirect handling
|
2016
1817
|
|
2017
|
-
**Total:
|
1818
|
+
**Total: 26 API endpoints across 11 modules + OAuth + Internal API + Auto Detection + Pagination**
|
2018
1819
|
|
2019
1820
|
## Contributing
|
2020
1821
|
|
data/lib/mangoapps/config.rb
CHANGED
@@ -6,11 +6,11 @@ module MangoApps
|
|
6
6
|
class Config
|
7
7
|
attr_accessor :domain, :client_id, :client_secret, :redirect_uri, :scope,
|
8
8
|
:token_store, :timeout, :open_timeout, :logger, :access_token, :refresh_token,
|
9
|
-
:internal_api_key, :internal_api_secret
|
9
|
+
:internal_api_key, :internal_api_secret
|
10
10
|
|
11
11
|
def initialize(domain: nil, client_id: nil, client_secret: nil, redirect_uri: nil, scope: nil, # rubocop:disable Metrics/ParameterLists
|
12
12
|
token_store: nil, timeout: 30, open_timeout: 10, logger: nil,
|
13
|
-
internal_api_key: nil, internal_api_secret: nil
|
13
|
+
internal_api_key: nil, internal_api_secret: nil)
|
14
14
|
# Load environment variables from .env file
|
15
15
|
Dotenv.load if File.exist?(".env")
|
16
16
|
|
@@ -23,7 +23,6 @@ module MangoApps
|
|
23
23
|
@refresh_token = ENV["MANGOAPPS_REFRESH_TOKEN"]
|
24
24
|
@internal_api_key = internal_api_key || ENV["MANGOAPPS_INTERNAL_API_KEY"]
|
25
25
|
@internal_api_secret = internal_api_secret || ENV["MANGOAPPS_INTERNAL_API_SECRET"]
|
26
|
-
@test_header = test_header || ENV["MANGOAPPS_TEST_HEADER"]
|
27
26
|
@token_store = token_store
|
28
27
|
@timeout = timeout
|
29
28
|
@open_timeout = open_timeout
|
@@ -4,9 +4,8 @@ module MangoApps
|
|
4
4
|
class Client
|
5
5
|
module Attachments
|
6
6
|
module GetFolderFiles
|
7
|
-
def get_folder_files(folder_id, include_folders: "Y",
|
8
|
-
|
9
|
-
get("folders/#{folder_id}/files.json", params: params)
|
7
|
+
def get_folder_files(folder_id, include_folders: "Y", params: {})
|
8
|
+
get("folders/#{folder_id}/files.json?include_folders=#{include_folders}", params: params)
|
10
9
|
end
|
11
10
|
end
|
12
11
|
end
|
@@ -4,9 +4,8 @@ module MangoApps
|
|
4
4
|
class Client
|
5
5
|
module Feeds
|
6
6
|
module Feeds
|
7
|
-
def feeds(
|
8
|
-
|
9
|
-
get("feeds.json", params: params)
|
7
|
+
def feeds(offset: 0, limit: 20, all_comments: 'Y', params: {})
|
8
|
+
get("feeds.json?offset=#{offset}&limit=#{limit}&all_comments=#{all_comments}", params: params)
|
10
9
|
end
|
11
10
|
end
|
12
11
|
end
|
@@ -7,8 +7,7 @@ module MangoApps
|
|
7
7
|
# Get course catalog from MangoApps Learn API
|
8
8
|
# GET /api/v2/learn/course_catalog.json
|
9
9
|
def course_catalog(page: 1, limit: 20, params: {})
|
10
|
-
|
11
|
-
get("v2/learn/course_catalog.json", params: params)
|
10
|
+
get("v2/learn/course_catalog.json?page=#{page}&limit=#{limit}", params: params)
|
12
11
|
end
|
13
12
|
end
|
14
13
|
end
|
@@ -6,8 +6,7 @@ module MangoApps
|
|
6
6
|
module CourseCategories
|
7
7
|
# Get course categories from MangoApps Learn API
|
8
8
|
# GET /api/v2/learn/course_categories.json
|
9
|
-
def course_categories(
|
10
|
-
params = params.merge(page: page, limit: limit)
|
9
|
+
def course_categories(params: {})
|
11
10
|
get("v2/learn/course_categories.json", params: params)
|
12
11
|
end
|
13
12
|
end
|
@@ -4,9 +4,8 @@ module MangoApps
|
|
4
4
|
class Client
|
5
5
|
module Libraries
|
6
6
|
module GetLibraries
|
7
|
-
def get_libraries(
|
8
|
-
|
9
|
-
get("users/libraries/get_libraries.json", params: params)
|
7
|
+
def get_libraries(offset: 0, limit: 20, params: {})
|
8
|
+
get("users/libraries/get_libraries.json?offset=#{offset}&limit=#{limit}", params: params)
|
10
9
|
end
|
11
10
|
end
|
12
11
|
end
|
@@ -4,9 +4,8 @@ module MangoApps
|
|
4
4
|
class Client
|
5
5
|
module Libraries
|
6
6
|
module GetLibraryCategories
|
7
|
-
def get_library_categories(library_id,
|
8
|
-
|
9
|
-
get("users/libraries/#{library_id}.json", params: params)
|
7
|
+
def get_library_categories(library_id, offset: 0, limit: 20, params: {})
|
8
|
+
get("users/libraries/#{library_id}.json?offset=#{offset}&limit=#{limit}", params: params)
|
10
9
|
end
|
11
10
|
end
|
12
11
|
end
|
@@ -4,9 +4,8 @@ module MangoApps
|
|
4
4
|
class Client
|
5
5
|
module Libraries
|
6
6
|
module GetLibraryItems
|
7
|
-
def get_library_items(library_id, category_id,
|
8
|
-
|
9
|
-
get("users/libraries/#{library_id}/categories/#{category_id}/library_items/get_library_items.json", params: params)
|
7
|
+
def get_library_items(library_id, category_id, offset: 0, limit: 20, params: {})
|
8
|
+
get("users/libraries/#{library_id}/categories/#{category_id}/library_items/get_library_items.json?offset=#{offset}&limit=#{limit}", params: params)
|
10
9
|
end
|
11
10
|
end
|
12
11
|
end
|
@@ -4,9 +4,8 @@ module MangoApps
|
|
4
4
|
class Client
|
5
5
|
module Notifications
|
6
6
|
module Notifications
|
7
|
-
def notifications(
|
8
|
-
|
9
|
-
get("users/notifications.json", params: params)
|
7
|
+
def notifications(offset: 0, limit: 20, params: {})
|
8
|
+
get("users/notifications.json?offset=#{offset}&limit=#{limit}", params: params)
|
10
9
|
end
|
11
10
|
end
|
12
11
|
end
|
@@ -4,9 +4,8 @@ module MangoApps
|
|
4
4
|
class Client
|
5
5
|
module Posts
|
6
6
|
module GetAllPosts
|
7
|
-
def get_all_posts(filter_by: "all",
|
8
|
-
|
9
|
-
get("posts/get_all_posts.json", params: params)
|
7
|
+
def get_all_posts(filter_by: "all", offset: 0, limit: 20, params: {})
|
8
|
+
get("posts/get_all_posts.json?filter_by=#{filter_by}&offset=#{offset}&limit=#{limit}", params: params)
|
10
9
|
end
|
11
10
|
end
|
12
11
|
end
|
@@ -4,8 +4,7 @@ module MangoApps
|
|
4
4
|
class Client
|
5
5
|
module Recognitions
|
6
6
|
module AwardCategories
|
7
|
-
def award_categories(
|
8
|
-
params = params.merge(page: page, limit: limit)
|
7
|
+
def award_categories(params: {})
|
9
8
|
get("v2/recognitions/get_award_categories.json", params: params)
|
10
9
|
end
|
11
10
|
end
|
@@ -4,9 +4,8 @@ module MangoApps
|
|
4
4
|
class Client
|
5
5
|
module Recognitions
|
6
6
|
module GetAwardsList
|
7
|
-
def get_awards_list(category_id,
|
8
|
-
|
9
|
-
get("v2/recognitions/get_awards_list.json", params: params)
|
7
|
+
def get_awards_list(category_id, params: {})
|
8
|
+
get("v2/recognitions/get_awards_list.json?category_id=#{category_id}", params: params)
|
10
9
|
end
|
11
10
|
end
|
12
11
|
end
|
@@ -3,11 +3,8 @@
|
|
3
3
|
require_relative "recognitions/award_categories"
|
4
4
|
require_relative "recognitions/core_value_tags"
|
5
5
|
require_relative "recognitions/leaderboard_info"
|
6
|
-
require_relative "recognitions/gift_cards"
|
7
6
|
require_relative "recognitions/get_awards_list"
|
8
7
|
require_relative "recognitions/get_profile_awards"
|
9
|
-
require_relative "recognitions/get_team_awards"
|
10
|
-
require_relative "recognitions/get_award_feeds"
|
11
8
|
|
12
9
|
module MangoApps
|
13
10
|
class Client
|
@@ -16,11 +13,8 @@ module MangoApps
|
|
16
13
|
include MangoApps::Client::Recognitions::AwardCategories
|
17
14
|
include MangoApps::Client::Recognitions::CoreValueTags
|
18
15
|
include MangoApps::Client::Recognitions::LeaderboardInfo
|
19
|
-
include MangoApps::Client::Recognitions::GiftCards
|
20
16
|
include MangoApps::Client::Recognitions::GetAwardsList
|
21
17
|
include MangoApps::Client::Recognitions::GetProfileAwards
|
22
|
-
include MangoApps::Client::Recognitions::GetTeamAwards
|
23
|
-
include MangoApps::Client::Recognitions::GetAwardFeeds
|
24
18
|
end
|
25
19
|
end
|
26
20
|
end
|
@@ -5,8 +5,7 @@ module MangoApps
|
|
5
5
|
module Tasks
|
6
6
|
module GetTasks
|
7
7
|
def get_tasks(filter: "Pending_Tasks", page: 1, limit: 5, params: {})
|
8
|
-
|
9
|
-
get("tasks/new_index.json", params: params)
|
8
|
+
get("tasks/new_index.json?filter=#{filter}&page=#{page}&limit=#{limit}", params: params)
|
10
9
|
end
|
11
10
|
end
|
12
11
|
end
|
@@ -5,8 +5,7 @@ module MangoApps
|
|
5
5
|
module Trackers
|
6
6
|
module GetTrackers
|
7
7
|
def get_trackers(page: 1, limit: 20, params: {})
|
8
|
-
|
9
|
-
get("v2/trackers.json", params: params)
|
8
|
+
get("v2/trackers.json?page=#{page}&limit=#{limit}", params: params)
|
10
9
|
end
|
11
10
|
end
|
12
11
|
end
|
@@ -4,9 +4,8 @@ module MangoApps
|
|
4
4
|
class Client
|
5
5
|
module Wikis
|
6
6
|
module GetWikis
|
7
|
-
def get_wikis(mode: "my",
|
8
|
-
|
9
|
-
get("v2/wikis.json", params: params)
|
7
|
+
def get_wikis(mode: "my", offset: 0, limit: 20, params: {})
|
8
|
+
get("v2/wikis.json?mode=#{mode}&offset=#{offset}&limit=#{limit}", params: params)
|
10
9
|
end
|
11
10
|
end
|
12
11
|
end
|
data/lib/mangoapps/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mangoapps-ex-sdk-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.19.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MangoApps Inc.
|
@@ -133,11 +133,8 @@ files:
|
|
133
133
|
- lib/mangoapps/modules/recognitions.rb
|
134
134
|
- lib/mangoapps/modules/recognitions/award_categories.rb
|
135
135
|
- lib/mangoapps/modules/recognitions/core_value_tags.rb
|
136
|
-
- lib/mangoapps/modules/recognitions/get_award_feeds.rb
|
137
136
|
- lib/mangoapps/modules/recognitions/get_awards_list.rb
|
138
137
|
- lib/mangoapps/modules/recognitions/get_profile_awards.rb
|
139
|
-
- lib/mangoapps/modules/recognitions/get_team_awards.rb
|
140
|
-
- lib/mangoapps/modules/recognitions/gift_cards.rb
|
141
138
|
- lib/mangoapps/modules/recognitions/leaderboard_info.rb
|
142
139
|
- lib/mangoapps/modules/tasks.rb
|
143
140
|
- lib/mangoapps/modules/tasks/get_task_details.rb
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module MangoApps
|
4
|
-
class Client
|
5
|
-
module Recognitions
|
6
|
-
module GetAwardFeeds
|
7
|
-
def get_award_feeds(page: 1, limit: 20, params: {})
|
8
|
-
params = params.merge(page: page, limit: limit)
|
9
|
-
get("v2/recognitions/get_award_feeds.json", params: params)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|