cinch-rfc 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7bbd561465d5e4fb975023948128cd427d0d801
4
- data.tar.gz: c2fd97fa39d28ee7092c00a68dc2c6efa9af53f9
3
+ metadata.gz: 6a8fb55c4fd519e8d71f50cabc113eef2b404bf4
4
+ data.tar.gz: 581f8a45136b54d7824134b983f2bce9bdda7f9c
5
5
  SHA512:
6
- metadata.gz: 911e00e9f2b5b651866e02d1b711a36c42ab96a210254034ba43f9eb07054a9c092a4e98e83102749e6c66ed2b9b509de7dacf2d4b4af0653cdb821405159c55
7
- data.tar.gz: 43c3e947e3c24b8049fc94b9b9971f17e54eb2ed681ca331c47ab0e592a78d271bc675516908f40a6ea21b8a849c3c2d91a3c71afbb7f6b39d26aa1cc833ac7a
6
+ metadata.gz: 9fc4d3e26dea934a486d82c3064627f188d690162feae642fc7278416106a3ae9054f21e375566bdc36da1236a9bc1d736d80188ddeb9e7f145ba741c5e1cc43
7
+ data.tar.gz: b2b658f717810fcafc44624cda33eb63ffd3de05082654fc89a322e60f9e3ede48c2e99c283818fb13bb5d6306c32fb66f7aefc28d12f28f5ae6abedf7b61f96
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "cinch", "~>2.0"
22
- spec.add_dependency "curb"
22
+ spec.add_dependency "httparty"
23
23
  spec.add_dependency "nokogiri"
24
24
 
25
25
  spec.add_development_dependency "bundler", "~> 1.3"
@@ -1,6 +1,6 @@
1
1
  require 'cinch'
2
2
  require 'nokogiri'
3
- require 'curb'
3
+ require 'httparty'
4
4
  require 'uri'
5
5
 
6
6
  module Cinch
@@ -11,7 +11,7 @@ module Cinch
11
11
  match /RFC ?(\d+)/i, method: :rfc_link, use_prefix: false
12
12
 
13
13
  def rfc_link(m, rfc)
14
- rfc_url = "http://tools.ietf.org/rfc/rfc#{rfc}.txt"
14
+ rfc_url = "http://tools.ietf.org/html/rfc#{rfc}"
15
15
  rfc_name = rfc_name_from_url(rfc_url)
16
16
  m.reply "RFC #{rfc}: #{rfc_name} (#{rfc_url})"
17
17
  end
@@ -19,14 +19,14 @@ module Cinch
19
19
  private
20
20
 
21
21
  def rfc_name_from_url(uri)
22
- call = Curl::Easy.perform(uri) do |easy|
23
- easy.headers["User-Agent"] = "cinch-rfc IRC bot"
24
- easy.follow_location = true
25
- easy.max_redirects = 2
26
- end
27
-
28
- html = Nokogiri::HTML(call.body_str)
29
- html.at_xpath('//meta[@name="DC.Title"]')['content']
22
+ res = HTTParty.get(uri, headers: {
23
+ "User-Agent" => "Cinch IRC bot",
24
+ "Accept" => "text/html"
25
+ })
26
+
27
+ Nokogiri::HTML(res.body).at_xpath('//meta[@name="DC.Title"]')['content']
28
+ rescue
29
+ "<could not retrieve RFC name>"
30
30
  end
31
31
  end
32
32
  end
@@ -1,7 +1,7 @@
1
1
  module Cinch
2
2
  module Plugins
3
3
  class RFC
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.4"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cinch-rfc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Hastings-Spital
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-15 00:00:00.000000000 Z
11
+ date: 2014-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cinch
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: curb
28
+ name: httparty
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '>='