quorable 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/Gemfile +9 -7
- data/Gemfile.lock +32 -0
- data/{README.rdoc → README.md} +9 -6
- data/Rakefile +17 -21
- data/VERSION +1 -1
- data/bin/quera +1 -1
- data/lib/quorable.rb +4 -1
- data/quorable.gemspec +10 -7
- data/spec/quorable_spec.rb +21 -0
- data/spec/spec_helper.rb +28 -0
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a8f6162dfedaa08056fa29991b4aa1e3d758ef4
|
4
|
+
data.tar.gz: 62cb98ae8816e65a16c203605ce89b83c400a99d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc9deea422de34bd3de7fac07bd4e67787c705e8a21e1074461d3b1ded8383cbb1da821018e941f416be1651ce7f70ccd11d090acabe540c40db51afe5821845
|
7
|
+
data.tar.gz: 297f3603f44e09c1d1fdb3e316bb1c101c1d94f0e410785f3a5ae2abbcc3ab9b62322636fa5afbda4b2056692fe1c19ae402d30f489432a8fd8614bc95f933e4
|
data/.rspec
ADDED
data/Gemfile
CHANGED
@@ -1,10 +1,7 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
# gem "activesupport", ">= 2.3.5"
|
5
2
|
|
6
|
-
|
7
|
-
|
3
|
+
gem 'nokogiri'
|
4
|
+
|
8
5
|
group :development do
|
9
6
|
gem "pry"
|
10
7
|
gem "shoulda", ">= 0"
|
@@ -12,7 +9,12 @@ group :development do
|
|
12
9
|
gem "bundler", "~> 1.0"
|
13
10
|
gem "jeweler", "~> 1.8.7"
|
14
11
|
gem "simplecov"
|
15
|
-
# gem "rcov", ">= 0"
|
16
12
|
end
|
17
13
|
|
18
|
-
|
14
|
+
group :test do
|
15
|
+
gem 'rspec'
|
16
|
+
gem 'webmock'
|
17
|
+
gem 'simplecov'
|
18
|
+
gem 'coveralls'
|
19
|
+
gem 'shoulda-matchers'
|
20
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -11,6 +11,15 @@ GEM
|
|
11
11
|
atomic (1.1.14)
|
12
12
|
builder (3.2.2)
|
13
13
|
coderay (1.1.0)
|
14
|
+
coveralls (0.7.0)
|
15
|
+
multi_json (~> 1.3)
|
16
|
+
rest-client
|
17
|
+
simplecov (>= 0.7)
|
18
|
+
term-ansicolor
|
19
|
+
thor
|
20
|
+
crack (0.4.1)
|
21
|
+
safe_yaml (~> 0.9.0)
|
22
|
+
diff-lcs (1.2.5)
|
14
23
|
docile (1.1.0)
|
15
24
|
faraday (0.8.8)
|
16
25
|
multipart-post (~> 1.2.0)
|
@@ -39,6 +48,7 @@ GEM
|
|
39
48
|
jwt (0.1.8)
|
40
49
|
multi_json (>= 1.5)
|
41
50
|
method_source (0.8.2)
|
51
|
+
mime-types (1.25.1)
|
42
52
|
minitest (4.7.5)
|
43
53
|
multi_json (1.8.2)
|
44
54
|
multi_xml (0.5.5)
|
@@ -59,6 +69,17 @@ GEM
|
|
59
69
|
rake (10.1.0)
|
60
70
|
rdoc (3.12.2)
|
61
71
|
json (~> 1.4)
|
72
|
+
rest-client (1.6.7)
|
73
|
+
mime-types (>= 1.16)
|
74
|
+
rspec (2.14.1)
|
75
|
+
rspec-core (~> 2.14.0)
|
76
|
+
rspec-expectations (~> 2.14.0)
|
77
|
+
rspec-mocks (~> 2.14.0)
|
78
|
+
rspec-core (2.14.7)
|
79
|
+
rspec-expectations (2.14.4)
|
80
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
81
|
+
rspec-mocks (2.14.4)
|
82
|
+
safe_yaml (0.9.7)
|
62
83
|
shoulda (3.5.0)
|
63
84
|
shoulda-context (~> 1.0, >= 1.0.1)
|
64
85
|
shoulda-matchers (>= 1.4.1, < 3.0)
|
@@ -71,18 +92,29 @@ GEM
|
|
71
92
|
simplecov-html (~> 0.8.0)
|
72
93
|
simplecov-html (0.8.0)
|
73
94
|
slop (3.4.7)
|
95
|
+
term-ansicolor (1.2.2)
|
96
|
+
tins (~> 0.8)
|
97
|
+
thor (0.18.1)
|
74
98
|
thread_safe (0.1.3)
|
75
99
|
atomic
|
100
|
+
tins (0.12.0)
|
76
101
|
tzinfo (0.3.38)
|
102
|
+
webmock (1.15.0)
|
103
|
+
addressable (>= 2.2.7)
|
104
|
+
crack (>= 0.3.2)
|
77
105
|
|
78
106
|
PLATFORMS
|
79
107
|
ruby
|
80
108
|
|
81
109
|
DEPENDENCIES
|
82
110
|
bundler (~> 1.0)
|
111
|
+
coveralls
|
83
112
|
jeweler (~> 1.8.7)
|
84
113
|
nokogiri
|
85
114
|
pry
|
86
115
|
rdoc (~> 3.12)
|
116
|
+
rspec
|
87
117
|
shoulda
|
118
|
+
shoulda-matchers
|
88
119
|
simplecov
|
120
|
+
webmock
|
data/{README.rdoc → README.md}
RENAMED
@@ -1,8 +1,12 @@
|
|
1
|
-
|
1
|
+
# quorable
|
2
2
|
|
3
|
-
|
3
|
+
quorable is a Ruby gem that aims to be the unofficial API for Quora. Under construction. Lots to build, a lot is broken, but the foundation is being laid. Feel free to pitch in.
|
4
4
|
|
5
|
-
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
`gem install quorable`
|
8
|
+
|
9
|
+
## Contributing to quorable
|
6
10
|
|
7
11
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
8
12
|
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
@@ -12,8 +16,7 @@ Description goes here.
|
|
12
16
|
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
17
|
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
18
|
|
15
|
-
|
19
|
+
## Copyright
|
16
20
|
|
17
|
-
Copyright (c) 2013 Rahul Horé. See LICENSE.txt for
|
18
|
-
further details.
|
21
|
+
Copyright (c) 2013 Rahul Horé. See LICENSE.txt for further details.
|
19
22
|
|
data/Rakefile
CHANGED
@@ -11,6 +11,9 @@ rescue Bundler::BundlerError => e
|
|
11
11
|
end
|
12
12
|
require 'rake'
|
13
13
|
|
14
|
+
# require 'rspec/core/rake_task'
|
15
|
+
# RSpec::Core::RakeTask.new(:spec)
|
16
|
+
|
14
17
|
require 'jeweler'
|
15
18
|
Jeweler::Tasks.new do |gem|
|
16
19
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
@@ -18,36 +21,29 @@ Jeweler::Tasks.new do |gem|
|
|
18
21
|
gem.homepage = "http://github.com/O-I/quorable"
|
19
22
|
gem.license = "MIT"
|
20
23
|
gem.summary = %Q{A quasi-API for Quora}
|
21
|
-
gem.description = %Q{Still need to add some more functionality. Right now, all this does is get the 10 most recent paths for a given topic.}
|
24
|
+
gem.description = %Q{Still need to add some more functionality. Right now, all this does is get the 10 (or fewer) most recent paths for a given topic.}
|
22
25
|
gem.email = "hore.rahul@gmail.com"
|
23
26
|
gem.authors = ["Rahul Horé"]
|
24
27
|
# dependencies defined in Gemfile
|
25
28
|
end
|
26
29
|
Jeweler::RubygemsDotOrgTasks.new
|
27
30
|
|
28
|
-
|
29
|
-
|
30
|
-
test.libs << 'lib' << 'test'
|
31
|
-
test.pattern = 'test/**/test_*.rb'
|
32
|
-
test.verbose = true
|
33
|
-
end
|
31
|
+
task default: :spec
|
32
|
+
task test: :spec
|
34
33
|
|
35
|
-
# require '
|
36
|
-
#
|
37
|
-
# test.libs << 'test'
|
34
|
+
# require 'rake/testtask'
|
35
|
+
# Rake::TestTask.new(:test) do |test|
|
36
|
+
# test.libs << 'lib' << 'test'
|
38
37
|
# test.pattern = 'test/**/test_*.rb'
|
39
38
|
# test.verbose = true
|
40
|
-
# test.rcov_opts << '--exclude "gems/*"'
|
41
39
|
# end
|
42
40
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
Rake::RDocTask.new do |rdoc|
|
47
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
41
|
+
# require 'rdoc/task'
|
42
|
+
# Rake::RDocTask.new do |rdoc|
|
43
|
+
# version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
44
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
45
|
+
# rdoc.rdoc_dir = 'rdoc'
|
46
|
+
# rdoc.title = "quorable #{version}"
|
47
|
+
# rdoc.rdoc_files.include('README*')
|
48
|
+
# rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
+
# end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.7
|
data/bin/quera
CHANGED
data/lib/quorable.rb
CHANGED
@@ -7,9 +7,12 @@ module Quorable
|
|
7
7
|
|
8
8
|
def self.feed(topic)
|
9
9
|
doc = Nokogiri::HTML.parse(open("#{BASE_URL}/#{Quorable.parameterize(topic)}"))
|
10
|
-
paths = doc.css('.question_link').map { |link| link['href'] }
|
10
|
+
paths = doc.css('.question_link').map { |link| "#{BASE_URL}#{link['href']}" }
|
11
|
+
paths
|
11
12
|
end
|
12
13
|
|
14
|
+
private
|
15
|
+
|
13
16
|
def self.parameterize(topic)
|
14
17
|
topic.split(' ').map(&:downcase).map(&:capitalize).join('-')
|
15
18
|
end
|
data/quorable.gemspec
CHANGED
@@ -2,33 +2,36 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: quorable 0.1.
|
5
|
+
# stub: quorable 0.1.7 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "quorable"
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.7"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.authors = ["Rahul Hor\u{e9}"]
|
13
|
-
s.date = "2013-11-
|
14
|
-
s.description = "Still need to add some more functionality. Right now, all this does is get the 10 most recent paths for a given topic."
|
13
|
+
s.date = "2013-11-26"
|
14
|
+
s.description = "Still need to add some more functionality. Right now, all this does is get the 10 (or fewer) most recent paths for a given topic."
|
15
15
|
s.email = "hore.rahul@gmail.com"
|
16
16
|
s.executables = ["quera"]
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE.txt",
|
19
|
-
"README.
|
19
|
+
"README.md"
|
20
20
|
]
|
21
21
|
s.files = [
|
22
22
|
".document",
|
23
|
+
".rspec",
|
23
24
|
"Gemfile",
|
24
25
|
"Gemfile.lock",
|
25
26
|
"LICENSE.txt",
|
26
|
-
"README.
|
27
|
+
"README.md",
|
27
28
|
"Rakefile",
|
28
29
|
"VERSION",
|
29
30
|
"bin/quera",
|
30
31
|
"lib/quorable.rb",
|
31
|
-
"quorable.gemspec"
|
32
|
+
"quorable.gemspec",
|
33
|
+
"spec/quorable_spec.rb",
|
34
|
+
"spec/spec_helper.rb"
|
32
35
|
]
|
33
36
|
s.homepage = "http://github.com/O-I/quorable"
|
34
37
|
s.licenses = ["MIT"]
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Quorable do
|
4
|
+
describe '.feed' do
|
5
|
+
before do
|
6
|
+
stub_request(:get, "http://www.quora.com/Music").
|
7
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
|
8
|
+
to_return(:status => 200, :body => "", :headers => {})
|
9
|
+
end
|
10
|
+
it 'returns an array of 10 or fewer paths to the Quora topic provided' do
|
11
|
+
expect(Quorable.feed('music')).to eq []
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '.parameterize' do
|
16
|
+
it 'parameterizes a word' do
|
17
|
+
result = Quorable.parameterize('happy days')
|
18
|
+
expect(result).to eq 'Happy-Days'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'coveralls'
|
3
|
+
|
4
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
5
|
+
SimpleCov::Formatter::HTMLFormatter,
|
6
|
+
Coveralls::SimpleCov::Formatter
|
7
|
+
]
|
8
|
+
SimpleCov.start
|
9
|
+
|
10
|
+
require 'quorable'
|
11
|
+
require 'rspec'
|
12
|
+
require 'webmock/rspec'
|
13
|
+
require 'json'
|
14
|
+
|
15
|
+
RSpec.configure do |config|
|
16
|
+
config.order = 'random'
|
17
|
+
config.expect_with :rspec do |c|
|
18
|
+
c.syntax = :expect
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def fixture_path
|
23
|
+
File.expand_path('../fixtures', __FILE__)
|
24
|
+
end
|
25
|
+
|
26
|
+
def fixture(file)
|
27
|
+
File.new(fixture_path + '/' + file)
|
28
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quorable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rahul Horé
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -109,25 +109,28 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
description: Still need to add some more functionality. Right now, all this does is
|
112
|
-
get the 10 most recent paths for a given topic.
|
112
|
+
get the 10 (or fewer) most recent paths for a given topic.
|
113
113
|
email: hore.rahul@gmail.com
|
114
114
|
executables:
|
115
115
|
- quera
|
116
116
|
extensions: []
|
117
117
|
extra_rdoc_files:
|
118
118
|
- LICENSE.txt
|
119
|
-
- README.
|
119
|
+
- README.md
|
120
120
|
files:
|
121
121
|
- .document
|
122
|
+
- .rspec
|
122
123
|
- Gemfile
|
123
124
|
- Gemfile.lock
|
124
125
|
- LICENSE.txt
|
125
|
-
- README.
|
126
|
+
- README.md
|
126
127
|
- Rakefile
|
127
128
|
- VERSION
|
128
129
|
- bin/quera
|
129
130
|
- lib/quorable.rb
|
130
131
|
- quorable.gemspec
|
132
|
+
- spec/quorable_spec.rb
|
133
|
+
- spec/spec_helper.rb
|
131
134
|
homepage: http://github.com/O-I/quorable
|
132
135
|
licenses:
|
133
136
|
- MIT
|