wrest 0.1.2-java → 1.0.0.beta0-java

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,16 +5,15 @@
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
  s.platform = %q{java}
10
10
 
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["Sidu Ponnappa"]
13
13
  s.date = %q{2010-07-27}
14
- s.default_executable = %q{wrest}
15
14
  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.}
16
15
  s.email = %q{ckponnappa@gmail.com}
17
- s.executables = ["wrest"]
16
+ s.executables = ["wrest", "jwrest"]
18
17
  s.extra_rdoc_files = [
19
18
  "README.rdoc"
20
19
  ]
@@ -92,7 +91,7 @@ Gem::Specification.new do |s|
92
91
  "lib/wrest/version.rb",
93
92
  "spec/custom_matchers/custom_matchers.rb",
94
93
  "spec/rcov.opts",
95
- "spec/spec.opts",
94
+ "spec/spec.opts.disable",
96
95
  "spec/unit/spec_helper.rb",
97
96
  "spec/unit/wrest/components/attributes_container/alias_accessors_spec.rb",
98
97
  "spec/unit/wrest/components/attributes_container/typecaster_spec.rb",
@@ -109,7 +108,6 @@ Gem::Specification.new do |s|
109
108
  "spec/unit/wrest/curl/request_spec.rb",
110
109
  "spec/unit/wrest/curl/response_spec.rb",
111
110
  "spec/unit/wrest/http/response_spec.rb",
112
- "spec/unit/wrest/native/get_spec.rb",
113
111
  "spec/unit/wrest/native/redirection_spec.rb",
114
112
  "spec/unit/wrest/native/request_spec.rb",
115
113
  "spec/unit/wrest/native/response_spec.rb",
@@ -145,7 +143,6 @@ Gem::Specification.new do |s|
145
143
  "spec/unit/wrest/curl/request_spec.rb",
146
144
  "spec/unit/wrest/curl/response_spec.rb",
147
145
  "spec/unit/wrest/http/response_spec.rb",
148
- "spec/unit/wrest/native/get_spec.rb",
149
146
  "spec/unit/wrest/native/redirection_spec.rb",
150
147
  "spec/unit/wrest/native/request_spec.rb",
151
148
  "spec/unit/wrest/native/response_spec.rb",
@@ -158,17 +155,17 @@ Gem::Specification.new do |s|
158
155
  s.specification_version = 3
159
156
 
160
157
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
161
- s.add_runtime_dependency(%q<activesupport>, ["= 2.3.8"])
162
- s.add_runtime_dependency(%q<json-jruby>, [">= 1.1.3"])
158
+ s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0.rc"])
159
+ s.add_runtime_dependency(%q<json-jruby>, [">= 1.4.2"])
163
160
  s.add_runtime_dependency(%q<nokogiri>, [">= 1.3.3"])
164
161
  else
165
- s.add_dependency(%q<activesupport>, ["= 2.3.8"])
166
- s.add_dependency(%q<json-jruby>, [">= 1.1.3"])
162
+ s.add_dependency(%q<activesupport>, [">= 3.0.0.rc"])
163
+ s.add_dependency(%q<json-jruby>, [">= 1.4.2"])
167
164
  s.add_dependency(%q<nokogiri>, [">= 1.3.3"])
168
165
  end
169
166
  else
170
- s.add_dependency(%q<activesupport>, ["= 2.3.8"])
171
- s.add_dependency(%q<json-jruby>, [">= 1.1.3"])
167
+ s.add_dependency(%q<activesupport>, [">= 3.0.0.rc"])
168
+ s.add_dependency(%q<json-jruby>, [">= 1.4.2"])
172
169
  s.add_dependency(%q<nokogiri>, [">= 1.3.3"])
173
170
  end
174
171
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wrest
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ prerelease: true
5
5
  segments:
6
- - 0
7
6
  - 1
8
- - 2
9
- version: 0.1.2
7
+ - 0
8
+ - 0
9
+ - beta0
10
+ version: 1.0.0.beta0
10
11
  platform: java
11
12
  authors:
12
13
  - Sidu Ponnappa
@@ -15,7 +16,7 @@ bindir: bin
15
16
  cert_chain: []
16
17
 
17
18
  date: 2010-07-27 00:00:00 +05:30
18
- default_executable: wrest
19
+ default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: activesupport
@@ -23,13 +24,14 @@ dependencies:
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
24
25
  none: false
25
26
  requirements:
26
- - - "="
27
+ - - ">="
27
28
  - !ruby/object:Gem::Version
28
29
  segments:
29
- - 2
30
30
  - 3
31
- - 8
32
- version: 2.3.8
31
+ - 0
32
+ - 0
33
+ - rc
34
+ version: 3.0.0.rc
33
35
  type: :runtime
34
36
  version_requirements: *id001
35
37
  - !ruby/object:Gem::Dependency
@@ -42,9 +44,9 @@ dependencies:
42
44
  - !ruby/object:Gem::Version
43
45
  segments:
44
46
  - 1
45
- - 1
46
- - 3
47
- version: 1.1.3
47
+ - 4
48
+ - 2
49
+ version: 1.4.2
48
50
  type: :runtime
49
51
  version_requirements: *id002
50
52
  - !ruby/object:Gem::Dependency
@@ -66,6 +68,7 @@ description: Wrest is a HTTP and REST client library which allows you to quickly
66
68
  email: ckponnappa@gmail.com
67
69
  executables:
68
70
  - wrest
71
+ - jwrest
69
72
  extensions: []
70
73
 
71
74
  extra_rdoc_files:
@@ -144,7 +147,7 @@ files:
144
147
  - lib/wrest/version.rb
145
148
  - spec/custom_matchers/custom_matchers.rb
146
149
  - spec/rcov.opts
147
- - spec/spec.opts
150
+ - spec/spec.opts.disable
148
151
  - spec/unit/spec_helper.rb
149
152
  - spec/unit/wrest/components/attributes_container/alias_accessors_spec.rb
150
153
  - spec/unit/wrest/components/attributes_container/typecaster_spec.rb
@@ -161,7 +164,6 @@ files:
161
164
  - spec/unit/wrest/curl/request_spec.rb
162
165
  - spec/unit/wrest/curl/response_spec.rb
163
166
  - spec/unit/wrest/http/response_spec.rb
164
- - spec/unit/wrest/native/get_spec.rb
165
167
  - spec/unit/wrest/native/redirection_spec.rb
166
168
  - spec/unit/wrest/native/request_spec.rb
167
169
  - spec/unit/wrest/native/response_spec.rb
@@ -190,11 +192,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
190
192
  required_rubygems_version: !ruby/object:Gem::Requirement
191
193
  none: false
192
194
  requirements:
193
- - - ">="
195
+ - - ">"
194
196
  - !ruby/object:Gem::Version
195
197
  segments:
196
- - 0
197
- version: "0"
198
+ - 1
199
+ - 3
200
+ - 1
201
+ version: 1.3.1
198
202
  requirements: []
199
203
 
200
204
  rubyforge_project: wrest
@@ -222,7 +226,6 @@ test_files:
222
226
  - spec/unit/wrest/curl/request_spec.rb
223
227
  - spec/unit/wrest/curl/response_spec.rb
224
228
  - spec/unit/wrest/http/response_spec.rb
225
- - spec/unit/wrest/native/get_spec.rb
226
229
  - spec/unit/wrest/native/redirection_spec.rb
227
230
  - spec/unit/wrest/native/request_spec.rb
228
231
  - 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