share_learning 0.2.1 → 0.2.3
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 +2 -1
- data/bin/coursera +2 -0
- data/bin/youtube +1 -0
- data/lib/share_learning/share_learning_version.rb +1 -1
- data/lib/share_learning/udacity_course.rb +15 -9
- data/lib/share_learning/youtube_playlist.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c0a42f0fe61387e653a8e13c93bc00c28dacf92
|
4
|
+
data.tar.gz: f39511a044ccc0f2e8a03ef2be7a54c5b37ed80a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c8b4f820e22fdd4662b38759860140cbafbef83e6abb95e75fc5dca2bc797528607e0e335d37974d92a5090b571ed7209b5ec0d3137021dfaf4c8fb9dac4dd1
|
7
|
+
data.tar.gz: 286a414d0796f0041eb598f816821262a7cbc17ceb313b17fa1ae13bf07defb7d4d9979adf09960dc671c0122536457497f2210fd98f32e53291881bf1cb6fe1
|
data/README.md
CHANGED
@@ -105,7 +105,7 @@ See the following example code for more usage details:
|
|
105
105
|
|
106
106
|
```ruby
|
107
107
|
# Access courses data
|
108
|
-
courses = Udacity::UdacityCourse.find
|
108
|
+
courses = Udacity::UdacityCourse.find
|
109
109
|
|
110
110
|
# Acquire all courses information
|
111
111
|
all_courses = courses.acquire_all_courses
|
@@ -138,6 +138,7 @@ playlist_data = YouTube::YouTubePlaylist.find(keyword: 'keyword')
|
|
138
138
|
playlist_data.results.each.with_index do |playlist, index|
|
139
139
|
print "#{index + 1}. "
|
140
140
|
puts "Playlist on YouTube: #{playlist['title']}"
|
141
|
+
puts "Playlist ID: #{playlist['playlistId']}"
|
141
142
|
puts "Description: #{playlist['description']}"
|
142
143
|
puts "Image: #{playlist['image']}"
|
143
144
|
puts "URL: #{playlist['url']}"
|
data/bin/coursera
CHANGED
@@ -26,6 +26,7 @@ end
|
|
26
26
|
|
27
27
|
def show_course(course, sequence_number)
|
28
28
|
puts "Course #{sequence_number}:\n"\
|
29
|
+
"\tID: #{course[:course_id]}\n"\
|
29
30
|
"\tTitle: #{course[:course_name]}\n"\
|
30
31
|
"\tType: #{course[:course_type]}\n"\
|
31
32
|
"\tSlug: #{course[:course_slug]}\n"\
|
@@ -42,6 +43,7 @@ def execute_command(command, keyword)
|
|
42
43
|
end
|
43
44
|
reject unless keyword
|
44
45
|
# search_courses(search_method, keyword)
|
46
|
+
puts 'retrieving courses from Coursera...'
|
45
47
|
results = Coursera::CourseraCourses.find.search_courses(method, keyword)
|
46
48
|
results.size.times { |i| show_course(results[i], i + 1) }
|
47
49
|
end
|
data/bin/youtube
CHANGED
@@ -14,6 +14,7 @@ playlist_data = YouTube::YouTubePlaylist.find(keyword: keyword)
|
|
14
14
|
playlist_data.results.each.with_index do |playlist, index|
|
15
15
|
print "#{index + 1}. "
|
16
16
|
puts "Playlist on YouTube: #{playlist['title']}"
|
17
|
+
puts "Playlist ID: #{playlist['playlistId']}"
|
17
18
|
puts "Description: #{playlist['description']}"
|
18
19
|
puts "Image: #{playlist['image']}"
|
19
20
|
puts "URL: #{playlist['url']}"
|
@@ -13,16 +13,17 @@ module Udacity
|
|
13
13
|
@total_course_num = total_course_num
|
14
14
|
end
|
15
15
|
|
16
|
-
def create_hash(title, intro, link, image)
|
17
|
-
{ title: title, intro: intro, link: link, image: image }
|
16
|
+
def create_hash(title, id, intro, link, image)
|
17
|
+
{ title: title, id: id, intro: intro, link: link, image: image }
|
18
18
|
end
|
19
19
|
|
20
20
|
# get all courses information
|
21
21
|
def acquire_all_courses
|
22
22
|
course_array = []
|
23
23
|
@json_response['courses'].each do |course|
|
24
|
-
h = create_hash(course['title'], course['
|
25
|
-
course['
|
24
|
+
h = create_hash(course['title'], course['key'], \
|
25
|
+
course['summary'], course['homepage'], \
|
26
|
+
course['image'])
|
26
27
|
course_array.push(h)
|
27
28
|
end
|
28
29
|
course_array
|
@@ -42,8 +43,9 @@ module Udacity
|
|
42
43
|
def acquire_course_info(key, value)
|
43
44
|
@json_response['courses'].each do |course|
|
44
45
|
next unless course[key] == value
|
45
|
-
h = create_hash(course['title'], course['
|
46
|
-
course['
|
46
|
+
h = create_hash(course['title'], course['key'], \
|
47
|
+
course['summary'], course['homepage'], \
|
48
|
+
course['image'])
|
47
49
|
return h
|
48
50
|
end
|
49
51
|
end
|
@@ -53,8 +55,9 @@ module Udacity
|
|
53
55
|
end
|
54
56
|
|
55
57
|
def append_course(course_array, course)
|
56
|
-
h = create_hash(course['title'], course['
|
57
|
-
course['
|
58
|
+
h = create_hash(course['title'], course['key'], \
|
59
|
+
course['summary'], course['homepage'], \
|
60
|
+
course['image'])
|
58
61
|
course_array.push(h)
|
59
62
|
course_array
|
60
63
|
end
|
@@ -67,6 +70,7 @@ module Udacity
|
|
67
70
|
|
68
71
|
course_array = append_course(course_array, course)
|
69
72
|
end
|
73
|
+
|
70
74
|
course_array
|
71
75
|
end
|
72
76
|
|
@@ -95,5 +99,7 @@ module Udacity
|
|
95
99
|
total_course_num = UdacityAPI.total_course_num
|
96
100
|
new(UdacityAPI, course_data, total_course_num)
|
97
101
|
end
|
102
|
+
|
98
103
|
end
|
99
|
-
|
104
|
+
|
105
|
+
end
|
@@ -20,13 +20,15 @@ module YouTube
|
|
20
20
|
def load_data(playlists)
|
21
21
|
results = []
|
22
22
|
playlists['items'].each do |playlist|
|
23
|
+
playlistId = playlist['id']['playlistId']
|
23
24
|
title = playlist['snippet']['title']
|
24
25
|
des = playlist['snippet']['description']
|
25
26
|
image = playlist['snippet']['thumbnails']['high']['url']
|
26
27
|
playlistId = playlist['id']['playlistId']
|
27
28
|
url = 'https://www.youtube.com/channel/' + playlistId
|
28
|
-
results.push({'title' => title, 'description' => des, 'image' => image, 'url' => url})
|
29
|
+
results.push({'playlistId' => playlistId, 'title' => title, 'description' => des, 'image' => image, 'url' => url})
|
29
30
|
end
|
31
|
+
print results
|
30
32
|
results
|
31
33
|
end
|
32
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: share_learning
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ashleycheng, blureze, meegoStar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|