soa_codeschool 0.0.4 → 0.0.5
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 +1 -1
- data/lib/code_school/code_school.rb +4 -2
- data/lib/code_school/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 337ab046dbd442251ed32be1955f6b384eae02bb
|
4
|
+
data.tar.gz: 69f14b363171e9760af89df3bb52230aeb9d0bf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6106af1dd432061780943391b1a49999e70b6852e14529e0a66cfd77705e632985923c5843301ba131685c162f6ae8a1e58dcfe61c9ba1586beec062604c34cc
|
7
|
+
data.tar.gz: d38426ce2ac80551766ef830dd1556d993481e259105a6bb04e6d4f6de0063d1966df2cb430d5c162b99271a0411538a70ff0db4fdb329d741e390bf3d88e453
|
data/README.md
CHANGED
@@ -15,7 +15,7 @@ gem install soa_codeschool
|
|
15
15
|
### Command line usage
|
16
16
|
|
17
17
|
```
|
18
|
-
|
18
|
+
codeschool # Puts JSON array of code school courses and teachers to command line
|
19
19
|
```
|
20
20
|
|
21
21
|
### Usage in ruby code
|
@@ -5,6 +5,8 @@ require 'json'
|
|
5
5
|
# Scraper for CodeSchool website
|
6
6
|
module CodeSchool
|
7
7
|
COURSES = 'https://www.codeschool.com/courses'
|
8
|
+
COURSE_NAMES_XPATH = '//h2/a'
|
9
|
+
TEACHER_NAMES_XPATH = '//h3/a'
|
8
10
|
|
9
11
|
# Gets array of courses
|
10
12
|
def courses
|
@@ -18,7 +20,7 @@ module CodeSchool
|
|
18
20
|
|
19
21
|
# Get an array of course names
|
20
22
|
def course_names
|
21
|
-
courses.xpath(
|
23
|
+
courses.xpath(COURSE_NAMES_XPATH).map(&:text)
|
22
24
|
end
|
23
25
|
|
24
26
|
# Change course names to urls
|
@@ -33,7 +35,7 @@ module CodeSchool
|
|
33
35
|
# Get teachar's name by visiting each course page
|
34
36
|
def teacher_names
|
35
37
|
course_urls.map do |course_url|
|
36
|
-
teacher(course_url).xpath(
|
38
|
+
teacher(course_url).xpath(TEACHER_NAMES_XPATH).map(&:text)
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
data/lib/code_school/version.rb
CHANGED