activeresource-response 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -8,7 +8,7 @@ Such functionallity can be used for easily implementing pagination in a REST API
8
8
  == How to use?
9
9
  Add dependency to your Gemfile
10
10
 
11
- gem "activeresource-response", "~> 0.0.3"
11
+ gem "activeresource-response", "~> 0.0.5"
12
12
 
13
13
  Just open your ActiveResource class and add
14
14
 
@@ -8,11 +8,11 @@ Gem::Specification.new do |s|
8
8
  s.authors = ["Igor Fedoronchuk"]
9
9
  s.email = ["fedoronchuk@gmail.com"]
10
10
  s.homepage = "https://github.com/Fivell/activeresource-response"
11
- s.summary = %q{activeresoure extension}
12
- s.description = %q{adding possibility to access http response object from result of activeresource call }
11
+ s.summary = %q{activeresource extension}
12
+ s.description = %q{This gem adds possibility to access http response object from result of ActiveResource::Base find method }
13
13
 
14
14
 
15
- s.add_dependency('activeresource', '>= 3.1')
15
+ s.add_dependency('activeresource', '>= 3.0')
16
16
 
17
17
  s.rubyforge_project = "activeresource-response"
18
18
 
@@ -1,39 +1,5 @@
1
1
  require "activeresource-response/version"
2
- module ActiveresourceResponse
3
- module Connection
4
- def self.included(base)
5
- base.class_eval do
6
- alias_method :origin_handle_response, :handle_response
7
- def handle_response(response)
8
- Thread.current['ActiveResource::Base.http_response'] = response
9
- origin_handle_response(response)
10
- end
11
- def http_response
12
- Thread.current['ActiveResource::Base.http_response']
13
- end
14
- end
15
- end
16
- end
17
- module AddResponseMethod
18
- def self.included(base)
19
- base.extend ClassMethods
20
- end
21
- module ClassMethods
22
- def add_response_method(method_name = 'http_response')
23
- class_eval <<-EOS
24
- class << self
25
- alias_method :origin_find, :find
26
- def find(*arguments)
27
- result = origin_find(*arguments)
28
- result.class_eval("attr_reader :#{method_name}")
29
- result.instance_variable_set(:"@#{method_name}", connection.http_response)
30
- result
31
- end
32
- end
33
- EOS
34
- end
35
- end
36
- end
37
- end
2
+ require "activeresource-response/connection"
3
+ require "activeresource-response/add_response_method"
38
4
  ActiveResource::Connection.send :include, ActiveresourceResponse::Connection
39
5
  ActiveResource::Base.send :include, ActiveresourceResponse::AddResponseMethod
@@ -0,0 +1,22 @@
1
+ module ActiveresourceResponse
2
+ module AddResponseMethod
3
+ def self.included(base)
4
+ base.extend ClassMethods
5
+ end
6
+ module ClassMethods
7
+ def add_response_method(method_name = 'http_response')
8
+ class_eval <<-EOS
9
+ class << self
10
+ alias_method :origin_find, :find
11
+ def find(*arguments)
12
+ result = origin_find(*arguments)
13
+ result.class_eval("attr_reader :#{method_name}")
14
+ result.instance_variable_set(:"@#{method_name}", connection.http_response)
15
+ result
16
+ end
17
+ end
18
+ EOS
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,16 @@
1
+ module ActiveresourceResponse
2
+ module Connection
3
+ def self.included(base)
4
+ base.class_eval do
5
+ alias_method :origin_handle_response, :handle_response
6
+ def handle_response(response)
7
+ Thread.current['ActiveResource::Base.http_response'] = response
8
+ origin_handle_response(response)
9
+ end
10
+ def http_response
11
+ Thread.current['ActiveResource::Base.http_response']
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,5 +1,5 @@
1
1
  module ActiveresourceResponse
2
2
  module Version
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: activeresource-response
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.4
5
+ version: 0.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Igor Fedoronchuk
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-02-16 00:00:00 Z
13
+ date: 2012-02-17 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activeresource
@@ -20,10 +20,10 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: "3.1"
23
+ version: "3.0"
24
24
  type: :runtime
25
25
  version_requirements: *id001
26
- description: "adding possibility to access http response object from result of activeresource call "
26
+ description: "This gem adds possibility to access http response object from result of ActiveResource::Base find method "
27
27
  email:
28
28
  - fedoronchuk@gmail.com
29
29
  executables: []
@@ -39,6 +39,8 @@ files:
39
39
  - Rakefile
40
40
  - activeresource-response.gemspec
41
41
  - lib/activeresource-response.rb
42
+ - lib/activeresource-response/add_response_method.rb
43
+ - lib/activeresource-response/connection.rb
42
44
  - lib/activeresource-response/version.rb
43
45
  homepage: https://github.com/Fivell/activeresource-response
44
46
  licenses: []
@@ -66,6 +68,6 @@ rubyforge_project: activeresource-response
66
68
  rubygems_version: 1.8.13
67
69
  signing_key:
68
70
  specification_version: 3
69
- summary: activeresoure extension
71
+ summary: activeresource extension
70
72
  test_files: []
71
73