wrest 1.0.0.beta3 → 1.0.0.beta4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -18,6 +18,9 @@ Features under a numbered section are complete and available in the Wrest gem.
18
18
 
19
19
  == Current
20
20
 
21
+ == 1.0.0.beta4
22
+ * GH#34 Wrest::Uri extensions swallow existing path
23
+
21
24
  == 1.0.0.beta3
22
25
  * GH#13 Works for get and delete with parameters appended to the uri string and
23
26
  with ? and no parameters appended to the uri string
data/README.rdoc CHANGED
@@ -1,4 +1,4 @@
1
- = Wrest 1.0.0.beta3
1
+ = Wrest 1.0.0.beta4
2
2
 
3
3
  (c) Copyright 2009-2010 {Sidu Ponnappa}[http://blog.sidu.in]. All Rights Reserved.
4
4
 
@@ -17,55 +17,38 @@ To receive notifications whenever new features are added to Wrest, please subscr
17
17
 
18
18
  For Facebook, Twitter, Delicious, GitHub and other API examples, see http://github.com/kaiwren/wrest/tree/master/examples
19
19
 
20
- == Installation
21
-
22
- The source is available at git://github.com/kaiwren/wrest.git
23
-
24
- To install the Wrest gem, do <tt>(sudo) gem install wrest --pre</tt>.
25
-
26
- Wrest is currently available as a gem for for Ruby and JRuby.
27
-
28
- === Shell
29
-
30
- You can launch the interactive Wrest shell by running bin/wrest if you have the source or invoking <tt>wrest</tt> from your prompt if you've installed the gem.
31
- $ wrest
32
- >> y 'http://twitter.com/statuses/public_timeline.json'.to_uri(:timeout => 5).get.deserialise
33
-
34
- === Library
35
-
36
- require 'rubygems'
37
- require 'wrest'
38
- y "http://search.yahooapis.com/NewsSearchService/V1/newsSearch".to_uri.get(
39
- :appid => 'YahooDemo',
40
- :output => 'xml',
41
- :query => 'India',
42
- :results=> '3',
43
- :start => '1'
44
- )
45
20
  === Basic Http Calls
46
21
 
47
22
  ==== GET
48
23
 
49
- A couple of ways to get Yahoo news as a hash map.
50
-
51
- * This example simply does a get on a uri and figures out the appropriate deserialiser using the content-type (in this case 'text/javascript', which uses Wrest::Translators::Json). See content_types.rb under lib/wrest/mappers/translators.
52
- "http://search.yahooapis.com/NewsSearchService/V1/newsSearch?appid=YahooDemo&output=json&query=India&results=3&start=1".to_uri.get.deserialise
53
-
54
- * This example does a get on a base uri with several parameters passed to it, resulting in a uri essentially the same as the one above. It also shows how you can specify a custom deserialiser to produce a hash-map from the response, as well as a hash mutator to clean up the deserialised hash.
55
- require 'rubygems'
56
- require 'wrest'
57
- include Wrest::Components
58
- y "http://search.yahooapis.com/NewsSearchService/V1/newsSearch".to_uri.get(
24
+ * Basic API calls
25
+
26
+ 'http://twitter.com/statuses/public_timeline.json'.to_uri.get.deserialise # works with json and xml out of the box
27
+
28
+ 'http://twitter.com/statuses/public_timeline.xml'.to_uri.get.deserialise # see lib/wrest/components/translators to add other formats
29
+ * Timeout support
30
+
31
+ 'http://twitter.com/statuses/public_timeline.json'.to_uri.get(:timeout => 5).body
32
+ * Redirect support
33
+
34
+ 'http://google.com'.to_uri(:follow_redirects => false).get
35
+
36
+ 'http://google.com'.to_uri(:follow_redirects_limit => 1).get
37
+ * More complex call with custom deserialiser
38
+
39
+ 'http://search.yahooapis.com/NewsSearchService/V1/newsSearch'.to_uri.get(
59
40
  :appid => 'YahooDemo',
60
41
  :output => 'xml',
61
42
  :query => 'India',
62
43
  :results=> '3',
63
44
  :start => '1'
64
45
  ).deserialise_using(
65
- Translators::Xml
66
- ).mutate_using(
67
- Mutators::XmlMiniTypeCaster.new
46
+ Wrest::Translators::Xml
68
47
  )
48
+ * Basic HTTP auth and URI extensions using Wrest::Uri#[]
49
+
50
+ base_uri = 'https://api.del.icio.us/v1'.to_uri(:username => 'kaiwren', :password => 'fupupp1es')
51
+ bookmarks = base_uri['/posts/get'].get.deserialise
69
52
 
70
53
  ==== DELETE
71
54
 
@@ -125,3 +108,17 @@ Wrest RDocs can be found at http://wrest.rubyforge.org
125
108
  == Roadmap
126
109
 
127
110
  Features that are planned, in progress or already implemented are documented in the {CHANGELOG}[http://github.com/kaiwren/wrest/tree/master/CHANGELOG] starting from version 0.0.8.
111
+
112
+ == Installation
113
+
114
+ The source is available at git://github.com/kaiwren/wrest.git
115
+
116
+ To install the Wrest gem, do <tt>(sudo) gem install wrest --pre</tt>.
117
+
118
+ Wrest is currently available as a gem for for Ruby and JRuby.
119
+
120
+ === Shell
121
+
122
+ You can launch the interactive Wrest shell by running bin/wrest if you have the source or invoking <tt>wrest</tt> from your prompt if you've installed the gem.
123
+ $ wrest
124
+ >> y 'http://twitter.com/statuses/public_timeline.json'.to_uri(:timeout => 5).get.deserialise
data/lib/wrest/uri.rb CHANGED
@@ -58,7 +58,7 @@ module Wrest #:nodoc:
58
58
  # uri = "https://localhost:3000/v1".to_uri(:username => 'foo', :password => 'bar')
59
59
  # uri['/oogas/1', {:username => 'meh', :password => 'baz'}].get
60
60
  def [](path, options = nil)
61
- Uri.new(URI.join(uri_string, path), options || @options)
61
+ Uri.new(uri + File.join(uri_path, path), options || @options)
62
62
  end
63
63
 
64
64
  # Clones a Uri, building a new instance with exactly the same uri string.
data/lib/wrest/version.rb CHANGED
@@ -13,7 +13,7 @@ module Wrest
13
13
  MAJOR = 1
14
14
  MINOR = 0
15
15
  TINY = 0
16
- BUILD = 'beta3'
16
+ BUILD = 'beta4'
17
17
 
18
18
  STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
19
19
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wrest
3
3
  version: !ruby/object:Gem::Version
4
- hash: 299253595
4
+ hash: -1848230056
5
5
  prerelease: true
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
9
  - 0
10
- - beta3
11
- version: 1.0.0.beta3
10
+ - beta4
11
+ version: 1.0.0.beta4
12
12
  platform: ruby
13
13
  authors:
14
14
  - Sidu Ponnappa
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-09-15 00:00:00 +05:30
20
+ date: 2010-09-17 00:00:00 +05:30
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -96,63 +96,63 @@ extensions: []
96
96
  extra_rdoc_files:
97
97
  - README.rdoc
98
98
  files:
99
- - bin/wrest_shell.rb
100
99
  - bin/wrest
101
- - lib/wrest.rb
102
- - lib/wrest/uri_template.rb
103
- - lib/wrest/version.rb
104
- - lib/wrest/resource/state.rb
105
- - lib/wrest/resource/base.rb
106
- - lib/wrest/resource/collection.rb
107
- - lib/wrest/test.rb
100
+ - bin/wrest_shell.rb
101
+ - lib/wrest/components/container/alias_accessors.rb
102
+ - lib/wrest/components/container/typecaster.rb
103
+ - lib/wrest/components/container.rb
104
+ - lib/wrest/components/mutators/base.rb
105
+ - lib/wrest/components/mutators/camel_to_snake_case.rb
106
+ - lib/wrest/components/mutators/xml_mini_type_caster.rb
107
+ - lib/wrest/components/mutators/xml_simple_type_caster.rb
108
+ - lib/wrest/components/mutators.rb
109
+ - lib/wrest/components/translators/content_types.rb
110
+ - lib/wrest/components/translators/json.rb
111
+ - lib/wrest/components/translators/xml.rb
112
+ - lib/wrest/components/translators.rb
113
+ - lib/wrest/components.rb
108
114
  - lib/wrest/core_ext/hash/conversions.rb
109
115
  - lib/wrest/core_ext/hash.rb
110
116
  - lib/wrest/core_ext/string/conversions.rb
111
117
  - lib/wrest/core_ext/string.rb
112
- - lib/wrest/curl.rb
113
- - lib/wrest/native.rb
114
- - lib/wrest/http_shared.rb
115
- - lib/wrest/native/session.rb
116
- - lib/wrest/native/redirection.rb
117
- - lib/wrest/native/response.rb
118
- - lib/wrest/native/options.rb
119
- - lib/wrest/native/get.rb
120
- - lib/wrest/native/connection_factory.rb
121
- - lib/wrest/native/request.rb
122
- - lib/wrest/native/post.rb
123
- - lib/wrest/native/put_multipart.rb
124
- - lib/wrest/native/put.rb
125
- - lib/wrest/native/delete.rb
126
- - lib/wrest/native/post_multipart.rb
127
- - lib/wrest/uri.rb
128
- - lib/wrest/components.rb
129
- - lib/wrest/curl/session.rb
130
- - lib/wrest/curl/response.rb
131
- - lib/wrest/curl/options.rb
118
+ - lib/wrest/curl/delete.rb
132
119
  - lib/wrest/curl/get.rb
133
- - lib/wrest/curl/request.rb
120
+ - lib/wrest/curl/options.rb
134
121
  - lib/wrest/curl/post.rb
135
122
  - lib/wrest/curl/put.rb
136
- - lib/wrest/curl/delete.rb
123
+ - lib/wrest/curl/request.rb
124
+ - lib/wrest/curl/response.rb
125
+ - lib/wrest/curl/session.rb
126
+ - lib/wrest/curl.rb
137
127
  - lib/wrest/exceptions.rb
138
- - lib/wrest/components/translators/json.rb
139
- - lib/wrest/components/translators/xml.rb
140
- - lib/wrest/components/translators/content_types.rb
141
- - lib/wrest/components/mutators.rb
142
- - lib/wrest/components/translators.rb
143
- - lib/wrest/components/container.rb
144
- - lib/wrest/components/container/alias_accessors.rb
145
- - lib/wrest/components/container/typecaster.rb
146
- - lib/wrest/components/mutators/camel_to_snake_case.rb
147
- - lib/wrest/components/mutators/xml_mini_type_caster.rb
148
- - lib/wrest/components/mutators/base.rb
149
- - lib/wrest/components/mutators/xml_simple_type_caster.rb
150
- - lib/wrest/http_shared/standard_tokens.rb
151
- - lib/wrest/http_shared/standard_headers.rb
152
128
  - lib/wrest/http_shared/headers.rb
129
+ - lib/wrest/http_shared/standard_headers.rb
130
+ - lib/wrest/http_shared/standard_tokens.rb
131
+ - lib/wrest/http_shared.rb
132
+ - lib/wrest/multipart.rb
133
+ - lib/wrest/native/connection_factory.rb
134
+ - lib/wrest/native/delete.rb
135
+ - lib/wrest/native/get.rb
136
+ - lib/wrest/native/options.rb
137
+ - lib/wrest/native/post.rb
138
+ - lib/wrest/native/post_multipart.rb
139
+ - lib/wrest/native/put.rb
140
+ - lib/wrest/native/put_multipart.rb
141
+ - lib/wrest/native/redirection.rb
142
+ - lib/wrest/native/request.rb
143
+ - lib/wrest/native/response.rb
144
+ - lib/wrest/native/session.rb
145
+ - lib/wrest/native.rb
146
+ - lib/wrest/resource/base.rb
147
+ - lib/wrest/resource/collection.rb
148
+ - lib/wrest/resource/state.rb
153
149
  - lib/wrest/resource.rb
154
150
  - lib/wrest/test/request_patches.rb
155
- - lib/wrest/multipart.rb
151
+ - lib/wrest/test.rb
152
+ - lib/wrest/uri.rb
153
+ - lib/wrest/uri_template.rb
154
+ - lib/wrest/version.rb
155
+ - lib/wrest.rb
156
156
  - README.rdoc
157
157
  - CHANGELOG
158
158
  - LICENCE