omf_common 6.0.0.pre.1 → 6.0.0.pre.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/omf_common/comm.rb +1 -0
- data/lib/omf_common/command.rb +1 -1
- data/lib/omf_common/message.rb +7 -0
- data/lib/omf_common/version.rb +1 -1
- metadata +2 -2
data/lib/omf_common/comm.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'omf_common/dsl/xmpp_blather'
|
2
2
|
|
3
3
|
module OmfCommon
|
4
|
+
# PubSub communication class, can be extended with different implementations
|
4
5
|
class Comm
|
5
6
|
def initialize(pubsub_implementation)
|
6
7
|
self.extend("OmfCommon::DSL::#{pubsub_implementation.to_s.camelcase}".constant)
|
data/lib/omf_common/command.rb
CHANGED
data/lib/omf_common/message.rb
CHANGED
@@ -38,6 +38,8 @@ module OmfCommon
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
+
# Construct a property node
|
42
|
+
#
|
41
43
|
def property(key, value = nil, &block)
|
42
44
|
key_node = Message.new('property')
|
43
45
|
key_node.write_attr('key', key)
|
@@ -58,6 +60,8 @@ module OmfCommon
|
|
58
60
|
self
|
59
61
|
end
|
60
62
|
|
63
|
+
# Validate against relaxng schema
|
64
|
+
#
|
61
65
|
def valid?
|
62
66
|
validation = Nokogiri::XML::RelaxNG(File.open(SCHEMA_FILE)).validate(document)
|
63
67
|
if validation.empty?
|
@@ -68,6 +72,8 @@ module OmfCommon
|
|
68
72
|
end
|
69
73
|
end
|
70
74
|
|
75
|
+
# Short cut for adding xml node
|
76
|
+
#
|
71
77
|
def element(key, value)
|
72
78
|
key_node = Niceogiri::XML::Node.new(key)
|
73
79
|
key_node.content = value
|
@@ -80,6 +86,7 @@ module OmfCommon
|
|
80
86
|
element_name.to_sym
|
81
87
|
end
|
82
88
|
|
89
|
+
# Short cut for grabbing a group of nodes using xpath, but with default namespace
|
83
90
|
def element_by_xpath_with_default_namespace(xpath_without_ns)
|
84
91
|
xpath(xpath_without_ns.gsub(/(\/+)(\w+)/, '\1xmlns:\2'), :xmlns => OMF_NAMESPACE)
|
85
92
|
end
|
data/lib/omf_common/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omf_common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.0.pre.
|
4
|
+
version: 6.0.0.pre.2
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|