octopus 0.0.6 → 0.0.7

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.7
@@ -41,9 +41,14 @@ module Grabbers
41
41
  #
42
42
  def notify_subscribers(resource)
43
43
  resource.subscriptions.each do |subscription|
44
- uri = URI.parse(subscription.url)
45
- conn = HttpClient2.connect uri.host, uri.port
46
- req = conn.get(uri.path)
44
+ http = EM::HttpRequest.new(subscription.url).post(:body => {:data => resource.body})
45
+ http.callback{ |response|
46
+ puts "found updated data for #{resource.url}, #{resource.body.length} characters"
47
+ }
48
+ http.errback {|response|
49
+ # Do something here, maybe setting the resource
50
+ # to be not checked anymore.
51
+ }
47
52
  end
48
53
  end
49
54
 
@@ -52,7 +57,11 @@ module Grabbers
52
57
  #
53
58
  def resource_changed?(resource, response)
54
59
  changed = false
55
- if response.hash != resource.last_modified_hash
60
+ puts "checking for changes on #{resource.url}"
61
+ puts "response.response.hash: #{response.response.hash}"
62
+ puts "resource.last_modified_hash: #{resource.last_modified_hash}"
63
+ if response.response.hash != resource.last_modified_hash
64
+ puts "changed!!!!\n\n\n\n"
56
65
  changed = true
57
66
  end
58
67
  end
@@ -64,9 +73,9 @@ module Grabbers
64
73
  # time.
65
74
  #
66
75
  def update_changed_resource(resource, response)
67
- resource.last_modified_hash = response.hash
76
+ resource.last_modified_hash = response.response.hash
68
77
  resource.last_updated = Time.now
69
- resource.body = response
78
+ resource.body = response.response
70
79
  resource.save
71
80
  end
72
81
 
@@ -12,7 +12,7 @@ class NetResource
12
12
  property :update_period, Integer, :required => true, :default => 1200
13
13
  property :next_update, DateTime, :required => true, :default => Time.now
14
14
  property :last_updated, DateTime
15
- property :body, Text
15
+ property :body, Text, :length => 0..10000000000000
16
16
  property :created_at, DateTime
17
17
  property :updated_at, DateTime
18
18
 
data/octopus.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{octopus}
8
- s.version = "0.0.6"
8
+ s.version = "0.0.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["dave@boomer"]
12
- s.date = %q{2010-11-12}
12
+ s.date = %q{2010-11-17}
13
13
  s.default_executable = %q{octopus}
14
14
  s.description = %q{Grabs stuff off the net and notifies interested subscribers.}
15
15
  s.email = %q{dave.hrycyszyn@headlondon.com}
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octopus
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - dave@boomer
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-12 00:00:00 +00:00
18
+ date: 2010-11-17 00:00:00 +00:00
19
19
  default_executable: octopus
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency