rest-core 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/.gitmodules +3 -0
- data/.travis.yml +9 -0
- data/CONTRIBUTORS +11 -0
- data/Gemfile +8 -0
- data/LICENSE +201 -0
- data/NOTE.md +48 -0
- data/README +83 -0
- data/README.md +83 -0
- data/Rakefile +26 -0
- data/TODO.md +17 -0
- data/example/facebook.rb +145 -0
- data/example/github.rb +21 -0
- data/lib/rest-core.rb +48 -0
- data/lib/rest-core/app/ask.rb +11 -0
- data/lib/rest-core/app/rest-client.rb +24 -0
- data/lib/rest-core/builder.rb +24 -0
- data/lib/rest-core/client.rb +278 -0
- data/lib/rest-core/client/github.rb +19 -0
- data/lib/rest-core/client/linkedin.rb +57 -0
- data/lib/rest-core/client/rest-graph.rb +262 -0
- data/lib/rest-core/client/twitter.rb +59 -0
- data/lib/rest-core/client_oauth1.rb +25 -0
- data/lib/rest-core/event.rb +17 -0
- data/lib/rest-core/middleware.rb +53 -0
- data/lib/rest-core/middleware/cache.rb +80 -0
- data/lib/rest-core/middleware/common_logger.rb +27 -0
- data/lib/rest-core/middleware/default_headers.rb +11 -0
- data/lib/rest-core/middleware/default_query.rb +11 -0
- data/lib/rest-core/middleware/default_site.rb +15 -0
- data/lib/rest-core/middleware/defaults.rb +44 -0
- data/lib/rest-core/middleware/error_detector.rb +16 -0
- data/lib/rest-core/middleware/error_detector_http.rb +11 -0
- data/lib/rest-core/middleware/error_handler.rb +19 -0
- data/lib/rest-core/middleware/json_decode.rb +83 -0
- data/lib/rest-core/middleware/oauth1_header.rb +81 -0
- data/lib/rest-core/middleware/oauth2_query.rb +19 -0
- data/lib/rest-core/middleware/timeout.rb +13 -0
- data/lib/rest-core/util/hmac.rb +22 -0
- data/lib/rest-core/version.rb +4 -0
- data/lib/rest-core/wrapper.rb +55 -0
- data/lib/rest-graph/config_util.rb +43 -0
- data/rest-core.gemspec +162 -0
- data/task/.gitignore +1 -0
- data/task/gemgem.rb +184 -0
- data/test/common.rb +29 -0
- data/test/config/rest-graph.yaml +7 -0
- data/test/pending/test_load_config.rb +42 -0
- data/test/pending/test_multi.rb +123 -0
- data/test/pending/test_test_util.rb +86 -0
- data/test/test_api.rb +98 -0
- data/test/test_cache.rb +62 -0
- data/test/test_default.rb +27 -0
- data/test/test_error.rb +66 -0
- data/test/test_handler.rb +87 -0
- data/test/test_misc.rb +75 -0
- data/test/test_oauth.rb +42 -0
- data/test/test_oauth1_header.rb +46 -0
- data/test/test_old.rb +116 -0
- data/test/test_page.rb +110 -0
- data/test/test_parse.rb +131 -0
- data/test/test_rest-graph.rb +10 -0
- data/test/test_serialize.rb +44 -0
- data/test/test_timeout.rb +25 -0
- metadata +267 -0
data/test/test_page.rb
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
|
2
|
+
if respond_to?(:require_relative, true)
|
3
|
+
require_relative 'common'
|
4
|
+
else
|
5
|
+
require File.dirname(__FILE__) + '/common'
|
6
|
+
end
|
7
|
+
|
8
|
+
describe RestGraph do
|
9
|
+
after do
|
10
|
+
WebMock.reset!
|
11
|
+
RR.verify
|
12
|
+
end
|
13
|
+
|
14
|
+
should 'get the next/prev page' do
|
15
|
+
rg = RestGraph.new(:site => '', :cache => false)
|
16
|
+
%w[next previous].each{ |type|
|
17
|
+
kind = "#{type}_page"
|
18
|
+
rg.send(kind, {}) .should == nil
|
19
|
+
rg.send(kind, {'paging' => []}).should == nil
|
20
|
+
rg.send(kind, {'paging' => {}}).should == nil
|
21
|
+
|
22
|
+
stub_request(:get, 'zzz').to_return(:body => '["ok"]')
|
23
|
+
rg.send(kind, {'paging' => {type => 'zzz'}}).should == ['ok']
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
should 'merge all pages into one' do
|
28
|
+
rg = RestGraph.new(:site => '', :cache => false)
|
29
|
+
%w[next previous].each{ |type|
|
30
|
+
kind = "#{type}_page"
|
31
|
+
data = {'paging' => {type => 'zzz'}, 'data' => ['z']}
|
32
|
+
|
33
|
+
# invalid pages or just the page itself
|
34
|
+
(-1..1).each{ |page|
|
35
|
+
rg.for_pages(data, page, {}, kind).should == data
|
36
|
+
}
|
37
|
+
|
38
|
+
(2..4).each{ |pages|
|
39
|
+
# merge data
|
40
|
+
stub_request(:get, 'zzz').to_return(:body => '{"data":["y"]}')
|
41
|
+
rg.for_pages(data, pages, {}, kind).should == {'data' => %w[z y]}
|
42
|
+
|
43
|
+
# this data cannot be merged
|
44
|
+
stub_request(:get, 'zzz').to_return(:body => '{"data":"y"}')
|
45
|
+
rg.for_pages(data, pages, {}, kind).should == {'data' => %w[z]}
|
46
|
+
}
|
47
|
+
|
48
|
+
stub_request(:get, 'zzz').to_return(:body =>
|
49
|
+
'{"paging":{"'+type+'":"yyy"},"data":["y"]}')
|
50
|
+
stub_request(:get, 'yyy').to_return(:body => '{"data":["x"]}')
|
51
|
+
|
52
|
+
rg.for_pages(data, 3, {}, kind).should == {'data' => %w[z y x]}
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
should 'for_pages with callback' do
|
57
|
+
rg = RestGraph.new(:site => '', :cache => false)
|
58
|
+
%w[next previous].each{ |type|
|
59
|
+
kind = "#{type}_page"
|
60
|
+
data = {'paging' => {type => 'zzz'}, 'data' => ['z']}
|
61
|
+
|
62
|
+
# invalid pages or just the page itself
|
63
|
+
nils = 0
|
64
|
+
ranges = -1..1
|
65
|
+
ranges.each{ |page|
|
66
|
+
rg.for_pages(data, page, {}, kind){ |r|
|
67
|
+
if r
|
68
|
+
r.should == data
|
69
|
+
else
|
70
|
+
nils += 1
|
71
|
+
end
|
72
|
+
}.should == data
|
73
|
+
}
|
74
|
+
nils.should == ranges.to_a.size
|
75
|
+
|
76
|
+
(2..4).each{ |pages|
|
77
|
+
# merge data
|
78
|
+
stub_request(:get, 'zzz').to_return(:body => '{"data":["y"]}')
|
79
|
+
expects = [{'data' => %w[y]}, nil]
|
80
|
+
rg.for_pages(data, pages, {}, kind){ |r|
|
81
|
+
r.should == expects.shift
|
82
|
+
}.should == {'data' => %w[z y]}
|
83
|
+
expects.empty?.should == true
|
84
|
+
|
85
|
+
# this data cannot be merged
|
86
|
+
stub_request(:get, 'zzz').to_return(:body => '{"data":"y"}')
|
87
|
+
expects = [{'data' => 'y'}, nil]
|
88
|
+
rg.for_pages(data, pages, {}, kind){ |r|
|
89
|
+
r.should == expects.shift
|
90
|
+
}.should == {'data' => %w[z]}
|
91
|
+
expects.empty?.should == true
|
92
|
+
}
|
93
|
+
|
94
|
+
stub_request(:get, 'zzz').to_return(:body =>
|
95
|
+
'{"paging":{"'+type+'":"yyy"},"data":["y"]}')
|
96
|
+
stub_request(:get, 'yyy').to_return(:body => '{"data":["x"]}')
|
97
|
+
|
98
|
+
expects = [{'data' => %w[y]}, {'data' => %w[x]}, nil]
|
99
|
+
rg.for_pages(data, 3, {}, kind){ |rr|
|
100
|
+
if rr
|
101
|
+
r = rr.dup
|
102
|
+
r.delete('paging')
|
103
|
+
else
|
104
|
+
r = rr
|
105
|
+
end
|
106
|
+
r.should == expects.shift
|
107
|
+
}.should == {'data' => %w[z y x]}
|
108
|
+
}
|
109
|
+
end
|
110
|
+
end
|
data/test/test_parse.rb
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
|
2
|
+
if respond_to?(:require_relative, true)
|
3
|
+
require_relative 'common'
|
4
|
+
else
|
5
|
+
require File.dirname(__FILE__) + '/common'
|
6
|
+
end
|
7
|
+
|
8
|
+
describe RestGraph do
|
9
|
+
|
10
|
+
should 'return nil if parse error, but not when call data directly' do
|
11
|
+
rg = RestGraph.new
|
12
|
+
rg.parse_cookies!({}).should == nil
|
13
|
+
rg.data .should == {}
|
14
|
+
end
|
15
|
+
|
16
|
+
should 'parse if fbs contains json as well' do
|
17
|
+
algorithm = 'HMAC-SHA256'
|
18
|
+
user = '{"country"=>"us", "age"=>{"min"=>21}}'
|
19
|
+
data = {'algorithm' => algorithm, 'user' => user}
|
20
|
+
rg = RestGraph.new(:data => data, :secret => 'secret')
|
21
|
+
sig = rg.send(:calculate_sig, data)
|
22
|
+
rg.parse_fbs!("\"#{rg.fbs}\"").should == data.merge('sig' => sig)
|
23
|
+
end
|
24
|
+
|
25
|
+
should 'extract correct access_token or fail checking sig' do
|
26
|
+
access_token = '1|2-5|f.'
|
27
|
+
app_id = '1829'
|
28
|
+
secret = app_id.reverse
|
29
|
+
sig = '398262caea8442bd8801e8fba7c55c8a'
|
30
|
+
fbs = "access_token=#{CGI.escape(access_token)}&expires=0&" \
|
31
|
+
"secret=abc&session_key=def-456&sig=#{sig}&uid=3"
|
32
|
+
|
33
|
+
check = lambda{ |token, fbs|
|
34
|
+
http_cookie =
|
35
|
+
"__utma=123; __utmz=456.utmcsr=(d)|utmccn=(d)|utmcmd=(n); " \
|
36
|
+
"fbs_#{app_id}=#{fbs}"
|
37
|
+
|
38
|
+
rg = RestGraph.new(:app_id => app_id, :secret => secret)
|
39
|
+
rg.parse_rack_env!('HTTP_COOKIE' => http_cookie).
|
40
|
+
should.kind_of?(token ? Hash : NilClass)
|
41
|
+
rg.access_token.should == token
|
42
|
+
|
43
|
+
rg.parse_rack_env!('HTTP_COOKIE' => nil).should == nil
|
44
|
+
rg.data.should == {}
|
45
|
+
|
46
|
+
rg.parse_cookies!({"fbs_#{app_id}" => fbs}).
|
47
|
+
should.kind_of?(token ? Hash : NilClass)
|
48
|
+
rg.access_token.should == token
|
49
|
+
|
50
|
+
rg.parse_fbs!(fbs).
|
51
|
+
should.kind_of?(token ? Hash : NilClass)
|
52
|
+
rg.access_token.should == token
|
53
|
+
}
|
54
|
+
check.call(access_token, fbs)
|
55
|
+
check.call(access_token, "\"#{fbs}\"")
|
56
|
+
fbs << '&inject=evil"'
|
57
|
+
check.call(nil, fbs)
|
58
|
+
check.call(nil, "\"#{fbs}\"")
|
59
|
+
end
|
60
|
+
|
61
|
+
should 'not pass if there is no secret, prevent from forgery' do
|
62
|
+
rg = RestGraph.new
|
63
|
+
rg.parse_fbs!('"feed=me&sig=bddd192cf27f22c05f61c8bea24fa4b7"').
|
64
|
+
should == nil
|
65
|
+
end
|
66
|
+
|
67
|
+
should 'parse json correctly' do
|
68
|
+
rg = RestGraph.new
|
69
|
+
|
70
|
+
rg.parse_json!('bad json') .should == nil
|
71
|
+
rg.parse_json!('{"no":"sig"}').should == nil
|
72
|
+
rg.parse_json!('{"feed":"me","sig":"bddd192cf27f22c05f61c8bea24fa4b7"}').
|
73
|
+
should == nil
|
74
|
+
|
75
|
+
rg = RestGraph.new(:secret => 'bread')
|
76
|
+
rg.parse_json!('{"feed":"me","sig":"20393e7823730308938a86ecf1c88b14"}').
|
77
|
+
should == {'feed' => 'me', 'sig' => "20393e7823730308938a86ecf1c88b14"}
|
78
|
+
rg.data.empty?.should == false
|
79
|
+
rg.parse_json!('bad json')
|
80
|
+
rg.data.empty?.should == true
|
81
|
+
end
|
82
|
+
|
83
|
+
should 'parse signed_request' do
|
84
|
+
secret = 'aloha'
|
85
|
+
json = RestCore::JsonDecode.json_encode('ooh' => 'dir', 'moo' => 'bar')
|
86
|
+
encode = lambda{ |str|
|
87
|
+
[str].pack('m').tr("\n=", '').tr('+/', '-_')
|
88
|
+
}
|
89
|
+
json_encoded = encode[json]
|
90
|
+
sig = OpenSSL::HMAC.digest('sha256', secret, json_encoded)
|
91
|
+
signed_request = "#{encode[sig]}.#{json_encoded}"
|
92
|
+
|
93
|
+
rg = RestGraph.new(:secret => secret)
|
94
|
+
rg.parse_signed_request!(signed_request)
|
95
|
+
rg.data['ooh'].should == 'dir'
|
96
|
+
rg.data['moo'].should == 'bar'
|
97
|
+
|
98
|
+
signed_request = "#{encode[sig[0..-4]+'bad']}.#{json_encoded}"
|
99
|
+
rg.parse_signed_request!(signed_request).should == nil
|
100
|
+
rg.data .should == {}
|
101
|
+
end
|
102
|
+
|
103
|
+
should 'fallback to ruby-hmac if Digest.new raise an runtime error' do
|
104
|
+
key, data = 'top', 'secret'
|
105
|
+
digest = OpenSSL::HMAC.digest('sha256', key, data)
|
106
|
+
mock(OpenSSL::HMAC).digest('sha256', key, data){ raise 'boom' }
|
107
|
+
RestCore::Hmac.sha256(key, data).should == digest
|
108
|
+
end
|
109
|
+
|
110
|
+
should 'generate correct fbs with correct sig' do
|
111
|
+
RestGraph.new(:access_token => 'fake', :secret => 's').fbs.should ==
|
112
|
+
"access_token=fake&sig=#{Digest::MD5.hexdigest('access_token=fakes')}"
|
113
|
+
end
|
114
|
+
|
115
|
+
should 'parse fbs from facebook response which lacks sig...' do
|
116
|
+
rg = RestGraph.new(:access_token => 'a', :secret => 'z')
|
117
|
+
rg.parse_fbs!(rg.fbs) .should.kind_of?(Hash)
|
118
|
+
rg.data.empty?.should == false
|
119
|
+
rg.parse_fbs!(rg.fbs.sub(/sig\=\w+/, 'sig=abc')).should == nil
|
120
|
+
rg.data.empty?.should == true
|
121
|
+
end
|
122
|
+
|
123
|
+
should 'generate correct fbs with additional parameters' do
|
124
|
+
rg = RestGraph.new(:access_token => 'a', :secret => 'z')
|
125
|
+
rg.data['expires'] = '1234'
|
126
|
+
rg.parse_fbs!(rg.fbs).should.kind_of?(Hash)
|
127
|
+
rg.access_token .should == 'a'
|
128
|
+
rg.data['expires'] .should == '1234'
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
|
2
|
+
$LOAD_PATH << File.dirname(__FILE__)
|
3
|
+
$LOAD_PATH.uniq!
|
4
|
+
|
5
|
+
Dir["#{File.dirname(__FILE__)}/*.rb"].each{ |file|
|
6
|
+
next if file == __FILE__
|
7
|
+
next if ARGV.map{ |path| File.expand_path(path)
|
8
|
+
}.include?(File.expand_path(file))
|
9
|
+
require File.basename(file).sub(/\..+$/, '')
|
10
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
|
2
|
+
if respond_to?(:require_relative, true)
|
3
|
+
require_relative 'common'
|
4
|
+
else
|
5
|
+
require File.dirname(__FILE__) + '/common'
|
6
|
+
end
|
7
|
+
|
8
|
+
describe RestGraph do
|
9
|
+
after do
|
10
|
+
WebMock.reset!
|
11
|
+
RR.verify
|
12
|
+
end
|
13
|
+
|
14
|
+
should 'be serialized with lighten' do
|
15
|
+
engines = if RUBY_VERSION >= '1.9.2'
|
16
|
+
begin
|
17
|
+
require 'psych'
|
18
|
+
YAML::ENGINE.yamler = 'psych' # TODO: probably a bug?
|
19
|
+
[Marshal, YAML, Psych]
|
20
|
+
rescue LoadError
|
21
|
+
[Marshal, YAML]
|
22
|
+
end
|
23
|
+
elsif defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
|
24
|
+
[Marshal]
|
25
|
+
else
|
26
|
+
[YAML]
|
27
|
+
end
|
28
|
+
|
29
|
+
engines.each{ |engine|
|
30
|
+
test = lambda{ |obj| engine.load(engine.dump(obj)) }
|
31
|
+
rg = RestGraph.new(:log_handler => lambda{})
|
32
|
+
lambda{ test[rg] }.should.raise(TypeError)
|
33
|
+
test[rg.lighten].should == rg.lighten
|
34
|
+
lambda{ test[rg] }.should.raise(TypeError)
|
35
|
+
rg.lighten!
|
36
|
+
test[rg.lighten].should == rg
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
should 'lighten takes options to change attributes' do
|
41
|
+
RestGraph.new.lighten(:timeout => 100 ).timeout.should == 100
|
42
|
+
RestGraph.new.lighten(:lang => 'zh-TW').lang .should == 'zh-TW'
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
if respond_to?(:require_relative, true)
|
3
|
+
require_relative 'common'
|
4
|
+
else
|
5
|
+
require File.dirname(__FILE__) + '/common'
|
6
|
+
end
|
7
|
+
|
8
|
+
describe RestGraph do
|
9
|
+
after do
|
10
|
+
WebMock.reset!
|
11
|
+
RR.verify
|
12
|
+
end
|
13
|
+
|
14
|
+
should 'respect timeout' do
|
15
|
+
stub_request(:get, 'https://graph.facebook.com/me').
|
16
|
+
to_return(:body => '{}')
|
17
|
+
mock.proxy(Timeout).timeout(numeric)
|
18
|
+
RestGraph.new.get('me').should == {}
|
19
|
+
end
|
20
|
+
|
21
|
+
should 'override timeout' do
|
22
|
+
mock(Timeout).timeout(99){ {RestCore::RESPONSE_BODY => true} }
|
23
|
+
RestGraph.new(:timeout => 1).get('me', {}, :timeout => 99).should == true
|
24
|
+
end
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,267 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rest-core
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Cardinal Blue
|
9
|
+
- Lin Jen-Shin (godfat)
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2011-08-16 00:00:00.000000000Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rest-client
|
17
|
+
requirement: &2153518960 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *2153518960
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rack
|
28
|
+
requirement: &2153518480 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *2153518480
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: yajl-ruby
|
39
|
+
requirement: &2153518000 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *2153518000
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: json
|
50
|
+
requirement: &2153517520 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *2153517520
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: json_pure
|
61
|
+
requirement: &2153517040 !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
type: :development
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *2153517040
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: ruby-hmac
|
72
|
+
requirement: &2153516560 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
type: :development
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: *2153516560
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: webmock
|
83
|
+
requirement: &2153516080 !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
type: :development
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: *2153516080
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: bacon
|
94
|
+
requirement: &2153515600 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ! '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
type: :development
|
101
|
+
prerelease: false
|
102
|
+
version_requirements: *2153515600
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: rr
|
105
|
+
requirement: &2153515120 !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
type: :development
|
112
|
+
prerelease: false
|
113
|
+
version_requirements: *2153515120
|
114
|
+
- !ruby/object:Gem::Dependency
|
115
|
+
name: rake
|
116
|
+
requirement: &2153514640 !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
118
|
+
requirements:
|
119
|
+
- - ! '>='
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
type: :development
|
123
|
+
prerelease: false
|
124
|
+
version_requirements: *2153514640
|
125
|
+
description: ! 'A modular Ruby REST client collection/infrastructure.
|
126
|
+
|
127
|
+
|
128
|
+
In this era of web services and mashups, we have seen a blooming of REST
|
129
|
+
|
130
|
+
APIs. One might wonder, how do we use these APIs easily and elegantly?
|
131
|
+
|
132
|
+
Since REST is very simple compared to SOAP, it is not hard to build a
|
133
|
+
|
134
|
+
dedicated client ourselves.
|
135
|
+
|
136
|
+
|
137
|
+
We have developed [rest-core][] with composable middlewares to build a
|
138
|
+
|
139
|
+
REST client, based on the effort from [rest-graph][]. In the cases of
|
140
|
+
|
141
|
+
common APIs such as Facebook, Github, and Twitter, developers can simply
|
142
|
+
|
143
|
+
use the built-in dedicated clients provided by rest-core, or do it yourself
|
144
|
+
|
145
|
+
for any other REST APIs.
|
146
|
+
|
147
|
+
|
148
|
+
[rest-core]: http://github.com/cardinalblue/rest-core
|
149
|
+
|
150
|
+
[rest-graph]: http://github.com/cardinalblue/rest-graph'
|
151
|
+
email:
|
152
|
+
- dev (XD) cardinalblue.com
|
153
|
+
executables: []
|
154
|
+
extensions: []
|
155
|
+
extra_rdoc_files:
|
156
|
+
- CONTRIBUTORS
|
157
|
+
- LICENSE
|
158
|
+
- TODO.md
|
159
|
+
files:
|
160
|
+
- .gitignore
|
161
|
+
- .gitmodules
|
162
|
+
- .travis.yml
|
163
|
+
- CONTRIBUTORS
|
164
|
+
- Gemfile
|
165
|
+
- LICENSE
|
166
|
+
- NOTE.md
|
167
|
+
- README
|
168
|
+
- README.md
|
169
|
+
- Rakefile
|
170
|
+
- TODO.md
|
171
|
+
- example/facebook.rb
|
172
|
+
- example/github.rb
|
173
|
+
- lib/rest-core.rb
|
174
|
+
- lib/rest-core/app/ask.rb
|
175
|
+
- lib/rest-core/app/rest-client.rb
|
176
|
+
- lib/rest-core/builder.rb
|
177
|
+
- lib/rest-core/client.rb
|
178
|
+
- lib/rest-core/client/github.rb
|
179
|
+
- lib/rest-core/client/linkedin.rb
|
180
|
+
- lib/rest-core/client/rest-graph.rb
|
181
|
+
- lib/rest-core/client/twitter.rb
|
182
|
+
- lib/rest-core/client_oauth1.rb
|
183
|
+
- lib/rest-core/event.rb
|
184
|
+
- lib/rest-core/middleware.rb
|
185
|
+
- lib/rest-core/middleware/cache.rb
|
186
|
+
- lib/rest-core/middleware/common_logger.rb
|
187
|
+
- lib/rest-core/middleware/default_headers.rb
|
188
|
+
- lib/rest-core/middleware/default_query.rb
|
189
|
+
- lib/rest-core/middleware/default_site.rb
|
190
|
+
- lib/rest-core/middleware/defaults.rb
|
191
|
+
- lib/rest-core/middleware/error_detector.rb
|
192
|
+
- lib/rest-core/middleware/error_detector_http.rb
|
193
|
+
- lib/rest-core/middleware/error_handler.rb
|
194
|
+
- lib/rest-core/middleware/json_decode.rb
|
195
|
+
- lib/rest-core/middleware/oauth1_header.rb
|
196
|
+
- lib/rest-core/middleware/oauth2_query.rb
|
197
|
+
- lib/rest-core/middleware/timeout.rb
|
198
|
+
- lib/rest-core/util/hmac.rb
|
199
|
+
- lib/rest-core/version.rb
|
200
|
+
- lib/rest-core/wrapper.rb
|
201
|
+
- lib/rest-graph/config_util.rb
|
202
|
+
- rest-core.gemspec
|
203
|
+
- task/.gitignore
|
204
|
+
- task/gemgem.rb
|
205
|
+
- test/common.rb
|
206
|
+
- test/config/rest-graph.yaml
|
207
|
+
- test/pending/test_load_config.rb
|
208
|
+
- test/pending/test_multi.rb
|
209
|
+
- test/pending/test_test_util.rb
|
210
|
+
- test/test_api.rb
|
211
|
+
- test/test_cache.rb
|
212
|
+
- test/test_default.rb
|
213
|
+
- test/test_error.rb
|
214
|
+
- test/test_handler.rb
|
215
|
+
- test/test_misc.rb
|
216
|
+
- test/test_oauth.rb
|
217
|
+
- test/test_oauth1_header.rb
|
218
|
+
- test/test_old.rb
|
219
|
+
- test/test_page.rb
|
220
|
+
- test/test_parse.rb
|
221
|
+
- test/test_rest-graph.rb
|
222
|
+
- test/test_serialize.rb
|
223
|
+
- test/test_timeout.rb
|
224
|
+
homepage: https://github.com/cardinalblue/rest-core
|
225
|
+
licenses: []
|
226
|
+
post_install_message:
|
227
|
+
rdoc_options:
|
228
|
+
- --main
|
229
|
+
- README
|
230
|
+
require_paths:
|
231
|
+
- lib
|
232
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
233
|
+
none: false
|
234
|
+
requirements:
|
235
|
+
- - ! '>='
|
236
|
+
- !ruby/object:Gem::Version
|
237
|
+
version: '0'
|
238
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
239
|
+
none: false
|
240
|
+
requirements:
|
241
|
+
- - ! '>='
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: '0'
|
244
|
+
requirements: []
|
245
|
+
rubyforge_project:
|
246
|
+
rubygems_version: 1.8.7
|
247
|
+
signing_key:
|
248
|
+
specification_version: 3
|
249
|
+
summary: A modular Ruby REST client collection/infrastructure.
|
250
|
+
test_files:
|
251
|
+
- test/pending/test_load_config.rb
|
252
|
+
- test/pending/test_multi.rb
|
253
|
+
- test/pending/test_test_util.rb
|
254
|
+
- test/test_api.rb
|
255
|
+
- test/test_cache.rb
|
256
|
+
- test/test_default.rb
|
257
|
+
- test/test_error.rb
|
258
|
+
- test/test_handler.rb
|
259
|
+
- test/test_misc.rb
|
260
|
+
- test/test_oauth.rb
|
261
|
+
- test/test_oauth1_header.rb
|
262
|
+
- test/test_old.rb
|
263
|
+
- test/test_page.rb
|
264
|
+
- test/test_parse.rb
|
265
|
+
- test/test_rest-graph.rb
|
266
|
+
- test/test_serialize.rb
|
267
|
+
- test/test_timeout.rb
|