cm-httpclient 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/httpclient.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{httpclient}
5
- s.version = "1.0.1"
5
+ s.version = "1.0.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["pedro gutierrez"]
@@ -24,9 +24,10 @@ Gem::Specification.new do |s|
24
24
  s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
25
25
  s.require_paths = ["lib"]
26
26
  s.rubyforge_project = %q{cm-httpclient}
27
- s.rubygems_version = %q{1.0.1}
27
+ s.rubygems_version = %q{1.0.2}
28
28
  s.summary = %q{a simple httpclient}
29
-
29
+ s.add_dependency( %q<json>, [">= 1.1.6"])
30
+
30
31
  #if s.respond_to? :specification_version then
31
32
  # current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
32
33
  # s.specification_version = 2
@@ -1,6 +1,8 @@
1
+ require 'rubygems'
1
2
  require 'net/https'
2
3
  require 'uri'
3
4
  require 'rexml/document'
5
+ require 'json'
4
6
 
5
7
  class Hash
6
8
  def to_s
@@ -139,9 +141,10 @@ module CodeMutiny
139
141
  headers = res.to_hash
140
142
  body = res.body
141
143
  debug_response( code, headers, body )
142
- if res[ 'Content-Type' ] == 'text/xml'
143
- body = REXML::Document.new( body )
144
- end
144
+ case res[ 'Content-Type' ]
145
+ when 'text/x-json' then body = JSON.parse body
146
+ when 'text/xml' then body = REXML::Document.new( body )
147
+ end
145
148
  if block
146
149
  block.call( code, body, headers )
147
150
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cm-httpclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - pedro gutierrez
@@ -11,8 +11,17 @@ cert_chain: []
11
11
 
12
12
  date: 2009-05-29 00:00:00 -07:00
13
13
  default_executable:
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: json
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.1.6
24
+ version:
16
25
  description: a simple httpclient
17
26
  email: pedrogutierrez@mac.com
18
27
  executables: []