nestful 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/nestful/formats/blank_format.rb +5 -5
- data/lib/nestful/request.rb +13 -0
- data/lib/nestful/resource.rb +4 -2
- data/lib/nestful.rb +5 -6
- data/nestful.gemspec +4 -4
- metadata +7 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
@@ -1,13 +1,13 @@
|
|
1
|
-
module Nestful
|
1
|
+
module Nestful
|
2
2
|
module Formats
|
3
3
|
class BlankFormat < Format
|
4
4
|
def encode(params, options = nil)
|
5
|
-
raise "Choose an encoding format, such as :form"
|
5
|
+
raise "Choose an encoding format, such as :form"
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
def decode(body)
|
9
9
|
body
|
10
10
|
end
|
11
|
-
end
|
12
|
-
end
|
11
|
+
end
|
12
|
+
end
|
13
13
|
end
|
data/lib/nestful/request.rb
CHANGED
@@ -24,6 +24,10 @@ module Nestful
|
|
24
24
|
self.headers ||= {}
|
25
25
|
self.params ||= {}
|
26
26
|
self.body ||= ''
|
27
|
+
|
28
|
+
if self.uri.query
|
29
|
+
populate_query_params
|
30
|
+
end
|
27
31
|
end
|
28
32
|
|
29
33
|
def format=(mime_or_format)
|
@@ -101,6 +105,15 @@ module Nestful
|
|
101
105
|
end
|
102
106
|
end
|
103
107
|
|
108
|
+
def populate_query_params
|
109
|
+
uri_query = self.uri.query.split("&").inject({}) {|hash, res|
|
110
|
+
key, value = res.split("=")
|
111
|
+
hash[key] = value
|
112
|
+
hash
|
113
|
+
}
|
114
|
+
self.params.merge!(uri_query)
|
115
|
+
end
|
116
|
+
|
104
117
|
def callbacks(type = nil)
|
105
118
|
@callbacks ||= {}
|
106
119
|
return @callbacks unless type
|
data/lib/nestful/resource.rb
CHANGED
data/lib/nestful.rb
CHANGED
@@ -2,8 +2,7 @@ require "net/http"
|
|
2
2
|
require "uri"
|
3
3
|
require "tempfile"
|
4
4
|
|
5
|
-
require "active_support/core_ext
|
6
|
-
require "active_support/core_ext/object/to_query"
|
5
|
+
require "active_support/core_ext"
|
7
6
|
require "active_support/inflector"
|
8
7
|
|
9
8
|
$:.unshift(File.dirname(__FILE__))
|
@@ -19,19 +18,19 @@ module Nestful
|
|
19
18
|
extend self
|
20
19
|
|
21
20
|
def get(url, options = {})
|
22
|
-
Request.new(url,
|
21
|
+
Request.new(url, ({:method => :get}).merge(options)).execute
|
23
22
|
end
|
24
23
|
|
25
24
|
def post(url, options = {})
|
26
|
-
Request.new(url,
|
25
|
+
Request.new(url, ({:method => :post, :format => :form}).merge(options)).execute
|
27
26
|
end
|
28
27
|
|
29
28
|
def put(url, options = {})
|
30
|
-
Request.new(url,
|
29
|
+
Request.new(url, ({:method => :put}).merge(options)).execute
|
31
30
|
end
|
32
31
|
|
33
32
|
def delete(url, options = {})
|
34
|
-
Request.new(url,
|
33
|
+
Request.new(url, ({:method => :delete}).merge(options)).execute
|
35
34
|
end
|
36
35
|
|
37
36
|
def json_get(url, params = nil)
|
data/nestful.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{nestful}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Alex MacCaw"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-08-23}
|
13
13
|
s.description = %q{Simple Ruby HTTP/REST client with a sane API}
|
14
14
|
s.email = %q{info@eribium.org}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -38,14 +38,14 @@ Gem::Specification.new do |s|
|
|
38
38
|
s.homepage = %q{http://github.com/maccman/nestful}
|
39
39
|
s.rdoc_options = ["--charset=UTF-8"]
|
40
40
|
s.require_paths = ["lib"]
|
41
|
-
s.rubygems_version = %q{1.3.
|
41
|
+
s.rubygems_version = %q{1.3.7}
|
42
42
|
s.summary = %q{Simple Ruby HTTP/REST client with a sane API}
|
43
43
|
|
44
44
|
if s.respond_to? :specification_version then
|
45
45
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
46
46
|
s.specification_version = 3
|
47
47
|
|
48
|
-
if Gem::Version.new(Gem::
|
48
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
49
49
|
s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0.beta"])
|
50
50
|
else
|
51
51
|
s.add_dependency(%q<activesupport>, [">= 3.0.0.beta"])
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Alex MacCaw
|
@@ -14,13 +14,14 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-08-23 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: activesupport
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
24
25
|
requirements:
|
25
26
|
- - ">="
|
26
27
|
- !ruby/object:Gem::Version
|
@@ -69,6 +70,7 @@ rdoc_options:
|
|
69
70
|
require_paths:
|
70
71
|
- lib
|
71
72
|
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
72
74
|
requirements:
|
73
75
|
- - ">="
|
74
76
|
- !ruby/object:Gem::Version
|
@@ -76,6 +78,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
76
78
|
- 0
|
77
79
|
version: "0"
|
78
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
79
82
|
requirements:
|
80
83
|
- - ">="
|
81
84
|
- !ruby/object:Gem::Version
|
@@ -85,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
88
|
requirements: []
|
86
89
|
|
87
90
|
rubyforge_project:
|
88
|
-
rubygems_version: 1.3.
|
91
|
+
rubygems_version: 1.3.7
|
89
92
|
signing_key:
|
90
93
|
specification_version: 3
|
91
94
|
summary: Simple Ruby HTTP/REST client with a sane API
|