roboed 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/robo_ed/version.rb +3 -0
- data/lib/robo_ed.rb +33 -0
- metadata +46 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1138b3a0dd5b374c50c4bf2457133c70572422c9
|
4
|
+
data.tar.gz: 7691498e95290e60caeb15593a8b9364b38738a6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 89020722bc7df1b3290c8636ab2e8d8a9383d6081af7acce43a667477425ce921235f5cc55b0e478f320aa63e96645bd5eb8cb622ee9b7a9d70e595f7cfc15bf
|
7
|
+
data.tar.gz: 8858c586847798b599824515113e9bd239c7886971bae41c95603cfbd90b91d4d70ff5c2fa312a4460902907fdbc0f01b17d064954585958b1083a60d44cb47d
|
data/lib/robo_ed.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'robo_ed/version'
|
3
|
+
|
4
|
+
module RoboEd
|
5
|
+
ENDPOINT = 'http://www.ed.conpet.gov.br/mod_perl/bot_gateway.cgi?server=0.0.0.0%3A8085&charset_post=utf-8&charset=utf-8&pure=1&js=0&tst=1&msg='
|
6
|
+
TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE']
|
7
|
+
|
8
|
+
@@strip_tags = true
|
9
|
+
|
10
|
+
def self.strip_tags
|
11
|
+
@@strip_tags
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.strip_tags= option
|
15
|
+
@@strip_tags = TRUE_VALUES.include?(option)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.setup(&block)
|
19
|
+
yield self
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.ask question
|
23
|
+
question = question.to_s
|
24
|
+
raise 'Question cannot be blank!' if question.empty?
|
25
|
+
|
26
|
+
request = open(ENDPOINT + URI.encode(question))
|
27
|
+
|
28
|
+
answer = request.read.strip
|
29
|
+
answer = answer.gsub(/<[^>]*>/, '') if self.strip_tags
|
30
|
+
|
31
|
+
return answer
|
32
|
+
end
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: roboed
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hugo Demiglio
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-04-02 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Talk with Robô Ed.
|
14
|
+
email:
|
15
|
+
- hugodemiglio@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/robo_ed.rb
|
21
|
+
- lib/robo_ed/version.rb
|
22
|
+
homepage: https://github.com/formaweb/roboed
|
23
|
+
licenses:
|
24
|
+
- MIT
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 2.4.8
|
43
|
+
signing_key:
|
44
|
+
specification_version: 4
|
45
|
+
summary: Talk with Robô Ed by Petrobras.
|
46
|
+
test_files: []
|