fog-xml 0.0.1.alpha
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 +7 -0
- data/.gitignore +22 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/CONTRIBUTING.md +18 -0
- data/CONTRIBUTORS.md +1 -0
- data/Gemfile +4 -0
- data/LICENSE.md +20 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/fog-xml.gemspec +26 -0
- data/lib/fog/xml.rb +9 -0
- data/lib/fog/xml/connection.rb +13 -0
- data/lib/fog/xml/sax_parser_connection.rb +47 -0
- data/lib/fog/xml/version.rb +5 -0
- metadata +121 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 12c27f44895e68fe9010f39286aa775b946fab8f
|
4
|
+
data.tar.gz: 7453b55f621248e65516ed116f882307bd23708e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c7f9342ec6794b11df1b570cd097b08c1e1a3a3619eb864b41e607ef2bea78e98f89873b2d15de2df8feb2aa952e7e9bf53bb602202996ac5f66a29587b00d39
|
7
|
+
data.tar.gz: 649ac8df967444a144d7fbed2c24e1cbd41cf3d4cddfabfbfd60bf4d6eb86f06d61febba516b272c7ce9dfd5ac926ac59494492e693c195fab68d7fe79f2f5ea
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
fog-xml
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.2
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
## Getting Involved
|
2
|
+
|
3
|
+
New contributors are always welcome, when it doubt please ask questions. We strive to be an open and welcoming community. Please be nice to one another.
|
4
|
+
|
5
|
+
### Coding
|
6
|
+
|
7
|
+
* Pick a task:
|
8
|
+
* Offer feedback on open [pull requests](https://github.com/zertico/fog-xml/pulls).
|
9
|
+
* Review open [issues](https://github.com/zertico/fog-xml/issues) for things to help on.
|
10
|
+
* [Create an issue](https://github.com/zertico/fog-xml/issues/new) to start a discussion on additions or features.
|
11
|
+
* Fork the project, add your changes and tests to cover them in a topic branch.
|
12
|
+
* Commit your changes and rebase against `zertico/fog-xml` to ensure everything is up to date.
|
13
|
+
* [Submit a pull request](https://github.com/zertico/fog-xml/compare/)
|
14
|
+
|
15
|
+
### Non-Coding
|
16
|
+
|
17
|
+
* Offer feedback on open [issues](https://github.com/zertico/fog-xml/issues).
|
18
|
+
* Organize or volunteer at events.
|
data/CONTRIBUTORS.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* Paulo Henrique Lopes Ribeiro <plribeiro@zertico.com>
|
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014-2014 [CONTRIBUTORS.md](https://github.com/zertico/fog-xml/blob/master/CONTRIBUTORS.md)
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Fog::Xml
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'fog-xml'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install fog-xml
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( https://github.com/zertico/fog-xml/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/fog-xml.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'fog/xml/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "fog-xml"
|
8
|
+
spec.version = Fog::Xml::VERSION
|
9
|
+
spec.authors = %q(Paulo Henrique Lopes Ribeiro)
|
10
|
+
spec.email = %q(plribeiro3000@gmail.com)
|
11
|
+
spec.summary = %q{XML parsing for fog providers}
|
12
|
+
spec.description = %q{Extraction of the XML parsing tools shared between a
|
13
|
+
number of providers in the 'fog' gem}
|
14
|
+
spec.homepage = 'https://github.com/zertico/fog-xml'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = %w(lib)
|
21
|
+
|
22
|
+
spec.add_dependency 'fog-core'
|
23
|
+
spec.add_dependency 'nokogiri', '~> 1.5', '>= 1.5.11'
|
24
|
+
spec.add_development_dependency 'rake'
|
25
|
+
spec.add_development_dependency 'rspec'
|
26
|
+
end
|
data/lib/fog/xml.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'fog/core/connection'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Xml
|
5
|
+
class SAXParserConnection < ::Fog::Core::Connection
|
6
|
+
# Makes a request using the connection using Excon
|
7
|
+
#
|
8
|
+
# @param [Hash] params
|
9
|
+
# @option params [String] :body text to be sent over a socket
|
10
|
+
# @option params [Hash<Symbol, String>] :headers The default headers to supply in a request
|
11
|
+
# @option params [String] :host The destination host's reachable DNS name or IP, in the form of a String
|
12
|
+
# @option params [String] :path appears after 'scheme://host:port/'
|
13
|
+
# @option params [Fixnum] :port The port on which to connect, to the destination host
|
14
|
+
# @option params [Hash] :query appended to the 'scheme://host:port/path/' in the form of '?key=value'
|
15
|
+
# @option params [String] :scheme The protocol; 'https' causes OpenSSL to be used
|
16
|
+
# @option params [Proc] :response_block
|
17
|
+
# @option params [Nokogiri::XML::SAX::Document] :parser
|
18
|
+
#
|
19
|
+
# @return [Excon::Response]
|
20
|
+
#
|
21
|
+
# @raise [Excon::Errors::StubNotFound]
|
22
|
+
# @raise [Excon::Errors::Timeout]
|
23
|
+
# @raise [Excon::Errors::SocketError]
|
24
|
+
#
|
25
|
+
def request(parser, params)
|
26
|
+
reset unless @persistent
|
27
|
+
|
28
|
+
# Prepare the SAX parser
|
29
|
+
data_stream = Nokogiri::XML::SAX::PushParser.new(parser)
|
30
|
+
response_string = ""
|
31
|
+
params[:response_block] = lambda do |chunk, remaining, total|
|
32
|
+
response_string << chunk if ENV['DEBUG_RESPONSE']
|
33
|
+
data_stream << chunk
|
34
|
+
end
|
35
|
+
|
36
|
+
# Make request which read chunks into parser
|
37
|
+
response = @excon.request(params)
|
38
|
+
Fog::Logger.debug "\n#{response_string}" if ENV['DEBUG_RESPONSE']
|
39
|
+
|
40
|
+
# Cease parsing and override response.body with parsed data
|
41
|
+
data_stream.finish
|
42
|
+
response.body = parser.response
|
43
|
+
response
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fog-xml
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.alpha
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Paulo Henrique Lopes Ribeiro
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: fog-core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: nokogiri
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.5'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 1.5.11
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '1.5'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.5.11
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rspec
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
description: |-
|
76
|
+
Extraction of the XML parsing tools shared between a
|
77
|
+
number of providers in the 'fog' gem
|
78
|
+
email: plribeiro3000@gmail.com
|
79
|
+
executables: []
|
80
|
+
extensions: []
|
81
|
+
extra_rdoc_files: []
|
82
|
+
files:
|
83
|
+
- ".gitignore"
|
84
|
+
- ".ruby-gemset"
|
85
|
+
- ".ruby-version"
|
86
|
+
- CONTRIBUTING.md
|
87
|
+
- CONTRIBUTORS.md
|
88
|
+
- Gemfile
|
89
|
+
- LICENSE.md
|
90
|
+
- README.md
|
91
|
+
- Rakefile
|
92
|
+
- fog-xml.gemspec
|
93
|
+
- lib/fog/xml.rb
|
94
|
+
- lib/fog/xml/connection.rb
|
95
|
+
- lib/fog/xml/sax_parser_connection.rb
|
96
|
+
- lib/fog/xml/version.rb
|
97
|
+
homepage: https://github.com/zertico/fog-xml
|
98
|
+
licenses:
|
99
|
+
- MIT
|
100
|
+
metadata: {}
|
101
|
+
post_install_message:
|
102
|
+
rdoc_options: []
|
103
|
+
require_paths:
|
104
|
+
- lib
|
105
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - ">"
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: 1.3.1
|
115
|
+
requirements: []
|
116
|
+
rubyforge_project:
|
117
|
+
rubygems_version: 2.2.2
|
118
|
+
signing_key:
|
119
|
+
specification_version: 4
|
120
|
+
summary: XML parsing for fog providers
|
121
|
+
test_files: []
|