activeresource-persistent 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Andriy Yanko
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # ActiveResource::Persistent
2
+
3
+ HTTP persistent connection support for ActiveResource.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'active_resource-persistent', :require => 'active_resource/persistent'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install active_resource-persistent
18
+
19
+ ## Usage
20
+
21
+ Works out of box after adding:
22
+
23
+ require 'active_resource/persistent'
24
+
25
+ ## References
26
+
27
+ * [activeresource](https://github.com/rails/activeresource)
28
+ * [net-http-persistent](https://github.com/drbrain/net-http-persistent)
29
+
30
+ ## Contributing
31
+
32
+ 1. Fork it
33
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
34
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
35
+ 4. Push to the branch (`git push origin my-new-feature`)
36
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,18 @@
1
+ # -*- encoding: utf-8 -*-
2
+ Gem::Specification.new do |gem|
3
+ gem.authors = ["Andriy Yanko"]
4
+ gem.email = ["andriy.yanko@gmail.com"]
5
+ gem.description = %q{HTTP persistent connection support for ActiveResource}
6
+ gem.summary = %q{HTTP persistent connection support for ActiveResource}
7
+ gem.homepage = "https://github.com/railsware/activeresource-persistent"
8
+
9
+ gem.files = `git ls-files`.split($\)
10
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
11
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
12
+ gem.name = "activeresource-persistent"
13
+ gem.require_paths = ["lib"]
14
+ gem.version = "0.0.1"
15
+
16
+ gem.add_runtime_dependency 'net-http-persistent', '>=2.5'
17
+ gem.add_runtime_dependency 'activeresource', '>=2.3.0'
18
+ end
@@ -0,0 +1,2 @@
1
+ require 'active_resource/persistent/http'
2
+ require 'active_resource/persistent/connection'
@@ -0,0 +1,12 @@
1
+ require 'active_resource/connection'
2
+
3
+ module ActiveResource
4
+ class Connection
5
+
6
+ protected
7
+
8
+ def new_http
9
+ ActiveResource::Persistent::HTTP.new(site, proxy)
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,39 @@
1
+ require 'net/http/persistent'
2
+
3
+ module ActiveResource
4
+ module Persistent
5
+ class HTTP < Net::HTTP::Persistent
6
+ def initialize(site, proxy)
7
+ super('active_resource', proxy)
8
+ @site = site
9
+ end
10
+
11
+ def get(path, headers)
12
+ req = Net::HTTP::Get.new(path, headers)
13
+ request(@site, req)
14
+ end
15
+
16
+ def post(path, data, headers)
17
+ req = Net::HTTP::Post.new(path, headers)
18
+ req.body = data
19
+ request(@site, req)
20
+ end
21
+
22
+ def put(path, data, headers)
23
+ req = Net::HTTP::Put.new(path, headers)
24
+ req.body = data
25
+ request(@site, req)
26
+ end
27
+
28
+ def delete(path, headers)
29
+ req = Net::HTTP::Delete.new(path, headers)
30
+ request(@site, req)
31
+ end
32
+
33
+ def head(path, headers)
34
+ req = Net::HTTP::Head.new(path, headers)
35
+ request(@site, req)
36
+ end
37
+ end
38
+ end
39
+ end
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: activeresource-persistent
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Andriy Yanko
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-04-19 00:00:00 +03:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: net-http-persistent
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 9
30
+ segments:
31
+ - 2
32
+ - 5
33
+ version: "2.5"
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: activeresource
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 2
47
+ - 3
48
+ - 0
49
+ version: 2.3.0
50
+ type: :runtime
51
+ version_requirements: *id002
52
+ description: HTTP persistent connection support for ActiveResource
53
+ email:
54
+ - andriy.yanko@gmail.com
55
+ executables: []
56
+
57
+ extensions: []
58
+
59
+ extra_rdoc_files: []
60
+
61
+ files:
62
+ - .gitignore
63
+ - Gemfile
64
+ - LICENSE
65
+ - README.md
66
+ - Rakefile
67
+ - activeresource-persistent.gemspec
68
+ - lib/active_resource/persistent.rb
69
+ - lib/active_resource/persistent/connection.rb
70
+ - lib/active_resource/persistent/http.rb
71
+ has_rdoc: true
72
+ homepage: https://github.com/railsware/activeresource-persistent
73
+ licenses: []
74
+
75
+ post_install_message:
76
+ rdoc_options: []
77
+
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ hash: 3
86
+ segments:
87
+ - 0
88
+ version: "0"
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ hash: 3
95
+ segments:
96
+ - 0
97
+ version: "0"
98
+ requirements: []
99
+
100
+ rubyforge_project:
101
+ rubygems_version: 1.5.2
102
+ signing_key:
103
+ specification_version: 3
104
+ summary: HTTP persistent connection support for ActiveResource
105
+ test_files: []
106
+