wrest 1.0.0.beta4 → 1.0.0.beta5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -18,6 +18,10 @@ Features under a numbered section are complete and available in the Wrest gem.
18
18
 
19
19
  == Current
20
20
 
21
+ == 1.0.0.beta5
22
+ * GH#30 Replace rails app in spec/sample_rails_app with a lighter sinatra app
23
+ * GH#37 Allow opting out of Adding to_uri to string
24
+
21
25
  == 1.0.0.beta4
22
26
  * GH#34 Wrest::Uri extensions swallow existing path
23
27
 
data/README.rdoc CHANGED
@@ -34,7 +34,7 @@ For Facebook, Twitter, Delicious, GitHub and other API examples, see http://gith
34
34
  'http://google.com'.to_uri(:follow_redirects => false).get
35
35
 
36
36
  'http://google.com'.to_uri(:follow_redirects_limit => 1).get
37
- * More complex call with custom deserialiser
37
+ * More complex request with parameters and a custom deserialiser
38
38
 
39
39
  'http://search.yahooapis.com/NewsSearchService/V1/newsSearch'.to_uri.get(
40
40
  :appid => 'YahooDemo',
@@ -50,6 +50,28 @@ For Facebook, Twitter, Delicious, GitHub and other API examples, see http://gith
50
50
  base_uri = 'https://api.del.icio.us/v1'.to_uri(:username => 'kaiwren', :password => 'fupupp1es')
51
51
  bookmarks = base_uri['/posts/get'].get.deserialise
52
52
 
53
+ ==== POST
54
+
55
+ * Regular, vanilla Post with a body and headers
56
+
57
+ 'http://my.api.com'.to_uri.post('YAML encoded body', 'Content-Type' => 'text/x-yaml')
58
+ * Form encoded post
59
+
60
+ 'https://api.del.icio.us/v1/posts/add'.to_uri(
61
+ :username => 'kaiwren', :password => 'fupupp1es'
62
+ ).post_form(
63
+ :url => 'http://blog.sidu.in/search/label/ruby',
64
+ :description => 'The Ruby related posts on my blog!',
65
+ :extended => "All posts tagged with 'ruby'",
66
+ :tags => 'ruby hacking'
67
+ )
68
+ * Multipart posts
69
+
70
+ 'http://imgur.com/api/upload.xml'.to_uri.post_multipart(
71
+ :image => UploadIO.new(File.open(file_path), "image/png", file_path),
72
+ :key => imgur_key
73
+ ).deserialise
74
+
53
75
  ==== DELETE
54
76
 
55
77
  To delete a resource:
@@ -121,4 +143,14 @@ Wrest is currently available as a gem for for Ruby and JRuby.
121
143
 
122
144
  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
145
  $ wrest
124
- >> y 'http://twitter.com/statuses/public_timeline.json'.to_uri(:timeout => 5).get.deserialise
146
+ >> y 'http://twitter.com/statuses/public_timeline.json'.to_uri(:timeout => 5).get.deserialise
147
+
148
+ == Contributors
149
+
150
+ * Sidu Ponnappa : {kaiwren}[http://github.com/kaiwren]
151
+ * Niranjan Paranjape : {achamian}[http://github.com/achamian]
152
+ * Aakash Dharmadhkari : {aakashd}[http://github.com/aakashd]
153
+ * Srushti : {srushti}[http://github.com/srushti]
154
+ * Preethi Ramdev : {preethiramdev}[http://github.com/preethiramdev]
155
+ * Nikhil Vallishayee : {preethiramdev}[http://github.com/preethiramdev]
156
+ * Jacques Crocker: {railsjedi}[http://github.com/railsjedi]
data/lib/wrest.rb CHANGED
@@ -94,7 +94,7 @@ require "#{Wrest::Root}/wrest/exceptions"
94
94
  require "#{Wrest::Root}/wrest/components"
95
95
 
96
96
  # Load Wrest::Resource
97
- require "#{Wrest::Root}/wrest/resource"
97
+ # require "#{Wrest::Root}/wrest/resource"
98
98
 
99
99
  # if (ENV['RAILS_ENV'] == 'test' || (Kernel.const_defined?(:RAILS_ENV) && (RAILS_ENV == 'test')))
100
100
  # require "#{Wrest::Root}/wrest/test"
@@ -1,5 +1,5 @@
1
1
  require "#{Wrest::Root}/wrest/core_ext/string/conversions"
2
2
 
3
3
  class String #:nodoc:
4
- include Wrest::CoreExt::String::Conversions
4
+ include Wrest::CoreExt::String::Conversions unless Wrest.const_defined?('NoStringExtensions')
5
5
  end
@@ -11,6 +11,14 @@ module Wrest
11
11
  module CoreExt #:nodoc:
12
12
  module String #:nodoc:
13
13
  # Makes it easier to build other objects from a String
14
+ # This module is opt-out - if you don't want the to_uri
15
+ # convenience method on String, set the NoStringExtensions
16
+ # constant on the Wrest module before requiring wrest.
17
+ #
18
+ # module Wrest
19
+ # NoStringExtensions = true
20
+ # end
21
+ # require 'wrest'
14
22
  module Conversions
15
23
 
16
24
  # A convenience method equivalent to Wrest::Uri.new(string)
@@ -7,7 +7,7 @@
7
7
  # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8
8
  # See the License for the specific language governing permissions and limitations under the License.
9
9
 
10
- module Wrest::Native
10
+ module Wrest::Curl
11
11
  # This class is a wrapper for a keep-alive HTTP connection. It simply passes the
12
12
  # same connection instance as an option to all Wrest::Http::Request instances created using it.
13
13
  #
@@ -20,7 +20,7 @@ module Wrest::Native
20
20
  class Session
21
21
  attr_reader :uri
22
22
  def initialize(uri)
23
- @uri = uri.is_a?(String) ? uri.to_uri : uri
23
+ @uri = Wrest::Uri.new(uri)
24
24
  @default_headers = { StandardHeaders::Connection => StandardTokens::KeepAlive }
25
25
 
26
26
  yield(self) if block_given?
@@ -31,7 +31,7 @@ module Wrest #:nodoc:
31
31
  raise Wrest::Exceptions::AutoRedirectLimitExceeded if (redirect_request_options[:follow_redirects_count] += 1) >= redirect_request_options[:follow_redirects_limit]
32
32
 
33
33
  Wrest.logger.debug "--| Redirecting to #{target}"
34
- target.to_uri(redirect_request_options).get
34
+ Wrest::Uri.new(target, redirect_request_options).get
35
35
  end
36
36
  end
37
37
  end
@@ -20,7 +20,7 @@ module Wrest::Native
20
20
  class Session
21
21
  attr_reader :uri
22
22
  def initialize(uri)
23
- @uri = uri.is_a?(String) ? uri.to_uri : uri
23
+ @uri = Wrest::Uri.new(uri)
24
24
  @default_headers = { Wrest::Native::StandardHeaders::Connection => Wrest::Native::StandardTokens::KeepAlive }
25
25
 
26
26
  yield(self) if block_given?
@@ -10,6 +10,8 @@
10
10
  module Wrest::Resource #:nodoc:
11
11
  # Resource::Base is the equivalent of ActiveResource::Base.
12
12
  # It is a REST client targetted at Rails REST apps.
13
+ #
14
+ # Note that it is currently incomplete.
13
15
  class Base
14
16
  include Wrest::Components::Container
15
17
 
@@ -40,10 +40,10 @@ module Wrest
40
40
  # )
41
41
  # => #<Wrest::Uri:0x18e0bec @uri=#<URI::HTTP:0x18e09a8 URL:http://kaiwren:fupuppies@coathangers.com/portal/1>>
42
42
  def to_uri(options = {})
43
- options.inject(uri_pattern.clone) do |uri_string, tuple|
43
+ Wrest::Uri.new(options.inject(uri_pattern.clone) do |uri_string, tuple|
44
44
  key, value = tuple
45
45
  uri_string.gsub(":#{key.to_s}", value.to_s)
46
- end.to_uri
46
+ end)
47
47
  end
48
48
 
49
49
  def [](path)
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 = 'beta4'
16
+ BUILD = 'beta5'
17
17
 
18
18
  STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
19
19
 
@@ -0,0 +1,5 @@
1
+ # Opts out of including Wrest's String Extensions
2
+ module Wrest
3
+ NoStringExtensions = true
4
+ end
5
+ require 'wrest'
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: -1848230056
4
+ hash: -1848230055
5
5
  prerelease: true
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
9
  - 0
10
- - beta4
11
- version: 1.0.0.beta4
10
+ - beta5
11
+ version: 1.0.0.beta5
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-17 00:00:00 +05:30
20
+ date: 2010-09-19 00:00:00 +05:30
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -153,6 +153,7 @@ files:
153
153
  - lib/wrest/uri_template.rb
154
154
  - lib/wrest/version.rb
155
155
  - lib/wrest.rb
156
+ - lib/wrest_no_ext.rb
156
157
  - README.rdoc
157
158
  - CHANGELOG
158
159
  - LICENCE
@@ -192,6 +193,6 @@ rubyforge_project: wrest
192
193
  rubygems_version: 1.3.7
193
194
  signing_key:
194
195
  specification_version: 3
195
- summary: Wrest is an elegant, object oriented HTTP client library.
196
+ summary: Wrest is an elegant, object oriented HTTP client library for 1.8, 1.9, JRuby and Rubinius.
196
197
  test_files: []
197
198