rest-core 0.7.0 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -4,5 +4,6 @@ rvm:
4
4
  - 1.8.7
5
5
  - 1.9.2
6
6
  - 1.9.3
7
- - rbx
7
+ - rbx-18mode
8
+ - rbx-19mode
8
9
  - jruby
data/CHANGES.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # CHANGES
2
2
 
3
+ ## rest-core 0.7.2 -- 2011-11-04
4
+
5
+ * Moved rib-rest-core to [rest-more][]
6
+ * Moved `RestCore::Config` to [rest-more][]
7
+ * Renamed `RestCore::Vendor` to `RestCore::ParseQuery`
8
+
3
9
  ## rest-core 0.7.0 -- 2011-10-08
4
10
 
5
11
  ### IMPORTANT CHANGE!
data/README.md CHANGED
@@ -70,21 +70,6 @@ and [slides][] from [rubyconf.tw/2011][rubyconf.tw] for concepts.
70
70
  [rubyconf.tw]: http://rubyconf.tw/2011/#6
71
71
  [slides]: http://www.godfat.org/slide/2011-08-27-rest-core.html
72
72
 
73
- ## A simple interactive shell with [rib][]:
74
-
75
- You need to install [rib][] in order to try this interactive shell:
76
-
77
- gem install rib
78
-
79
- Then you can try this by running `rib rest-core`:
80
-
81
- rest-core>> self.site = 'https://api.github.com/users/'
82
- rest-core>> get 'cardinalblue', {}, :json_decode => true
83
-
84
- Which is using `RestCore::Universal` for accessing arbitrary websites.
85
-
86
- [rib]: https://github.com/godfat/rib
87
-
88
73
  ## rest-core users:
89
74
 
90
75
  * [topcoder](https://github.com/miaout17/topcoder)
data/lib/rest-core.rb CHANGED
@@ -27,8 +27,7 @@ module RestCore
27
27
 
28
28
  # misc utilities
29
29
  autoload :Hmac , 'rest-core/util/hmac'
30
- autoload :Config , 'rest-core/util/config'
31
- autoload :Vendor , 'rest-core/util/vendor'
30
+ autoload :ParseQuery , 'rest-core/util/parse_query'
32
31
 
33
32
  # middlewares
34
33
  autoload :Bypass , 'rest-core/middleware/bypass'
@@ -5,14 +5,14 @@ module RestCore::ClientOauth1
5
5
  include RestCore
6
6
 
7
7
  def authorize_url!
8
- set_token(Vendor.parse_query(
8
+ set_token(ParseQuery.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(Vendor.parse_query(
15
+ set_token(ParseQuery.parse_query(
16
16
  post(access_token_path, {}, {}, {:verifier => verifier,
17
17
  :json_decode => false})))
18
18
  end
@@ -1,6 +1,6 @@
1
1
 
2
2
  module RestCore; end
3
- module RestCore::Vendor
3
+ module RestCore::ParseQuery
4
4
  module_function
5
5
  begin
6
6
  require 'rack/utils'
@@ -1,4 +1,4 @@
1
1
 
2
2
  module RestCore
3
- VERSION = '0.7.0'
3
+ VERSION = '0.7.2'
4
4
  end
data/rest-core.gemspec CHANGED
@@ -2,16 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rest-core"
5
- s.version = "0.7.0"
5
+ s.version = "0.7.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = [
9
9
  "Cardinal Blue",
10
10
  "Lin Jen-Shin (godfat)"]
11
- s.date = "2011-10-08"
11
+ s.date = "2011-11-04"
12
12
  s.description = "Modular Ruby clients interface for REST APIs\n\nThere has been an explosion in the number of REST APIs available today.\nTo address the need for a way to access these APIs easily and elegantly,\nwe have developed [rest-core][], which consists of composable middleware\nthat allows you to build a REST client for any REST API. Or in the case of\ncommon APIs such as Facebook, Github, and Twitter, you can simply use the\ndedicated clients provided by [rest-more][].\n\n[rest-core]: http://github.com/cardinalblue/rest-core\n[rest-more]: http://github.com/cardinalblue/rest-more"
13
13
  s.email = ["dev (XD) cardinalblue.com"]
14
- s.executables = ["rib-rest-core"]
15
14
  s.files = [
16
15
  ".gitignore",
17
16
  ".gitmodules",
@@ -24,7 +23,6 @@ Gem::Specification.new do |s|
24
23
  "README.md",
25
24
  "Rakefile",
26
25
  "TODO.md",
27
- "bin/rib-rest-core",
28
26
  "example/facebook.rb",
29
27
  "example/github.rb",
30
28
  "example/linkedin.rb",
@@ -56,13 +54,10 @@ Gem::Specification.new do |s|
56
54
  "lib/rest-core/middleware/oauth2_query.rb",
57
55
  "lib/rest-core/middleware/timeout.rb",
58
56
  "lib/rest-core/test.rb",
59
- "lib/rest-core/util/config.rb",
60
57
  "lib/rest-core/util/hmac.rb",
61
- "lib/rest-core/util/rails_util_util.rb",
62
- "lib/rest-core/util/vendor.rb",
58
+ "lib/rest-core/util/parse_query.rb",
63
59
  "lib/rest-core/version.rb",
64
60
  "lib/rest-core/wrapper.rb",
65
- "lib/rib/app/rest-core.rb",
66
61
  "pending/test_multi.rb",
67
62
  "pending/test_test_util.rb",
68
63
  "rest-core.gemspec",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-10-08 00:00:00.000000000Z
13
+ date: 2011-11-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rest-client
17
- requirement: &2156421740 !ruby/object:Gem::Requirement
17
+ requirement: &2153817700 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2156421740
25
+ version_requirements: *2153817700
26
26
  description: ! 'Modular Ruby clients interface for REST APIs
27
27
 
28
28
 
@@ -44,8 +44,7 @@ description: ! 'Modular Ruby clients interface for REST APIs
44
44
  [rest-more]: http://github.com/cardinalblue/rest-more'
45
45
  email:
46
46
  - dev (XD) cardinalblue.com
47
- executables:
48
- - rib-rest-core
47
+ executables: []
49
48
  extensions: []
50
49
  extra_rdoc_files: []
51
50
  files:
@@ -60,7 +59,6 @@ files:
60
59
  - README.md
61
60
  - Rakefile
62
61
  - TODO.md
63
- - bin/rib-rest-core
64
62
  - example/facebook.rb
65
63
  - example/github.rb
66
64
  - example/linkedin.rb
@@ -92,13 +90,10 @@ files:
92
90
  - lib/rest-core/middleware/oauth2_query.rb
93
91
  - lib/rest-core/middleware/timeout.rb
94
92
  - lib/rest-core/test.rb
95
- - lib/rest-core/util/config.rb
96
93
  - lib/rest-core/util/hmac.rb
97
- - lib/rest-core/util/rails_util_util.rb
98
- - lib/rest-core/util/vendor.rb
94
+ - lib/rest-core/util/parse_query.rb
99
95
  - lib/rest-core/version.rb
100
96
  - lib/rest-core/wrapper.rb
101
- - lib/rib/app/rest-core.rb
102
97
  - pending/test_multi.rb
103
98
  - pending/test_test_util.rb
104
99
  - rest-core.gemspec
data/bin/rib-rest-core DELETED
@@ -1,22 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- begin
4
- require 'rib/runner'
5
- # create the shell before app to prvent your bundler (if any) kicks in
6
- Rib.shell
7
- # we need to require anything before loading the app,
8
- # and both `rib auto` (true) and `rib-auto` (nil) should work
9
- require 'rib/core' if Rib.config.delete(:mimic_irb) != false
10
- require 'rib/app/rest-core'
11
- # load the app
12
- Rib::RestCore.load
13
- Rib::Runner.run(ARGV)
14
- rescue LoadError => e
15
- abort("Error: #{e}\n" \
16
- "Please install rib to use interactive rest-core:\n\n" \
17
- " gem install rib\n\n" \
18
- "Or add rib or rest-core to Gemfile if that's the case")
19
- end
20
-
21
- __END__
22
- Run as interactive rest-core client
@@ -1,55 +0,0 @@
1
-
2
- require 'erb'
3
- require 'yaml'
4
-
5
- module RestCore; end
6
- module RestCore::Config
7
- extend self
8
-
9
- DefaultModuleName = 'DefaultAttributes'
10
-
11
- def load_for_rails klass, namespace=nil, app=Rails
12
- root = File.expand_path(app.root)
13
- path = ["#{root}/config/rest-core.yaml", # YAML should use .yaml
14
- "#{root}/config/rest-core.yml" ].find{|p| File.exist?(p)}
15
- return if path.nil?
16
- RestCore::Config.load(klass, path, app.env, namespace)
17
- end
18
-
19
- def load klass, path, env, namespace=nil
20
- config = YAML.load(ERB.new(File.read(path)).result(binding))
21
- defaults = config[env]
22
- return false unless defaults
23
- return false unless defaults[namespace] if namespace
24
- data = if namespace
25
- defaults[namespace]
26
- else
27
- defaults
28
- end
29
- raise ArgumentError.new("#{data} is not a hash") unless
30
- data.kind_of?(Hash)
31
-
32
- mod = if klass.const_defined?(DefaultModuleName)
33
- klass.const_get(DefaultModuleName)
34
- else
35
- klass.send(:const_set, DefaultModuleName, Module.new)
36
- end
37
-
38
- singleton_class = if klass.respond_to?(:singleton_class)
39
- klass.singleton_class
40
- else
41
- class << klass; self; end
42
- end
43
-
44
- klass.send(:extend, mod) unless singleton_class < mod
45
-
46
- mod.module_eval(data.inject(["extend self\n"]){ |r, (k, v)|
47
- # quote strings, leave others free (e.g. false, numbers, etc)
48
- r << <<-RUBY
49
- def default_#{k}
50
- #{v.kind_of?(String) ? "'#{v}'" : v}
51
- end
52
- RUBY
53
- }.join, __FILE__, __LINE__)
54
- end
55
- end
@@ -1,19 +0,0 @@
1
-
2
- module RestCore; end
3
- module RestCore::RailsUtilUtil
4
- module Cache
5
- def [] key ; read(key) ; end
6
- def []= key, value; write(key, value) ; end
7
- def store key, value,
8
- options={}; write(key, value, options); end
9
- end
10
-
11
- module_function
12
- def extract_options members, options, method
13
- # Hash[] is for ruby 1.8.7
14
- # map(&:to_sym) is for ruby 1.8.7
15
- Hash[options.send(method){ |(k, v)| members.map(&:to_sym).member?(k) }]
16
- end
17
- end
18
-
19
- ActiveSupport::Cache::Store.send(:include, RestCore::RailsUtilUtil::Cache)
@@ -1,15 +0,0 @@
1
-
2
- require 'rest-core'
3
-
4
- module Rib; end
5
- module Rib::RestCore
6
- Rib::Shell.use(self)
7
- def self.load
8
- Rib.shell.config[:binding] =
9
- ::RestCore::Universal.new.instance_eval{binding}
10
- end
11
-
12
- def prompt
13
- "rest-core#{super}"
14
- end
15
- end