xkcd_guru 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/lib/xkcd_guru.rb +39 -0
- metadata +48 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d4e5943a6128647f9b30f0dcc627426154e397e2
|
4
|
+
data.tar.gz: c99807be3c8f3857c50a0bc1e5987c7e01d1d11a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: de957a0aadf447349b25848f74ac15a90c191a5101d03df7978d9b686ff3960d558cfdb4ec2236e6dc236f897fc6cc6c42df39e4589ee60db9c1e281b032e251
|
7
|
+
data.tar.gz: 13cf42c779b00249fe81eebf82e0d940497104e54f7b93ab2bf32d516f9816b9248ea6be0b0eed3205b07c0efb2f48be765b117ba4233293def802125316f7fb
|
data/lib/xkcd_guru.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
|
3
|
+
response = HTTParty.get('http://xkcd-unofficial-api.herokuapp.com/xkcd?year=2007')
|
4
|
+
#this gets comics 1-60
|
5
|
+
# all_comics = {};
|
6
|
+
# for num in 0..60
|
7
|
+
# all_comics[num] = HTTParty.get("http://xkcd.com/#{num}/info.0.json")
|
8
|
+
# end
|
9
|
+
|
10
|
+
def comic_by_date(year, month = nil, day = nil)
|
11
|
+
if day
|
12
|
+
day_text = "&day=#{day}"
|
13
|
+
end
|
14
|
+
if month
|
15
|
+
month_text = "&month=#{month_text}"
|
16
|
+
end
|
17
|
+
return HTTParty.get("http://xkcd-unofficial-api.herokuapp.com/xkcd?year=#{year}#{month_text}#{day_text}")
|
18
|
+
end
|
19
|
+
|
20
|
+
def comic_by_month(month, day = nil)
|
21
|
+
return HTTParty.get("http://xkcd-unofficial-api.herokuapp.com/xkcd?month=#{month}")
|
22
|
+
end
|
23
|
+
|
24
|
+
def comic_by_day(day)
|
25
|
+
return HTTParty.get("http://xkcd-unofficial-api.herokuapp.com/xkcd?day=#{day}")
|
26
|
+
end
|
27
|
+
|
28
|
+
def comic_by_num(num)
|
29
|
+
return HTTParty.get("http://xkcd-unofficial-api.herokuapp.com/xkcd?num=#{num}")
|
30
|
+
end
|
31
|
+
|
32
|
+
def comic_by_title(safe_title)
|
33
|
+
return HTTParty.get("http://xkcd-unofficial-api.herokuapp.com/xkcd?safe_title=#{safe_title}")
|
34
|
+
end
|
35
|
+
|
36
|
+
def comic_by_alt(alt)
|
37
|
+
return HTTParty.get("http://xkcd-unofficial-api.herokuapp.com/xkcd?alt=#{alt}")
|
38
|
+
end
|
39
|
+
|
metadata
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: xkcd_guru
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chris Sherlin
|
8
|
+
- Ryan Page
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-11-25 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Allows easy interactions with the 'xkcd-unofficial-api'.
|
15
|
+
email:
|
16
|
+
- rhymeswithmerlin@gmail.com
|
17
|
+
- rpage326@gmail.com
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- lib/xkcd_guru.rb
|
23
|
+
homepage: https://github.com/ChrisSherlin/xkcd_guru
|
24
|
+
licenses:
|
25
|
+
- MIT
|
26
|
+
metadata: {}
|
27
|
+
post_install_message:
|
28
|
+
rdoc_options: []
|
29
|
+
require_paths:
|
30
|
+
- lib
|
31
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - '>='
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
requirements: []
|
42
|
+
rubyforge_project:
|
43
|
+
rubygems_version: 2.0.6
|
44
|
+
signing_key:
|
45
|
+
specification_version: 4
|
46
|
+
summary: Allows easy interactions with the 'xkcd-unofficial-api'.
|
47
|
+
test_files: []
|
48
|
+
has_rdoc:
|