fuelprice 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Manifest +4 -0
- data/README.rdoc +1 -0
- data/Rakefile +14 -0
- data/fuelprice.gemspec +30 -0
- data/lib/fuelprice.rb +34 -0
- metadata +78 -0
data/Manifest
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Very small gem for getting the actual fuelprice in the Netherlands.
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'echoe'
|
4
|
+
|
5
|
+
Echoe.new('fuelprice', '0.1.0') do |p|
|
6
|
+
p.description = "Get the actuel fuelprice in the Netherlands."
|
7
|
+
p.url = "http://github.com/stalkert/fuelprice"
|
8
|
+
p.author = "Joost Saanen"
|
9
|
+
p.email = "stalkert@gmail.com"
|
10
|
+
p.ignore_pattern = ["tmp/*", "script/*"]
|
11
|
+
p.development_dependencies = []
|
12
|
+
end
|
13
|
+
|
14
|
+
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
data/fuelprice.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{fuelprice}
|
5
|
+
s.version = "0.1.0"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Joost Saanen"]
|
9
|
+
s.date = %q{2010-07-16}
|
10
|
+
s.description = %q{Get the actuel fuelprice in the Netherlands.}
|
11
|
+
s.email = %q{stalkert@gmail.com}
|
12
|
+
s.extra_rdoc_files = ["README.rdoc", "lib/fuelprice.rb"]
|
13
|
+
s.files = ["README.rdoc", "Rakefile", "lib/fuelprice.rb", "Manifest", "fuelprice.gemspec"]
|
14
|
+
s.homepage = %q{http://github.com/stalkert/fuelprice}
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Fuelprice", "--main", "README.rdoc"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubyforge_project = %q{fuelprice}
|
18
|
+
s.rubygems_version = %q{1.3.7}
|
19
|
+
s.summary = %q{Get the actuel fuelprice in the Netherlands.}
|
20
|
+
|
21
|
+
if s.respond_to? :specification_version then
|
22
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
23
|
+
s.specification_version = 3
|
24
|
+
|
25
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
+
else
|
27
|
+
end
|
28
|
+
else
|
29
|
+
end
|
30
|
+
end
|
data/lib/fuelprice.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'hpricot'
|
4
|
+
|
5
|
+
module Fuelprice
|
6
|
+
|
7
|
+
class Fuelprice
|
8
|
+
|
9
|
+
attr_accessor :url
|
10
|
+
|
11
|
+
|
12
|
+
# Initialize a new Fuelprice object with the url of the dutch newssite www.nu.nl/brandstof
|
13
|
+
# fuelprice = Fuelprice::Fuelprice.new("0095016")
|
14
|
+
|
15
|
+
def initialize
|
16
|
+
@url = "http://www.nu.nl/brandstof"
|
17
|
+
end
|
18
|
+
|
19
|
+
def gasoline
|
20
|
+
document.search("#gasprices tr[3]/td[2]/b").innerHTML.to_i
|
21
|
+
end
|
22
|
+
|
23
|
+
def oil
|
24
|
+
document.search("#gasprices tr[5]/td[2]/b").innerHTML.to_i
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
def document
|
29
|
+
@document ||= Hpricot(open(self.url))
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fuelprice
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Joost Saanen
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-07-16 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: Get the actuel fuelprice in the Netherlands.
|
23
|
+
email: stalkert@gmail.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files:
|
29
|
+
- README.rdoc
|
30
|
+
- lib/fuelprice.rb
|
31
|
+
files:
|
32
|
+
- README.rdoc
|
33
|
+
- Rakefile
|
34
|
+
- lib/fuelprice.rb
|
35
|
+
- Manifest
|
36
|
+
- fuelprice.gemspec
|
37
|
+
has_rdoc: true
|
38
|
+
homepage: http://github.com/stalkert/fuelprice
|
39
|
+
licenses: []
|
40
|
+
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options:
|
43
|
+
- --line-numbers
|
44
|
+
- --inline-source
|
45
|
+
- --title
|
46
|
+
- Fuelprice
|
47
|
+
- --main
|
48
|
+
- README.rdoc
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 3
|
57
|
+
segments:
|
58
|
+
- 0
|
59
|
+
version: "0"
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
hash: 11
|
66
|
+
segments:
|
67
|
+
- 1
|
68
|
+
- 2
|
69
|
+
version: "1.2"
|
70
|
+
requirements: []
|
71
|
+
|
72
|
+
rubyforge_project: fuelprice
|
73
|
+
rubygems_version: 1.3.7
|
74
|
+
signing_key:
|
75
|
+
specification_version: 3
|
76
|
+
summary: Get the actuel fuelprice in the Netherlands.
|
77
|
+
test_files: []
|
78
|
+
|