zerigo_dns 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/activeresource-ext.rb +42 -0
- metadata +2 -1
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'activeresource'
|
2
|
+
|
3
|
+
module ActiveResource
|
4
|
+
module CaptureHeaders
|
5
|
+
module InstanceMethods
|
6
|
+
private
|
7
|
+
def request_with_headers(method, path, *arguments)
|
8
|
+
request_without_headers(method, path, *arguments).tap do |resp|
|
9
|
+
@headers = resp.to_hash
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.included(receiver)
|
16
|
+
receiver.class_eval do
|
17
|
+
include InstanceMethods
|
18
|
+
alias_method_chain :request, :headers
|
19
|
+
attr :headers
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
module RetrieveHeaders
|
25
|
+
module InstanceMethods
|
26
|
+
def last_count
|
27
|
+
@last_count ||= (c = connection.headers['x-query-count']) ? c[0].to_i : nil
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.included(receiver)
|
33
|
+
receiver.class_eval do
|
34
|
+
include InstanceMethods
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
ActiveResource::Connection.send :include, ActiveResource::CaptureHeaders
|
42
|
+
ActiveResource::Base.send :include, ActiveResource::RetrieveHeaders
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zerigo_dns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Wilson
|
@@ -46,6 +46,7 @@ files:
|
|
46
46
|
- README.rdoc
|
47
47
|
- Rakefile
|
48
48
|
- example/sample.rb
|
49
|
+
- lib/activeresource-ext.rb
|
49
50
|
- lib/zerigo_dns.rb
|
50
51
|
has_rdoc: true
|
51
52
|
homepage: http://github.com/twilson63/zerigo_dns
|