atheme 0.0.4 → 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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.gitignore +0 -1
- data/LICENSE.txt +1 -1
- data/README.md +17 -5
- data/Rakefile +5 -0
- data/atheme.gemspec +3 -1
- data/lib/atheme.rb +15 -3
- data/lib/atheme/configuration.rb +16 -4
- data/lib/atheme/errors.rb +2 -2
- data/lib/atheme/parser.rb +47 -0
- data/lib/atheme/parser_helper.rb +5 -0
- data/lib/atheme/parsers/chanserv.rb +15 -0
- data/lib/atheme/service.rb +30 -2
- data/lib/atheme/support.rb +14 -0
- data/lib/atheme/version.rb +1 -1
- data/spec/config.yml +9 -0
- data/spec/lib/authenticate_spec.rb +12 -6
- data/spec/lib/configuration_spec.rb +4 -4
- data/spec/lib/parser_spec.rb +53 -0
- data/spec/lib/parsers/chanserv_spec.rb +25 -0
- data/spec/lib/service_spec.rb +16 -2
- data/spec/spec_helper.rb +15 -10
- data/spec/vcr_cassettes/authenticate_error.yml +43 -0
- data/spec/vcr_cassettes/authenticate_success.yml +40 -0
- data/spec/vcr_cassettes/bad_service_command.yml +43 -0
- data/spec/vcr_cassettes/chanserv_help.yml +70 -0
- data/spec/vcr_cassettes/chanserv_info.yml +44 -0
- metadata +51 -18
- metadata.gz.sig +0 -0
- data/lib/atheme/services/alis.rb +0 -2
- data/lib/atheme/services/chanserv.rb +0 -2
- data/lib/atheme/services/gameserv.rb +0 -2
- data/lib/atheme/services/global.rb +0 -2
- data/lib/atheme/services/groupserv.rb +0 -2
- data/lib/atheme/services/helpserv.rb +0 -2
- data/lib/atheme/services/hostserv.rb +0 -2
- data/lib/atheme/services/infoserv.rb +0 -2
- data/lib/atheme/services/memoserv.rb +0 -2
- data/lib/atheme/services/nickserv.rb +0 -2
- data/lib/atheme/services/operserv.rb +0 -2
- data/lib/atheme/services/rpgserv.rb +0 -2
- data/lib/atheme/services/statserv.rb +0 -2
- data/spec/config.yml.example +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2998dc6b7bb543e351d32b16752b46209b48d68
|
4
|
+
data.tar.gz: 2c22e7cb236a49f1d3806fee16d2cec721643dad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c640de4939bb35e70df70830a32ae4a650ed63d8f1502d77f1bd09d77745cbd17a3d230a39d5e2a5cf3868aed654bcd203da9d74858d694707d15fcff899bea4
|
7
|
+
data.tar.gz: d9638c291948f850680a300b033c88b97dbeae62d429d941b4d3fe52b54fd8a56a4dd19322f2b08722c20f3a81b696e9a0488446f170b6a26a46b74f9287826d
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.gitignore
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -27,10 +27,7 @@ You need to be using [Atheme IRC Services](http://www.atheme.net) with httpd and
|
|
27
27
|
### Configuration
|
28
28
|
|
29
29
|
```ruby
|
30
|
-
Atheme.configure
|
31
|
-
config.hostname = 'example.com'
|
32
|
-
config.port = 9876
|
33
|
-
end
|
30
|
+
Atheme.configure hostname: 'example.com', port: 1234, protocol: 'http'
|
34
31
|
```
|
35
32
|
|
36
33
|
Optional: `protocol` (default http)
|
@@ -54,7 +51,22 @@ Any command can be used that the user has access to use.
|
|
54
51
|
|
55
52
|
Command format: `Atheme::ServiceName.command 'param', 'param', ...`
|
56
53
|
|
57
|
-
To see services
|
54
|
+
To see supported services [go here](https://github.com/zaphyous/atheme-ruby/blob/feature/chanserv_methods/lib/atheme.rb#L21).
|
55
|
+
|
56
|
+
If you use a custom service you can create a class like so:
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
class Atheme::ServiceName < Atheme::Service
|
60
|
+
end
|
61
|
+
```
|
62
|
+
|
63
|
+
Each command will return an object of the `Atheme::Service` that is used. All will always have `#to_raw` that has the raw services output.
|
64
|
+
|
65
|
+
Some commands will return an object with additional methods on them depending if a parser exists for that command. [Parsers can be seen here](https://github.com/zaphyous/atheme-ruby/tree/develop/lib/atheme/parsers)
|
66
|
+
|
67
|
+
## Testing
|
68
|
+
|
69
|
+
In order to be able to generate VCR cassettes properly when testing (minus those that already exist!) you must run a local IRC server with Atheme with httpd and XMLRPC enabled (listening on `localhost:1234`).
|
58
70
|
|
59
71
|
## Contributing
|
60
72
|
|
data/Rakefile
CHANGED
data/atheme.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ['james@Zaphyous.com', 'robert@Zaphyous.com']
|
11
11
|
spec.description = %q{A ruby wrapper around the Atheme IRC Services XMLRPC interface}
|
12
12
|
spec.summary = %q{atheme-ruby is an easy way to integrate your ruby application with the Atheme IRC Services XMLRPC interface}
|
13
|
-
spec.homepage = 'https://github.com/zaphyous/atheme'
|
13
|
+
spec.homepage = 'https://github.com/zaphyous/atheme-ruby'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
@@ -24,4 +24,6 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency 'guard-rspec'
|
25
25
|
spec.add_development_dependency 'pry'
|
26
26
|
spec.add_development_dependency 'rb-fsevent'
|
27
|
+
spec.add_development_dependency 'vcr'
|
28
|
+
spec.add_development_dependency 'webmock'
|
27
29
|
end
|
data/lib/atheme.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module Atheme
|
2
2
|
SERVICES = []
|
3
|
+
PARSERS = {}
|
3
4
|
end
|
4
5
|
|
5
6
|
require 'xmlrpc/client'
|
@@ -7,17 +8,28 @@ require 'atheme/version'
|
|
7
8
|
require 'atheme/errors'
|
8
9
|
require 'atheme/configuration'
|
9
10
|
require 'atheme/authenticate'
|
10
|
-
require 'atheme/service'
|
11
11
|
require 'atheme/objectified_hash'
|
12
|
+
require 'atheme/support'
|
13
|
+
require 'atheme/parser'
|
14
|
+
require 'atheme/parser_helper'
|
15
|
+
|
16
|
+
Dir[File.expand_path('../atheme/parsers/*.rb', __FILE__)].each { |file| require file }
|
12
17
|
|
13
|
-
|
18
|
+
require 'atheme/service'
|
14
19
|
|
15
20
|
module Atheme
|
16
21
|
extend Configuration
|
17
22
|
extend Authenticate
|
18
23
|
|
24
|
+
%w(ALIS ChanServ GameServ Global GroupServ HelpServ HostServ InfoServ MemoServ NickServ OperServ RPGServ StatServ).each do |name|
|
25
|
+
module_eval <<-RUBY
|
26
|
+
class Atheme::#{name} < Atheme::Service
|
27
|
+
end
|
28
|
+
RUBY
|
29
|
+
end
|
30
|
+
|
19
31
|
def self.server
|
20
|
-
XMLRPC::Client.new2("#{Atheme.protocol}://#{Atheme.hostname}:#{Atheme.port}/xmlrpc")
|
32
|
+
XMLRPC::Client.new2("#{Atheme.options.protocol}://#{Atheme.options.hostname}:#{Atheme.options.port}/xmlrpc")
|
21
33
|
end
|
22
34
|
|
23
35
|
def self.call(*args)
|
data/lib/atheme/configuration.rb
CHANGED
@@ -1,9 +1,21 @@
|
|
1
1
|
module Atheme::Configuration
|
2
|
-
|
2
|
+
REQUIRED_OPTIONS = [:hostname, :port]
|
3
3
|
|
4
|
-
def configure
|
5
|
-
|
4
|
+
def configure(opts = {})
|
5
|
+
unless validate_options(opts)
|
6
|
+
raise Atheme::Error::InvalidConfiguration, "Missing configuration options: #{REQUIRED_OPTIONS.delete_if { |x| opts.has_key?(x) }.join(', ')}"
|
7
|
+
end
|
6
8
|
|
7
|
-
|
9
|
+
opts[:protocol] ||= 'http'
|
10
|
+
|
11
|
+
@options = opts
|
12
|
+
end
|
13
|
+
|
14
|
+
def options
|
15
|
+
Atheme::ObjectifiedHash.new(@options)
|
16
|
+
end
|
17
|
+
|
18
|
+
def validate_options(opts)
|
19
|
+
REQUIRED_OPTIONS.delete_if { |x| opts.has_key?(x) }.count == 0
|
8
20
|
end
|
9
21
|
end
|
data/lib/atheme/errors.rb
CHANGED
@@ -0,0 +1,47 @@
|
|
1
|
+
module Atheme::Parser
|
2
|
+
def self.included(klass)
|
3
|
+
if klass.name.split('::').count > 3
|
4
|
+
service = klass.name.sub('Atheme::Parser::', '').gsub(/::.*/, '')
|
5
|
+
command = klass.name.sub('Atheme::Parser::', '').gsub(/.*::/, '').downcase
|
6
|
+
|
7
|
+
Atheme::PARSERS[service] ||= []
|
8
|
+
|
9
|
+
(Atheme::PARSERS[service] << command) unless command == ''
|
10
|
+
|
11
|
+
Atheme::PARSERS[service].uniq!
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def command(name, &block)
|
16
|
+
@commands << [name, block]
|
17
|
+
end
|
18
|
+
|
19
|
+
def parse(name)
|
20
|
+
@commands = []
|
21
|
+
|
22
|
+
create_parser(name)
|
23
|
+
|
24
|
+
yield if block_given?
|
25
|
+
|
26
|
+
create_commands if @commands.count > 0
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def create_parser(name)
|
32
|
+
@parser = "Atheme::Parser::#{self.name.gsub('Atheme::Parser::', '')}::#{name.capitalize}"
|
33
|
+
|
34
|
+
module_eval <<-RUBY
|
35
|
+
module #{@parser}
|
36
|
+
include Atheme::Parser
|
37
|
+
include Atheme::ParserHelper
|
38
|
+
end
|
39
|
+
RUBY
|
40
|
+
end
|
41
|
+
|
42
|
+
def create_commands
|
43
|
+
@commands.each do |command, block|
|
44
|
+
Atheme::Support.constantize(@parser).send(:define_method, command, block)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Atheme::Parser::ChanServ
|
2
|
+
extend Atheme::Parser
|
3
|
+
|
4
|
+
parse :info do
|
5
|
+
command(:founder) { match(/Founder\s+:\s+(\w+)/) }
|
6
|
+
|
7
|
+
command :registered do
|
8
|
+
Date.parse(match(/Registered\s+:\s+(\w+ [0-9]{2} [0-9(:?)]+ [0-9]{4})/)).to_time
|
9
|
+
end
|
10
|
+
|
11
|
+
command :successor do
|
12
|
+
raw_services_output.match(/Successor\s+:\s+\(none\)/) ? nil : match(/Successor\s+:\s+(\w+)/)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/atheme/service.rb
CHANGED
@@ -1,11 +1,39 @@
|
|
1
1
|
class Atheme::Service
|
2
|
+
attr_reader :raw_services_output
|
3
|
+
|
4
|
+
def initialize(output)
|
5
|
+
@raw_services_output = output
|
6
|
+
end
|
7
|
+
|
2
8
|
def self.inherited(klass)
|
3
9
|
Atheme::SERVICES << klass.name.gsub('Atheme::', '')
|
4
10
|
end
|
5
11
|
|
12
|
+
def self.create_service_object(method, service, atheme_data)
|
13
|
+
if parser_for?(service, method)
|
14
|
+
parser = Atheme::Support.constantize("Atheme::Parser::#{service}::#{method.capitalize}")
|
15
|
+
|
16
|
+
self.new(atheme_data).extend(parser)
|
17
|
+
else
|
18
|
+
self.new(atheme_data)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
6
22
|
def self.method_missing(method, *args, &block)
|
7
|
-
raise Atheme::Error::
|
23
|
+
raise Atheme::Error::InvalidUser, 'No user has been set' if Atheme.user.nil?
|
24
|
+
|
25
|
+
service = self.name.gsub('Atheme::', '')
|
26
|
+
|
27
|
+
self.create_service_object(method, service, Atheme.call('atheme.command',
|
28
|
+
Atheme.user.cookie, Atheme.user.username, Atheme.user.ip,
|
29
|
+
service, method, *args))
|
30
|
+
end
|
8
31
|
|
9
|
-
|
32
|
+
def self.parser_for?(service, command)
|
33
|
+
if Atheme::PARSERS.include?(service)
|
34
|
+
Atheme::PARSERS[service].include?(command.to_s)
|
35
|
+
else
|
36
|
+
false
|
37
|
+
end
|
10
38
|
end
|
11
39
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Atheme::Support
|
2
|
+
def self.constantize(camel_cased_word)
|
3
|
+
names = camel_cased_word.split('::')
|
4
|
+
names.shift if names.empty? || names.first.empty?
|
5
|
+
|
6
|
+
constant = Object
|
7
|
+
|
8
|
+
names.each do |name|
|
9
|
+
constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
|
10
|
+
end
|
11
|
+
|
12
|
+
constant
|
13
|
+
end
|
14
|
+
end
|
data/lib/atheme/version.rb
CHANGED
data/spec/config.yml
ADDED
@@ -2,19 +2,25 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Atheme::Authenticate do
|
4
4
|
it 'should get a cookie when logging in' do
|
5
|
-
|
5
|
+
VCR.use_cassette('authenticate_success') do
|
6
|
+
expect(Atheme.login(atheme_config['nick'], atheme_config['password'])).to match(/([a-z]){20}/)
|
7
|
+
end
|
6
8
|
end
|
7
9
|
|
8
10
|
it 'should get a XMLRPC::FaultException when incorrect login information is provided' do
|
9
|
-
|
11
|
+
VCR.use_cassette('authenticate_error') do
|
12
|
+
expect { Atheme.login(atheme_config['nick'], 'bad-password') }.to raise_error XMLRPC::FaultException
|
13
|
+
end
|
10
14
|
end
|
11
15
|
|
12
16
|
it 'should remember a user when set' do
|
13
|
-
|
17
|
+
VCR.use_cassette('authenticate_success') do
|
18
|
+
cookie = Atheme.login(atheme_config['nick'], atheme_config['password'])
|
14
19
|
|
15
|
-
|
20
|
+
Atheme.set_user(cookie, atheme_config['nick'], atheme_config['ip'])
|
16
21
|
|
17
|
-
|
18
|
-
|
22
|
+
expect(Atheme.user.cookie).to eql cookie
|
23
|
+
expect(Atheme.user.username).to eql atheme_config['nick']
|
24
|
+
end
|
19
25
|
end
|
20
26
|
end
|
@@ -2,14 +2,14 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Atheme::Configuration do
|
4
4
|
it 'should have a port' do
|
5
|
-
expect(Atheme.port).to eql
|
5
|
+
expect(Atheme.options.port).to eql 1234
|
6
6
|
end
|
7
7
|
|
8
|
-
it 'should have a
|
9
|
-
expect(Atheme.hostname).to eql
|
8
|
+
it 'should have a hostname' do
|
9
|
+
expect(Atheme.options.hostname).to eql 'localhost'
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'should have a protocol' do
|
13
|
-
expect(Atheme.protocol).to eql
|
13
|
+
expect(Atheme.options.protocol).to eql 'http'
|
14
14
|
end
|
15
15
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Atheme::Parser do
|
4
|
+
before do
|
5
|
+
module Atheme::Parser::ChanServ
|
6
|
+
extend Atheme::Parser
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
context '#parse' do
|
11
|
+
module Atheme::Parser::ChanServ
|
12
|
+
parse :info
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should create a parser module' do
|
16
|
+
expect(Atheme::Parser::ChanServ::Info).to be_true
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should create multiple parser modules' do
|
20
|
+
module Atheme::Parser::ChanServ
|
21
|
+
parse :help
|
22
|
+
end
|
23
|
+
|
24
|
+
expect(Atheme::Parser::ChanServ::Info).to be_true
|
25
|
+
expect(Atheme::Parser::ChanServ::Help).to be_true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context '#command' do
|
30
|
+
module Atheme::Parser::ChanServ
|
31
|
+
parse :info do
|
32
|
+
command(:one) { 'one' }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should create a method on the parser' do
|
37
|
+
expect(Atheme::Parser::ChanServ::Info.method_defined?(:one)).to be_true
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should create multiple methods on the parser' do
|
41
|
+
module Atheme::Parser::ChanServ
|
42
|
+
parse :help do
|
43
|
+
command(:one) { 'one' }
|
44
|
+
command(:two) { 'two' }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
[:one, :two].each do |method|
|
49
|
+
expect(Atheme::Parser::ChanServ::Help.method_defined?(method)).to be_true
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Atheme::Parser::ChanServ do
|
4
|
+
context '.info' do
|
5
|
+
before { authenticate }
|
6
|
+
|
7
|
+
let(:info) do
|
8
|
+
VCR.use_cassette('chanserv_info') do
|
9
|
+
Atheme::ChanServ.info atheme_config['channel']
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'has a founder' do
|
14
|
+
expect(info.founder).to eql atheme_config['nick']
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'has a successor' do
|
18
|
+
expect(info.successor).to eql 'username_'
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should have a registered date' do
|
22
|
+
expect(info.registered).to eql Date.parse('2013-02-08').to_time
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/spec/lib/service_spec.rb
CHANGED
@@ -8,12 +8,26 @@ describe 'Atheme::Service' do
|
|
8
8
|
it 'should be able to query services' do
|
9
9
|
authenticate
|
10
10
|
|
11
|
-
|
11
|
+
VCR.use_cassette('chanserv_help') do
|
12
|
+
expect(Atheme::ChanServ.help).to be_true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should error when an invalid services command is used' do
|
17
|
+
VCR.use_cassette('bad_service_command') do
|
18
|
+
expect{ Atheme::ChanServ.bad_method }.to raise_error XMLRPC::FaultException
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should have raw xmlrpc output in to_raw' do
|
23
|
+
VCR.use_cassette('chanserv_help') do
|
24
|
+
expect(Atheme::ChanServ.help.raw_services_output).to include('***** ChanServ Help *****')
|
25
|
+
end
|
12
26
|
end
|
13
27
|
|
14
28
|
it 'should raise an error when no user is set' do
|
15
29
|
Atheme.user = nil
|
16
30
|
|
17
|
-
expect { Atheme::ChanServ.help }.to raise_error Atheme::Error::
|
31
|
+
expect { Atheme::ChanServ.help }.to raise_error Atheme::Error::InvalidUser
|
18
32
|
end
|
19
33
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'rspec'
|
2
2
|
require 'pry'
|
3
3
|
require 'atheme'
|
4
|
+
require 'vcr'
|
5
|
+
require 'webmock/rspec'
|
4
6
|
|
5
7
|
Dir[File.expand_path('../support/**/*.rb', __FILE__)].each { |file| require file }
|
6
8
|
|
@@ -9,19 +11,22 @@ def atheme_config
|
|
9
11
|
end
|
10
12
|
|
11
13
|
def configure_atheme
|
12
|
-
Atheme.configure
|
13
|
-
config.port = atheme_config['port']
|
14
|
-
config.hostname = atheme_config['hostname']
|
15
|
-
config.protocol = atheme_config['protocol']
|
16
|
-
end
|
14
|
+
Atheme.configure port: 1234, hostname: 'localhost'
|
17
15
|
end
|
18
16
|
|
19
|
-
|
20
|
-
|
17
|
+
RSpec.configure do |config|
|
18
|
+
config.before { configure_atheme }
|
19
|
+
end
|
21
20
|
|
22
|
-
|
21
|
+
VCR.configure do |config|
|
22
|
+
config.cassette_library_dir = 'spec/vcr_cassettes'
|
23
|
+
config.hook_into :webmock
|
23
24
|
end
|
24
25
|
|
25
|
-
|
26
|
-
|
26
|
+
def authenticate
|
27
|
+
VCR.use_cassette('authenticate_success') do
|
28
|
+
cookie = Atheme.login(atheme_config['nick'], atheme_config['password'])
|
29
|
+
|
30
|
+
Atheme.set_user(cookie, atheme_config['nick'], atheme_config['ip'])
|
31
|
+
end
|
27
32
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://localhost:1234/xmlrpc
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: |
|
9
|
+
<?xml version="1.0" ?><methodCall><methodName>atheme.login</methodName><params><param><value><string>username</string></value></param><param><value><string>bad-password</string></value></param></params></methodCall>
|
10
|
+
headers:
|
11
|
+
User-Agent:
|
12
|
+
- XMLRPC::Client (Ruby 2.0.0)
|
13
|
+
Content-Type:
|
14
|
+
- text/xml; charset=utf-8
|
15
|
+
Content-Length:
|
16
|
+
- '214'
|
17
|
+
Connection:
|
18
|
+
- keep-alive
|
19
|
+
Accept-Encoding:
|
20
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
21
|
+
Accept:
|
22
|
+
- '*/*'
|
23
|
+
response:
|
24
|
+
status:
|
25
|
+
code: 200
|
26
|
+
message: OK
|
27
|
+
headers:
|
28
|
+
Server:
|
29
|
+
- Atheme/7.0.5
|
30
|
+
Content-Type:
|
31
|
+
- text/xml
|
32
|
+
Content-Length:
|
33
|
+
- '363'
|
34
|
+
body:
|
35
|
+
encoding: UTF-8
|
36
|
+
string: "<?xml version=\"1.0\"?>\r\n<methodResponse>\r\n <fault>\r\n <value>\r\n
|
37
|
+
\ <struct>\r\n <member>\r\n <name>faultCode</name>\r\n <value><int>5</int></value>\r\n
|
38
|
+
\ </member>\r\n <member>\r\n <name>faultString</name>\r\n <value><string>The
|
39
|
+
password is not valid for this account.</string></value>\r\n </member>\r\n
|
40
|
+
\ </struct>\r\n </value>\r\n </fault>\r\n</methodResponse>"
|
41
|
+
http_version:
|
42
|
+
recorded_at: Thu, 11 Apr 2013 07:09:35 GMT
|
43
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,40 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://localhost:1234/xmlrpc
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: |
|
9
|
+
<?xml version="1.0" ?><methodCall><methodName>atheme.login</methodName><params><param><value><string>username</string></value></param><param><value><string>password</string></value></param></params></methodCall>
|
10
|
+
headers:
|
11
|
+
User-Agent:
|
12
|
+
- XMLRPC::Client (Ruby 2.0.0)
|
13
|
+
Content-Type:
|
14
|
+
- text/xml; charset=utf-8
|
15
|
+
Content-Length:
|
16
|
+
- '212'
|
17
|
+
Connection:
|
18
|
+
- keep-alive
|
19
|
+
Accept-Encoding:
|
20
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
21
|
+
Accept:
|
22
|
+
- '*/*'
|
23
|
+
response:
|
24
|
+
status:
|
25
|
+
code: 200
|
26
|
+
message: OK
|
27
|
+
headers:
|
28
|
+
Server:
|
29
|
+
- Atheme/7.0.5
|
30
|
+
Content-Type:
|
31
|
+
- text/xml
|
32
|
+
Content-Length:
|
33
|
+
- '165'
|
34
|
+
body:
|
35
|
+
encoding: UTF-8
|
36
|
+
string: "<?xml version=\"1.0\"?>\r\n<methodResponse>\r\n<params>\r\n <param>\r\n
|
37
|
+
\ <value>\r\n <string>qiyrmryiqqdrqqtswqnk</string>\r\n </value>\r\n </param>\r\n</params>\r\n</methodResponse>"
|
38
|
+
http_version:
|
39
|
+
recorded_at: Thu, 11 Apr 2013 07:08:42 GMT
|
40
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,43 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://localhost:1234/xmlrpc
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: |
|
9
|
+
<?xml version="1.0" ?><methodCall><methodName>atheme.command</methodName><params><param><value><string>qiyrmryiqqdrqqtswqnk</string></value></param><param><value><string>username</string></value></param><param><value><string>127.0.0.1</string></value></param><param><value><string>ChanServ</string></value></param><param><value><string>bad_method</string></value></param></params></methodCall>
|
10
|
+
headers:
|
11
|
+
User-Agent:
|
12
|
+
- XMLRPC::Client (Ruby 2.0.0)
|
13
|
+
Content-Type:
|
14
|
+
- text/xml; charset=utf-8
|
15
|
+
Content-Length:
|
16
|
+
- '392'
|
17
|
+
Connection:
|
18
|
+
- keep-alive
|
19
|
+
Accept-Encoding:
|
20
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
21
|
+
Accept:
|
22
|
+
- '*/*'
|
23
|
+
response:
|
24
|
+
status:
|
25
|
+
code: 200
|
26
|
+
message: OK
|
27
|
+
headers:
|
28
|
+
Server:
|
29
|
+
- Atheme/7.0.5
|
30
|
+
Content-Type:
|
31
|
+
- text/xml
|
32
|
+
Content-Length:
|
33
|
+
- '341'
|
34
|
+
body:
|
35
|
+
encoding: UTF-8
|
36
|
+
string: "<?xml version=\"1.0\"?>\r\n<methodResponse>\r\n <fault>\r\n <value>\r\n
|
37
|
+
\ <struct>\r\n <member>\r\n <name>faultCode</name>\r\n <value><int>3</int></value>\r\n
|
38
|
+
\ </member>\r\n <member>\r\n <name>faultString</name>\r\n <value><string>Invalid
|
39
|
+
command name.</string></value>\r\n </member>\r\n </struct>\r\n </value>\r\n
|
40
|
+
</fault>\r\n</methodResponse>"
|
41
|
+
http_version:
|
42
|
+
recorded_at: Thu, 11 Apr 2013 07:11:24 GMT
|
43
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,70 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://localhost:1234/xmlrpc
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: |
|
9
|
+
<?xml version="1.0" ?><methodCall><methodName>atheme.command</methodName><params><param><value><string>qiyrmryiqqdrqqtswqnk</string></value></param><param><value><string>username</string></value></param><param><value><string>127.0.0.1</string></value></param><param><value><string>ChanServ</string></value></param><param><value><string>help</string></value></param></params></methodCall>
|
10
|
+
headers:
|
11
|
+
User-Agent:
|
12
|
+
- XMLRPC::Client (Ruby 2.0.0)
|
13
|
+
Content-Type:
|
14
|
+
- text/xml; charset=utf-8
|
15
|
+
Content-Length:
|
16
|
+
- '386'
|
17
|
+
Connection:
|
18
|
+
- keep-alive
|
19
|
+
Accept-Encoding:
|
20
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
21
|
+
Accept:
|
22
|
+
- '*/*'
|
23
|
+
response:
|
24
|
+
status:
|
25
|
+
code: 200
|
26
|
+
message: OK
|
27
|
+
headers:
|
28
|
+
Server:
|
29
|
+
- Atheme/7.0.5
|
30
|
+
Content-Type:
|
31
|
+
- text/xml
|
32
|
+
Content-Length:
|
33
|
+
- '2460'
|
34
|
+
body:
|
35
|
+
encoding: UTF-8
|
36
|
+
string: "<?xml version=\"1.0\"?>\r\n<methodResponse>\r\n<params>\r\n <param>\r\n
|
37
|
+
\ <value>\r\n <string>***** ChanServ Help *****\nChanServ gives normal users
|
38
|
+
the ability to maintain controlof a channel, without the need of a bot. Channel
|
39
|
+
takeovers arevirtually impossible when a channel is registered with ChanServ.Registration
|
40
|
+
is a quick and painless process. Once registered,the founder can maintain
|
41
|
+
complete and total control over the channel.\nPlease note that channels will
|
42
|
+
expire after 30 days of inactivity,or if there are no eligible channel successors.Activity
|
43
|
+
is defined as a user with one of +FORforsv being on the channel.\nSuccessors
|
44
|
+
are primarily those who have the +R flagset on their account in the channel,
|
45
|
+
although otherpeople may be chosen depending on their accesslevel and activity.\n
|
46
|
+
\nCommands can also be given on channel by prefixing one of '.'and omitting
|
47
|
+
the channel name. These are called "fantasy"commands and can also
|
48
|
+
be disabled on a per-channel basis.\n \nFor more information on a command,
|
49
|
+
type:\n/msg ChanServ help <command>\nFor a verbose listing of all commands,
|
50
|
+
type:\n/msg ChanServ help commands\n \nThe following commands are available:\nCLOSE
|
51
|
+
\ Closes a channel.\nFDROP Forces dropping of a channel
|
52
|
+
registration.\nFFLAGS Forces a flags change on a channel.\nFLAGS
|
53
|
+
\ Manipulates specific permissions on a channel.\nFTRANSFER Forces
|
54
|
+
foundership transfer of a channel.\nINVITE Invites you to a channel.\nOP
|
55
|
+
\ Gives channel ops to a user.\nRECOVER Regain control
|
56
|
+
of your channel.\nREGISTER Registers a channel.\nSET Sets
|
57
|
+
various control flags.\nUNBAN Removes a ban on a channel.\n \nOther
|
58
|
+
commands: ACCESS, ACTIVATE, AKICK, BADWORDS, BAN, \n CALC,
|
59
|
+
CLEAR, CLONE, COUNT, DEOP, DEVOICE, \n DF, DOWN, DROP, EIGHTBALL,
|
60
|
+
FREGISTER, GETKEY, \n HELP, HOLD, INFO, KICK, KICKBAN, LIST,
|
61
|
+
LOTTERY, \n MARK, NAMEGEN, NWOD, PING, QUIET, REJECT, \n ROLE,
|
62
|
+
ROLL, ROULETTE, RPS, STATUS, SYNC, \n TAXONOMY, TEMPLATE, TOPIC,
|
63
|
+
TOPICAPPEND, \n TOPICPREPEND, UNQUIET, UP, USERINFO, VOICE,
|
64
|
+
\n WAITING, WHY, WOD\n***** End of Help *****\nIf you're having
|
65
|
+
trouble or you need some additional help, you may want to join the help channel
|
66
|
+
#help or visit the help webpage http://www.stack.nl/~jilles/irc/atheme-help/</string>\r\n
|
67
|
+
\ </value>\r\n </param>\r\n</params>\r\n</methodResponse>"
|
68
|
+
http_version:
|
69
|
+
recorded_at: Thu, 11 Apr 2013 07:08:42 GMT
|
70
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://localhost:1234/xmlrpc
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: |
|
9
|
+
<?xml version="1.0" ?><methodCall><methodName>atheme.command</methodName><params><param><value><string>qiyrmryiqqdrqqtswqnk</string></value></param><param><value><string>username</string></value></param><param><value><string>127.0.0.1</string></value></param><param><value><string>ChanServ</string></value></param><param><value><string>info</string></value></param><param><value><string>#channel</string></value></param></params></methodCall>
|
10
|
+
headers:
|
11
|
+
User-Agent:
|
12
|
+
- XMLRPC::Client (Ruby 2.0.0)
|
13
|
+
Content-Type:
|
14
|
+
- text/xml; charset=utf-8
|
15
|
+
Content-Length:
|
16
|
+
- '442'
|
17
|
+
Connection:
|
18
|
+
- keep-alive
|
19
|
+
Accept-Encoding:
|
20
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
21
|
+
Accept:
|
22
|
+
- '*/*'
|
23
|
+
response:
|
24
|
+
status:
|
25
|
+
code: 200
|
26
|
+
message: OK
|
27
|
+
headers:
|
28
|
+
Server:
|
29
|
+
- Atheme/7.0.5
|
30
|
+
Content-Type:
|
31
|
+
- text/xml
|
32
|
+
Content-Length:
|
33
|
+
- '476'
|
34
|
+
body:
|
35
|
+
encoding: UTF-8
|
36
|
+
string: "<?xml version=\"1.0\"?>\r\n<methodResponse>\r\n<params>\r\n <param>\r\n
|
37
|
+
\ <value>\r\n <string>Information on #channel:\nFounder : username\nSuccessor
|
38
|
+
\ : username_\nRegistered : Feb 08 15:09:32 2013 (8 weeks, 5 days, 08:03:27 ago)\nMode
|
39
|
+
lock : +nstr\nURL : http://example.com\nEmail : username@example.com\nFlags
|
40
|
+
\ : VERBOSE RESTRICTED KEEPTOPIC TOPICLOCK GUARD FANTASY\nPrefix :
|
41
|
+
. (default)\n*** End of Info ***</string>\r\n </value>\r\n </param>\r\n</params>\r\n</methodResponse>"
|
42
|
+
http_version:
|
43
|
+
recorded_at: Thu, 11 Apr 2013 07:14:07 GMT
|
44
|
+
recorded_with: VCR 2.4.0
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atheme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Newton
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
IdasO+EybhhmNT32weebimCM21ychbBqkWzJGPlIfqgvmOMbQc/TwQcwkYPgoX6l
|
32
32
|
QdB79NrQet5m6RR7qA5joVvZhZA=
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2013-
|
34
|
+
date: 2013-05-03 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
@@ -117,6 +117,34 @@ dependencies:
|
|
117
117
|
- - '>='
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: '0'
|
120
|
+
- !ruby/object:Gem::Dependency
|
121
|
+
name: vcr
|
122
|
+
requirement: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
type: :development
|
128
|
+
prerelease: false
|
129
|
+
version_requirements: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
- !ruby/object:Gem::Dependency
|
135
|
+
name: webmock
|
136
|
+
requirement: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - '>='
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
type: :development
|
142
|
+
prerelease: false
|
143
|
+
version_requirements: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - '>='
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
120
148
|
description: A ruby wrapper around the Atheme IRC Services XMLRPC interface
|
121
149
|
email:
|
122
150
|
- james@Zaphyous.com
|
@@ -138,27 +166,25 @@ files:
|
|
138
166
|
- lib/atheme/configuration.rb
|
139
167
|
- lib/atheme/errors.rb
|
140
168
|
- lib/atheme/objectified_hash.rb
|
169
|
+
- lib/atheme/parser.rb
|
170
|
+
- lib/atheme/parser_helper.rb
|
171
|
+
- lib/atheme/parsers/chanserv.rb
|
141
172
|
- lib/atheme/service.rb
|
142
|
-
- lib/atheme/
|
143
|
-
- lib/atheme/services/chanserv.rb
|
144
|
-
- lib/atheme/services/gameserv.rb
|
145
|
-
- lib/atheme/services/global.rb
|
146
|
-
- lib/atheme/services/groupserv.rb
|
147
|
-
- lib/atheme/services/helpserv.rb
|
148
|
-
- lib/atheme/services/hostserv.rb
|
149
|
-
- lib/atheme/services/infoserv.rb
|
150
|
-
- lib/atheme/services/memoserv.rb
|
151
|
-
- lib/atheme/services/nickserv.rb
|
152
|
-
- lib/atheme/services/operserv.rb
|
153
|
-
- lib/atheme/services/rpgserv.rb
|
154
|
-
- lib/atheme/services/statserv.rb
|
173
|
+
- lib/atheme/support.rb
|
155
174
|
- lib/atheme/version.rb
|
156
|
-
- spec/config.yml
|
175
|
+
- spec/config.yml
|
157
176
|
- spec/lib/authenticate_spec.rb
|
158
177
|
- spec/lib/configuration_spec.rb
|
178
|
+
- spec/lib/parser_spec.rb
|
179
|
+
- spec/lib/parsers/chanserv_spec.rb
|
159
180
|
- spec/lib/service_spec.rb
|
160
181
|
- spec/spec_helper.rb
|
161
|
-
|
182
|
+
- spec/vcr_cassettes/authenticate_error.yml
|
183
|
+
- spec/vcr_cassettes/authenticate_success.yml
|
184
|
+
- spec/vcr_cassettes/bad_service_command.yml
|
185
|
+
- spec/vcr_cassettes/chanserv_help.yml
|
186
|
+
- spec/vcr_cassettes/chanserv_info.yml
|
187
|
+
homepage: https://github.com/zaphyous/atheme-ruby
|
162
188
|
licenses:
|
163
189
|
- MIT
|
164
190
|
metadata: {}
|
@@ -184,8 +210,15 @@ specification_version: 4
|
|
184
210
|
summary: atheme-ruby is an easy way to integrate your ruby application with the Atheme
|
185
211
|
IRC Services XMLRPC interface
|
186
212
|
test_files:
|
187
|
-
- spec/config.yml
|
213
|
+
- spec/config.yml
|
188
214
|
- spec/lib/authenticate_spec.rb
|
189
215
|
- spec/lib/configuration_spec.rb
|
216
|
+
- spec/lib/parser_spec.rb
|
217
|
+
- spec/lib/parsers/chanserv_spec.rb
|
190
218
|
- spec/lib/service_spec.rb
|
191
219
|
- spec/spec_helper.rb
|
220
|
+
- spec/vcr_cassettes/authenticate_error.yml
|
221
|
+
- spec/vcr_cassettes/authenticate_success.yml
|
222
|
+
- spec/vcr_cassettes/bad_service_command.yml
|
223
|
+
- spec/vcr_cassettes/chanserv_help.yml
|
224
|
+
- spec/vcr_cassettes/chanserv_info.yml
|
metadata.gz.sig
CHANGED
Binary file
|
data/lib/atheme/services/alis.rb
DELETED