rest-core 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: 53be9b581bc7a4fcb1a7e1f1a42341c7298b9434
4
+ data.tar.gz: 75f8582f77c1fd69d12e1437f487f4785b49ed6d
5
+ !binary "U0hBNTEy":
6
+ metadata.gz: 164029833febdeb100e027761b780eadc937085193f8713340d48fe59975e30029c6a2a2651ea67073c400bcde86524b4cde8e445f802c1b43b820aea1c48c4b
7
+ data.tar.gz: 4a8d30cf61afbf17950ce3418b15791c9b948b12f14d3dc7915cf8dedad7239ed80f3cec91dbc8d5192d48149c35f2471bacbb68a7a0a4fc28d71a5b67db91c7
@@ -6,5 +6,6 @@ env:
6
6
 
7
7
  rvm:
8
8
  - 1.9.3
9
+ - 2.0.0
9
10
  - rbx-head
10
11
  - jruby-head
data/CHANGES.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # CHANGES
2
2
 
3
+ ## rest-core 2.0.3 -- 2013-04-01
4
+
5
+ * Use `URI.escape(string, UNRESERVED)` for URI escaping instead of
6
+ `CGI.escape`
7
+
8
+ * [`Defaults`] Use `respond_to_missing?` instead of `respond_to?`
9
+
3
10
  ## rest-core 2.0.2 -- 2013-02-07
4
11
 
5
12
  ### Bugs fixes
@@ -68,12 +68,8 @@ module RestCore::ClientOauth1
68
68
 
69
69
  def calculate_sig hash=data
70
70
  base = hash.reject{ |(k, _)| k == 'sig' }.sort.map{ |(k, v)|
71
- "#{escape(k.to_s)}=#{escape(v.to_s)}"
71
+ "#{Middleware.escape(k.to_s)}=#{Middleware.escape(v.to_s)}"
72
72
  }.join('&')
73
- Digest::MD5.hexdigest("#{escape(consumer_secret)}&#{base}")
74
- end
75
-
76
- def escape string
77
- CGI.escape(string).gsub('+', '%20')
73
+ Digest::MD5.hexdigest("#{Middleware.escape(consumer_secret)}&#{base}")
78
74
  end
79
75
  end
@@ -1,7 +1,7 @@
1
1
 
2
2
  require 'rest-core'
3
3
 
4
- require 'cgi'
4
+ require 'uri'
5
5
 
6
6
  module RestCore::Middleware
7
7
  include RestCore
@@ -60,11 +60,17 @@ module RestCore::Middleware
60
60
  q = if env[REQUEST_PATH] =~ /\?/ then '&' else '?' end
61
61
  "#{env[REQUEST_PATH]}#{q}" \
62
62
  "#{query.sort.map{ |(k, v)|
63
- "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}" }.join('&')}"
63
+ "#{escape(k.to_s)}=#{escape(v.to_s)}" }.join('&')}"
64
64
  end
65
65
  end
66
66
  public :request_uri
67
67
 
68
+ UNRESERVED = /[^a-zA-Z0-9\-\.\_\~]/
69
+ def escape string
70
+ URI.escape(string, UNRESERVED)
71
+ end
72
+ public :escape
73
+
68
74
  def string_keys hash
69
75
  hash.inject({}){ |r, (k, v)|
70
76
  if v.kind_of?(Hash)
@@ -30,7 +30,7 @@ class RestCore::Defaults
30
30
  end
31
31
  end
32
32
 
33
- def respond_to? msg
33
+ def respond_to_missing? msg, include_private=false
34
34
  # since psych would call respond_to? before setting up
35
35
  # instance variables when restoring ruby objects, we might
36
36
  # be accessing undefined ivars in that case even all ivars are
@@ -6,8 +6,6 @@ require 'uri'
6
6
  require 'openssl'
7
7
 
8
8
  class RestCore::Oauth1Header
9
- UNRESERVED = /[^a-zA-Z0-9\-\.\_\~]/
10
-
11
9
  def self.members
12
10
  [:request_token_path, :access_token_path, :authorize_path,
13
11
  :consumer_key, :consumer_secret,
@@ -107,8 +105,4 @@ class RestCore::Oauth1Header
107
105
  v.respond_to?(:empty) &&
108
106
  v.strip.empty? == true) }
109
107
  end
110
-
111
- def escape string
112
- URI.escape(string, UNRESERVED)
113
- end
114
108
  end
@@ -1,4 +1,4 @@
1
1
 
2
2
  module RestCore
3
- VERSION = '2.0.2'
3
+ VERSION = '2.0.3'
4
4
  end
@@ -2,13 +2,13 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rest-core"
5
- s.version = "2.0.2"
5
+ s.version = "2.0.3"
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 = "2013-02-07"
11
+ s.date = "2013-04-01"
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-more]: https://github.com/cardinalblue/rest-more"
13
13
  s.email = ["dev (XD) cardinalblue.com"]
14
14
  s.files = [
@@ -94,7 +94,7 @@ Gem::Specification.new do |s|
94
94
  "test/test_wrapper.rb"]
95
95
  s.homepage = "https://github.com/cardinalblue/rest-core"
96
96
  s.require_paths = ["lib"]
97
- s.rubygems_version = "1.8.23"
97
+ s.rubygems_version = "2.0.0"
98
98
  s.summary = "Modular Ruby clients interface for REST APIs"
99
99
  s.test_files = [
100
100
  "test/test_auth_basic.rb",
@@ -118,7 +118,7 @@ Gem::Specification.new do |s|
118
118
  "test/test_wrapper.rb"]
119
119
 
120
120
  if s.respond_to? :specification_version then
121
- s.specification_version = 3
121
+ s.specification_version = 4
122
122
 
123
123
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
124
124
  s.add_runtime_dependency(%q<rest-client>, [">= 0"])
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
5
- prerelease:
4
+ version: 2.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Cardinal Blue
@@ -10,12 +9,11 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-02-07 00:00:00.000000000 Z
12
+ date: 2013-04-01 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rest-client
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
18
  - - ! '>='
21
19
  - !ruby/object:Gem::Version
@@ -23,7 +21,6 @@ dependencies:
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
25
  - - ! '>='
29
26
  - !ruby/object:Gem::Version
@@ -133,27 +130,26 @@ files:
133
130
  - test/test_wrapper.rb
134
131
  homepage: https://github.com/cardinalblue/rest-core
135
132
  licenses: []
133
+ metadata: {}
136
134
  post_install_message:
137
135
  rdoc_options: []
138
136
  require_paths:
139
137
  - lib
140
138
  required_ruby_version: !ruby/object:Gem::Requirement
141
- none: false
142
139
  requirements:
143
140
  - - ! '>='
144
141
  - !ruby/object:Gem::Version
145
142
  version: '0'
146
143
  required_rubygems_version: !ruby/object:Gem::Requirement
147
- none: false
148
144
  requirements:
149
145
  - - ! '>='
150
146
  - !ruby/object:Gem::Version
151
147
  version: '0'
152
148
  requirements: []
153
149
  rubyforge_project:
154
- rubygems_version: 1.8.23
150
+ rubygems_version: 2.0.0
155
151
  signing_key:
156
- specification_version: 3
152
+ specification_version: 4
157
153
  summary: Modular Ruby clients interface for REST APIs
158
154
  test_files:
159
155
  - test/test_auth_basic.rb