wrest 0.1.2 → 1.0.0.beta0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -13,6 +13,12 @@ Features under a numbered section are complete and available in the Wrest gem.
13
13
  * 304/ETag response caching
14
14
  * Keep-alive support for libcurl
15
15
 
16
+ == 0.9.0
17
+ * Dependencies updated to ActiveSupport 3.0.0.rc and RSpec 2.0.0.beta19
18
+
19
+ == 0.1.2
20
+ * Locked gem dependencies to ActiveSupport 2.3.8 and rspec 1.3.0 to avoid breakages caused by inadvertently requiring the Rails 3.0 and Rspec 2.0 gems which have changed greatly
21
+
16
22
  == 0.1.1
17
23
  * Multipart post and put using Net::Http
18
24
 
data/README.rdoc CHANGED
@@ -1,13 +1,13 @@
1
- = Wrest 0.1.2
1
+ = Wrest 1.0.0.beta0
2
2
 
3
3
  (c) Copyright 2009-2010 {Sidu Ponnappa}[http://blog.sidu.in]. All Rights Reserved.
4
4
 
5
5
  Wrest is a ruby REST client library which
6
6
  * allows allows you to quickly build object oriented wrappers around any web service
7
7
  * is spec driven, strongly favours immutable objects and avoids class methods and setters making it better suited for use as a library, especially in multi-threaded environments
8
- * runs on Ruby 1.8, 1.9 and JRuby, with MacRuby and IronRuby support on the way
8
+ * runs on Ruby 1.8 and JRuby with 1.9, Rubinius, MacRuby and IronRuby support on the way
9
9
 
10
- To receive notifications whenever new features are added to Wrest, pleasesubscribe to my {twitter feed}[http://twitter.com/ponnappa].
10
+ To receive notifications whenever new features are added to Wrest, please subscribe to my {twitter feed}[http://twitter.com/ponnappa].
11
11
 
12
12
  (If you were wondering why the words 'demon', 'chi' and 'fu-puppies' show up in nearly every example and spec, it's because they're all references to {Roger Zelazny's}[http://en.wikipedia.org/wiki/Roger_Zelazny] last book, 'Lord Demon.')
13
13
 
data/Rakefile CHANGED
@@ -10,14 +10,14 @@
10
10
  # Note that some optional libraries/gems that the build (not Wrest itself) uses may not be available on all implementations of Ruby.
11
11
  puts "Building on Ruby #{RUBY_VERSION}, #{RUBY_RELEASE_DATE}, #{RUBY_PLATFORM}"
12
12
 
13
- if Object.const_defined?('RAILS_ROOT') || Object.const_defined?('Rails')
13
+ if Object.const_defined?('RAILS_ROOT')
14
14
  require File.dirname(__FILE__) + '/../../../config/environment'
15
15
  else
16
16
  require 'rubygems'
17
- gem 'rspec', '= 1.3.0'
17
+ gem 'rspec'
18
18
  require 'rake'
19
- require 'spec'
20
- require 'spec/rake/spectask'
19
+ require 'rspec'
20
+ require 'rspec/core/rake_task'
21
21
 
22
22
  begin
23
23
  require 'metric_fu'
@@ -28,19 +28,16 @@ end
28
28
 
29
29
  desc 'Default: run spec tests.'
30
30
  task :default => 'rspec:unit'
31
- task :spec => 'rspec:unit'
32
31
 
33
32
  namespace :rspec do
34
33
  desc "Run all unit specs"
35
- Spec::Rake::SpecTask.new(:unit) do |task|
36
- task.spec_files = FileList['spec/unit/wrest/**/*_spec.rb']
37
- task.spec_opts = ['--options', 'spec/spec.opts']
34
+ RSpec::Core::RakeTask.new(:unit) do |task|
35
+ task.pattern = 'spec/unit/wrest/**/*_spec.rb'
38
36
  end
39
-
37
+
40
38
  desc "Run all live functional specs - requires sample_rails_app running at 3000 in test environment"
41
- Spec::Rake::SpecTask.new(:functional) do |task|
42
- task.spec_files = FileList['spec/functional/wrest/**/*_spec.rb']
43
- task.spec_opts = ['--options', 'spec/spec.opts']
39
+ RSpec::Core::RakeTask.new(:functional) do |task|
40
+ task.pattern = 'spec/functional/wrest/**/*_spec.rb'
44
41
  end
45
42
  end
46
43
 
@@ -63,9 +60,9 @@ begin
63
60
  require 'rcov'
64
61
  require 'rcov/rcovtask'
65
62
  desc "Run all specs in spec directory with RCov"
66
- Spec::Rake::SpecTask.new(:rcov) do |t|
63
+ RSpec::Core::RakeTask.new(:rcov) do |t|
67
64
  t.spec_opts = ['--options', "spec/spec.opts"]
68
- t.spec_files = FileList["spec/unit/wrest/**/*_spec.rb"]
65
+ t.pattern = "spec/unit/wrest/**/*_spec.rb"
69
66
  t.rcov = true
70
67
  t.rcov_opts = lambda do
71
68
  IO.readlines("spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
@@ -88,24 +85,24 @@ begin
88
85
  gemspec.homepage = "http://github.com/kaiwren/wrest"
89
86
  gemspec.has_rdoc = true
90
87
  gemspec.rubyforge_project = 'wrest'
91
- gemspec.executables = ['wrest']
88
+ gemspec.executables = ['wrest', 'jwrest']
92
89
  gemspec.require_path = "lib"
93
90
  gemspec.files.exclude *['.gitignore', 'spec/functional']
94
91
  gemspec.test_files.exclude *['.gitignore', 'spec/functional', 'examples']
95
- gemspec.add_dependency('activesupport', '= 2.3.8')
92
+ gemspec.add_dependency('activesupport', '>= 3.0.0.rc')
96
93
  case RUBY_PLATFORM
97
94
  when /java/
98
- gemspec.add_dependency('json-jruby', '>= 1.1.3')
95
+ gemspec.add_dependency('json-jruby', '>= 1.4.2')
99
96
  gemspec.add_dependency('nokogiri', '>= 1.3.3')
100
97
  gemspec.platform = 'java'
101
98
  else
102
- gemspec.add_dependency('json', '>= 1.1.3')
99
+ gemspec.add_dependency('json', '>= 1.4.2')
103
100
  gemspec.platform = Gem::Platform::RUBY
104
101
  end
105
102
  end
106
103
  rescue LoadError
107
- puts "Jeweler not available. Install it with: gem install jeweler"
108
- puts "If you're using JRuby and are having trouble installing jeweler, try installing the git (gem install git) and rubyforge (gem install rubyforge) gems by hand. Also remember to update gems itself (jruby -S gem update --system)." if RUBY_PLATFORM =~ /java/
104
+ puts "Jeweler not available. Install it with: gem install technicalpickles-jeweler -s http://gems.github.com"
105
+ puts "If you're using JRuby and are having trouble installing jeweler, try installing the git (gem install git) and rubyforge (gem install rubyforge) gems by hand. Also remember to update gems itself (jruby -S gem update --system)."
109
106
  end
110
107
 
111
108
  begin
data/VERSION.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  ---
2
- :patch: 2
3
- :minor: 1
4
- :major: 0
2
+ :build: beta0
3
+ :patch: 0
4
+ :minor: 0
5
+ :major: 1
data/lib/wrest.rb CHANGED
@@ -7,7 +7,7 @@
7
7
  # See the License for the specific language governing permissions and limitations under the License.
8
8
 
9
9
  require 'rubygems'
10
- gem 'activesupport', '=2.3.8'
10
+ gem 'activesupport', '>= 3.0.0.rc'
11
11
 
12
12
  require 'net/http'
13
13
  require 'net/https'
@@ -18,7 +18,11 @@ require 'base64'
18
18
  require 'logger'
19
19
  require 'benchmark'
20
20
  require 'active_support'
21
-
21
+ require 'active_support/json'
22
+ require 'active_support/core_ext/string'
23
+ require 'active_support/core_ext/hash'
24
+ require 'active_support/core_ext/module'
25
+ require 'active_support/core_ext/object'
22
26
 
23
27
  module Wrest
24
28
  Root = File.dirname(__FILE__)
@@ -52,7 +56,9 @@ begin
52
56
  gem 'libxml-ruby', '>= 1.1.3'
53
57
  ActiveSupport::XmlMini.backend='LibXML'
54
58
  rescue Gem::LoadError
55
- Wrest.logger.debug "Warning: LibXML >= 1.1.3 not found, attempting to use Nokogiri. To install LibXML run `(sudo) gem install libxml-ruby` (libxml-ruby is not available on JRuby)"
59
+ unless RUBY_PLATFORM =~ /java/
60
+ Wrest.logger.debug "Warning: LibXML >= 1.1.3 not found, attempting to use Nokogiri. To install LibXML run `(sudo) gem install libxml-ruby` (libxml-ruby is not available on JRuby)"
61
+ end
56
62
  begin
57
63
  gem 'nokogiri', '>= 1.3.3'
58
64
  ActiveSupport::XmlMini.backend='Nokogiri'
@@ -70,6 +76,10 @@ rescue Gem::LoadError
70
76
  end
71
77
  end
72
78
 
79
+ RUBY_PLATFORM =~ /java/ ? gem('json-jruby', '>= 1.4.2') : gem('json', '>= 1.4.2')
80
+ ActiveSupport::JSON.backend = "JSONGem"
81
+
82
+
73
83
  Dir["#{File.expand_path(File.dirname(__FILE__))}/wrest/core_ext/*.rb"].each { |file| require file }
74
84
 
75
85
  # Load Wrest Core
@@ -26,45 +26,45 @@ module Wrest
26
26
  klass.class_eval{ include Typecaster::InstanceMethods }
27
27
  klass.alias_method_chain :initialize, :typecasting
28
28
  end
29
-
29
+
30
30
  module Helpers
31
31
  def as_base64Binary
32
- ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING['base64Binary']
32
+ ActiveSupport::XmlMini::PARSING['base64Binary']
33
33
  end
34
34
 
35
35
  def as_boolean
36
- ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING['boolean']
36
+ ActiveSupport::XmlMini::PARSING['boolean']
37
37
  end
38
38
 
39
39
  def as_decimal
40
- ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING['decimal']
40
+ ActiveSupport::XmlMini::PARSING['decimal']
41
41
  end
42
42
 
43
43
  def as_date
44
- ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING['date']
44
+ ActiveSupport::XmlMini::PARSING['date']
45
45
  end
46
46
 
47
47
  def as_datetime
48
- ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING['datetime']
48
+ ActiveSupport::XmlMini::PARSING['datetime']
49
49
  end
50
50
 
51
51
  def as_float
52
- ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING['float']
52
+ ActiveSupport::XmlMini::PARSING['float']
53
53
  end
54
54
 
55
55
  def as_integer
56
- ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING['integer']
56
+ ActiveSupport::XmlMini::PARSING['integer']
57
57
  end
58
58
 
59
59
  def as_symbol
60
- ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING['symbol']
60
+ ActiveSupport::XmlMini::PARSING['symbol']
61
61
  end
62
62
 
63
63
  def as_yaml
64
- ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING['yaml']
64
+ ActiveSupport::XmlMini::PARSING['yaml']
65
65
  end
66
66
  end
67
-
67
+
68
68
  module ClassMethods
69
69
  # Accepts a set of attribute-name/lambda pairs which are used
70
70
  # to typecast string values injected through the constructor.
@@ -23,7 +23,7 @@ module Wrest
23
23
  if in_value['nil'] == 'true'
24
24
  out_value = nil
25
25
  elsif in_value.key?('type')
26
- caster = ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING[in_value['type']]
26
+ caster = ActiveSupport::XmlMini::PARSING[in_value['type']]
27
27
  out_value = caster ? caster.call(in_value['__content__']) : in_value
28
28
  elsif in_value.key?('__content__')
29
29
  out_value = in_value['__content__']
@@ -24,7 +24,7 @@ module Wrest
24
24
  if in_value['nil'] == 'true'
25
25
  out_value = nil
26
26
  elsif in_value.key?('type')
27
- out_value = ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING[in_value['type']].call(in_value['content'])
27
+ out_value = ActiveSupport::XmlMini::PARSING[in_value['type']].call(in_value['content'])
28
28
  else
29
29
  out_value = in_value.mutate_using(self)
30
30
  end
@@ -34,9 +34,9 @@ module Wrest
34
34
  # :start => '1'
35
35
  # ).deserialise.mutate_using(XmlSimpleTypeCaster.new)
36
36
  def mutate_using(mutator)
37
- returning({})do |mutated_hash|
37
+ mutated_hash = {}
38
38
  self.each{|tuple| mutated_hash.store(*mutator.mutate(tuple))}
39
- end
39
+ mutated_hash
40
40
  end
41
41
  end
42
42
  end
@@ -12,7 +12,6 @@ module Wrest::Native
12
12
  def initialize(wrest_uri, parameters = {}, headers = {}, options = {})
13
13
  follow_redirects = options[:follow_redirects]
14
14
  options[:follow_redirects] = (follow_redirects == nil ? true : follow_redirects)
15
- options[:cache_store] ||= {}
16
15
  super(
17
16
  wrest_uri,
18
17
  Net::HTTP::Get,
@@ -22,30 +21,5 @@ module Wrest::Native
22
21
  options
23
22
  )
24
23
  end
25
-
26
- def invoke_with_cache_check
27
- cached_response = get_cached_response
28
- if cached_response.nil? then
29
- response = invoke_without_cache_check
30
- cache_response(response)
31
- response
32
- else
33
- cached_response
34
- end
35
- end
36
-
37
- def get_cached_response
38
- response = nil
39
- if cache_store.has_key?(@uri)
40
- response = cache_store.fetch(@uri)
41
- end
42
- response
43
- end
44
-
45
- def cache_response(response)
46
- cache_store[@uri] = response
47
- end
48
-
49
- alias_method_chain :invoke, :cache_check
50
24
  end
51
25
  end
@@ -13,7 +13,7 @@ module Wrest::Native
13
13
  # or Wrest::Native::Get etc. instead.
14
14
  class Request
15
15
  attr_reader :http_request, :uri, :body, :headers, :username, :password, :follow_redirects,
16
- :follow_redirects_limit, :follow_redirects_count, :timeout, :connection, :parameters, :cache_store
16
+ :follow_redirects_limit, :follow_redirects_count, :timeout, :connection, :parameters
17
17
  # Valid tuples for the options are:
18
18
  # :username => String, defaults to nil
19
19
  # :password => String, defaults to nil
@@ -31,7 +31,6 @@ module Wrest::Native
31
31
  # in the event of a connection failing to open. Defaulted to 60 by Uri#create_connection.
32
32
  # :connection => The HTTP Connection object to use. This is how a keep-alive connection can be
33
33
  # used for multiple requests.
34
- # :cache_store => The object which should be used as cache store for cacheable responses
35
34
  def initialize(wrest_uri, http_request_klass, parameters = {}, body = nil, headers = {}, options = {})
36
35
  @uri = wrest_uri
37
36
  @headers = headers.stringify_keys
@@ -46,7 +45,6 @@ module Wrest::Native
46
45
  @timeout = @options[:timeout]
47
46
  @connection = @options[:connection]
48
47
  @http_request = self.build_request(http_request_klass, @uri, @parameters, @headers)
49
- @cache_store = options[:cache_store]
50
48
  end
51
49
 
52
50
  # Makes a request and returns a Wrest::Native::Response.
data/lib/wrest/version.rb CHANGED
@@ -10,11 +10,12 @@
10
10
  module Wrest
11
11
  module VERSION
12
12
  unless defined? MAJOR
13
- MAJOR = 0
14
- MINOR = 1
15
- TINY = 2
16
-
17
- STRING = [MAJOR, MINOR, TINY].join('.')
13
+ MAJOR = 1
14
+ MINOR = 0
15
+ TINY = 0
16
+ BUILD = 'beta0'
17
+
18
+ STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
18
19
 
19
20
  SUMMARY = "wrest version #{STRING}"
20
21
  end
File without changes
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/../../lib/wrest")
2
2
  require "#{Wrest::Root}/wrest/curl" unless RUBY_PLATFORM =~ /java/
3
- require 'spec'
3
+ require 'rspec'
4
4
 
5
5
  ['/../custom_matchers/**/*.rb'].each{|directory|
6
6
  Dir["#{File.expand_path(File.dirname(__FILE__) + directory)}"].each { |file|
@@ -22,12 +22,12 @@ def puts(*args)
22
22
  # super *args
23
23
  end
24
24
 
25
- Spec::Runner.configure do |config|
25
+ RSpec.configure do |config|
26
26
  config.include(CustomMatchers)
27
27
  end
28
28
 
29
29
  def build_ok_response(body = '')
30
- returning mock(Net::HTTPOK) do |response|
30
+ mock(Net::HTTPOK).tap do |response|
31
31
  response.stub!(:code).and_return('200')
32
32
  response.stub!(:message).and_return('OK')
33
33
  response.stub!(:body).and_return(body)
@@ -35,7 +35,7 @@ module Wrest
35
35
  http.should_receive(:request).with(request_two, nil).and_return(ok_response)
36
36
 
37
37
  Native::Session.new(uri) do |session|
38
- session.get('/glassware', :owner => 'Kai', :type => 'bottle')
38
+ session.get('/glassware', ActiveSupport::OrderedHash.new.merge!([[:owner, 'Kai'],[:type, 'bottle']]))
39
39
  session.get '/bottles.xml'
40
40
  end
41
41
  end
@@ -64,7 +64,7 @@ module Wrest
64
64
  http.should_receive(:request).with(request_two, nil).and_return(ok_response_with_connection_close)
65
65
 
66
66
  Native::Session.new(uri) do |session|
67
- session.get('/glassware', :owner => 'Kai', :type => 'bottle')
67
+ session.get('/glassware', ActiveSupport::OrderedHash.new.merge!([[:owner, 'Kai'],[:type, 'bottle']]))
68
68
  session.instance_variable_get('@connection').should == http
69
69
  session.get '/bottles.xml'
70
70
  session.instance_variable_get('@connection').should be_nil
@@ -129,10 +129,10 @@ module Wrest
129
129
 
130
130
  describe 'HTTP actions' do
131
131
  def setup_http
132
- returning mock(Net::HTTP) do |http|
132
+ http = mock(Net::HTTP)
133
133
  Net::HTTP.should_receive(:new).with('localhost', 3000).and_return(http)
134
134
  http.should_receive(:read_timeout=).with(60)
135
- end
135
+ http
136
136
  end
137
137
 
138
138
  it "should know how to get" do
@@ -160,7 +160,7 @@ module Wrest
160
160
 
161
161
  http.should_receive(:request).with(request, nil).and_return(build_ok_response)
162
162
 
163
- uri.get({:owner => 'Kai', :type => 'bottle'}, :page => '2', :per_page => '5')
163
+ uri.get(ActiveSupport::OrderedHash.new.merge!([[:owner, 'Kai'],[:type, 'bottle']]), :page => '2', :per_page => '5')
164
164
  end
165
165
 
166
166
  it "should know how to get with parameters but without any headers" do
@@ -174,7 +174,7 @@ module Wrest
174
174
 
175
175
  http.should_receive(:request).with(request, nil).and_return(build_ok_response)
176
176
 
177
- uri.get(:owner => 'Kai', :type => 'bottle')
177
+ uri.get(ActiveSupport::OrderedHash.new.merge!([[:owner, 'Kai'],[:type, 'bottle']]))
178
178
  end
179
179
 
180
180
  it "should know how to post" do
@@ -203,10 +203,7 @@ module Wrest
203
203
  ).and_return(request)
204
204
 
205
205
  http.should_receive(:request).with(request, "foo=bar&ooga=booga").and_return(build_ok_response)
206
- params = ActiveSupport::OrderedHash.new
207
- params[:ooga] = 'booga'
208
- params[:foo] = 'bar'
209
- uri.post_form(params, :page => '2', :per_page => '5')
206
+ uri.post_form(ActiveSupport::OrderedHash.new.merge!([[:foo, 'bar'],[:ooga, 'booga']]), :page => '2', :per_page => '5')
210
207
  end
211
208
 
212
209
  it "should know how to put" do
@@ -234,7 +231,7 @@ module Wrest
234
231
 
235
232
  http.should_receive(:request).with(request, nil).and_return(build_ok_response(nil))
236
233
 
237
- uri.delete({:owner => 'Kai', :type => 'bottle'}, :page => '2', :per_page => '5')
234
+ uri.delete(ActiveSupport::OrderedHash.new.merge!([[:owner, 'Kai'],[:type, 'bottle']]), :page => '2', :per_page => '5')
238
235
  end
239
236
 
240
237
  it "should know how to ask for options on a URI" do
@@ -268,7 +265,7 @@ module Wrest
268
265
  http.should_receive(:request).with(request_get, nil).and_return(build_ok_response)
269
266
  http.should_receive(:request).with(request_post, '<ooga>Booga</ooga>').and_return(build_ok_response)
270
267
 
271
- uri.get({:owner => 'Kai', :type => 'bottle'}, :page => '2', :per_page => '5')
268
+ uri.get(ActiveSupport::OrderedHash.new.merge!([[:owner, 'Kai'],[:type, 'bottle']]), :page => '2', :per_page => '5')
272
269
  uri.post '<ooga>Booga</ooga>', :page => '2', :per_page => '5'
273
270
  end
274
271
  end
data/wrest.gemspec CHANGED
@@ -5,15 +5,14 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wrest}
8
- s.version = "0.1.2"
8
+ s.version = "1.0.0.beta0"
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
10
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Sidu Ponnappa"]
12
12
  s.date = %q{2010-07-27}
13
- s.default_executable = %q{wrest}
14
13
  s.description = %q{Wrest is a HTTP and REST client library which allows you to quickly build well encapsulated, object oriented wrappers around any web service.}
15
14
  s.email = %q{ckponnappa@gmail.com}
16
- s.executables = ["wrest"]
15
+ s.executables = ["wrest", "jwrest"]
17
16
  s.extra_rdoc_files = [
18
17
  "README.rdoc"
19
18
  ]
@@ -91,7 +90,7 @@ Gem::Specification.new do |s|
91
90
  "lib/wrest/version.rb",
92
91
  "spec/custom_matchers/custom_matchers.rb",
93
92
  "spec/rcov.opts",
94
- "spec/spec.opts",
93
+ "spec/spec.opts.disable",
95
94
  "spec/unit/spec_helper.rb",
96
95
  "spec/unit/wrest/components/attributes_container/alias_accessors_spec.rb",
97
96
  "spec/unit/wrest/components/attributes_container/typecaster_spec.rb",
@@ -108,7 +107,6 @@ Gem::Specification.new do |s|
108
107
  "spec/unit/wrest/curl/request_spec.rb",
109
108
  "spec/unit/wrest/curl/response_spec.rb",
110
109
  "spec/unit/wrest/http/response_spec.rb",
111
- "spec/unit/wrest/native/get_spec.rb",
112
110
  "spec/unit/wrest/native/redirection_spec.rb",
113
111
  "spec/unit/wrest/native/request_spec.rb",
114
112
  "spec/unit/wrest/native/response_spec.rb",
@@ -142,7 +140,6 @@ Gem::Specification.new do |s|
142
140
  "spec/unit/wrest/curl/request_spec.rb",
143
141
  "spec/unit/wrest/curl/response_spec.rb",
144
142
  "spec/unit/wrest/http/response_spec.rb",
145
- "spec/unit/wrest/native/get_spec.rb",
146
143
  "spec/unit/wrest/native/redirection_spec.rb",
147
144
  "spec/unit/wrest/native/request_spec.rb",
148
145
  "spec/unit/wrest/native/response_spec.rb",
@@ -157,15 +154,15 @@ Gem::Specification.new do |s|
157
154
  s.specification_version = 3
158
155
 
159
156
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
160
- s.add_runtime_dependency(%q<activesupport>, ["= 2.3.8"])
161
- s.add_runtime_dependency(%q<json>, [">= 1.1.3"])
157
+ s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0.rc"])
158
+ s.add_runtime_dependency(%q<json>, [">= 1.4.2"])
162
159
  else
163
- s.add_dependency(%q<activesupport>, ["= 2.3.8"])
164
- s.add_dependency(%q<json>, [">= 1.1.3"])
160
+ s.add_dependency(%q<activesupport>, [">= 3.0.0.rc"])
161
+ s.add_dependency(%q<json>, [">= 1.4.2"])
165
162
  end
166
163
  else
167
- s.add_dependency(%q<activesupport>, ["= 2.3.8"])
168
- s.add_dependency(%q<json>, [">= 1.1.3"])
164
+ s.add_dependency(%q<activesupport>, [">= 3.0.0.rc"])
165
+ s.add_dependency(%q<json>, [">= 1.4.2"])
169
166
  end
170
167
  end
171
168
 
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wrest
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease: false
4
+ hash: -1848230052
5
+ prerelease: true
6
6
  segments:
7
- - 0
8
7
  - 1
9
- - 2
10
- version: 0.1.2
8
+ - 0
9
+ - 0
10
+ - beta0
11
+ version: 1.0.0.beta0
11
12
  platform: ruby
12
13
  authors:
13
14
  - Sidu Ponnappa
@@ -16,7 +17,7 @@ bindir: bin
16
17
  cert_chain: []
17
18
 
18
19
  date: 2010-07-27 00:00:00 +05:30
19
- default_executable: wrest
20
+ default_executable:
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
22
23
  name: activesupport
@@ -24,14 +25,15 @@ dependencies:
24
25
  requirement: &id001 !ruby/object:Gem::Requirement
25
26
  none: false
26
27
  requirements:
27
- - - "="
28
+ - - ">="
28
29
  - !ruby/object:Gem::Version
29
- hash: 19
30
+ hash: 7712042
30
31
  segments:
31
- - 2
32
32
  - 3
33
- - 8
34
- version: 2.3.8
33
+ - 0
34
+ - 0
35
+ - rc
36
+ version: 3.0.0.rc
35
37
  type: :runtime
36
38
  version_requirements: *id001
37
39
  - !ruby/object:Gem::Dependency
@@ -42,18 +44,19 @@ dependencies:
42
44
  requirements:
43
45
  - - ">="
44
46
  - !ruby/object:Gem::Version
45
- hash: 21
47
+ hash: 3
46
48
  segments:
47
49
  - 1
48
- - 1
49
- - 3
50
- version: 1.1.3
50
+ - 4
51
+ - 2
52
+ version: 1.4.2
51
53
  type: :runtime
52
54
  version_requirements: *id002
53
55
  description: Wrest is a HTTP and REST client library which allows you to quickly build well encapsulated, object oriented wrappers around any web service.
54
56
  email: ckponnappa@gmail.com
55
57
  executables:
56
58
  - wrest
59
+ - jwrest
57
60
  extensions: []
58
61
 
59
62
  extra_rdoc_files:
@@ -132,7 +135,7 @@ files:
132
135
  - lib/wrest/version.rb
133
136
  - spec/custom_matchers/custom_matchers.rb
134
137
  - spec/rcov.opts
135
- - spec/spec.opts
138
+ - spec/spec.opts.disable
136
139
  - spec/unit/spec_helper.rb
137
140
  - spec/unit/wrest/components/attributes_container/alias_accessors_spec.rb
138
141
  - spec/unit/wrest/components/attributes_container/typecaster_spec.rb
@@ -149,7 +152,6 @@ files:
149
152
  - spec/unit/wrest/curl/request_spec.rb
150
153
  - spec/unit/wrest/curl/response_spec.rb
151
154
  - spec/unit/wrest/http/response_spec.rb
152
- - spec/unit/wrest/native/get_spec.rb
153
155
  - spec/unit/wrest/native/redirection_spec.rb
154
156
  - spec/unit/wrest/native/request_spec.rb
155
157
  - spec/unit/wrest/native/response_spec.rb
@@ -179,12 +181,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
179
181
  required_rubygems_version: !ruby/object:Gem::Requirement
180
182
  none: false
181
183
  requirements:
182
- - - ">="
184
+ - - ">"
183
185
  - !ruby/object:Gem::Version
184
- hash: 3
186
+ hash: 25
185
187
  segments:
186
- - 0
187
- version: "0"
188
+ - 1
189
+ - 3
190
+ - 1
191
+ version: 1.3.1
188
192
  requirements: []
189
193
 
190
194
  rubyforge_project: wrest
@@ -210,7 +214,6 @@ test_files:
210
214
  - spec/unit/wrest/curl/request_spec.rb
211
215
  - spec/unit/wrest/curl/response_spec.rb
212
216
  - spec/unit/wrest/http/response_spec.rb
213
- - spec/unit/wrest/native/get_spec.rb
214
217
  - spec/unit/wrest/native/redirection_spec.rb
215
218
  - spec/unit/wrest/native/request_spec.rb
216
219
  - spec/unit/wrest/native/response_spec.rb
@@ -1,64 +0,0 @@
1
- # Copyright 2009 Sidu Ponnappa
2
-
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- # Unless required by applicable law or agreed to in writing, software distributed under the License
7
- # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8
- # See the License for the specific language governing permissions and limitations under the License.
9
-
10
- require File.dirname(__FILE__) + '/../../spec_helper'
11
-
12
- describe Wrest::Native::Get do
13
- describe "caching" do
14
-
15
- before :each do
16
- @request_uri = 'http://localhost/foo'.to_uri
17
- @cache = Hash.new
18
- @get = Wrest::Native::Get.new(@request_uri, {},{},{:cache_store => @cache})
19
- end
20
-
21
- describe "dependencies" do
22
- before :each do
23
- @get.stub!(:invoke_without_cache_check).and_return(build_ok_response)
24
- end
25
-
26
- it "should call get_cached_response before making actual request" do
27
- @get.should_receive(:get_cached_response)
28
- @get.invoke
29
- end
30
-
31
- it "should call cache_response after calling invoke method for fresh request" do
32
- @get.should_receive(:get_cached_response).and_return(nil)
33
- @get.should_receive(:cache_response)
34
- @get.invoke
35
- end
36
-
37
- it "should check if response already exists cache before making a request" do
38
- @cache.should_receive(:has_key?).with(@request_uri)
39
- @get.invoke
40
- end
41
- end
42
- it "should call invoke_without_cache_check if response does not exist in cache" do
43
- @cache.should_receive(:has_key?).with(@request_uri).and_return(false)
44
- @get.should_receive(:invoke_without_cache_check)
45
- @get.invoke
46
- end
47
-
48
- it "should not call invoke_without_cache_check if response exists in cache" do
49
- @cache.should_receive(:has_key?).with(@request_uri).and_return(true)
50
- @cache.should_receive(:fetch).with(@request_uri).and_return(build_ok_response)
51
- @get.should_not_receive(:invoke_without_cache_check)
52
- @get.invoke
53
- end
54
-
55
- it "should store response in cache if it did not exist in cache" do
56
- response = build_ok_response
57
- @cache.should_receive(:has_key?).with(@request_uri).and_return(false)
58
- @get.should_receive(:invoke_without_cache_check).and_return(response)
59
- @cache.should_receive(:[]=).with(@request_uri,response)
60
- @get.invoke
61
- end
62
-
63
- end
64
- end