rest-core 0.2.3 → 0.3.0.pre.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. data/.travis.yml +8 -4
  2. data/CHANGES.md +20 -0
  3. data/Gemfile +4 -3
  4. data/README.md +8 -8
  5. data/Rakefile +42 -2
  6. data/example/rails2/Gemfile +13 -0
  7. data/example/rails2/README +4 -0
  8. data/example/rails2/Rakefile +11 -0
  9. data/example/rails2/app/controllers/application_controller.rb +119 -0
  10. data/example/rails2/app/views/application/helper.html.erb +1 -0
  11. data/example/rails2/config/boot.rb +130 -0
  12. data/example/rails2/config/environment.rb +15 -0
  13. data/example/rails2/config/environments/development.rb +17 -0
  14. data/example/rails2/config/environments/production.rb +28 -0
  15. data/example/rails2/config/environments/test.rb +30 -0
  16. data/example/rails2/config/initializers/cookie_verification_secret.rb +7 -0
  17. data/example/rails2/config/initializers/new_rails_defaults.rb +21 -0
  18. data/example/rails2/config/initializers/session_store.rb +15 -0
  19. data/example/rails2/config/preinitializer.rb +23 -0
  20. data/example/rails2/config/rest-core.yaml +12 -0
  21. data/example/rails2/config/routes.rb +43 -0
  22. data/example/rails2/log +0 -0
  23. data/example/rails2/test/functional/application_controller_test.rb +183 -0
  24. data/example/rails2/test/test_helper.rb +18 -0
  25. data/example/rails2/test/unit/rails_util_test.rb +44 -0
  26. data/example/rails3/Gemfile +13 -0
  27. data/example/rails3/README +4 -0
  28. data/example/rails3/Rakefile +7 -0
  29. data/example/rails3/app/controllers/application_controller.rb +119 -0
  30. data/example/rails3/app/views/application/helper.html.erb +1 -0
  31. data/example/rails3/config/application.rb +23 -0
  32. data/example/rails3/config/environment.rb +5 -0
  33. data/example/rails3/config/environments/development.rb +26 -0
  34. data/example/rails3/config/environments/production.rb +49 -0
  35. data/example/rails3/config/environments/test.rb +30 -0
  36. data/example/rails3/config/initializers/secret_token.rb +7 -0
  37. data/example/rails3/config/initializers/session_store.rb +8 -0
  38. data/example/rails3/config/rest-core.yaml +12 -0
  39. data/example/rails3/config/routes.rb +5 -0
  40. data/example/rails3/config.ru +4 -0
  41. data/example/rails3/test/functional/application_controller_test.rb +183 -0
  42. data/example/rails3/test/test_helper.rb +18 -0
  43. data/example/rails3/test/unit/rails_util_test.rb +44 -0
  44. data/example/sinatra/config.ru +16 -0
  45. data/lib/rest-core/app/ask.rb +0 -2
  46. data/lib/rest-core/client/facebook/rails_util.rb +342 -0
  47. data/lib/rest-core/client/{rest-graph.rb → facebook.rb} +21 -28
  48. data/lib/rest-core/client/github.rb +1 -1
  49. data/lib/rest-core/client/linkedin.rb +3 -1
  50. data/lib/rest-core/client/twitter.rb +2 -2
  51. data/lib/rest-core/client.rb +2 -2
  52. data/lib/rest-core/client_oauth1.rb +3 -3
  53. data/lib/rest-core/middleware/oauth2_query.rb +3 -3
  54. data/{test/common.rb → lib/rest-core/test.rb} +7 -3
  55. data/lib/rest-core/util/config.rb +22 -17
  56. data/lib/rest-core/util/vendor.rb +31 -0
  57. data/lib/rest-core/version.rb +1 -1
  58. data/lib/rest-core.rb +5 -0
  59. data/rest-core.gemspec +135 -108
  60. data/test/client/facebook/config/rest-core.yaml +8 -0
  61. data/test/{test_api.rb → client/facebook/test_api.rb} +22 -23
  62. data/test/{test_cache.rb → client/facebook/test_cache.rb} +4 -8
  63. data/test/{test_default.rb → client/facebook/test_default.rb} +6 -10
  64. data/test/client/facebook/test_error.rb +65 -0
  65. data/test/{test_handler.rb → client/facebook/test_handler.rb} +12 -15
  66. data/test/{test_load_config.rb → client/facebook/test_load_config.rb} +6 -9
  67. data/test/{test_misc.rb → client/facebook/test_misc.rb} +15 -18
  68. data/test/{test_oauth.rb → client/facebook/test_oauth.rb} +4 -8
  69. data/test/{test_old.rb → client/facebook/test_old.rb} +16 -18
  70. data/test/{test_page.rb → client/facebook/test_page.rb} +5 -9
  71. data/test/{test_parse.rb → client/facebook/test_parse.rb} +13 -16
  72. data/test/client/facebook/test_serialize.rb +42 -0
  73. data/test/client/facebook/test_timeout.rb +22 -0
  74. data/test/test_oauth1_header.rb +1 -5
  75. metadata +99 -58
  76. data/test/config/rest-core.yaml +0 -7
  77. data/test/test_error.rb +0 -66
  78. data/test/test_serialize.rb +0 -44
  79. data/test/test_timeout.rb +0 -25
@@ -2,22 +2,22 @@
2
2
  require 'rest-core'
3
3
  require 'rest-core/util/hmac'
4
4
 
5
- # optional gem
6
- begin; require 'rack'; rescue LoadError; end
5
+ RestCore::Facebook = RestCore::Builder.client(
6
+ :data, :app_id, :secret, :old_site) do
7
7
 
8
- RestGraph = RestCore::Builder.client(:data, :app_id, :secret, :old_site) do
9
8
  s = self.class # this is only for ruby 1.8!
10
9
  use s::Timeout , 10
11
10
 
12
11
  use s::DefaultSite , 'https://graph.facebook.com/'
13
12
  use s::DefaultHeaders, {'Accept' => 'application/json',
14
13
  'Accept-Language' => 'en-us'}
15
- use s::Oauth2Query , 'access_token', nil
14
+ use s::Oauth2Query , nil
16
15
 
17
16
  use s::CommonLogger , lambda{|obj|obj}
18
17
 
19
- use s::Cache , {}, 3600 do
20
- use s::ErrorHandler , lambda{ |env| raise ::RestGraph::Error.call(env) }
18
+ use s::Cache , nil, 3600 do
19
+ use s::ErrorHandler , lambda{ |env|
20
+ raise ::RestCore::Facebook::Error.call(env) }
21
21
  use s::ErrorDetector , lambda{ |env|
22
22
  if env[s::RESPONSE_BODY].kind_of?(Hash)
23
23
  env[s::RESPONSE_BODY]['error'] ||
@@ -34,9 +34,9 @@ RestGraph = RestCore::Builder.client(:data, :app_id, :secret, :old_site) do
34
34
  run s::RestClient
35
35
  end
36
36
 
37
- class RestGraph::Error < RuntimeError
37
+ class RestCore::Facebook::Error < RuntimeError
38
38
  include RestCore
39
- class AccessToken < RestGraph::Error; end
39
+ class AccessToken < Facebook::Error; end
40
40
  class InvalidAccessToken < AccessToken ; end
41
41
  class MissingAccessToken < AccessToken ; end
42
42
 
@@ -70,32 +70,24 @@ class RestGraph::Error < RuntimeError
70
70
  end
71
71
  end
72
72
 
73
- module RestGraph::Client
73
+ module RestCore::Facebook::Client
74
74
  include RestCore
75
75
 
76
- def self.included mod
77
- mod.send(:alias_method, :auto_decode , :json_decode )
78
- mod.send(:alias_method, :auto_decode=, :json_decode=)
79
- end
80
-
81
- def oauth_token
76
+ def access_token
82
77
  data['access_token'] || data['oauth_token'] if data.kind_of?(Hash)
83
78
  end
84
- def oauth_token= token
79
+
80
+ def access_token= token
85
81
  data['access_token'] = token if data.kind_of?(Hash)
86
82
  end
87
- alias_method :access_token , :oauth_token
88
- alias_method :access_token=, :oauth_token=
89
-
90
- def secret_oauth_token ; "#{app_id}|#{secret}" ; end
91
- alias_method :secret_access_token, :secret_oauth_token
92
83
 
84
+ def secret_access_token; "#{app_id}|#{secret}" ; end
93
85
  def accept ; headers['Accept'] ; end
94
86
  def accept= val; headers['Accept'] = val; end
95
87
  def lang ; headers['Accept-Language'] ; end
96
88
  def lang= val; headers['Accept-Language'] = val; end
97
89
 
98
- def authorized? ; !!oauth_token ; end
90
+ def authorized? ; !!access_token ; end
99
91
 
100
92
  def next_page hash, opts={}, &cb
101
93
  if hash['paging'].kind_of?(Hash) && hash['paging']['next']
@@ -140,7 +132,7 @@ module RestGraph::Client
140
132
  def parse_fbs! fbs
141
133
  self.data = check_sig_and_return_data(
142
134
  # take out facebook sometimes there but sometimes not quotes in cookies
143
- Rack::Utils.parse_query(fbs.to_s.sub(/^"/, '').sub(/"$/, '')))
135
+ Vendor.parse_query(fbs.to_s.sub(/^"/, '').sub(/"$/, '')))
144
136
  end
145
137
 
146
138
  def parse_json! json
@@ -178,8 +170,8 @@ module RestGraph::Client
178
170
 
179
171
  def authorize! opts={}
180
172
  query = {:client_id => app_id, :client_secret => secret}.merge(opts)
181
- self.data = Rack::Utils.parse_query(
182
- request({:auto_decode => false}.merge(opts),
173
+ self.data = Vendor.parse_query(
174
+ request({:json_decode => false}.merge(opts),
183
175
  [:get, url('oauth/access_token', query)]))
184
176
  end
185
177
 
@@ -224,8 +216,7 @@ module RestGraph::Client
224
216
  def build_env env={}
225
217
  super(env.inject({}){ |r, (k, v)|
226
218
  case k.to_s
227
- when 'auto_decode'; r['json_decode' ] = v
228
- when 'secret' ; r['oauth_token' ] = secret_oauth_token
219
+ when 'secret' ; r['access_token'] = secret_access_token
229
220
  when 'cache' ; r['cache.update'] = !!!v
230
221
  else ; r[k.to_s] = v
231
222
  end
@@ -259,4 +250,6 @@ module RestGraph::Client
259
250
  end
260
251
  end
261
252
 
262
- RestGraph.send(:include, RestGraph::Client)
253
+ RestCore::Facebook.send(:include, RestCore::Facebook::Client)
254
+ require 'rest-core/client/facebook/rails_util' if
255
+ Object.const_defined?(:Rails)
@@ -10,7 +10,7 @@ RestCore::Github = RestCore::Builder.client do
10
10
  use s::Oauth2Query , 'access_token', nil
11
11
 
12
12
  use s::CommonLogger , lambda{|obj|obj}
13
- use s::Cache , {}, 3600 do
13
+ use s::Cache , nil, 3600 do
14
14
  use s::ErrorHandler , lambda{|env| raise env[s::RESPONSE_BODY]['message']}
15
15
  use s::ErrorDetectorHttp
16
16
  use s::JsonDecode , true
@@ -1,4 +1,6 @@
1
1
 
2
+ require 'rest-core'
3
+
2
4
  RestCore::Linkedin = RestCore::Builder.client(:data) do
3
5
  s = self.class # this is only for ruby 1.8!
4
6
  use s::Timeout , 10
@@ -13,7 +15,7 @@ RestCore::Linkedin = RestCore::Builder.client(:data) do
13
15
 
14
16
  use s::CommonLogger , method(:puts)
15
17
 
16
- use s::Cache , {}, 3600 do
18
+ use s::Cache , nil, 3600 do
17
19
  use s::ErrorHandler , lambda{|env|
18
20
  if (body = env[s::RESPONSE_BODY]).kind_of?(Hash)
19
21
  raise body['message']
@@ -13,7 +13,7 @@ RestCore::Twitter = RestCore::Builder.client(:data) do
13
13
 
14
14
  use s::CommonLogger , method(:puts)
15
15
 
16
- use s::Cache , {}, 3600 do
16
+ use s::Cache , nil, 3600 do
17
17
  use s::ErrorHandler , lambda{ |env|
18
18
  if (body = env[s::RESPONSE_BODY]).kind_of?(Hash)
19
19
  raise body['error']
@@ -53,7 +53,7 @@ module RestCore::Twitter::Client
53
53
  {:status => status, 'media[]' => media},
54
54
  {}, opts)
55
55
  else
56
- post('1/statuses/update.json', {:status => status}, opts)
56
+ post('1/statuses/update.json', {:status => status}, {}, opts)
57
57
  end
58
58
  end
59
59
 
@@ -92,8 +92,8 @@ module RestCore::Client
92
92
  end
93
93
 
94
94
  # extra options:
95
- # auto_decode: Bool # decode with json or not in this API request
96
- # # default: auto_decode in rest-graph instance
95
+ # json_decode: Bool # decode with json or not in this API request
96
+ # # default: json_decode in rest-graph instance
97
97
  # timeout: Int # the timeout for this API request
98
98
  # # default: timeout in rest-graph instance
99
99
  # secret: Bool # use secret_acccess_token or not
@@ -1,18 +1,18 @@
1
1
 
2
- require 'rack'
2
+ require 'rest-core'
3
3
 
4
4
  module RestCore::ClientOauth1
5
5
  include RestCore
6
6
 
7
7
  def authorize_url!
8
- set_token(Rack::Utils.parse_query(
8
+ set_token(Vendor.parse_query(
9
9
  post(request_token_path, {}, {}, {:json_decode => false})))
10
10
 
11
11
  url(authorize_path, :oauth_token => oauth_token, :format => false)
12
12
  end
13
13
 
14
14
  def authorize! verifier
15
- set_token(Rack::Utils.parse_query(
15
+ set_token(Vendor.parse_query(
16
16
  post(access_token_path, {}, {}, {:verifier => verifier,
17
17
  :json_decode => false})))
18
18
  end
@@ -2,13 +2,13 @@
2
2
  require 'rest-core/middleware'
3
3
 
4
4
  class RestCore::Oauth2Query
5
- def self.members; [:oauth_token_name, :oauth_token]; end
5
+ def self.members; [:access_token]; end
6
6
  include RestCore::Middleware
7
7
 
8
8
  def call env
9
- local = if oauth_token(env)
9
+ local = if access_token(env)
10
10
  env.merge(REQUEST_QUERY =>
11
- {oauth_token_name(env) => oauth_token(env)}.
11
+ {'access_token' => access_token(env)}.
12
12
  merge(env[REQUEST_QUERY] || {}))
13
13
  else
14
14
  env
@@ -1,7 +1,5 @@
1
1
 
2
- require 'rubygems' if RUBY_VERSION < '1.9.2'
3
- require 'rack' if RUBY_VERSION < '1.9.2' # autoload broken in 1.8?
4
- require 'rest-core/client/rest-graph'
2
+ require 'rest-core/client/facebook'
5
3
 
6
4
  # need to require this before webmock in order to enable mocking in em-http
7
5
 
@@ -27,3 +25,9 @@ module TestHelper
27
25
  url.sub(/\?.+/){ |query| TestHelper.normalize_query(query) }
28
26
  end
29
27
  end
28
+
29
+ module Kernel
30
+ def eq? rhs
31
+ self == rhs
32
+ end
33
+ end
@@ -2,42 +2,47 @@
2
2
  require 'erb'
3
3
  require 'yaml'
4
4
 
5
- require 'rest-core'
6
-
5
+ module RestCore; end
7
6
  module RestCore::Config
8
7
  extend self
9
8
 
10
9
  DefaultModuleName = 'DefaultAttributes'
11
10
 
12
- def load_for_rails klass, app=Rails
11
+ def load_for_rails klass, namespace=nil, app=Rails
13
12
  root = File.expand_path(app.root)
14
13
  path = ["#{root}/config/rest-core.yaml", # YAML should use .yaml
15
14
  "#{root}/config/rest-core.yml" ].find{|p| File.exist?(p)}
16
- RestCore::Config.load(klass, path, app.env)
17
- end
18
-
19
- def load klass, path, env
20
- return false if klass.const_defined?(DefaultModuleName)
21
- RestCore::Config.load!(klass, path, env)
15
+ RestCore::Config.load(klass, path, app.env, namespace)
22
16
  end
23
17
 
24
- def load! klass, path, env
18
+ def load klass, path, env, namespace=nil
25
19
  config = YAML.load(ERB.new(File.read(path)).result(binding))
26
20
  defaults = config[env]
27
21
  return false unless defaults
28
- raise ArgumentError.new("#{defaults} is not a hash") unless
29
- defaults.kind_of?(Hash)
22
+ return false unless defaults[namespace] if namespace
23
+ data = if namespace
24
+ defaults[namespace]
25
+ else
26
+ defaults
27
+ end
28
+ raise ArgumentError.new("#{data} is not a hash") unless
29
+ data.kind_of?(Hash)
30
30
 
31
31
  mod = if klass.const_defined?(DefaultModuleName)
32
32
  klass.const_get(DefaultModuleName)
33
33
  else
34
- m = Module.new
35
- klass.send(:extend, m)
36
- klass.send(:const_set, DefaultModuleName, m)
37
- m
34
+ klass.send(:const_set, DefaultModuleName, Module.new)
38
35
  end
39
36
 
40
- mod.module_eval(defaults.inject([]){ |r, (k, v)|
37
+ singleton_class = if klass.respond_to?(:singleton_class)
38
+ klass.singleton_class
39
+ else
40
+ class << klass; self; end
41
+ end
42
+
43
+ klass.send(:extend, mod) unless singleton_class < mod
44
+
45
+ mod.module_eval(data.inject(["extend self\n"]){ |r, (k, v)|
41
46
  # quote strings, leave others free (e.g. false, numbers, etc)
42
47
  r << <<-RUBY
43
48
  def default_#{k}
@@ -0,0 +1,31 @@
1
+
2
+ module RestCore; end
3
+ module RestCore::Vendor
4
+ module_function
5
+ begin
6
+ require 'rack/utils'
7
+ def parse_query(qs, d = nil)
8
+ Rack::Utils.parse_query(qs, d)
9
+ end
10
+ rescue LoadError
11
+ # Stolen from Rack
12
+ def parse_query(qs, d = nil)
13
+ params = {}
14
+
15
+ (qs || '').split(d ? /[#{d}] */n : DEFAULT_SEP).each do |p|
16
+ k, v = p.split('=', 2).map { |x| unescape(x) }
17
+ if cur = params[k]
18
+ if cur.class == Array
19
+ params[k] << v
20
+ else
21
+ params[k] = [cur, v]
22
+ end
23
+ else
24
+ params[k] = v
25
+ end
26
+ end
27
+
28
+ return params
29
+ end
30
+ end
31
+ end
@@ -1,4 +1,4 @@
1
1
 
2
2
  module RestCore
3
- VERSION = '0.2.3'
3
+ VERSION = '0.3.0.pre.0'
4
4
  end
data/lib/rest-core.rb CHANGED
@@ -26,6 +26,8 @@ module RestCore
26
26
 
27
27
  # misc utilities
28
28
  autoload :Hmac , 'rest-core/util/hmac'
29
+ autoload :Config , 'rest-core/util/config'
30
+ autoload :Vendor , 'rest-core/util/vendor'
29
31
 
30
32
  # middlewares
31
33
  autoload :Cache , 'rest-core/middleware/cache'
@@ -50,4 +52,7 @@ module RestCore
50
52
  autoload :Github , 'rest-core/client/github'
51
53
  autoload :Twitter , 'rest-core/client/twitter'
52
54
  autoload :Linkedin , 'rest-core/client/linkedin'
55
+ autoload :Facebook , 'rest-core/client/facebook'
53
56
  end
57
+
58
+ RC = RestCore unless Object.const_defined?(:RC)
data/rest-core.gemspec CHANGED
@@ -1,123 +1,150 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  Gem::Specification.new do |s|
4
- s.name = %q{rest-core}
5
- s.version = "0.2.3"
4
+ s.name = "rest-core"
5
+ s.version = "0.3.0.pre.0"
6
6
 
7
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
7
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = [
9
- %q{Cardinal Blue},
10
- %q{Lin Jen-Shin (godfat)}]
11
- s.date = %q{2011-08-27}
12
- s.description = %q{A modular Ruby REST client collection/infrastructure.
13
-
14
- In this era of web services and mashups, we have seen a blooming of REST
15
- APIs. One might wonder, how do we use these APIs easily and elegantly?
16
- Since REST is very simple compared to SOAP, it is not hard to build a
17
- dedicated client ourselves.
18
-
19
- We have developed [rest-core][] with composable middlewares to build a
20
- REST client, based on the effort from [rest-graph][]. In the cases of
21
- common APIs such as Facebook, Github, and Twitter, developers can simply
22
- use the built-in dedicated clients provided by rest-core, or do it yourself
23
- for any other REST APIs.
24
-
25
- [rest-core]: http://github.com/cardinalblue/rest-core
26
- [rest-graph]: http://github.com/cardinalblue/rest-graph}
27
- s.email = [%q{dev (XD) cardinalblue.com}]
9
+ "Cardinal Blue",
10
+ "Lin Jen-Shin (godfat)"]
11
+ s.date = "2011-09-02"
12
+ s.description = "A modular Ruby REST client collection/infrastructure.\n\nIn this era of web services and mashups, we have seen a blooming of REST\nAPIs. One might wonder, how do we use these APIs easily and elegantly?\nSince REST is very simple compared to SOAP, it is not hard to build a\ndedicated client ourselves.\n\nWe have developed [rest-core][] with composable middlewares to build a\nREST client, based on the effort from [rest-graph][]. In the cases of\ncommon APIs such as Facebook, Github, and Twitter, developers can simply\nuse the built-in dedicated clients provided by rest-core, or do it yourself\nfor any other REST APIs.\n\n[rest-core]: http://github.com/cardinalblue/rest-core\n[rest-graph]: http://github.com/cardinalblue/rest-graph"
13
+ s.email = ["dev (XD) cardinalblue.com"]
28
14
  s.files = [
29
- %q{.gitignore},
30
- %q{.gitmodules},
31
- %q{.travis.yml},
32
- %q{CHANGES.md},
33
- %q{CONTRIBUTORS},
34
- %q{Gemfile},
35
- %q{LICENSE},
36
- %q{NOTE.md},
37
- %q{README.md},
38
- %q{Rakefile},
39
- %q{TODO.md},
40
- %q{example/facebook.rb},
41
- %q{example/github.rb},
42
- %q{example/linkedin.rb},
43
- %q{example/twitter.rb},
44
- %q{lib/rest-core.rb},
45
- %q{lib/rest-core/app/ask.rb},
46
- %q{lib/rest-core/app/rest-client.rb},
47
- %q{lib/rest-core/builder.rb},
48
- %q{lib/rest-core/client.rb},
49
- %q{lib/rest-core/client/github.rb},
50
- %q{lib/rest-core/client/linkedin.rb},
51
- %q{lib/rest-core/client/rest-graph.rb},
52
- %q{lib/rest-core/client/twitter.rb},
53
- %q{lib/rest-core/client_oauth1.rb},
54
- %q{lib/rest-core/event.rb},
55
- %q{lib/rest-core/middleware.rb},
56
- %q{lib/rest-core/middleware/cache.rb},
57
- %q{lib/rest-core/middleware/common_logger.rb},
58
- %q{lib/rest-core/middleware/default_headers.rb},
59
- %q{lib/rest-core/middleware/default_query.rb},
60
- %q{lib/rest-core/middleware/default_site.rb},
61
- %q{lib/rest-core/middleware/defaults.rb},
62
- %q{lib/rest-core/middleware/error_detector.rb},
63
- %q{lib/rest-core/middleware/error_detector_http.rb},
64
- %q{lib/rest-core/middleware/error_handler.rb},
65
- %q{lib/rest-core/middleware/json_decode.rb},
66
- %q{lib/rest-core/middleware/oauth1_header.rb},
67
- %q{lib/rest-core/middleware/oauth2_query.rb},
68
- %q{lib/rest-core/middleware/timeout.rb},
69
- %q{lib/rest-core/util/config.rb},
70
- %q{lib/rest-core/util/hmac.rb},
71
- %q{lib/rest-core/version.rb},
72
- %q{lib/rest-core/wrapper.rb},
73
- %q{pending/test_multi.rb},
74
- %q{pending/test_test_util.rb},
75
- %q{rest-core.gemspec},
76
- %q{task/.gitignore},
77
- %q{task/gemgem.rb},
78
- %q{test/common.rb},
79
- %q{test/config/rest-core.yaml},
80
- %q{test/test_api.rb},
81
- %q{test/test_cache.rb},
82
- %q{test/test_default.rb},
83
- %q{test/test_error.rb},
84
- %q{test/test_handler.rb},
85
- %q{test/test_load_config.rb},
86
- %q{test/test_misc.rb},
87
- %q{test/test_oauth.rb},
88
- %q{test/test_oauth1_header.rb},
89
- %q{test/test_old.rb},
90
- %q{test/test_page.rb},
91
- %q{test/test_parse.rb},
92
- %q{test/test_serialize.rb},
93
- %q{test/test_timeout.rb}]
94
- s.homepage = %q{https://github.com/cardinalblue/rest-core}
95
- s.require_paths = [%q{lib}]
96
- s.rubygems_version = %q{1.8.9}
97
- s.summary = %q{A modular Ruby REST client collection/infrastructure.}
15
+ ".gitignore",
16
+ ".gitmodules",
17
+ ".travis.yml",
18
+ "CHANGES.md",
19
+ "CONTRIBUTORS",
20
+ "Gemfile",
21
+ "LICENSE",
22
+ "NOTE.md",
23
+ "README.md",
24
+ "Rakefile",
25
+ "TODO.md",
26
+ "example/facebook.rb",
27
+ "example/github.rb",
28
+ "example/linkedin.rb",
29
+ "example/rails2/Gemfile",
30
+ "example/rails2/README",
31
+ "example/rails2/Rakefile",
32
+ "example/rails2/app/controllers/application_controller.rb",
33
+ "example/rails2/app/views/application/helper.html.erb",
34
+ "example/rails2/config/boot.rb",
35
+ "example/rails2/config/environment.rb",
36
+ "example/rails2/config/environments/development.rb",
37
+ "example/rails2/config/environments/production.rb",
38
+ "example/rails2/config/environments/test.rb",
39
+ "example/rails2/config/initializers/cookie_verification_secret.rb",
40
+ "example/rails2/config/initializers/new_rails_defaults.rb",
41
+ "example/rails2/config/initializers/session_store.rb",
42
+ "example/rails2/config/preinitializer.rb",
43
+ "example/rails2/config/rest-core.yaml",
44
+ "example/rails2/config/routes.rb",
45
+ "example/rails2/log",
46
+ "example/rails2/test/functional/application_controller_test.rb",
47
+ "example/rails2/test/test_helper.rb",
48
+ "example/rails2/test/unit/rails_util_test.rb",
49
+ "example/rails3/Gemfile",
50
+ "example/rails3/README",
51
+ "example/rails3/Rakefile",
52
+ "example/rails3/app/controllers/application_controller.rb",
53
+ "example/rails3/app/views/application/helper.html.erb",
54
+ "example/rails3/config.ru",
55
+ "example/rails3/config/application.rb",
56
+ "example/rails3/config/environment.rb",
57
+ "example/rails3/config/environments/development.rb",
58
+ "example/rails3/config/environments/production.rb",
59
+ "example/rails3/config/environments/test.rb",
60
+ "example/rails3/config/initializers/secret_token.rb",
61
+ "example/rails3/config/initializers/session_store.rb",
62
+ "example/rails3/config/rest-core.yaml",
63
+ "example/rails3/config/routes.rb",
64
+ "example/rails3/test/functional/application_controller_test.rb",
65
+ "example/rails3/test/test_helper.rb",
66
+ "example/rails3/test/unit/rails_util_test.rb",
67
+ "example/sinatra/config.ru",
68
+ "example/twitter.rb",
69
+ "lib/rest-core.rb",
70
+ "lib/rest-core/app/ask.rb",
71
+ "lib/rest-core/app/rest-client.rb",
72
+ "lib/rest-core/builder.rb",
73
+ "lib/rest-core/client.rb",
74
+ "lib/rest-core/client/facebook.rb",
75
+ "lib/rest-core/client/facebook/rails_util.rb",
76
+ "lib/rest-core/client/github.rb",
77
+ "lib/rest-core/client/linkedin.rb",
78
+ "lib/rest-core/client/twitter.rb",
79
+ "lib/rest-core/client_oauth1.rb",
80
+ "lib/rest-core/event.rb",
81
+ "lib/rest-core/middleware.rb",
82
+ "lib/rest-core/middleware/cache.rb",
83
+ "lib/rest-core/middleware/common_logger.rb",
84
+ "lib/rest-core/middleware/default_headers.rb",
85
+ "lib/rest-core/middleware/default_query.rb",
86
+ "lib/rest-core/middleware/default_site.rb",
87
+ "lib/rest-core/middleware/defaults.rb",
88
+ "lib/rest-core/middleware/error_detector.rb",
89
+ "lib/rest-core/middleware/error_detector_http.rb",
90
+ "lib/rest-core/middleware/error_handler.rb",
91
+ "lib/rest-core/middleware/json_decode.rb",
92
+ "lib/rest-core/middleware/oauth1_header.rb",
93
+ "lib/rest-core/middleware/oauth2_query.rb",
94
+ "lib/rest-core/middleware/timeout.rb",
95
+ "lib/rest-core/test.rb",
96
+ "lib/rest-core/util/config.rb",
97
+ "lib/rest-core/util/hmac.rb",
98
+ "lib/rest-core/util/vendor.rb",
99
+ "lib/rest-core/version.rb",
100
+ "lib/rest-core/wrapper.rb",
101
+ "pending/test_multi.rb",
102
+ "pending/test_test_util.rb",
103
+ "rest-core.gemspec",
104
+ "task/.gitignore",
105
+ "task/gemgem.rb",
106
+ "test/client/facebook/config/rest-core.yaml",
107
+ "test/client/facebook/test_api.rb",
108
+ "test/client/facebook/test_cache.rb",
109
+ "test/client/facebook/test_default.rb",
110
+ "test/client/facebook/test_error.rb",
111
+ "test/client/facebook/test_handler.rb",
112
+ "test/client/facebook/test_load_config.rb",
113
+ "test/client/facebook/test_misc.rb",
114
+ "test/client/facebook/test_oauth.rb",
115
+ "test/client/facebook/test_old.rb",
116
+ "test/client/facebook/test_page.rb",
117
+ "test/client/facebook/test_parse.rb",
118
+ "test/client/facebook/test_serialize.rb",
119
+ "test/client/facebook/test_timeout.rb",
120
+ "test/test_oauth1_header.rb"]
121
+ s.homepage = "https://github.com/cardinalblue/rest-core"
122
+ s.require_paths = ["lib"]
123
+ s.rubygems_version = "1.8.10"
124
+ s.summary = "A modular Ruby REST client collection/infrastructure."
98
125
  s.test_files = [
99
- %q{test/test_api.rb},
100
- %q{test/test_cache.rb},
101
- %q{test/test_default.rb},
102
- %q{test/test_error.rb},
103
- %q{test/test_handler.rb},
104
- %q{test/test_load_config.rb},
105
- %q{test/test_misc.rb},
106
- %q{test/test_oauth.rb},
107
- %q{test/test_oauth1_header.rb},
108
- %q{test/test_old.rb},
109
- %q{test/test_page.rb},
110
- %q{test/test_parse.rb},
111
- %q{test/test_serialize.rb},
112
- %q{test/test_timeout.rb}]
126
+ "test/client/facebook/test_api.rb",
127
+ "test/client/facebook/test_cache.rb",
128
+ "test/client/facebook/test_default.rb",
129
+ "test/client/facebook/test_error.rb",
130
+ "test/client/facebook/test_handler.rb",
131
+ "test/client/facebook/test_load_config.rb",
132
+ "test/client/facebook/test_misc.rb",
133
+ "test/client/facebook/test_oauth.rb",
134
+ "test/client/facebook/test_old.rb",
135
+ "test/client/facebook/test_page.rb",
136
+ "test/client/facebook/test_parse.rb",
137
+ "test/client/facebook/test_serialize.rb",
138
+ "test/client/facebook/test_timeout.rb",
139
+ "test/test_oauth1_header.rb"]
113
140
 
114
141
  if s.respond_to? :specification_version then
115
142
  s.specification_version = 3
116
143
 
117
144
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
118
145
  s.add_runtime_dependency(%q<rest-client>, [">= 0"])
119
- s.add_runtime_dependency(%q<rack>, [">= 0"])
120
146
  s.add_development_dependency(%q<yajl-ruby>, [">= 0"])
147
+ s.add_development_dependency(%q<rack>, [">= 0"])
121
148
  s.add_development_dependency(%q<json>, [">= 0"])
122
149
  s.add_development_dependency(%q<json_pure>, [">= 0"])
123
150
  s.add_development_dependency(%q<ruby-hmac>, [">= 0"])
@@ -127,8 +154,8 @@ for any other REST APIs.
127
154
  s.add_development_dependency(%q<rake>, [">= 0"])
128
155
  else
129
156
  s.add_dependency(%q<rest-client>, [">= 0"])
130
- s.add_dependency(%q<rack>, [">= 0"])
131
157
  s.add_dependency(%q<yajl-ruby>, [">= 0"])
158
+ s.add_dependency(%q<rack>, [">= 0"])
132
159
  s.add_dependency(%q<json>, [">= 0"])
133
160
  s.add_dependency(%q<json_pure>, [">= 0"])
134
161
  s.add_dependency(%q<ruby-hmac>, [">= 0"])
@@ -139,8 +166,8 @@ for any other REST APIs.
139
166
  end
140
167
  else
141
168
  s.add_dependency(%q<rest-client>, [">= 0"])
142
- s.add_dependency(%q<rack>, [">= 0"])
143
169
  s.add_dependency(%q<yajl-ruby>, [">= 0"])
170
+ s.add_dependency(%q<rack>, [">= 0"])
144
171
  s.add_dependency(%q<json>, [">= 0"])
145
172
  s.add_dependency(%q<json_pure>, [">= 0"])
146
173
  s.add_dependency(%q<ruby-hmac>, [">= 0"])
@@ -0,0 +1,8 @@
1
+
2
+ test:
3
+ facebook:
4
+ app_id: 41829
5
+ secret: <%= 'r41829'.reverse %>
6
+ json_decode: false
7
+ lang: zh-tw
8
+ auto_authorize_scope: 'publish_stream'