jimmy_hat 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ == 1.0.0 2011-09-27
2
+
3
+ * 1 major enhancement:
4
+ * Initial release
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Yossef Mendelssohn
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,28 @@
1
+ # What?
2
+
3
+ All you need to know can be answered by reading this chat log.
4
+
5
+ ```
6
+ <arafatm> looking at the api. i have a service that only returns xml, no json.
7
+ <jameswhite> put a jimmy on it
8
+ <brandonvalentine> yeah, wear your jimmy hat
9
+ <rickbradley> someone should make an xml->json translator called jimmy hat
10
+ <cardioid> rickbradley: I'll do it.
11
+ <cardioid> rickbradley: I mean, it's just tying together some Ruby stdlibs and giving it a silly name, right?
12
+ <wilkes> cardioid: except for the edge cases that ruby libraries tend not cover because they are opinionated
13
+ <cardioid> wilkes: You think a gem called "jimmy_hat" is going to care about edge cases?
14
+ <wilkes> jimmy hats are all about edge cases
15
+ <rickbradley> quote of the day, so far
16
+ <cardioid> Actually, this can't use stdlib. There's no stdlib XML parser that doesn't suck.
17
+ <jameswhite> cardioid: even if there was a stdlib xml parser that didn't suck, It's still suck, becuase it uses xml.
18
+ ```
19
+
20
+ Or at least that's all I'm going to tell you.
21
+
22
+ ## Contributions
23
+
24
+ Fork it. Send a pull request. Have a blast.
25
+
26
+ ## License
27
+
28
+ jimmy_hat uses the MIT license. Read License.txt if you care.
@@ -0,0 +1,10 @@
1
+ require 'cobravsmongoose'
2
+ require 'json'
3
+
4
+ module JimmyHat
5
+ class << self
6
+ def convert(xml)
7
+ CobraVsMongoose.xml_to_json(xml)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ require 'rubygems'
2
+ require 'bacon'
3
+
4
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
5
+ require 'jimmy_hat'
@@ -0,0 +1,27 @@
1
+ require File.dirname(__FILE__) + '/helper.rb'
2
+
3
+ describe JimmyHat do
4
+ it 'should allow conversion' do
5
+ JimmyHat.should.respond_to(:convert)
6
+ end
7
+
8
+ describe 'conversion' do
9
+ it 'should accept XML' do
10
+ lambda { JimmyHat.convert('<hey>you</hey>') }.should.not.raise(ArgumentError)
11
+ end
12
+
13
+ it 'should require XML' do
14
+ lambda { JimmyHat.convert }.should.raise(ArgumentError)
15
+ end
16
+
17
+ it 'should convert the given XML into JSON' do
18
+ xml = '<something>
19
+ <blah>yo</blah>
20
+ </something>
21
+ '
22
+ json = '{"something":{"blah":{"$":"yo"}}}'
23
+
24
+ JimmyHat.convert(xml).should == json
25
+ end
26
+ end
27
+ end
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jimmy_hat
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Yossef Mendelssohn
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-09-27 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: cobravsmongoose
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 27
29
+ segments:
30
+ - 0
31
+ - 0
32
+ - 2
33
+ version: 0.0.2
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: json
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 13
45
+ segments:
46
+ - 1
47
+ - 6
48
+ - 1
49
+ version: 1.6.1
50
+ type: :runtime
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ name: bacon
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 19
61
+ segments:
62
+ - 1
63
+ - 1
64
+ - 0
65
+ version: 1.1.0
66
+ type: :development
67
+ version_requirements: *id003
68
+ description: Quick-and-easy XML-to-JSON con-ver-sion.
69
+ email:
70
+ - ymendel@pobox.com
71
+ executables: []
72
+
73
+ extensions: []
74
+
75
+ extra_rdoc_files: []
76
+
77
+ files:
78
+ - License.txt
79
+ - History.txt
80
+ - README.md
81
+ - lib/jimmy_hat.rb
82
+ - spec/helper.rb
83
+ - spec/jimmy_hat_spec.rb
84
+ homepage: http://github.com/ymendel/jimmy_hat/
85
+ licenses: []
86
+
87
+ post_install_message:
88
+ rdoc_options: []
89
+
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ none: false
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ hash: 3
98
+ segments:
99
+ - 0
100
+ version: "0"
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ hash: 3
107
+ segments:
108
+ - 0
109
+ version: "0"
110
+ requirements: []
111
+
112
+ rubyforge_project:
113
+ rubygems_version: 1.8.10
114
+ signing_key:
115
+ specification_version: 3
116
+ summary: Protect yourself (from XML).
117
+ test_files: []
118
+