hn-api 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +70 -0
- data/LICENSE.txt +20 -0
- data/README.md +21 -0
- data/Rakefile +43 -0
- data/VERSION +1 -0
- data/bin/hn-api +6 -0
- data/hn-api.gemspec +82 -0
- data/lib/hn-api.rb +7 -0
- data/lib/hn-api/client.rb +26 -0
- data/spec/client_spec.rb +10 -0
- data/spec/fixtures/page.json +1 -0
- data/spec/spec_helper.rb +12 -0
- metadata +242 -0
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gem 'rake'
|
4
|
+
gem 'jruby-openssl', :platforms => :jruby
|
5
|
+
gem 'faraday'
|
6
|
+
gem 'faraday_middleware'
|
7
|
+
gem 'hashie'
|
8
|
+
|
9
|
+
group :development do
|
10
|
+
gem 'rspec', '~> 2.11.0'
|
11
|
+
gem 'shoulda', '>= 0'
|
12
|
+
gem 'rdoc', '~> 3.12'
|
13
|
+
gem 'jeweler', '~> 1.8.4'
|
14
|
+
gem 'webmock'
|
15
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (3.2.11)
|
5
|
+
i18n (~> 0.6)
|
6
|
+
multi_json (~> 1.0)
|
7
|
+
addressable (2.3.2)
|
8
|
+
bouncy-castle-java (1.5.0146.1)
|
9
|
+
bourne (1.1.2)
|
10
|
+
mocha (= 0.10.5)
|
11
|
+
crack (0.3.2)
|
12
|
+
diff-lcs (1.1.3)
|
13
|
+
faraday (0.8.4)
|
14
|
+
multipart-post (~> 1.1)
|
15
|
+
faraday_middleware (0.9.0)
|
16
|
+
faraday (>= 0.7.4, < 0.9)
|
17
|
+
git (1.2.5)
|
18
|
+
hashie (1.2.0)
|
19
|
+
i18n (0.6.1)
|
20
|
+
jeweler (1.8.4)
|
21
|
+
bundler (~> 1.0)
|
22
|
+
git (>= 1.2.5)
|
23
|
+
rake
|
24
|
+
rdoc
|
25
|
+
jruby-openssl (0.8.2)
|
26
|
+
bouncy-castle-java (>= 1.5.0146.1)
|
27
|
+
json (1.7.6)
|
28
|
+
json (1.7.6-java)
|
29
|
+
metaclass (0.0.1)
|
30
|
+
mocha (0.10.5)
|
31
|
+
metaclass (~> 0.0.1)
|
32
|
+
multi_json (1.5.0)
|
33
|
+
multipart-post (1.1.5)
|
34
|
+
rake (10.0.3)
|
35
|
+
rdoc (3.12)
|
36
|
+
json (~> 1.4)
|
37
|
+
rspec (2.11.0)
|
38
|
+
rspec-core (~> 2.11.0)
|
39
|
+
rspec-expectations (~> 2.11.0)
|
40
|
+
rspec-mocks (~> 2.11.0)
|
41
|
+
rspec-core (2.11.1)
|
42
|
+
rspec-expectations (2.11.3)
|
43
|
+
diff-lcs (~> 1.1.3)
|
44
|
+
rspec-mocks (2.11.3)
|
45
|
+
shoulda (3.3.2)
|
46
|
+
shoulda-context (~> 1.0.1)
|
47
|
+
shoulda-matchers (~> 1.4.1)
|
48
|
+
shoulda-context (1.0.2)
|
49
|
+
shoulda-matchers (1.4.2)
|
50
|
+
activesupport (>= 3.0.0)
|
51
|
+
bourne (~> 1.1.2)
|
52
|
+
webmock (1.9.0)
|
53
|
+
addressable (>= 2.2.7)
|
54
|
+
crack (>= 0.1.7)
|
55
|
+
|
56
|
+
PLATFORMS
|
57
|
+
java
|
58
|
+
ruby
|
59
|
+
|
60
|
+
DEPENDENCIES
|
61
|
+
faraday
|
62
|
+
faraday_middleware
|
63
|
+
hashie
|
64
|
+
jeweler (~> 1.8.4)
|
65
|
+
jruby-openssl
|
66
|
+
rake
|
67
|
+
rdoc (~> 3.12)
|
68
|
+
rspec (~> 2.11.0)
|
69
|
+
shoulda
|
70
|
+
webmock
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 Sébastien Le Callonnec
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
= hn-api
|
2
|
+
|
3
|
+
Ruby interface to api.ihackernews.com
|
4
|
+
|
5
|
+
hn-api is based on [Faraday](http://rubydoc.info/gems/faraday/0.8.4/frames)
|
6
|
+
|
7
|
+
== Contributing to hn-api
|
8
|
+
|
9
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
10
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
11
|
+
* Fork the project.
|
12
|
+
* Start a feature/bugfix branch.
|
13
|
+
* Commit and push until you are happy with your contribution.
|
14
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
15
|
+
* 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.
|
16
|
+
|
17
|
+
== Copyright
|
18
|
+
|
19
|
+
Copyright (c) 2013 Sébastien Le Callonnec. See LICENSE.txt for
|
20
|
+
further details.
|
21
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'bundler'
|
3
|
+
|
4
|
+
begin
|
5
|
+
Bundler.setup(:default, :development)
|
6
|
+
rescue Bundler::BundlerError => e
|
7
|
+
$stderr.puts e.message
|
8
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
9
|
+
exit e.status_code
|
10
|
+
end
|
11
|
+
require 'rake'
|
12
|
+
|
13
|
+
require 'jeweler'
|
14
|
+
Jeweler::Tasks.new do |gem|
|
15
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
16
|
+
gem.name = "hn-api"
|
17
|
+
gem.homepage = "http://github.com/tychobrailleur/hn-api"
|
18
|
+
gem.license = "MIT"
|
19
|
+
gem.summary = %Q{Ruby interface to api.ihackernews.com}
|
20
|
+
gem.description = %Q{Ruby interface to api.ihackernews.com}
|
21
|
+
gem.email = "sebastien@weblogism.com"
|
22
|
+
gem.authors = ["Sébastien Le Callonnec"]
|
23
|
+
|
24
|
+
# Add executable to gem for debug purposes.
|
25
|
+
gem.executables = ['hn-api']
|
26
|
+
# dependencies defined in Gemfile
|
27
|
+
end
|
28
|
+
Jeweler::RubygemsDotOrgTasks.new
|
29
|
+
|
30
|
+
require 'rspec/core/rake_task'
|
31
|
+
RSpec::Core::RakeTask.new(:spec)
|
32
|
+
|
33
|
+
task :default => :spec
|
34
|
+
|
35
|
+
require 'rdoc/task'
|
36
|
+
Rake::RDocTask.new do |rdoc|
|
37
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
38
|
+
|
39
|
+
rdoc.rdoc_dir = 'rdoc'
|
40
|
+
rdoc.title = "hn-api #{version}"
|
41
|
+
rdoc.rdoc_files.include('README*')
|
42
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
43
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/bin/hn-api
ADDED
data/hn-api.gemspec
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "hn-api"
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["S\u{e9}bastien Le Callonnec"]
|
12
|
+
s.date = "2013-03-30"
|
13
|
+
s.description = "Ruby interface to api.ihackernews.com"
|
14
|
+
s.email = "sebastien@weblogism.com"
|
15
|
+
s.executables = ["hn-api"]
|
16
|
+
s.extra_rdoc_files = [
|
17
|
+
"LICENSE.txt",
|
18
|
+
"README.md"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".document",
|
22
|
+
".rspec",
|
23
|
+
"Gemfile",
|
24
|
+
"Gemfile.lock",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"README.md",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"bin/hn-api",
|
30
|
+
"hn-api.gemspec",
|
31
|
+
"lib/hn-api.rb",
|
32
|
+
"lib/hn-api/client.rb",
|
33
|
+
"spec/client_spec.rb",
|
34
|
+
"spec/fixtures/page.json",
|
35
|
+
"spec/spec_helper.rb"
|
36
|
+
]
|
37
|
+
s.homepage = "http://github.com/tychobrailleur/hn-api"
|
38
|
+
s.licenses = ["MIT"]
|
39
|
+
s.require_paths = ["lib"]
|
40
|
+
s.rubygems_version = "1.8.24"
|
41
|
+
s.summary = "Ruby interface to api.ihackernews.com"
|
42
|
+
|
43
|
+
if s.respond_to? :specification_version then
|
44
|
+
s.specification_version = 3
|
45
|
+
|
46
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
47
|
+
s.add_runtime_dependency(%q<rake>, [">= 0"])
|
48
|
+
s.add_runtime_dependency(%q<jruby-openssl>, [">= 0"])
|
49
|
+
s.add_runtime_dependency(%q<faraday>, [">= 0"])
|
50
|
+
s.add_runtime_dependency(%q<faraday_middleware>, [">= 0"])
|
51
|
+
s.add_runtime_dependency(%q<hashie>, [">= 0"])
|
52
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.11.0"])
|
53
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
54
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
55
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
56
|
+
s.add_development_dependency(%q<webmock>, [">= 0"])
|
57
|
+
else
|
58
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
59
|
+
s.add_dependency(%q<jruby-openssl>, [">= 0"])
|
60
|
+
s.add_dependency(%q<faraday>, [">= 0"])
|
61
|
+
s.add_dependency(%q<faraday_middleware>, [">= 0"])
|
62
|
+
s.add_dependency(%q<hashie>, [">= 0"])
|
63
|
+
s.add_dependency(%q<rspec>, ["~> 2.11.0"])
|
64
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
65
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
66
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
67
|
+
s.add_dependency(%q<webmock>, [">= 0"])
|
68
|
+
end
|
69
|
+
else
|
70
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
71
|
+
s.add_dependency(%q<jruby-openssl>, [">= 0"])
|
72
|
+
s.add_dependency(%q<faraday>, [">= 0"])
|
73
|
+
s.add_dependency(%q<faraday_middleware>, [">= 0"])
|
74
|
+
s.add_dependency(%q<hashie>, [">= 0"])
|
75
|
+
s.add_dependency(%q<rspec>, ["~> 2.11.0"])
|
76
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
77
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
78
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
79
|
+
s.add_dependency(%q<webmock>, [">= 0"])
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
data/lib/hn-api.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module HnApi
|
2
|
+
class Client
|
3
|
+
# Base URI for the HN API
|
4
|
+
URI = "http://api.ihackernews.com/" unless defined? HnApi::Client::URL
|
5
|
+
|
6
|
+
# Retrieve the latest posts from HN API, and transform into an object-like
|
7
|
+
# response with Hashie.
|
8
|
+
def latest
|
9
|
+
content = connection.get("/page").body
|
10
|
+
Hashie::Mash.new(content)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
# Create a new Faraday connection and memoize it.
|
15
|
+
def connection
|
16
|
+
@connection ||= Faraday.new(URI) do |conn|
|
17
|
+
conn.request :json
|
18
|
+
|
19
|
+
conn.response :json, :content_type => /\bjson$/
|
20
|
+
|
21
|
+
conn.use :instrumentation
|
22
|
+
conn.adapter Faraday.default_adapter
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/spec/client_spec.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe HnApi::Client do
|
4
|
+
subject { HnApi::Client.new }
|
5
|
+
|
6
|
+
it "returns the latest HN posts" do
|
7
|
+
stub_request(:get, HnApi::Client::URI + "page").to_return(body: fixture("page.json"), :headers => { content_type: "application/json; charset=utf-8" })
|
8
|
+
expect(subject.latest.items.first.title).to eq "The stupid cookie law is dead at last"
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{"nextId":null,"items":[{"title":"The stupid cookie law is dead at last","url":"http://blog.silktide.com/2013/01/the-stupid-cookie-law-is-dead-at-last/","id":5144422,"commentCount":7,"points":43,"postedAgo":"51 minutes ago","postedBy":"silktide"},{"title":"Cache Rules Everything Around Me","url":"http://iainkfraser.blogspot.co.uk/2013/01/cache-money-hoes-attached-code.html","id":5144325,"commentCount":8,"points":37,"postedAgo":"1 hour ago","postedBy":"scaramanga"},{"title":"Bitcoin hits year-high of $20","url":"http://bitcoincharts.com/charts/mtgoxUSD#tgSzm1g10zm2g25zv","id":5144181,"commentCount":17,"points":48,"postedAgo":"2 hours ago","postedBy":"redegg"},{"title":"Farewell to Regular Web Development Approaches","url":"http://devo.ps/blog/2013/01/31/farewell-to-regular-web-development-approaches.html","id":5144188,"commentCount":10,"points":29,"postedAgo":"2 hours ago","postedBy":"hunvreus"},{"title":"Chinese Hackers Infiltrate New York Times Computers","url":"http://www.nytimes.com/2013/01/31/technology/chinese-hackers-infiltrate-new-york-times-computers.html?pagewanted=all&_r=0","id":5143046,"commentCount":147,"points":248,"postedAgo":"9 hours ago","postedBy":"michael_nielsen"},{"title":"Amazon Profits Fall 45 Percent, Still the Most Amazing Company in the World","url":"http://www.slate.com/blogs/moneybox/2013/01/29/amazon_q4_profits_fall_45_percent.html","id":5143900,"commentCount":32,"points":48,"postedAgo":"4 hours ago","postedBy":"srlake"},{"title":"JSON Editor Online","url":"http://jsoneditoronline.org/","id":5143238,"commentCount":41,"points":116,"postedAgo":"8 hours ago","postedBy":"benackles"},{"title":"Blackberry\u0027s Euro MD ignores iPhone questions in BBC interview","url":"http://www.mcvuk.com/news/read/blackberry-s-euro-md-bates-ignores-iphone-questioning-on-bbc-radio-5live/0110091","id":5144244,"commentCount":8,"points":13,"postedAgo":"2 hours ago","postedBy":"iuguy"},{"title":"We Need to Have Sympathy for Those With Depression. It is an Illness","url":"http://www.bothsidesofthetable.com/2013/01/30/we-need-to-have-sympathy-for-those-with-depression-it-is-an-illness/","id":5143839,"commentCount":101,"points":99,"postedAgo":"5 hours ago","postedBy":"bcn"},{"title":"The Australian Computer Society should be disbanded","url":"http://www.linkedin.com/today/post/article/20130131000939-921366-the-australian-computer-society-should-be-disbanded","id":5142872,"commentCount":119,"points":143,"postedAgo":"10 hours ago","postedBy":"jennichen"},{"title":"Visual Studio and Team Foundation Server will have Git support","url":"http://blogs.msdn.com/b/bharry/archive/2013/01/30/git-init-vs.aspx","id":5140697,"commentCount":189,"points":365,"postedAgo":"18 hours ago","postedBy":"logictrip"},{"title":"Git is an editor, and rebase is the backspace key","url":"http://blog.izs.me/page/3","id":5144360,"commentCount":0,"points":7,"postedAgo":"1 hour ago","postedBy":"ColinWright"},{"title":"Are Placebos Really Sugar Pills?","url":"http://asserttrue.blogspot.com/2013/01/are-placebos-really-sugar-pills.html","id":5140049,"commentCount":131,"points":422,"postedAgo":"19 hours ago","postedBy":"techdog"},{"title":"Time Warner Boosts My Speed, Cuts My Bill","url":"http://consumerist.com/2013/01/30/time-warner-boosts-my-speed-cuts-my-bill-i-just-happen-to-live-near-google-fiber/","id":5142956,"commentCount":49,"points":97,"postedAgo":"9 hours ago","postedBy":"cjaredrun"},{"title":"Before there was Aaron Swartz, there was David LaMacchia","url":"http://www.bostonglobe.com/metro/2013/01/29/when-judgment-rewarded/2SdShgNQhA6FtgbkYS8aAP/story.html","id":5143897,"commentCount":0,"points":26,"postedAgo":"4 hours ago","postedBy":"theodpHN"},{"title":"MSFT: Modern.IE To Help Developers Test Their Web Apps For IE Versions","url":"http://techcrunch.com/2013/01/31/microsoft-launches-modern-ie-to-help-developers-test-their-web-apps-for-legacy-and-modern-versions-of-ie/","id":5144455,"commentCount":0,"points":4,"postedAgo":"40 minutes ago","postedBy":"iProject"},{"title":"How I Failed, Failed, and Finally Succeeded at Learning How to Code","url":"http://www.theatlantic.com/technology/print/2011/06/how-i-failed-failed-and-finally-succeeded-at-learning-how-to-code/239855#","id":5142325,"commentCount":51,"points":143,"postedAgo":"12 hours ago","postedBy":"ColinWright"},{"title":"The sound of the dialup, pictured","url":"http://windytan.blogspot.com/2012/11/the-sound-of-dialup-pictured.html","id":5140135,"commentCount":46,"points":328,"postedAgo":"19 hours ago","postedBy":"randomdrake"},{"title":"Rubygems.org compromised","url":"http://rubygems.org/gems/exploit/versions/22.31.31","id":5139583,"commentCount":150,"points":378,"postedAgo":"21 hours ago","postedBy":"benmmurphy"},{"title":"High Performance Networking in Google Chrome","url":"http://www.igvita.com/posa/high-performance-networking-in-google-chrome/","id":5141770,"commentCount":28,"points":168,"postedAgo":"14 hours ago","postedBy":"igrigorik"},{"title":"Transparency at the Office: Psst...This Is What Your Co-Worker Is Paid","url":"http://online.wsj.com/article/SB10001424127887323644904578272034121941000.html","id":5143439,"commentCount":38,"points":45,"postedAgo":"7 hours ago","postedBy":"coffeegeek"},{"title":"Australian police prosecute man for buying drugs via Tor and Silk Road","url":"http://www.theage.com.au/victoria/secret-website-harboured-drugs-smorgasbord-court-hears-20130131-2dlw3.html","id":5143555,"commentCount":29,"points":31,"postedAgo":"6 hours ago","postedBy":"jval"},{"title":"Firefox to block content based on Java, Reader, and Silverlight","url":"http://arstechnica.com/security/2013/01/firefox-to-block-content-based-on-java-reader-and-silverlight/","id":5143064,"commentCount":33,"points":51,"postedAgo":"9 hours ago","postedBy":"sk2code"},{"title":"Ruby deploys temporarily disabled","url":"https://status.heroku.com/incidents/489","id":5141069,"commentCount":92,"points":167,"postedAgo":"16 hours ago","postedBy":"ujeezy"},{"title":"Computer Scientists Find New Shortcuts for Traveling Salesman Problem","url":"https://simonsfoundation.org/features/science-news/computer-scientists-take-road-less-traveled/","id":5142480,"commentCount":2,"points":78,"postedAgo":"12 hours ago","postedBy":"co_pl_te"},{"title":"How to accept bitcoin donations on your website","url":"http://blog.coinbase.com/post/41907755756/allowing-custom-donation-amounts","id":5142796,"commentCount":13,"points":58,"postedAgo":"10 hours ago","postedBy":"barmstrong"},{"title":"Turn your browser into a notepad with one line","url":"https://coderwall.com/p/lhsrcq","id":5135194,"commentCount":175,"points":900,"postedAgo":"1 day ago","postedBy":"bitsweet"},{"title":"The Factory Floor: Picking (and Maintaining) a Partner","url":"http://www.bunniestudios.com/blog/?p=2794","id":5142374,"commentCount":5,"points":70,"postedAgo":"12 hours ago","postedBy":"dfox"},{"title":"Show HN: Launch your own hosted SelfStarter without writing a line of code","url":"http://www.crowdhoster.com/","id":5141995,"commentCount":29,"points":77,"postedAgo":"14 hours ago","postedBy":"knighthacker"},{"title":"Great Firewall architects fingered for GitHub attack","url":"http://www.theregister.co.uk/2013/01/31/github_ssl_man_in_the_middle_attack/","id":5143774,"commentCount":0,"points":15,"postedAgo":"5 hours ago","postedBy":"iProject"}],"version":"1.0","cachedOnUTC":"\/Date(1359633606418)\/"}
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
2
|
+
|
3
|
+
require 'hn-api'
|
4
|
+
require 'rspec/mocks'
|
5
|
+
require 'rspec/expectations'
|
6
|
+
require 'webmock/rspec'
|
7
|
+
|
8
|
+
|
9
|
+
# Load file at path to represent a fixture.
|
10
|
+
def fixture(path)
|
11
|
+
File.new(File.join(File.dirname(__FILE__), "fixtures", path))
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,242 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hn-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Sébastien Le Callonnec
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-03-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
version_requirements: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: !binary |-
|
21
|
+
MA==
|
22
|
+
none: false
|
23
|
+
requirement: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: !binary |-
|
28
|
+
MA==
|
29
|
+
none: false
|
30
|
+
prerelease: false
|
31
|
+
type: :runtime
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: jruby-openssl
|
34
|
+
version_requirements: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: !binary |-
|
39
|
+
MA==
|
40
|
+
none: false
|
41
|
+
requirement: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: !binary |-
|
46
|
+
MA==
|
47
|
+
none: false
|
48
|
+
prerelease: false
|
49
|
+
type: :runtime
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: faraday
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: !binary |-
|
57
|
+
MA==
|
58
|
+
none: false
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: !binary |-
|
64
|
+
MA==
|
65
|
+
none: false
|
66
|
+
prerelease: false
|
67
|
+
type: :runtime
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: faraday_middleware
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: !binary |-
|
75
|
+
MA==
|
76
|
+
none: false
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: !binary |-
|
82
|
+
MA==
|
83
|
+
none: false
|
84
|
+
prerelease: false
|
85
|
+
type: :runtime
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
name: hashie
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: !binary |-
|
93
|
+
MA==
|
94
|
+
none: false
|
95
|
+
requirement: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: !binary |-
|
100
|
+
MA==
|
101
|
+
none: false
|
102
|
+
prerelease: false
|
103
|
+
type: :runtime
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: rspec
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 2.11.0
|
111
|
+
none: false
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 2.11.0
|
117
|
+
none: false
|
118
|
+
prerelease: false
|
119
|
+
type: :development
|
120
|
+
- !ruby/object:Gem::Dependency
|
121
|
+
name: shoulda
|
122
|
+
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: !binary |-
|
127
|
+
MA==
|
128
|
+
none: false
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: !binary |-
|
134
|
+
MA==
|
135
|
+
none: false
|
136
|
+
prerelease: false
|
137
|
+
type: :development
|
138
|
+
- !ruby/object:Gem::Dependency
|
139
|
+
name: rdoc
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - "~>"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '3.12'
|
145
|
+
none: false
|
146
|
+
requirement: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - "~>"
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '3.12'
|
151
|
+
none: false
|
152
|
+
prerelease: false
|
153
|
+
type: :development
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: jeweler
|
156
|
+
version_requirements: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - "~>"
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: 1.8.4
|
161
|
+
none: false
|
162
|
+
requirement: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 1.8.4
|
167
|
+
none: false
|
168
|
+
prerelease: false
|
169
|
+
type: :development
|
170
|
+
- !ruby/object:Gem::Dependency
|
171
|
+
name: webmock
|
172
|
+
version_requirements: !ruby/object:Gem::Requirement
|
173
|
+
requirements:
|
174
|
+
- - ">="
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: !binary |-
|
177
|
+
MA==
|
178
|
+
none: false
|
179
|
+
requirement: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - ">="
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: !binary |-
|
184
|
+
MA==
|
185
|
+
none: false
|
186
|
+
prerelease: false
|
187
|
+
type: :development
|
188
|
+
description: Ruby interface to api.ihackernews.com
|
189
|
+
email: sebastien@weblogism.com
|
190
|
+
executables:
|
191
|
+
- hn-api
|
192
|
+
extensions: []
|
193
|
+
extra_rdoc_files:
|
194
|
+
- LICENSE.txt
|
195
|
+
- README.md
|
196
|
+
files:
|
197
|
+
- ".document"
|
198
|
+
- ".rspec"
|
199
|
+
- Gemfile
|
200
|
+
- Gemfile.lock
|
201
|
+
- LICENSE.txt
|
202
|
+
- README.md
|
203
|
+
- Rakefile
|
204
|
+
- VERSION
|
205
|
+
- bin/hn-api
|
206
|
+
- hn-api.gemspec
|
207
|
+
- lib/hn-api.rb
|
208
|
+
- lib/hn-api/client.rb
|
209
|
+
- spec/client_spec.rb
|
210
|
+
- spec/fixtures/page.json
|
211
|
+
- spec/spec_helper.rb
|
212
|
+
homepage: http://github.com/tychobrailleur/hn-api
|
213
|
+
licenses:
|
214
|
+
- MIT
|
215
|
+
post_install_message:
|
216
|
+
rdoc_options: []
|
217
|
+
require_paths:
|
218
|
+
- lib
|
219
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
220
|
+
requirements:
|
221
|
+
- - ">="
|
222
|
+
- !ruby/object:Gem::Version
|
223
|
+
segments:
|
224
|
+
- 0
|
225
|
+
hash: 2
|
226
|
+
version: !binary |-
|
227
|
+
MA==
|
228
|
+
none: false
|
229
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
230
|
+
requirements:
|
231
|
+
- - ">="
|
232
|
+
- !ruby/object:Gem::Version
|
233
|
+
version: !binary |-
|
234
|
+
MA==
|
235
|
+
none: false
|
236
|
+
requirements: []
|
237
|
+
rubyforge_project:
|
238
|
+
rubygems_version: 1.8.24
|
239
|
+
signing_key:
|
240
|
+
specification_version: 3
|
241
|
+
summary: Ruby interface to api.ihackernews.com
|
242
|
+
test_files: []
|