api-fairy 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +5 -0
- data/Gemfile +1 -1
- data/README.md +3 -0
- data/VERSION +1 -1
- data/api-fairy.gemspec +67 -0
- data/lib/api-fairy.rb +11 -1
- data/spec/api-fairy_spec.rb +7 -0
- metadata +6 -4
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
api-fairy
|
2
2
|
=========
|
3
3
|
|
4
|
+
[![Build Status](https://secure.travis-ci.org/aq1018/api-fairy.png?branch=master)](http://travis-ci.org/aq1018/api-fairy)
|
5
|
+
|
6
|
+
|
4
7
|
api-fairy is a Rack Middleware that **magically** speeds up your slow backend services just by including it as your middleware.
|
5
8
|
|
6
9
|
Install
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/api-fairy.gemspec
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "api-fairy"
|
8
|
+
s.version = "0.2.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Aaron Qian"]
|
12
|
+
s.date = "2012-03-29"
|
13
|
+
s.description = "api-fairy is a Rack Middleware that magically speeds up your slow backend services just by including it as your middleware."
|
14
|
+
s.email = "aq1018@gmail.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
".travis.yml",
|
23
|
+
"Gemfile",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.md",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"api-fairy.gemspec",
|
29
|
+
"lib/api-fairy.rb",
|
30
|
+
"spec/api-fairy_spec.rb",
|
31
|
+
"spec/spec_helper.rb",
|
32
|
+
"spec/support/api_helper.rb"
|
33
|
+
]
|
34
|
+
s.homepage = "http://github.com/aq1018/api-fairy"
|
35
|
+
s.licenses = ["MIT"]
|
36
|
+
s.require_paths = ["lib"]
|
37
|
+
s.rubygems_version = "1.8.19"
|
38
|
+
s.summary = "Rack Middleware that magically speeds up your slow backend services"
|
39
|
+
|
40
|
+
if s.respond_to? :specification_version then
|
41
|
+
s.specification_version = 3
|
42
|
+
|
43
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
44
|
+
s.add_runtime_dependency(%q<rack>, [">= 0"])
|
45
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
|
46
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
47
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.1.0"])
|
48
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
|
49
|
+
s.add_development_dependency(%q<rack-test>, [">= 0"])
|
50
|
+
else
|
51
|
+
s.add_dependency(%q<rack>, [">= 0"])
|
52
|
+
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
53
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
54
|
+
s.add_dependency(%q<bundler>, ["~> 1.1.0"])
|
55
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
56
|
+
s.add_dependency(%q<rack-test>, [">= 0"])
|
57
|
+
end
|
58
|
+
else
|
59
|
+
s.add_dependency(%q<rack>, [">= 0"])
|
60
|
+
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
61
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
62
|
+
s.add_dependency(%q<bundler>, ["~> 1.1.0"])
|
63
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
64
|
+
s.add_dependency(%q<rack-test>, [">= 0"])
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
data/lib/api-fairy.rb
CHANGED
@@ -1,11 +1,21 @@
|
|
1
|
+
require 'rack/utils'
|
2
|
+
|
1
3
|
module Rack
|
2
4
|
class ApiFairy
|
5
|
+
include Rack::Utils
|
6
|
+
|
3
7
|
def initialize(app)
|
4
8
|
@app = app
|
5
9
|
end
|
6
10
|
|
7
11
|
def call(env)
|
8
|
-
|
12
|
+
params = parse_nested_query(env['QUERY_STRING'])
|
13
|
+
response = 'Magic'
|
14
|
+
if params['name']
|
15
|
+
response += "al #{params['name']}"
|
16
|
+
end
|
17
|
+
|
18
|
+
[200, {'Content-Type' => 'text/plain'}, [response]]
|
9
19
|
end
|
10
20
|
end
|
11
21
|
end
|
data/spec/api-fairy_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api-fairy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
requirements:
|
67
67
|
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 1.
|
69
|
+
version: 1.1.0
|
70
70
|
type: :development
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -74,7 +74,7 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 1.
|
77
|
+
version: 1.1.0
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: jeweler
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -118,11 +118,13 @@ extra_rdoc_files:
|
|
118
118
|
files:
|
119
119
|
- .document
|
120
120
|
- .rspec
|
121
|
+
- .travis.yml
|
121
122
|
- Gemfile
|
122
123
|
- LICENSE.txt
|
123
124
|
- README.md
|
124
125
|
- Rakefile
|
125
126
|
- VERSION
|
127
|
+
- api-fairy.gemspec
|
126
128
|
- lib/api-fairy.rb
|
127
129
|
- spec/api-fairy_spec.rb
|
128
130
|
- spec/spec_helper.rb
|
@@ -142,7 +144,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
142
144
|
version: '0'
|
143
145
|
segments:
|
144
146
|
- 0
|
145
|
-
hash:
|
147
|
+
hash: -2549094047739865643
|
146
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
149
|
none: false
|
148
150
|
requirements:
|