share_learning 0.2.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 51881b5c17d1723c09e004f02a36627054aef086
4
- data.tar.gz: ff070d4da0cb833834c221eecdc5ef8f25e5bbd2
3
+ metadata.gz: 87508a27360aeaf7cd129dbc54397230fb486601
4
+ data.tar.gz: 992c8efa2e5da5b1130a4a98ce4d0eeb66a428a0
5
5
  SHA512:
6
- metadata.gz: 62e1d9b8dbabc97ec0b5b664611c50fd895ba76fca95298c66c19a65897cfe503a43506f2ac3da3cef1245abfe2b33d69151cce57329b777a7e748b555751d39
7
- data.tar.gz: 472b4fcb6e1f682e8eaa8f7176f0f3ca2a6f3492ab0b4203f3834881889fe1dacc4acd6cf8681a6f2ee7b75c5c38f9e9ec3775e41dcd5dee279e5db2790d7fa9
6
+ metadata.gz: dd01e4183acef511164073e003eb6173b2be1d623767402213e209401ffc3a96f2ec6c1fe90ce3d4bbbfeaf1e190a13a147ba8c0081b0d2073444b6ed93e5cfb
7
+ data.tar.gz: 8a422b7f00defad9439462f149319ac84d9306a6341dd12f8740cf5339825b0d51820a80721ca4e916ddb1f4916de4530b3d9d05d500d2b98ae8deef507181bb
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  # share_learning
3
- [![Gem Version](https://badge.fury.io/rb/Share_learning.svg)](https://badge.fury.io/rb/Share_learning)
4
- [![Build Status](https://travis-ci.org/BlueStarAshes/Share_learning.svg?branch=master)](https://travis-ci.org/BlueStarAshes/Share_learning)
3
+ [![Gem Version](https://badge.fury.io/rb/share_learning.svg)](https://badge.fury.io/rb/share_learning)
4
+ [![Build Status](https://travis-ci.org/BlueStarAshes/share_learning.svg?branch=master)](https://travis-ci.org/BlueStarAshes/share_learning)
5
5
 
6
6
 
7
7
  ## Introduction
@@ -100,7 +100,7 @@ BASIC USAGE: `udacity [command][feature]`
100
100
 
101
101
  #### In your project
102
102
 
103
- First, `require 'Share_learning'` in your code.
103
+ First, `require 'share_learning'` in your code.
104
104
  See the following example code for more usage details:
105
105
 
106
106
  ```ruby
@@ -130,7 +130,7 @@ get_course_by_id = courses.acquire_course_by_title(course_title)
130
130
  * `[keyword]` - helps you search and get information of playlists on YouTube.
131
131
 
132
132
  #### In your project
133
- * `require 'Share_learning'`
133
+ * `require 'share_learning'`
134
134
  See the following example code for more usage details:
135
135
  ```ruby
136
136
  # Access playlists data
data/bin/udacity CHANGED
@@ -66,13 +66,13 @@ def action(command, feature=nil)
66
66
  when 'search'
67
67
  check_feature_available('search', feature)
68
68
  course = Udacity::UdacityCourse.find().acquire_courses_by_keywords(feature)
69
- if course.class == Array
69
+ if course.empty?
70
+ puts 'no courses found'
71
+ else
70
72
  course.each do |item|
71
73
  show(item)
72
74
  puts "\n" + "------"
73
- end
74
- else
75
- puts 'no courses found'
75
+ end
76
76
  end
77
77
  end
78
78
  end
@@ -80,4 +80,4 @@ end
80
80
  command = ARGV[0]
81
81
  feature = ARGV[1]
82
82
  check_command_available(command)
83
- action(command, feature)
83
+ action(command, feature)
data/bin/youtube CHANGED
@@ -5,7 +5,7 @@ require 'share_learning'
5
5
 
6
6
  keyword = ARGV[0] || ENV['KEYWORD']
7
7
  unless keyword
8
- puts 'USAGE: share_learning [keyword]'
8
+ puts 'USAGE: youtube [keyword]'
9
9
  exit(1)
10
10
  end
11
11
 
@@ -1,3 +1,3 @@
1
1
  module ShareLearning
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.2.1'.freeze
3
3
  end
@@ -22,8 +22,7 @@ module Udacity
22
22
 
23
23
  # Retrieve the total number of courses on the catlog
24
24
  json_resp = acquire_json_response
25
- puts json_resp.class
26
25
  @total_course_num = json_resp['courses'].size
27
26
  end
28
27
  end
29
- end
28
+ end
@@ -67,9 +67,7 @@ module Udacity
67
67
 
68
68
  course_array = append_course(course_array, course)
69
69
  end
70
-
71
- return 'no courses found' if course_array.empty?
72
- course_array # return course_array if it is not empty
70
+ course_array
73
71
  end
74
72
 
75
73
  # # get courses by skill levels ('', 'beginner', 'intermediate', 'advanced')
@@ -98,4 +96,4 @@ module Udacity
98
96
  new(UdacityAPI, course_data, total_course_num)
99
97
  end
100
98
  end
101
- end
99
+ end
@@ -5,7 +5,8 @@ module YouTube
5
5
  # using YouTube API to get playlists
6
6
  class YouTubeAPI
7
7
  max_results = 8 # number of videos that should be returned
8
- YouTube_URL = 'https://www.googleapis.com/youtube/v3/search?part=snippet&type=playlist&order=relevance&maxResults=' + max_results.to_s
8
+ YouTube_URL = 'https://www.googleapis.com/youtube/v3/search?part=snippet' + \
9
+ '&type=playlist&order=relevance&maxResults=' + max_results.to_s
9
10
 
10
11
  def self.config=(credentials)
11
12
  @config ? @config.update(credentials) : @config = credentials
@@ -19,7 +20,8 @@ module YouTube
19
20
  # Retrieve the search results
20
21
  def self.get_playlist(keyword)
21
22
  search_response =
22
- HTTP.get(YouTube_URL + '&q=' + keyword.split().join('+') + '&key=' + config[:api_key])
23
+ HTTP.get(YouTube_URL + '&q=' + keyword.split().join('+') + \
24
+ '&key=' + config[:api_key])
23
25
  JSON.parse(search_response)
24
26
  end
25
27
  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.0
4
+ version: 0.2.1
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-04 00:00:00.000000000 Z
11
+ date: 2016-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http