vbulletin 0.0.4 → 0.0.5

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/Rakefile CHANGED
@@ -10,7 +10,7 @@ begin
10
10
  gem.email = "lloydpick@gmail.com"
11
11
  gem.homepage = "http://github.com/lloydpick/vbulletin"
12
12
  gem.authors = ["Lloyd Pick"]
13
- gem.version = '0.0.4'
13
+ gem.version = '0.0.5'
14
14
  gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
15
15
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
16
  gem.add_dependency('mechanize', '1.0.0')
@@ -1,19 +1,11 @@
1
1
  module VBulletin
2
2
  class Forum < Base
3
3
 
4
- def initialize(api, options = {})
5
- @api = api
6
- @debug = options[:debug] || false
7
- end
8
-
9
- def all
10
- parse_index(@api.construct_full_url("index.php"))
11
- end
4
+ attr_reader :id, :name
12
5
 
13
- private
14
- def parse_index(url)
15
- if (result = @api.mechanize.get(url))
16
- puts result.body
6
+ def initialize(*params)
7
+ params.each do |key|
8
+ key.each { |k, v| instance_variable_set("@#{k}", v) }
17
9
  end
18
10
  end
19
11
 
@@ -17,7 +17,11 @@ module VBulletin
17
17
  thread_id = CGI.parse(URI.parse(thread_link['href']).query)['t'][0]
18
18
  thread_author = result.search('//td[@class="page"]/table/tr/td').first
19
19
  thread_created_at = result.search('//td[@class="page"]/table/tr/td[@class="smallfont"]').first.inner_html
20
- VBulletin::Thread.new(:id => thread_id, :title => thread_title, :created_at => thread_created_at)
20
+ forum = result.links_with(:href => /forumdisplay.php/).first
21
+ thread_forum_name = forum.text
22
+ thread_forum_id = CGI.parse(URI.parse(forum.href).query)['f'][0]
23
+ forum = VBulletin::Forum.new(:id => thread_forum_id, :name => thread_forum_name)
24
+ VBulletin::Thread.new(:id => thread_id, :title => thread_title, :created_at => thread_created_at, :forum => forum)
21
25
  end
22
26
  end
23
27
 
@@ -1,7 +1,7 @@
1
1
  module VBulletin
2
2
  class Thread < Base
3
3
 
4
- attr_reader :id, :title, :api, :created_at
4
+ attr_reader :id, :title, :api, :created_at, :forum
5
5
 
6
6
  def initialize(*params)
7
7
  params.each do |key|
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{vbulletin}
8
- s.version = "0.0.4"
8
+ s.version = "0.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Lloyd Pick"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vbulletin
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Lloyd Pick