opub 0.0.1

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.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in opub.gemspec
4
+ gemspec
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,2 @@
1
+ require_relative 'opub/publisher'
2
+ require_relative 'opub/publishers'
@@ -0,0 +1,19 @@
1
+ require 'net/http'
2
+ require 'uri'
3
+
4
+ module OPub
5
+ class Publisher
6
+ def initialize(topic_url, hubs)
7
+ @topic_url = topic_url
8
+ @hub_urls = hubs
9
+ end
10
+
11
+ def ping_hubs
12
+ @hub_urls.each do |hub_url|
13
+ res = Net::HTTP.post_form(URI.parse(hub_url),
14
+ { 'hub.mode' => 'publish',
15
+ 'hub.url' => @topic_url })
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,26 @@
1
+ require 'net/http'
2
+ require 'uri'
3
+
4
+ require_relative 'publisher'
5
+
6
+ module OPub
7
+ module Publishers
8
+ def Publishers.new(topic_url, hubs)
9
+ if not defined?(@@instances)
10
+ @@instances = {}
11
+ end
12
+
13
+ if @@instances[topic_url] == nil
14
+ sub = OPub::Publisher.new(topic_url, hubs)
15
+ @@instances[topic_url] = sub
16
+ end
17
+
18
+ @@instances[topic_url]
19
+ end
20
+
21
+ def Publishers.[](topic_url)
22
+ return nil if not defined?(@@instances)
23
+ @@instances[topic_url]
24
+ end
25
+ end
26
+ end
@@ -0,0 +1 @@
1
+ require 'sinatra'
@@ -0,0 +1,3 @@
1
+ module OPub
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "opub/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "opub"
7
+ s.version = OPub::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ['Hackers of the Severed Hand']
10
+ s.email = ['hotsh@xomb.org']
11
+ s.homepage = ""
12
+ s.summary = %q{This is a simple implementation of a publisher in the PubSubHubbub protocol.}
13
+ s.description = %q{This is a simple implementation of a publisher in the PubSubHubbub protocol.}
14
+
15
+ s.rubyforge_project = "opub"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+ end
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: opub
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Hackers of the Severed Hand
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-03-12 23:00:00 -05:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: This is a simple implementation of a publisher in the PubSubHubbub protocol.
22
+ email:
23
+ - hotsh@xomb.org
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - .gitignore
32
+ - Gemfile
33
+ - Rakefile
34
+ - lib/opub.rb
35
+ - lib/opub/publisher.rb
36
+ - lib/opub/publishers.rb
37
+ - lib/opub/server.rb
38
+ - lib/opub/version.rb
39
+ - opub.gemspec
40
+ has_rdoc: true
41
+ homepage: ""
42
+ licenses: []
43
+
44
+ post_install_message:
45
+ rdoc_options: []
46
+
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ segments:
55
+ - 0
56
+ version: "0"
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ segments:
63
+ - 0
64
+ version: "0"
65
+ requirements: []
66
+
67
+ rubyforge_project: opub
68
+ rubygems_version: 1.3.7
69
+ signing_key:
70
+ specification_version: 3
71
+ summary: This is a simple implementation of a publisher in the PubSubHubbub protocol.
72
+ test_files: []
73
+