wrest 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +31 -17
- data/Rakefile +147 -134
- data/VERSION.yml +1 -1
- data/bin/jwrest +3 -0
- data/bin/wrest +1 -20
- data/bin/wrest_shell.rb +21 -0
- data/lib/wrest/components.rb +4 -1
- data/lib/wrest/components/attributes_container.rb +65 -10
- data/lib/wrest/{translators/xml.rb → components/mutators.rb} +11 -13
- data/lib/wrest/components/mutators/base.rb +43 -0
- data/lib/wrest/components/mutators/camel_to_snake_case.rb +20 -0
- data/lib/wrest/components/mutators/xml_simple_type_caster.rb +35 -0
- data/lib/wrest/{translators.rb → components/translators.rb} +6 -7
- data/lib/wrest/{translators → components/translators}/content_types.rb +5 -5
- data/lib/wrest/components/translators/json.rb +22 -0
- data/lib/wrest/components/translators/xml.rb +26 -0
- data/lib/wrest/components/typecast_helpers.rb +41 -0
- data/lib/wrest/core_ext/hash.rb +5 -0
- data/lib/wrest/core_ext/hash/conversions.rb +44 -0
- data/lib/wrest/exceptions.rb +6 -1
- data/lib/wrest/exceptions/method_not_overridden_exception.rb +17 -0
- data/lib/wrest/exceptions/unsupported_content_type_exception.rb +11 -9
- data/lib/wrest/resource/base.rb +5 -1
- data/lib/wrest/response.rb +2 -2
- data/lib/wrest/uri.rb +3 -3
- data/lib/wrest/version.rb +1 -1
- data/spec/spec_helper.rb +2 -1
- data/spec/wrest/components/attributes_container_spec.rb +66 -11
- data/spec/wrest/components/mutators/base_spec.rb +38 -0
- data/spec/wrest/components/mutators/camel_to_snake_spec.rb +22 -0
- data/spec/wrest/components/mutators/xml_simple_type_caster_spec.rb +47 -0
- data/spec/wrest/{translators → components/translators}/xml_spec.rb +3 -3
- data/spec/wrest/components/translators_spec.rb +9 -0
- data/spec/wrest/core_ext/hash/conversions_spec.rb +22 -0
- data/{lib/wrest/translators/json.rb → spec/wrest/core_ext/string/conversions_spec.rb} +4 -9
- data/spec/wrest/resource/base_spec.rb +1 -1
- data/spec/wrest/response_spec.rb +3 -3
- data/spec/wrest/uri_spec.rb +2 -2
- metadata +34 -19
- data/lib/wrest/translators/typed_hash.rb +0 -4
- data/spec/wrest/core_ext/string_spec.rb +0 -7
- data/spec/wrest/translators/typed_hash_spec.rb +0 -9
- data/spec/wrest/translators_spec.rb +0 -9
data/spec/wrest/uri_spec.rb
CHANGED
@@ -109,9 +109,9 @@ module Wrest
|
|
109
109
|
http = mock(Net::HTTP)
|
110
110
|
Net::HTTP.should_receive(:new).with('localhost', 3000).and_return(http)
|
111
111
|
|
112
|
-
http.should_receive(:delete).with('/glassware', {'page' => '2', 'per_page' => '5'}).and_return(build_ok_response(nil))
|
112
|
+
http.should_receive(:delete).with('/glassware?owner=Kai&type=bottle', {'page' => '2', 'per_page' => '5'}).and_return(build_ok_response(nil))
|
113
113
|
|
114
|
-
uri.delete(:page => '2', :per_page => '5')
|
114
|
+
uri.delete({:owner => 'Kai', :type => 'bottle'}, :page => '2', :per_page => '5')
|
115
115
|
end
|
116
116
|
|
117
117
|
it "should not mutate state of the uri across requests" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wrest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sidu Ponnappa
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-24 00:00:00 +05:30
|
13
13
|
default_executable: wrest
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -23,24 +23,24 @@ dependencies:
|
|
23
23
|
version: 2.1.0
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
26
|
+
name: xml-simple
|
27
27
|
type: :runtime
|
28
28
|
version_requirement:
|
29
29
|
version_requirements: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.0.11
|
34
34
|
version:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
36
|
+
name: json
|
37
37
|
type: :runtime
|
38
38
|
version_requirement:
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 1.
|
43
|
+
version: 1.1.3
|
44
44
|
version:
|
45
45
|
description: Wrest is a REST client library which allows you to quickly build object oriented wrappers around any web service. It has two main components - Wrest Core and Wrest::Resource.
|
46
46
|
email: ckponnappa@gmail.com
|
@@ -54,23 +54,32 @@ files:
|
|
54
54
|
- README.rdoc
|
55
55
|
- Rakefile
|
56
56
|
- VERSION.yml
|
57
|
+
- bin/jwrest
|
57
58
|
- bin/wrest
|
59
|
+
- bin/wrest_shell.rb
|
58
60
|
- lib/wrest.rb
|
59
61
|
- lib/wrest/components.rb
|
60
62
|
- lib/wrest/components/attributes_container.rb
|
63
|
+
- lib/wrest/components/mutators.rb
|
64
|
+
- lib/wrest/components/mutators/base.rb
|
65
|
+
- lib/wrest/components/mutators/camel_to_snake_case.rb
|
66
|
+
- lib/wrest/components/mutators/xml_simple_type_caster.rb
|
67
|
+
- lib/wrest/components/translators.rb
|
68
|
+
- lib/wrest/components/translators/content_types.rb
|
69
|
+
- lib/wrest/components/translators/json.rb
|
70
|
+
- lib/wrest/components/translators/xml.rb
|
71
|
+
- lib/wrest/components/typecast_helpers.rb
|
72
|
+
- lib/wrest/core_ext/hash.rb
|
73
|
+
- lib/wrest/core_ext/hash/conversions.rb
|
61
74
|
- lib/wrest/core_ext/string.rb
|
62
75
|
- lib/wrest/core_ext/string/conversions.rb
|
63
76
|
- lib/wrest/exceptions.rb
|
77
|
+
- lib/wrest/exceptions/method_not_overridden_exception.rb
|
64
78
|
- lib/wrest/exceptions/unsupported_content_type_exception.rb
|
65
79
|
- lib/wrest/resource.rb
|
66
80
|
- lib/wrest/resource/base.rb
|
67
81
|
- lib/wrest/resource/collection.rb
|
68
82
|
- lib/wrest/response.rb
|
69
|
-
- lib/wrest/translators.rb
|
70
|
-
- lib/wrest/translators/content_types.rb
|
71
|
-
- lib/wrest/translators/json.rb
|
72
|
-
- lib/wrest/translators/typed_hash.rb
|
73
|
-
- lib/wrest/translators/xml.rb
|
74
83
|
- lib/wrest/uri.rb
|
75
84
|
- lib/wrest/uri_template.rb
|
76
85
|
- lib/wrest/version.rb
|
@@ -79,12 +88,15 @@ files:
|
|
79
88
|
- spec/spec.opts
|
80
89
|
- spec/spec_helper.rb
|
81
90
|
- spec/wrest/components/attributes_container_spec.rb
|
82
|
-
- spec/wrest/
|
91
|
+
- spec/wrest/components/mutators/base_spec.rb
|
92
|
+
- spec/wrest/components/mutators/camel_to_snake_spec.rb
|
93
|
+
- spec/wrest/components/mutators/xml_simple_type_caster_spec.rb
|
94
|
+
- spec/wrest/components/translators/xml_spec.rb
|
95
|
+
- spec/wrest/components/translators_spec.rb
|
96
|
+
- spec/wrest/core_ext/hash/conversions_spec.rb
|
97
|
+
- spec/wrest/core_ext/string/conversions_spec.rb
|
83
98
|
- spec/wrest/resource/base_spec.rb
|
84
99
|
- spec/wrest/response_spec.rb
|
85
|
-
- spec/wrest/translators/typed_hash_spec.rb
|
86
|
-
- spec/wrest/translators/xml_spec.rb
|
87
|
-
- spec/wrest/translators_spec.rb
|
88
100
|
- spec/wrest/uri_spec.rb
|
89
101
|
- spec/wrest/uri_template_spec.rb
|
90
102
|
has_rdoc: true
|
@@ -119,11 +131,14 @@ test_files:
|
|
119
131
|
- spec/custom_matchers/custom_matchers.rb
|
120
132
|
- spec/spec_helper.rb
|
121
133
|
- spec/wrest/components/attributes_container_spec.rb
|
122
|
-
- spec/wrest/
|
134
|
+
- spec/wrest/components/mutators/base_spec.rb
|
135
|
+
- spec/wrest/components/mutators/camel_to_snake_spec.rb
|
136
|
+
- spec/wrest/components/mutators/xml_simple_type_caster_spec.rb
|
137
|
+
- spec/wrest/components/translators/xml_spec.rb
|
138
|
+
- spec/wrest/components/translators_spec.rb
|
139
|
+
- spec/wrest/core_ext/hash/conversions_spec.rb
|
140
|
+
- spec/wrest/core_ext/string/conversions_spec.rb
|
123
141
|
- spec/wrest/resource/base_spec.rb
|
124
142
|
- spec/wrest/response_spec.rb
|
125
|
-
- spec/wrest/translators/typed_hash_spec.rb
|
126
|
-
- spec/wrest/translators/xml_spec.rb
|
127
|
-
- spec/wrest/translators_spec.rb
|
128
143
|
- spec/wrest/uri_spec.rb
|
129
144
|
- spec/wrest/uri_template_spec.rb
|
@@ -1,9 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
|
3
|
-
module Wrest
|
4
|
-
describe Translators do
|
5
|
-
it "should know how to raise an exception if the mime type doesn't exist" do
|
6
|
-
lambda{ Translators.load('weird/unknown')}.should raise_error(UnsupportedContentTypeException)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|