activeresource-response 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -1
- data/README.rdoc +6 -5
- data/activeresource-response.gemspec +3 -2
- data/lib/activeresource-response/http_response.rb +1 -2
- data/lib/activeresource-response/version.rb +1 -1
- metadata +3 -4
- data/.gitignore +0 -4
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -10,7 +10,7 @@ Such functionallity can be used for easily implementing pagination in a REST API
|
|
10
10
|
== How to use?
|
11
11
|
Add dependency to your Gemfile
|
12
12
|
|
13
|
-
gem "activeresource-response"
|
13
|
+
gem "activeresource-response"
|
14
14
|
|
15
15
|
Just open your ActiveResource class and add
|
16
16
|
|
@@ -82,7 +82,7 @@ Example
|
|
82
82
|
|
83
83
|
|
84
84
|
|
85
|
-
== Headers and cookies methods
|
85
|
+
== Headers and cookies methods
|
86
86
|
You can get cookies and headers from response
|
87
87
|
Example
|
88
88
|
|
@@ -93,11 +93,11 @@ Example
|
|
93
93
|
countries = Country.all
|
94
94
|
countries.my_response.headers
|
95
95
|
|
96
|
-
# => {:content_type=>["application/json; charset=utf-8"], :x_ua_compatible=>["IE=Edge"], ..., :set_cookie=>["bar=foo; path=/", "foo=bar; path=/"]}
|
96
|
+
# collection with symbolized keys => {:content_type=>["application/json; charset=utf-8"], :x_ua_compatible=>["IE=Edge"], ..., :set_cookie=>["bar=foo; path=/", "foo=bar; path=/"]}
|
97
97
|
|
98
98
|
|
99
99
|
countries.my_response.cookies
|
100
|
-
# => {
|
100
|
+
# => {"bar"=>"foo", "foo"=>"bar"}
|
101
101
|
|
102
102
|
== About Http response
|
103
103
|
http response is object of Net::HTTPOK, Net::HTTPClientError or one of other subclasses
|
@@ -111,4 +111,5 @@ http://phpblog.com.ua/2012/01/rails-activeresource-i-zagolovki/
|
|
111
111
|
http://stackoverflow.com/questions/5972429/active-resource-responses-how-to-get-them
|
112
112
|
|
113
113
|
|
114
|
-
== Please, feel free to contact me if you have any questions
|
114
|
+
== Please, feel free to contact me if you have any questions
|
115
|
+
fedoronchuk(at)gmail.com
|
@@ -3,11 +3,12 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
require "activeresource-response/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
|
+
|
6
7
|
s.name = "activeresource-response"
|
7
8
|
s.version = ActiveresourceResponse::Version::VERSION
|
8
9
|
s.authors = ["Igor Fedoronchuk"]
|
9
10
|
s.email = ["fedoronchuk@gmail.com"]
|
10
|
-
s.homepage = "
|
11
|
+
s.homepage = "http://fivell.github.com/activeresource-response/"
|
11
12
|
s.summary = %q{activeresource extension}
|
12
13
|
s.description = %q{This gem adds possibility to access http response object from result of ActiveResource::Base find method }
|
13
14
|
|
@@ -20,7 +21,7 @@ Gem::Specification.new do |s|
|
|
20
21
|
s.rdoc_options.concat ['--main', 'README.rdoc']
|
21
22
|
|
22
23
|
|
23
|
-
s.files = `git ls-files`.split("\n")
|
24
|
+
s.files = `git ls-files | sed '/.gitignore/d'`.split("\n")
|
24
25
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
25
26
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
26
27
|
s.require_paths = ["lib"]
|
@@ -5,13 +5,12 @@ module ActiveresourceResponse
|
|
5
5
|
end
|
6
6
|
def cookies
|
7
7
|
unless @_active_resource_response_cookies
|
8
|
-
|
8
|
+
@_active_resource_response_cookies = (self.headers[:set_cookie] || {}).inject({}) do |out, cookie_str|
|
9
9
|
CGI::Cookie::parse(cookie_str).each do |key, cookie|
|
10
10
|
out[key] = cookie.value.first unless ['expires', 'path'].include? key
|
11
11
|
end
|
12
12
|
out
|
13
13
|
end
|
14
|
-
@_active_resource_response_cookies = symbolize_keys(cookies)
|
15
14
|
end
|
16
15
|
@_active_resource_response_cookies
|
17
16
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeresource-response
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activeresource
|
@@ -36,7 +36,6 @@ extensions: []
|
|
36
36
|
extra_rdoc_files:
|
37
37
|
- README.rdoc
|
38
38
|
files:
|
39
|
-
- .gitignore
|
40
39
|
- Gemfile
|
41
40
|
- LICENSE
|
42
41
|
- README.rdoc
|
@@ -47,7 +46,7 @@ files:
|
|
47
46
|
- lib/activeresource-response/http_response.rb
|
48
47
|
- lib/activeresource-response/response_method.rb
|
49
48
|
- lib/activeresource-response/version.rb
|
50
|
-
homepage:
|
49
|
+
homepage: http://fivell.github.com/activeresource-response/
|
51
50
|
licenses: []
|
52
51
|
post_install_message:
|
53
52
|
rdoc_options:
|
data/.gitignore
DELETED