match_point 0.0.0 → 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,26 @@
1
+ module MatchPoint
2
+ class BxmlResponse
3
+
4
+ SPEC_NODE="MatchPointSpec"
5
+
6
+ def initialize xml_specification, xml
7
+ @specification = Nokogiri::XML(xml_specification)
8
+ @xml = Nokogiri::XML(xml)
9
+
10
+ self.define_methods
11
+ end
12
+
13
+ def define_methods
14
+ specified_nodes = @specification.xpath("//#{SPEC_NODE}")
15
+ specified_nodes.each do | specification_node |
16
+ attr_value = @xml.xpath(specification_node.path.gsub("/#{SPEC_NODE}","")).text
17
+ self.class.add_attr_reader_for specification_node, attr_value
18
+ end
19
+ end
20
+
21
+ def self.add_attr_reader_for specification_node, attr_value
22
+ define_method specification_node.text.to_sym, lambda { attr_value }
23
+ end
24
+
25
+ end
26
+ end
@@ -1,3 +1,3 @@
1
1
  module MatchPoint
2
- VERSION = '0.0.0'
3
- end
2
+ VERSION = '0.0.1'
3
+ end
data/lib/match_point.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  require 'match_point/version'
2
+ require 'match_point/bxml_response'
3
+ require 'nokogiri'
2
4
 
3
5
  module MatchPoint
4
6
  def self.version_string
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ describe MatchPoint do
4
+
5
+ describe("when reading the bxml specification") do
6
+
7
+ let(:specification) do
8
+ "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
9
+ <TIX version=\"TIX 4.11.0\">
10
+ <AccessControl method=\"AccessControlAuthenticate\">
11
+ <AuthRequest>
12
+ <AuthID><MatchPointSpec>auth_id</MatchPointSpec></AuthID>
13
+ </AuthRequest>
14
+ </AccessControl>
15
+ </TIX>"
16
+ end
17
+
18
+ let(:response_xml) do
19
+ "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
20
+ <TIX version=\"TIX 4.11.0\">
21
+ <AccessControl method=\"AccessControlAuthenticate\">
22
+ <AuthRequest>
23
+ <AuthID>1ua5J1gJz3TryPEMQZkeWFarOagSJvYY</AuthID>
24
+ </AuthRequest>
25
+ </AccessControl>
26
+ </TIX>"
27
+ end
28
+
29
+ let(:response) { MatchPoint::BxmlResponse.new(specification, response_xml) }
30
+
31
+ it "should get the auth_id from the xml if the specification for that field is defined" do
32
+ response.auth_id.should == "1ua5J1gJz3TryPEMQZkeWFarOagSJvYY"
33
+ end
34
+
35
+ end
36
+
37
+ end
@@ -0,0 +1,7 @@
1
+ require 'rspec'
2
+ require 'match_point'
3
+
4
+ RSpec.configure do |config|
5
+ config.color_enabled = true
6
+ config.formatter = 'documentation'
7
+ end
@@ -2,9 +2,6 @@ require 'test/unit'
2
2
  require 'match_point'
3
3
 
4
4
  class TestMatchPoint < Test::Unit::TestCase
5
- def test_silly_example
6
- assert_equal 2+2, 4
7
- end
8
5
 
9
6
  def test_version_string
10
7
  assert_equal MatchPoint.version_string, "MatchPoint version #{MatchPoint::VERSION}"
metadata CHANGED
@@ -1,28 +1,63 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: match_point
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
- - Nithin Bekal
8
+ - Agustin Calcagno
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-10 00:00:00.000000000 Z
13
- dependencies: []
14
- description: Solves Sudoku puzzles. D'uh!
12
+ date: 2013-05-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '2.0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '2.0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: nokogiri
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 1.3.3
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.3.3
46
+ description: ''
15
47
  email:
16
- - me@nithinbekal.com
48
+ - calqui@gmail.com
17
49
  executables: []
18
50
  extensions: []
19
51
  extra_rdoc_files: []
20
52
  files:
21
53
  - lib/match_point.rb
54
+ - lib/match_point/bxml_response.rb
22
55
  - lib/match_point/some_class.rb
23
56
  - lib/match_point/version.rb
57
+ - spec/spec_helper.rb
58
+ - spec/match_point_spec.rb
24
59
  - test/test_match_point.rb
25
- homepage: http://github.com/nithinbekal/sudoku
60
+ homepage: ''
26
61
  licenses: []
27
62
  post_install_message:
28
63
  rdoc_options: []
@@ -45,6 +80,8 @@ rubyforge_project:
45
80
  rubygems_version: 1.8.24
46
81
  signing_key:
47
82
  specification_version: 3
48
- summary: Sudoku solver in Ruby
83
+ summary: ''
49
84
  test_files:
85
+ - spec/spec_helper.rb
86
+ - spec/match_point_spec.rb
50
87
  - test/test_match_point.rb