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.
- data/lib/match_point/bxml_response.rb +26 -0
- data/lib/match_point/version.rb +2 -2
- data/lib/match_point.rb +2 -0
- data/spec/match_point_spec.rb +37 -0
- data/spec/spec_helper.rb +7 -0
- data/test/test_match_point.rb +0 -3
- metadata +45 -8
@@ -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
|
data/lib/match_point/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module MatchPoint
|
2
|
-
VERSION = '0.0.
|
3
|
-
end
|
2
|
+
VERSION = '0.0.1'
|
3
|
+
end
|
data/lib/match_point.rb
CHANGED
@@ -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
|
data/spec/spec_helper.rb
ADDED
data/test/test_match_point.rb
CHANGED
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.
|
4
|
+
version: 0.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
-
|
8
|
+
- Agustin Calcagno
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
13
|
-
dependencies:
|
14
|
-
|
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
|
-
-
|
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:
|
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:
|
83
|
+
summary: ''
|
49
84
|
test_files:
|
85
|
+
- spec/spec_helper.rb
|
86
|
+
- spec/match_point_spec.rb
|
50
87
|
- test/test_match_point.rb
|