restfulie 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -2
- data/lib/restfulie/client/ext/http_ext.rb +19 -13
- data/lib/restfulie/client/feature/base_request.rb +12 -5
- data/lib/restfulie/version.rb +2 -2
- data/restfulie.gemspec +2 -5
- metadata +60 -28
data/Rakefile
CHANGED
@@ -1,21 +1,27 @@
|
|
1
1
|
module Net
|
2
2
|
class HTTP
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
3
|
+
if not method_defined? :patch
|
4
|
+
# Definition of a patch method in the same way that post works
|
5
|
+
def patch(path, data, initheader = nil, dest = nil, &block) # :yield: +body_segment+
|
6
|
+
res = nil
|
7
|
+
request(Patch.new(path, initheader), data) {|r|
|
8
|
+
r.read_body dest, &block
|
9
|
+
res = r
|
10
|
+
}
|
11
|
+
unless @newimpl
|
12
|
+
res.value
|
13
|
+
return res, res.body
|
14
|
+
end
|
15
|
+
res
|
13
16
|
end
|
14
|
-
res
|
15
17
|
end
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
+
if not const_defined? :Patch
|
20
|
+
class Patch < HTTPRequest
|
21
|
+
METHOD = 'PATCH'
|
22
|
+
REQUEST_HAS_BODY = true
|
23
|
+
RESPONSE_HAS_BODY = true
|
24
|
+
end
|
19
25
|
end
|
20
26
|
end
|
21
27
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class Restfulie::Client::Feature::BaseRequest
|
2
|
-
|
2
|
+
|
3
3
|
def execute(flow, request, env)
|
4
4
|
request!(request.verb, request.host, request.path, request, flow, env)
|
5
5
|
end
|
@@ -11,7 +11,7 @@ class Restfulie::Client::Feature::BaseRequest
|
|
11
11
|
def request!(method, host, path, request, flow, env)
|
12
12
|
|
13
13
|
::Restfulie::Common::Logger.logger.info(request.http_to_s(method, path, [request.headers])) if ::Restfulie::Common::Logger.logger
|
14
|
-
http_request = get_connection_provider(host)
|
14
|
+
http_request = get_connection_provider(host, env)
|
15
15
|
|
16
16
|
if env[:body]
|
17
17
|
enhance http_request.send(method, path, env[:body], request.headers)
|
@@ -23,12 +23,19 @@ class Restfulie::Client::Feature::BaseRequest
|
|
23
23
|
|
24
24
|
protected
|
25
25
|
|
26
|
-
def get_connection_provider(
|
27
|
-
@connection ||=
|
26
|
+
def get_connection_provider(uri, env)
|
27
|
+
@connection ||= create_connection(uri, env)
|
28
28
|
end
|
29
29
|
|
30
30
|
private
|
31
|
-
|
31
|
+
def create_connection(uri, env)
|
32
|
+
result = ::Net::HTTP.new(uri.host, uri.port)
|
33
|
+
result.use_ssl = true if uri.scheme == 'https'
|
34
|
+
ssl_verify_mode = env[:ssl_verify_mode]
|
35
|
+
result.verify_mode = ssl_verify_mode if ssl_verify_mode
|
36
|
+
result
|
37
|
+
end
|
38
|
+
|
32
39
|
def enhance(response)
|
33
40
|
def response.code
|
34
41
|
super.to_i
|
data/lib/restfulie/version.rb
CHANGED
data/restfulie.gemspec
CHANGED
@@ -25,17 +25,14 @@ Gem::Specification.new do |s|
|
|
25
25
|
end
|
26
26
|
|
27
27
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
28
|
-
s.add_runtime_dependency("nokogiri", [">= 1.4.2"])
|
29
|
-
s.add_runtime_dependency("json_pure", [">= 1.2.4"])
|
30
28
|
s.add_development_dependency("sqlite3-ruby")
|
31
29
|
else
|
32
|
-
s.add_dependency("nokogiri", [">= 1.4.2"])
|
33
|
-
s.add_dependency("json_pure", [">= 1.2.4"])
|
34
30
|
s.add_dependency("sqlite3-ruby")
|
35
31
|
end
|
36
32
|
|
33
|
+
s.add_dependency("nokogiri", [">= 1.4.2"])
|
34
|
+
s.add_dependency("json_pure", [">= 1.2.4"])
|
37
35
|
s.add_dependency("rack-conneg")
|
38
|
-
s.add_dependency("sqlite3-ruby")
|
39
36
|
s.add_dependency('hypertemplate', "~> 1.2.0")
|
40
37
|
s.add_dependency('medie', "~> 1.0.0")
|
41
38
|
s.add_dependency('respondie', "~> 0.9.0")
|
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restfulie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 1.1.0
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Guilherme Silveira, Caue Guerra, Luis Cipriani, Everton Ribeiro, George Guimaraes, Paulo Ahagon, and many more!
|
@@ -10,40 +15,53 @@ autorequire:
|
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date: 2011-
|
18
|
+
date: 2011-11-09 00:00:00 Z
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
21
|
+
name: sqlite3-ruby
|
17
22
|
prerelease: false
|
18
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
19
24
|
none: false
|
20
25
|
requirements:
|
21
26
|
- - ">="
|
22
27
|
- !ruby/object:Gem::Version
|
23
|
-
|
24
|
-
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
32
|
+
type: :development
|
25
33
|
version_requirements: *id001
|
26
34
|
- !ruby/object:Gem::Dependency
|
27
|
-
name:
|
35
|
+
name: nokogiri
|
28
36
|
prerelease: false
|
29
37
|
requirement: &id002 !ruby/object:Gem::Requirement
|
30
38
|
none: false
|
31
39
|
requirements:
|
32
40
|
- - ">="
|
33
41
|
- !ruby/object:Gem::Version
|
34
|
-
|
42
|
+
hash: 3
|
43
|
+
segments:
|
44
|
+
- 1
|
45
|
+
- 4
|
46
|
+
- 2
|
47
|
+
version: 1.4.2
|
35
48
|
type: :runtime
|
36
49
|
version_requirements: *id002
|
37
50
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
51
|
+
name: json_pure
|
39
52
|
prerelease: false
|
40
53
|
requirement: &id003 !ruby/object:Gem::Requirement
|
41
54
|
none: false
|
42
55
|
requirements:
|
43
56
|
- - ">="
|
44
57
|
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
|
58
|
+
hash: 23
|
59
|
+
segments:
|
60
|
+
- 1
|
61
|
+
- 2
|
62
|
+
- 4
|
63
|
+
version: 1.2.4
|
64
|
+
type: :runtime
|
47
65
|
version_requirements: *id003
|
48
66
|
- !ruby/object:Gem::Dependency
|
49
67
|
name: rack-conneg
|
@@ -53,53 +71,60 @@ dependencies:
|
|
53
71
|
requirements:
|
54
72
|
- - ">="
|
55
73
|
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
75
|
+
segments:
|
76
|
+
- 0
|
56
77
|
version: "0"
|
57
78
|
type: :runtime
|
58
79
|
version_requirements: *id004
|
59
|
-
- !ruby/object:Gem::Dependency
|
60
|
-
name: sqlite3-ruby
|
61
|
-
prerelease: false
|
62
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
63
|
-
none: false
|
64
|
-
requirements:
|
65
|
-
- - ">="
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: "0"
|
68
|
-
type: :runtime
|
69
|
-
version_requirements: *id005
|
70
80
|
- !ruby/object:Gem::Dependency
|
71
81
|
name: hypertemplate
|
72
82
|
prerelease: false
|
73
|
-
requirement: &
|
83
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
74
84
|
none: false
|
75
85
|
requirements:
|
76
86
|
- - ~>
|
77
87
|
- !ruby/object:Gem::Version
|
88
|
+
hash: 31
|
89
|
+
segments:
|
90
|
+
- 1
|
91
|
+
- 2
|
92
|
+
- 0
|
78
93
|
version: 1.2.0
|
79
94
|
type: :runtime
|
80
|
-
version_requirements: *
|
95
|
+
version_requirements: *id005
|
81
96
|
- !ruby/object:Gem::Dependency
|
82
97
|
name: medie
|
83
98
|
prerelease: false
|
84
|
-
requirement: &
|
99
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
85
100
|
none: false
|
86
101
|
requirements:
|
87
102
|
- - ~>
|
88
103
|
- !ruby/object:Gem::Version
|
104
|
+
hash: 23
|
105
|
+
segments:
|
106
|
+
- 1
|
107
|
+
- 0
|
108
|
+
- 0
|
89
109
|
version: 1.0.0
|
90
110
|
type: :runtime
|
91
|
-
version_requirements: *
|
111
|
+
version_requirements: *id006
|
92
112
|
- !ruby/object:Gem::Dependency
|
93
113
|
name: respondie
|
94
114
|
prerelease: false
|
95
|
-
requirement: &
|
115
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
96
116
|
none: false
|
97
117
|
requirements:
|
98
118
|
- - ~>
|
99
119
|
- !ruby/object:Gem::Version
|
120
|
+
hash: 59
|
121
|
+
segments:
|
122
|
+
- 0
|
123
|
+
- 9
|
124
|
+
- 0
|
100
125
|
version: 0.9.0
|
101
126
|
type: :runtime
|
102
|
-
version_requirements: *
|
127
|
+
version_requirements: *id007
|
103
128
|
description: restfulie
|
104
129
|
email: guilherme.silveira@caelum.com.br
|
105
130
|
executables: []
|
@@ -637,17 +662,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
637
662
|
requirements:
|
638
663
|
- - ">="
|
639
664
|
- !ruby/object:Gem::Version
|
665
|
+
hash: 3
|
666
|
+
segments:
|
667
|
+
- 0
|
640
668
|
version: "0"
|
641
669
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
642
670
|
none: false
|
643
671
|
requirements:
|
644
672
|
- - ">="
|
645
673
|
- !ruby/object:Gem::Version
|
674
|
+
hash: 3
|
675
|
+
segments:
|
676
|
+
- 0
|
646
677
|
version: "0"
|
647
678
|
requirements: []
|
648
679
|
|
649
680
|
rubyforge_project: restfulie
|
650
|
-
rubygems_version: 1.8.
|
681
|
+
rubygems_version: 1.8.11
|
651
682
|
signing_key:
|
652
683
|
specification_version: 3
|
653
684
|
summary: Hypermedia aware resource based library in ruby (client side) and ruby on rails (server side).
|
@@ -682,3 +713,4 @@ test_files:
|
|
682
713
|
- spec/unit/server/core_ext/array_spec.rb
|
683
714
|
- spec/unit/server/restfulie_controller_spec.rb
|
684
715
|
- spec/unit/spec_helper.rb
|
716
|
+
has_rdoc:
|