xeroizer 0.3.1 → 0.3.2
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/VERSION +1 -1
- data/lib/xeroizer.rb +0 -1
- data/xeroizer.gemspec +2 -4
- metadata +4 -6
- data/Gemfile.lock +0 -28
- data/lib/nokogiri_utils.rb +0 -58
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/lib/xeroizer.rb
CHANGED
data/xeroizer.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{xeroizer}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Wayne Robinson"]
|
12
|
-
s.date = %q{2011-06-
|
12
|
+
s.date = %q{2011-06-09}
|
13
13
|
s.description = %q{Ruby library for the Xero accounting system API.}
|
14
14
|
s.email = %q{wayne.robinson@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -19,7 +19,6 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.files = [
|
20
20
|
".bundle/config",
|
21
21
|
"Gemfile",
|
22
|
-
"Gemfile.lock",
|
23
22
|
"LICENSE.txt",
|
24
23
|
"README.md",
|
25
24
|
"Rakefile",
|
@@ -27,7 +26,6 @@ Gem::Specification.new do |s|
|
|
27
26
|
"lib/.DS_Store",
|
28
27
|
"lib/big_decimal_to_s.rb",
|
29
28
|
"lib/class_level_inheritable_attributes.rb",
|
30
|
-
"lib/nokogiri_utils.rb",
|
31
29
|
"lib/xeroizer.rb",
|
32
30
|
"lib/xeroizer/application_http_proxy.rb",
|
33
31
|
"lib/xeroizer/ca-certificates.crt",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xeroizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Wayne Robinson
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-06-
|
18
|
+
date: 2011-06-09 00:00:00 +10:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -178,7 +178,6 @@ extra_rdoc_files:
|
|
178
178
|
files:
|
179
179
|
- .bundle/config
|
180
180
|
- Gemfile
|
181
|
-
- Gemfile.lock
|
182
181
|
- LICENSE.txt
|
183
182
|
- README.md
|
184
183
|
- Rakefile
|
@@ -186,7 +185,6 @@ files:
|
|
186
185
|
- lib/.DS_Store
|
187
186
|
- lib/big_decimal_to_s.rb
|
188
187
|
- lib/class_level_inheritable_attributes.rb
|
189
|
-
- lib/nokogiri_utils.rb
|
190
188
|
- lib/xeroizer.rb
|
191
189
|
- lib/xeroizer/application_http_proxy.rb
|
192
190
|
- lib/xeroizer/ca-certificates.crt
|
data/Gemfile.lock
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
activesupport (3.0.3)
|
5
|
-
builder (3.0.0)
|
6
|
-
git (1.2.5)
|
7
|
-
jeweler (1.5.2)
|
8
|
-
bundler (~> 1.0.0)
|
9
|
-
git (>= 1.2.5)
|
10
|
-
rake
|
11
|
-
mocha (0.9.10)
|
12
|
-
rake
|
13
|
-
nokogiri (1.4.4)
|
14
|
-
oauth (0.4.4)
|
15
|
-
rake (0.8.7)
|
16
|
-
shoulda (2.11.3)
|
17
|
-
|
18
|
-
PLATFORMS
|
19
|
-
ruby
|
20
|
-
|
21
|
-
DEPENDENCIES
|
22
|
-
activesupport
|
23
|
-
builder (>= 2.1.2)
|
24
|
-
jeweler (~> 1.5.2)
|
25
|
-
mocha
|
26
|
-
nokogiri
|
27
|
-
oauth (>= 0.3.6)
|
28
|
-
shoulda
|
data/lib/nokogiri_utils.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
class Hash
|
2
|
-
class << self
|
3
|
-
def from_xml(xml_io)
|
4
|
-
begin
|
5
|
-
result = Nokogiri::XML(xml_io)
|
6
|
-
return { result.root.name.to_sym => xml_node_to_hash(result.root)}
|
7
|
-
rescue Exception => e
|
8
|
-
# raise your custom exception here
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def xml_node_to_hash(node)
|
13
|
-
# If we are at the root of the document, start the hash
|
14
|
-
if node.element?
|
15
|
-
result_hash = {}
|
16
|
-
if node.attributes != {}
|
17
|
-
result_hash[:attributes] = {}
|
18
|
-
node.attributes.keys.each do |key|
|
19
|
-
result_hash[:attributes][node.attributes[key].name.to_sym] = prepare(node.attributes[key].value)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
if node.children.size > 0
|
23
|
-
node.children.each do |child|
|
24
|
-
result = xml_node_to_hash(child)
|
25
|
-
|
26
|
-
if child.name == "text"
|
27
|
-
unless child.next_sibling || child.previous_sibling
|
28
|
-
return prepare(result)
|
29
|
-
end
|
30
|
-
elsif result_hash[child.name.to_sym]
|
31
|
-
if result_hash[child.name.to_sym].is_a?(Object::Array)
|
32
|
-
result_hash[child.name.to_sym] << prepare(result)
|
33
|
-
else
|
34
|
-
result_hash[child.name.to_sym] = [result_hash[child.name.to_sym]] << prepare(result)
|
35
|
-
end
|
36
|
-
else
|
37
|
-
result_hash[child.name.to_sym] = prepare(result)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
return result_hash
|
42
|
-
else
|
43
|
-
return result_hash
|
44
|
-
end
|
45
|
-
else
|
46
|
-
return prepare(node.content.to_s)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def prepare(data)
|
51
|
-
(data.class == String && data.to_i.to_s == data) ? data.to_i : data
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def to_struct(struct_name)
|
56
|
-
Struct.new(struct_name,*keys).new(*values)
|
57
|
-
end
|
58
|
-
end
|