speakerdeck_api 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.travis.yml +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +33 -0
- data/Rakefile +11 -0
- data/lib/speakerdeck_api.rb +9 -0
- data/lib/speakerdeck_api/connection.rb +28 -0
- data/lib/speakerdeck_api/exceptions/speaker_not_found_exception.rb +7 -0
- data/lib/speakerdeck_api/parser.rb +10 -0
- data/lib/speakerdeck_api/speaker.rb +22 -0
- data/lib/speakerdeck_api/version.rb +3 -0
- data/speakerdeck_api.gemspec +27 -0
- data/spec/fixtures/speaker_profile.html +388 -0
- data/spec/speakerdeck_api/connection_spec.rb +36 -0
- data/spec/speakerdeck_api/parser_spec.rb +27 -0
- data/spec/speakerdeck_api/speaker_spec.rb +39 -0
- data/spec/speakerdeck_api_spec.rb +5 -0
- data/spec/spec_helper.rb +5 -0
- metadata +153 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3892efbff2761e7e134553b668c35f548cabf3d9
|
4
|
+
data.tar.gz: 9acae837f0c8370cd9c5d2819889d452b0dda84a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9268702f1ac2caccaf604ab945d3a0492e8bbf338167dbb5a6807e21a82814af55c3643d91db46152c57b102840db226a3010310b60cd6d957b65d7064dcfc5d
|
7
|
+
data.tar.gz: 22f442d296feace4492a03bf841d661655c4c6719936728137dfc20cf0d6b90d7b8113376949cecd974113b4e0171955bdd13b72ed3709c7e54efe7d0baee3cd
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Fer Perales
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# SpeakerdeckApi
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/FerPerales/speakerdeck_api.png?branch=master)](https://travis-ci.org/FerPerales/speakerdeck_api)
|
4
|
+
|
5
|
+
A gem for getting data from speakerdeck.com
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'speakerdeck_api'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install speakerdeck_api
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
1. Fork it ( https://github.com/[my-github-username]/speakerdeck_api/fork )
|
30
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
31
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
32
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
33
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
require "speakerdeck_api/version"
|
2
|
+
require 'speakerdeck_api/connection'
|
3
|
+
require 'speakerdeck_api/parser'
|
4
|
+
require 'speakerdeck_api/speaker'
|
5
|
+
require 'speakerdeck_api/exceptions/speaker_not_found_exception'
|
6
|
+
|
7
|
+
module SpeakerdeckApi
|
8
|
+
# Your code goes here...
|
9
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
require 'open-uri'
|
3
|
+
|
4
|
+
module SpeakerdeckApi
|
5
|
+
class Connection
|
6
|
+
|
7
|
+
BASE_URL = 'https://speakerdeck.com/'
|
8
|
+
|
9
|
+
def get_speaker_data(speaker_name)
|
10
|
+
url = url_for_speaker speaker_name
|
11
|
+
get_data(url)
|
12
|
+
end
|
13
|
+
|
14
|
+
def url_for_speaker(speaker_name)
|
15
|
+
BASE_URL + speaker_name
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def get_data(url)
|
23
|
+
Nokogiri::HTML(open(url))
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module SpeakerdeckApi
|
2
|
+
|
3
|
+
class Speaker
|
4
|
+
|
5
|
+
attr_reader :number_of_talks
|
6
|
+
|
7
|
+
def initialize(params = {})
|
8
|
+
@number_of_talks = params[:number_of_talks] || 0
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.get(speaker_name)
|
12
|
+
begin
|
13
|
+
speaker_data = SpeakerdeckApi::Connection.new.get_speaker_data speaker_name
|
14
|
+
speaker_details = SpeakerdeckApi::Parser.new.get_speaker_details speaker_data
|
15
|
+
SpeakerdeckApi::Speaker.new speaker_details
|
16
|
+
rescue
|
17
|
+
raise SpeakerdeckApi::Exceptions::SpeakerNotFoundException
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'speakerdeck_api/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "speakerdeck_api"
|
8
|
+
spec.version = SpeakerdeckApi::VERSION
|
9
|
+
spec.authors = ["Fer Perales"]
|
10
|
+
spec.email = ["me@ferperales.net"]
|
11
|
+
spec.summary = %q{A gem for getting data from speakerdeck.com}
|
12
|
+
spec.homepage = ""
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
21
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
22
|
+
spec.add_development_dependency "rspec"
|
23
|
+
spec.add_development_dependency "nokogiri"
|
24
|
+
spec.add_development_dependency "pry"
|
25
|
+
spec.add_development_dependency "pry-byebug"
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,388 @@
|
|
1
|
+
|
2
|
+
<!DOCTYPE html>
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
<title>Presentations by Fernando Perales // Speaker Deck</title>
|
7
|
+
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
|
8
|
+
|
9
|
+
<link href='//fonts.googleapis.com/css?family=Open+Sans:400,300,600&subset=latin,latin-ext,cyrillic,cyrillic-ext' rel='stylesheet' type='text/css'>
|
10
|
+
<link href="https://d2dfho4r6t7asi.cloudfront.net/assets/application-31e7b11e971c1191f531d134325dda3f.css" media="screen" rel="stylesheet" type="text/css" />
|
11
|
+
|
12
|
+
<meta name="octolytics-app-id" content="speakerdeck" /><meta name="octolytics-host" content="collector.githubapp.com" /><meta name="octolytics-script-host" content="collector-cdn.github.com" />
|
13
|
+
<meta name="octolytics-actor-id" content="13424" /><meta name="octolytics-actor-hash" content="050077a3de932b4489000e56dc249fa6b41708404be9ae26ae576c04103177ec" />
|
14
|
+
|
15
|
+
<script src="https://d2dfho4r6t7asi.cloudfront.net/assets/application-de3b0dfb5fa666c00edfef0bbc79a0d7.js" type="text/javascript"></script>
|
16
|
+
<!--[if lt IE 9]>
|
17
|
+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
18
|
+
<![endif]-->
|
19
|
+
<!--[if (gte IE 6)&(lte IE 8)]>
|
20
|
+
<script src="https://d2dfho4r6t7asi.cloudfront.net/assets/selectivizr-7b14bd1d1264beb6f8c385039c9cf80a.js" type="text/javascript"></script>
|
21
|
+
<![endif]-->
|
22
|
+
<meta content="authenticity_token" name="csrf-param" />
|
23
|
+
<meta content="c6i9OWNVcbBt6H3is4hMjDeJBReVJp6ZaGWwtoZOzH5UQO27+O2NKUh1+ruqLPrYq0iaVtWdu5P10yUrC2zUuw==" name="csrf-token" />
|
24
|
+
|
25
|
+
<link href="https://speakerdeck.com/ferperales.atom" rel="alternate" title="Fernando Perales's Presentations Feed" type="application/atom+xml" />
|
26
|
+
<meta name="octolytics-dimension-user_id" content="13424" /><meta name="octolytics-dimension-user_username" content="ferperales" />
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body class="signed-in">
|
30
|
+
<header>
|
31
|
+
<div class="container">
|
32
|
+
<h1><a href="/">Speaker Deck</a></h1>
|
33
|
+
|
34
|
+
<form accept-charset="UTF-8" action="/search" id="search_form" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /></div>
|
35
|
+
<input type="text" id="q" name="q" placeholder="Search…" value="" autocomplete="off" />
|
36
|
+
<button>Search</button>
|
37
|
+
</form>
|
38
|
+
<div class="navigation">
|
39
|
+
<ul>
|
40
|
+
<li class="browse"><a href="/p/featured">Browse</a></li>
|
41
|
+
<li class="upload"><a href="/new">Upload</a></li>
|
42
|
+
</ul>
|
43
|
+
|
44
|
+
<div id="amazing-shadow"></div>
|
45
|
+
<div id="account-settings">
|
46
|
+
<a class="user" href="/ferperales"><img alt="597e300a2878d54443eeb8cbde63edad?s=47" src="//secure.gravatar.com/avatar/597e300a2878d54443eeb8cbde63edad?s=47" />Fernando Perales</a>
|
47
|
+
<ul>
|
48
|
+
<li><a href="/ferperales">My Decks</a></li>
|
49
|
+
<li><a href="/account">My Account</a></a>
|
50
|
+
<li><a href="/ferperales/stars">My Stars</a></li>
|
51
|
+
<li><a href="#feedback_box" rel="facebox">Feedback</a></li>
|
52
|
+
<li><a href="/signout">Sign Out</a></li>
|
53
|
+
</ul>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
|
58
|
+
<div id="feedback_box" style="display: none">
|
59
|
+
<div class="letter">
|
60
|
+
<h2>Dear Speaker Deck,</h2>
|
61
|
+
<form accept-charset="UTF-8" action="/feedback" data-remote="true" id="feedback" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="EtNj8IV8MmZP24S+AEVefoNyJloJwNl5U9sn7AC7Mn81OzNyHsTO/2pGA+cZ4egqH7O5G0l7/HPObbJxjZkqug==" /></div>
|
62
|
+
|
63
|
+
<div class="subject">
|
64
|
+
<label for="subject">I’d like to talk with you about</label>
|
65
|
+
<input id="subject" name="subject" placeholder="Subject" type="text" />
|
66
|
+
</div>
|
67
|
+
<textarea id="comments" name="comments" placeholder="Your message">
|
68
|
+
</textarea>
|
69
|
+
|
70
|
+
<span style="display: block; margin-bottom: 10px;">
|
71
|
+
Signed,
|
72
|
+
</span>
|
73
|
+
<h2>Fernando Perales</h2><br/>
|
74
|
+
<hr>
|
75
|
+
<button type=submit class="primary">Send Mail</button>
|
76
|
+
</form> </div>
|
77
|
+
</div>
|
78
|
+
|
79
|
+
</div>
|
80
|
+
</header>
|
81
|
+
|
82
|
+
|
83
|
+
<div id="content">
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
<section class="light">
|
88
|
+
<div class="container">
|
89
|
+
<div class="main">
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
<h1>Talks by Fernando Perales</h1>
|
94
|
+
<p></p>
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
<div class="talks">
|
99
|
+
<div class="talk public" data-id="60e74b1029b90132958f166834114127" data-slide-count="42">
|
100
|
+
<a class="slide_preview scrub" href="/ferperales/i-dot-a-y-open-source">
|
101
|
+
<img alt="Thumb_slide_0" src="https://speakerd.s3.amazonaws.com/presentations/60e74b1029b90132958f166834114127/thumb_slide_0.jpg" />
|
102
|
+
<div class="scrubber"><div class="scrubbed" style="width:0;"></div></div>
|
103
|
+
</a>
|
104
|
+
<div class="talk-listing-meta">
|
105
|
+
<h3 class="title">
|
106
|
+
<a href="/ferperales/i-dot-a-y-open-source">I.A. y Open Source</a>
|
107
|
+
</h3>
|
108
|
+
<p class="date">
|
109
|
+
Sep 20, 2014 by
|
110
|
+
<a href="/ferperales">Fernando Perales</a></p>
|
111
|
+
</div>
|
112
|
+
</div>
|
113
|
+
|
114
|
+
<div class="talk public" data-id="13f78d50f4ea0131751b2ef16f2868ea" data-slide-count="51">
|
115
|
+
<a class="slide_preview scrub" href="/ferperales/the-x-factor">
|
116
|
+
<img alt="Thumb_slide_0" src="https://speakerd.s3.amazonaws.com/presentations/13f78d50f4ea0131751b2ef16f2868ea/thumb_slide_0.jpg" />
|
117
|
+
<div class="scrubber"><div class="scrubbed" style="width:0;"></div></div>
|
118
|
+
</a>
|
119
|
+
<div class="talk-listing-meta">
|
120
|
+
<h3 class="title">
|
121
|
+
<a href="/ferperales/the-x-factor">The X factor</a>
|
122
|
+
</h3>
|
123
|
+
<p class="date">
|
124
|
+
Jul 23, 2014 by
|
125
|
+
<a href="/ferperales">Fernando Perales</a></p>
|
126
|
+
</div>
|
127
|
+
</div>
|
128
|
+
|
129
|
+
<div class="talk public" data-id="119bae30ca68013176a162bf191fee83" data-slide-count="7">
|
130
|
+
<a class="slide_preview scrub" href="/ferperales/using-remotes-in-a-presentation">
|
131
|
+
<img alt="Thumb_slide_0" src="https://speakerd.s3.amazonaws.com/presentations/119bae30ca68013176a162bf191fee83/thumb_slide_0.jpg" />
|
132
|
+
<div class="scrubber"><div class="scrubbed" style="width:0;"></div></div>
|
133
|
+
</a>
|
134
|
+
<div class="talk-listing-meta">
|
135
|
+
<h3 class="title">
|
136
|
+
<a href="/ferperales/using-remotes-in-a-presentation">Using remotes in a presentation</a>
|
137
|
+
</h3>
|
138
|
+
<p class="date">
|
139
|
+
May 30, 2014 by
|
140
|
+
<a href="/ferperales">Fernando Perales</a></p>
|
141
|
+
</div>
|
142
|
+
</div>
|
143
|
+
|
144
|
+
<div class="talk public" data-id="dfc5df0089320131712b6e502952b505" data-slide-count="44">
|
145
|
+
<a class="slide_preview scrub" href="/ferperales/introduccion-a-git-y-github">
|
146
|
+
<img alt="Thumb_slide_0" src="https://speakerd.s3.amazonaws.com/presentations/dfc5df0089320131712b6e502952b505/thumb_slide_0.jpg" />
|
147
|
+
<div class="scrubber"><div class="scrubbed" style="width:0;"></div></div>
|
148
|
+
</a>
|
149
|
+
<div class="talk-listing-meta">
|
150
|
+
<h3 class="title">
|
151
|
+
<a href="/ferperales/introduccion-a-git-y-github">Introducción a git y GitHub</a>
|
152
|
+
</h3>
|
153
|
+
<p class="date">
|
154
|
+
Mar 8, 2014 by
|
155
|
+
<a href="/ferperales">Fernando Perales</a></p>
|
156
|
+
</div>
|
157
|
+
</div>
|
158
|
+
|
159
|
+
<div class="talk public" data-id="fc037890ca6c0130db67327b70541545" data-slide-count="20">
|
160
|
+
<a class="slide_preview scrub" href="/ferperales/marilyn-monroe-top-20-19-moments">
|
161
|
+
<img alt="Thumb_slide_0" src="https://speakerd.s3.amazonaws.com/presentations/fc037890ca6c0130db67327b70541545/thumb_slide_0.jpg" />
|
162
|
+
<div class="scrubber"><div class="scrubbed" style="width:0;"></div></div>
|
163
|
+
</a>
|
164
|
+
<div class="talk-listing-meta">
|
165
|
+
<h3 class="title">
|
166
|
+
<a href="/ferperales/marilyn-monroe-top-20-19-moments">Marilyn Monroe Top -20- 19 moments</a>
|
167
|
+
</h3>
|
168
|
+
<p class="date">
|
169
|
+
Jul 9, 2013 by
|
170
|
+
<a href="/ferperales">Fernando Perales</a></p>
|
171
|
+
</div>
|
172
|
+
</div>
|
173
|
+
|
174
|
+
<div class="talk public" data-id="bf5480d0b1150130d014221a8388c3ea" data-slide-count="31">
|
175
|
+
<a class="slide_preview scrub" href="/ferperales/from-just-hired-to-just-graduated">
|
176
|
+
<img alt="Thumb_slide_0" src="https://speakerd.s3.amazonaws.com/presentations/bf5480d0b1150130d014221a8388c3ea/thumb_slide_0.jpg" />
|
177
|
+
<div class="scrubber"><div class="scrubbed" style="width:0;"></div></div>
|
178
|
+
</a>
|
179
|
+
<div class="talk-listing-meta">
|
180
|
+
<h3 class="title">
|
181
|
+
<a href="/ferperales/from-just-hired-to-just-graduated">From just hired to just graduated</a>
|
182
|
+
</h3>
|
183
|
+
<p class="date">
|
184
|
+
Jun 6, 2013 by
|
185
|
+
<a href="/ferperales">Fernando Perales</a></p>
|
186
|
+
</div>
|
187
|
+
</div>
|
188
|
+
|
189
|
+
<div class="talk public" data-id="a93b60209e7501301b2f469a61e096c5" data-slide-count="96">
|
190
|
+
<a class="slide_preview scrub" href="/ferperales/termine-la-universidad-ahora-que-hago">
|
191
|
+
<img alt="Thumb_slide_0" src="https://speakerd.s3.amazonaws.com/presentations/a93b60209e7501301b2f469a61e096c5/thumb_slide_0.jpg" />
|
192
|
+
<div class="scrubber"><div class="scrubbed" style="width:0;"></div></div>
|
193
|
+
</a>
|
194
|
+
<div class="talk-listing-meta">
|
195
|
+
<h3 class="title">
|
196
|
+
<a href="/ferperales/termine-la-universidad-ahora-que-hago">Terminé la universidad: ¿ahora qué hago?</a>
|
197
|
+
</h3>
|
198
|
+
<p class="date">
|
199
|
+
May 14, 2013 by
|
200
|
+
<a href="/ferperales">Fernando Perales</a></p>
|
201
|
+
</div>
|
202
|
+
</div>
|
203
|
+
|
204
|
+
<div class="talk public" data-id="6dcd02400e8901305c251231382037e3" data-slide-count="13">
|
205
|
+
<a class="slide_preview scrub" href="/ferperales/songfly-dot-me">
|
206
|
+
<img alt="Thumb_slide_0" src="https://speakerd.s3.amazonaws.com/presentations/6dcd02400e8901305c251231382037e3/thumb_slide_0.jpg" />
|
207
|
+
<div class="scrubber"><div class="scrubbed" style="width:0;"></div></div>
|
208
|
+
</a>
|
209
|
+
<div class="talk-listing-meta">
|
210
|
+
<h3 class="title">
|
211
|
+
<a href="/ferperales/songfly-dot-me">Songfly.me</a>
|
212
|
+
</h3>
|
213
|
+
<p class="date">
|
214
|
+
Mar 21, 2013 by
|
215
|
+
<a href="/ferperales">Fernando Perales</a></p>
|
216
|
+
</div>
|
217
|
+
</div>
|
218
|
+
|
219
|
+
<div class="talk public" data-id="41d02bf05ce00130605912313d141deb" data-slide-count="22">
|
220
|
+
<a class="slide_preview scrub" href="/ferperales/hackergarage">
|
221
|
+
<img alt="Thumb_slide_0" src="https://speakerd.s3.amazonaws.com/presentations/41d02bf05ce00130605912313d141deb/thumb_slide_0.jpg" />
|
222
|
+
<div class="scrubber"><div class="scrubbed" style="width:0;"></div></div>
|
223
|
+
</a>
|
224
|
+
<div class="talk-listing-meta">
|
225
|
+
<h3 class="title">
|
226
|
+
<a href="/ferperales/hackergarage">HackerGarage</a>
|
227
|
+
</h3>
|
228
|
+
<p class="date">
|
229
|
+
Feb 19, 2013 by
|
230
|
+
<a href="/ferperales">Fernando Perales</a></p>
|
231
|
+
</div>
|
232
|
+
</div>
|
233
|
+
|
234
|
+
<div class="talk public" data-id="41cbae301bd30130ead722000a1c80bb" data-slide-count="16">
|
235
|
+
<a class="slide_preview scrub" href="/ferperales/eventos-hg">
|
236
|
+
<img alt="Thumb_slide_0" src="https://speakerd.s3.amazonaws.com/presentations/41cbae301bd30130ead722000a1c80bb/thumb_slide_0.jpg" />
|
237
|
+
<div class="scrubber"><div class="scrubbed" style="width:0;"></div></div>
|
238
|
+
</a>
|
239
|
+
<div class="talk-listing-meta">
|
240
|
+
<h3 class="title">
|
241
|
+
<a href="/ferperales/eventos-hg">Eventos HG</a>
|
242
|
+
</h3>
|
243
|
+
<p class="date">
|
244
|
+
Nov 28, 2012 by
|
245
|
+
<a href="/ferperales">Fernando Perales</a></p>
|
246
|
+
</div>
|
247
|
+
</div>
|
248
|
+
|
249
|
+
<div class="talk public" data-id="50799967cd5250000207dfe2" data-slide-count="17">
|
250
|
+
<a class="slide_preview scrub" href="/ferperales/strings-and-ranges-in-ruby">
|
251
|
+
<img alt="Thumb_slide_0" src="https://speakerd.s3.amazonaws.com/presentations/50799967cd5250000207dfe2/thumb_slide_0.jpg" />
|
252
|
+
<div class="scrubber"><div class="scrubbed" style="width:0;"></div></div>
|
253
|
+
</a>
|
254
|
+
<div class="talk-listing-meta">
|
255
|
+
<h3 class="title">
|
256
|
+
<a href="/ferperales/strings-and-ranges-in-ruby">Strings and ranges in Ruby</a>
|
257
|
+
</h3>
|
258
|
+
<p class="date">
|
259
|
+
Oct 13, 2012 by
|
260
|
+
<a href="/ferperales">Fernando Perales</a></p>
|
261
|
+
</div>
|
262
|
+
</div>
|
263
|
+
|
264
|
+
<div class="talk public" data-id="5063daf9d6efd30002040027" data-slide-count="33">
|
265
|
+
<a class="slide_preview scrub" href="/ferperales/ninjavascript">
|
266
|
+
<img alt="Thumb_slide_0" src="https://speakerd.s3.amazonaws.com/presentations/5063daf9d6efd30002040027/thumb_slide_0.jpg" />
|
267
|
+
<div class="scrubber"><div class="scrubbed" style="width:0;"></div></div>
|
268
|
+
</a>
|
269
|
+
<div class="talk-listing-meta">
|
270
|
+
<h3 class="title">
|
271
|
+
<a href="/ferperales/ninjavascript">ninJavascript</a>
|
272
|
+
</h3>
|
273
|
+
<p class="date">
|
274
|
+
Sep 27, 2012 by
|
275
|
+
<a href="/ferperales">Fernando Perales</a></p>
|
276
|
+
</div>
|
277
|
+
</div>
|
278
|
+
|
279
|
+
<div class="talk public" data-id="5063dc09ca52410002040a1c" data-slide-count="21">
|
280
|
+
<a class="slide_preview scrub" href="/ferperales/ajax">
|
281
|
+
<img alt="Thumb_slide_0" src="https://speakerd.s3.amazonaws.com/presentations/5063dc09ca52410002040a1c/thumb_slide_0.jpg" />
|
282
|
+
<div class="scrubber"><div class="scrubbed" style="width:0;"></div></div>
|
283
|
+
</a>
|
284
|
+
<div class="talk-listing-meta">
|
285
|
+
<h3 class="title">
|
286
|
+
<a href="/ferperales/ajax">AJAX</a>
|
287
|
+
</h3>
|
288
|
+
<p class="date">
|
289
|
+
Sep 27, 2012 by
|
290
|
+
<a href="/ferperales">Fernando Perales</a></p>
|
291
|
+
</div>
|
292
|
+
</div>
|
293
|
+
|
294
|
+
<div class="talk public" data-id="5063dbc8d6efd3000204029c" data-slide-count="11">
|
295
|
+
<a class="slide_preview scrub" href="/ferperales/json">
|
296
|
+
<img alt="Thumb_slide_0" src="https://speakerd.s3.amazonaws.com/presentations/5063dbc8d6efd3000204029c/thumb_slide_0.jpg" />
|
297
|
+
<div class="scrubber"><div class="scrubbed" style="width:0;"></div></div>
|
298
|
+
</a>
|
299
|
+
<div class="talk-listing-meta">
|
300
|
+
<h3 class="title">
|
301
|
+
<a href="/ferperales/json">JSON</a>
|
302
|
+
</h3>
|
303
|
+
<p class="date">
|
304
|
+
Sep 27, 2012 by
|
305
|
+
<a href="/ferperales">Fernando Perales</a></p>
|
306
|
+
</div>
|
307
|
+
</div>
|
308
|
+
|
309
|
+
<div class="talk empty"><div class="slide_preview"></div></div>
|
310
|
+
|
311
|
+
</div>
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
</div>
|
316
|
+
|
317
|
+
<div class="sidebar">
|
318
|
+
<div class="sidebar">
|
319
|
+
<h1>Speaker Details</h1>
|
320
|
+
<a href="/ferperales" class="bio_mugshot"><img alt="597e300a2878d54443eeb8cbde63edad?s=47" src="//secure.gravatar.com/avatar/597e300a2878d54443eeb8cbde63edad?s=47" /></a>
|
321
|
+
<h2>Fernando Perales</h2>
|
322
|
+
<div class="bio"><p><a href="http://ferperales.net/" rel="nofollow">http://ferperales.net/</a></p></div>
|
323
|
+
|
324
|
+
<ul class="delimited">
|
325
|
+
<li><a href="/ferperales/stars">7 Stars</a></li>
|
326
|
+
</ul>
|
327
|
+
|
328
|
+
<a href="/account" class="button">Edit My Account</a>
|
329
|
+
|
330
|
+
|
331
|
+
</div>
|
332
|
+
|
333
|
+
</div>
|
334
|
+
</div>
|
335
|
+
</section>
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
</div>
|
340
|
+
|
341
|
+
<footer>
|
342
|
+
<div class="container">
|
343
|
+
<span class="copyright">
|
344
|
+
<img alt="Invertocat" src="https://d2dfho4r6t7asi.cloudfront.net/assets/invertocat-f10d7398407ff679b054b8c4c86aa639.svg" />
|
345
|
+
<div class="copyright-text">Copyright © 2014 <a href="http://github.com">GitHub</a> Inc.
|
346
|
+
<div class="crumb">All slide content and descriptions are owned by their creators.</div>
|
347
|
+
</div>
|
348
|
+
</span>
|
349
|
+
|
350
|
+
<ul class="links">
|
351
|
+
<li><a href="/faq">F.A.Q.</a></li>
|
352
|
+
<li><a href="/tos">Terms of Service</a></li>
|
353
|
+
<li><a href="/privacy">Privacy Policy</a></li>
|
354
|
+
</ul>
|
355
|
+
</div>
|
356
|
+
</footer>
|
357
|
+
|
358
|
+
<script type="text/javascript">
|
359
|
+
var _gaq = _gaq || [];
|
360
|
+
_gaq.push(['_setAccount', 'UA-19290517-1']);
|
361
|
+
_gaq.push(['_setDomainName', '.speakerdeck.com']);
|
362
|
+
_gaq.push(['_trackPageview']);
|
363
|
+
|
364
|
+
(function() {
|
365
|
+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
366
|
+
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
367
|
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
368
|
+
})();
|
369
|
+
</script>
|
370
|
+
|
371
|
+
|
372
|
+
<script type="text/javascript">
|
373
|
+
(function() {
|
374
|
+
var t = document.createElement('script');
|
375
|
+
t.type = 'text/javascript';
|
376
|
+
t.async = true;
|
377
|
+
t.id = 'gauges-tracker';
|
378
|
+
t.setAttribute('data-site-id',
|
379
|
+
'4dd2a2b5613f5d2021000005');
|
380
|
+
t.src = '//secure.gaug.es/track.js';
|
381
|
+
var s = document.getElementsByTagName('script')[0];
|
382
|
+
s.parentNode.insertBefore(t, s);
|
383
|
+
})();
|
384
|
+
</script>
|
385
|
+
|
386
|
+
</body>
|
387
|
+
</html>
|
388
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module SpeakerdeckApi
|
4
|
+
describe Connection do
|
5
|
+
|
6
|
+
let(:valid_speaker) { 'ferperales' }
|
7
|
+
let(:invalid_speaker) { 'jondoe' }
|
8
|
+
let(:subject) { SpeakerdeckApi::Connection }
|
9
|
+
|
10
|
+
it 'has a base URL' do
|
11
|
+
expect(subject::BASE_URL).to be_eql('https://speakerdeck.com/')
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '.get_speaker_data' do
|
15
|
+
context 'with valid url' do
|
16
|
+
it 'returns a parseable object' do
|
17
|
+
expect(subject.new.get_speaker_data(valid_speaker)).to be_a Nokogiri::HTML::Document
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'with invalid url' do
|
23
|
+
it 'raises a OpenURI::HTTPError' do
|
24
|
+
expect { subject.new.get_speaker_data(invalid_speaker)}.to raise_error OpenURI::HTTPError
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
describe '.url_for_speaker' do
|
31
|
+
it 'returns the correct URL' do
|
32
|
+
expect(subject.new.url_for_speaker('ferperales')).to be_eql('https://speakerdeck.com/ferperales')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module SpeakerdeckApi
|
2
|
+
describe Parser do
|
3
|
+
|
4
|
+
let(:speaker_profile_page) do
|
5
|
+
path = File.join(File.dirname(File.expand_path(__FILE__)), "../fixtures/speaker_profile.html")
|
6
|
+
f = File.open(path)
|
7
|
+
doc = Nokogiri::XML(f)
|
8
|
+
f.close
|
9
|
+
doc
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'speakers' do
|
13
|
+
describe '.get_speaker_details' do
|
14
|
+
context 'valid speaker' do
|
15
|
+
|
16
|
+
it 'contains the "number of talks" key' do
|
17
|
+
expect(subject.get_speaker_details(speaker_profile_page)).to have_key(:number_of_talks)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'contains the right value' do
|
21
|
+
expect(subject.get_speaker_details(speaker_profile_page).values_at(:number_of_talks)).to eql([14])
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module SpeakerdeckApi
|
4
|
+
describe Speaker do
|
5
|
+
|
6
|
+
let!(:subject) { SpeakerdeckApi::Speaker }
|
7
|
+
|
8
|
+
describe '.get' do
|
9
|
+
|
10
|
+
context 'with invalid username' do
|
11
|
+
|
12
|
+
it 'throws a SpeakerNotFoundException' do
|
13
|
+
expect { subject.get('fake123') }.to raise_error(SpeakerdeckApi::Exceptions::SpeakerNotFoundException)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'with a valid username' do
|
19
|
+
it 'returns a SpeakerdeckApi::Speaker object' do
|
20
|
+
expect(subject.get('ferperales')).to be_a SpeakerdeckApi::Speaker
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'contains the number of talks' do
|
24
|
+
expect(subject.get('ferperales')).to respond_to :number_of_talks
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'contains the number of talks' do
|
28
|
+
expect(subject.get('ferperales').number_of_talks).to eql 14
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: speakerdeck_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Fer Perales
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: nokogiri
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry-byebug
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description:
|
98
|
+
email:
|
99
|
+
- me@ferperales.net
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".travis.yml"
|
106
|
+
- Gemfile
|
107
|
+
- LICENSE.txt
|
108
|
+
- README.md
|
109
|
+
- Rakefile
|
110
|
+
- lib/speakerdeck_api.rb
|
111
|
+
- lib/speakerdeck_api/connection.rb
|
112
|
+
- lib/speakerdeck_api/exceptions/speaker_not_found_exception.rb
|
113
|
+
- lib/speakerdeck_api/parser.rb
|
114
|
+
- lib/speakerdeck_api/speaker.rb
|
115
|
+
- lib/speakerdeck_api/version.rb
|
116
|
+
- speakerdeck_api.gemspec
|
117
|
+
- spec/fixtures/speaker_profile.html
|
118
|
+
- spec/speakerdeck_api/connection_spec.rb
|
119
|
+
- spec/speakerdeck_api/parser_spec.rb
|
120
|
+
- spec/speakerdeck_api/speaker_spec.rb
|
121
|
+
- spec/speakerdeck_api_spec.rb
|
122
|
+
- spec/spec_helper.rb
|
123
|
+
homepage: ''
|
124
|
+
licenses:
|
125
|
+
- MIT
|
126
|
+
metadata: {}
|
127
|
+
post_install_message:
|
128
|
+
rdoc_options: []
|
129
|
+
require_paths:
|
130
|
+
- lib
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
requirements: []
|
142
|
+
rubyforge_project:
|
143
|
+
rubygems_version: 2.2.2
|
144
|
+
signing_key:
|
145
|
+
specification_version: 4
|
146
|
+
summary: A gem for getting data from speakerdeck.com
|
147
|
+
test_files:
|
148
|
+
- spec/fixtures/speaker_profile.html
|
149
|
+
- spec/speakerdeck_api/connection_spec.rb
|
150
|
+
- spec/speakerdeck_api/parser_spec.rb
|
151
|
+
- spec/speakerdeck_api/speaker_spec.rb
|
152
|
+
- spec/speakerdeck_api_spec.rb
|
153
|
+
- spec/spec_helper.rb
|