doze 0.0.12 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/lib/doze/utils.rb +23 -18
  3. data/lib/doze/version.rb +1 -1
  4. metadata +56 -73
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3f81a7523454cf5b74c57db02eb075ae853029a0
4
+ data.tar.gz: 7f6402fd58578c236f1cec410a9858736de6928b
5
+ SHA512:
6
+ metadata.gz: af9ecf34ddfd51992ef8517d9abe89e80a703506a3d495dcb84f0aad5c6e53df7d69619099ce6502beab0f19c687b2c050a6cadd75c540ad13f02728bca9a9d2
7
+ data.tar.gz: f4f6daf01c822194a02be0b10718e598390ecd60a83592cc556c83fd1f1f71464b56b38e09c9238754c6ba0aaaa710e4c980784ad86420f4fb446d2d9c3922d7
data/lib/doze/utils.rb CHANGED
@@ -1,12 +1,10 @@
1
- # Various stateless utility functions which aid the conversion back and forth between HTTP syntax and the more abstracted ruby representations we use.
1
+ # Various stateless utility functions which aid the conversion back and forth
2
+ # between HTTP syntax and the more abstracted ruby representations we use.
2
3
  module Doze::Utils
3
- # Strictly this is a WebDAV extension but very useful in the wider HTTP context
4
- # see http://tools.ietf.org/html/rfc4918#section-11.2
5
- Rack::Utils::HTTP_STATUS_CODES[422] = 'Unprocessable entity'
6
-
7
- Rack::Utils::HTTP_STATUS_CODES.each do |code,text|
8
- const_set('STATUS_' << text.upcase.gsub(/[^A-Z]+/, '_'), code)
9
- end
4
+ Rack::Utils::HTTP_STATUS_CODES.reject { |_, text| text == 'Unassigned' }.
5
+ each do |code, text|
6
+ const_set('STATUS_' << text.upcase.gsub(/[^A-Z]+/, '_'), code)
7
+ end
10
8
 
11
9
  URI_SCHEMES = Hash.new(URI::Generic).merge!(
12
10
  'http' => URI::HTTP,
@@ -25,29 +23,36 @@ module Doze::Utils
25
23
  '"' << str.gsub(/[\\\"]/o, "\\\1") << '"'
26
24
  end
27
25
 
28
- # Note: unescape and escape proved bottlenecks in URI template matching and URI template generation which in turn
29
- # were bottlenecks for serving some simple requests and for generating URIs to use for cache lookups.
30
- # So perhaps a bit micro-optimised here, but there was a reason :)
26
+ # Note: unescape and escape proved bottlenecks in URI template matching and
27
+ # URI template generation which in turn were bottlenecks for serving some
28
+ # simple requests and for generating URIs to use for cache lookups. So
29
+ # perhaps a bit micro-optimised here, but there was a reason :)
31
30
 
32
31
  # Rack::Utils.unescape, but without turning '+' into ' '
33
32
  # Also must be passed a string.
34
33
  def unescape(s)
35
- s.gsub(/((?:%[0-9a-fA-F]{2})+)/n) {[$1.delete('%')].pack('H*')}
34
+ s.gsub(/((?:%[0-9a-fA-F]{2})+)/n) { [$1.delete('%')].pack('H*') }
36
35
  end
37
36
 
38
- # Rack::Utils.escape, but turning ' ' into '%20' rather than '+' (which is not a necessary part of the URI spec) to save an extra call to tr.
39
- # Also must be passed a string.
40
- # Also avoids an extra call to 1.8/1.9 compatibility wrapper for bytesize/size.
37
+ # Rack::Utils.escape, but turning ' ' into '%20' rather than '+' (which is
38
+ # not a necessary part of the URI spec) to save an extra call to tr. Also
39
+ # must be passed a string. Also avoids an extra call to 1.8/1.9
40
+ # compatibility wrapper for bytesize/size.
41
41
  if ''.respond_to?(:bytesize)
42
42
  def escape(s)
43
- s.gsub(/([^a-zA-Z0-9_.-]+)/n) {'%'+$1.unpack('H2'*$1.bytesize).join('%').upcase}
43
+ s.gsub(/([^a-zA-Z0-9_.-]+)/n) do
44
+ '%' + $1.unpack('H2' * $1.bytesize).join('%').upcase
45
+ end
44
46
  end
45
47
  else
46
48
  def escape(s)
47
- s.gsub(/([^a-zA-Z0-9_.-]+)/n) {'%'+$1.unpack('H2'*$1.size).join('%').upcase}
49
+ s.gsub(/([^a-zA-Z0-9_.-]+)/n) do
50
+ '%' + $1.unpack('H2' * $1.size).join('%').upcase
51
+ end
48
52
  end
49
53
  end
50
54
 
51
- # So utility functions are accessible as Doze::Utils.foo as well as via including the module
55
+ # So utility functions are accessible as Doze::Utils.foo as well as via
56
+ # including the module
52
57
  extend self
53
58
  end
data/lib/doze/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Doze
2
- VERSION = '0.0.12'
2
+ VERSION = '0.0.13'
3
3
  end
metadata CHANGED
@@ -1,118 +1,102 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doze
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
5
- prerelease:
4
+ version: 0.0.13
6
5
  platform: ruby
7
6
  authors:
8
7
  - Matthew Willson
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-10-18 00:00:00.000000000 Z
11
+ date: 2014-04-23 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rack-test
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: mocha
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rdoc
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rack
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ~>
73
+ - - "~>"
84
74
  - !ruby/object:Gem::Version
85
75
  version: '1.0'
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ~>
80
+ - - "~>"
92
81
  - !ruby/object:Gem::Version
93
82
  version: '1.0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: json
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - ">="
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - ">="
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
- description: ! 'Library for building restful APIs, with hierarchical routing, content
111
- type
112
-
97
+ description: |
98
+ Library for building restful APIs, with hierarchical routing, content type
113
99
  handling and other RESTful stuff
114
-
115
- '
116
100
  email:
117
101
  - matthew@playlouder.com
118
102
  executables: []
@@ -120,84 +104,83 @@ extensions: []
120
104
  extra_rdoc_files:
121
105
  - README.md
122
106
  files:
107
+ - README.md
123
108
  - lib/doze.rb
109
+ - lib/doze/application.rb
110
+ - lib/doze/collection/object.rb
111
+ - lib/doze/entity.rb
124
112
  - lib/doze/error.rb
125
- - lib/doze/uri_template.rb
126
- - lib/doze/responder.rb
127
- - lib/doze/version.rb
128
- - lib/doze/response.rb
129
113
  - lib/doze/media_type.rb
130
114
  - lib/doze/negotiator.rb
131
- - lib/doze/collection/object.rb
132
- - lib/doze/utils.rb
115
+ - lib/doze/page.rb
133
116
  - lib/doze/request.rb
117
+ - lib/doze/resource.rb
134
118
  - lib/doze/resource/error.rb
135
119
  - lib/doze/resource/proxy.rb
136
- - lib/doze/router/route_set.rb
120
+ - lib/doze/responder.rb
121
+ - lib/doze/responder/error.rb
122
+ - lib/doze/responder/main.rb
123
+ - lib/doze/responder/resource.rb
124
+ - lib/doze/response.rb
125
+ - lib/doze/router.rb
137
126
  - lib/doze/router/anchored_route_set.rb
138
127
  - lib/doze/router/route.rb
139
- - lib/doze/serialization/json.rb
128
+ - lib/doze/router/route_set.rb
129
+ - lib/doze/serialization/entity.rb
130
+ - lib/doze/serialization/form_data_helpers.rb
140
131
  - lib/doze/serialization/html.rb
132
+ - lib/doze/serialization/json.rb
141
133
  - lib/doze/serialization/multipart_form_data.rb
142
- - lib/doze/serialization/yaml.rb
143
- - lib/doze/serialization/www_form_encoded.rb
144
- - lib/doze/serialization/form_data_helpers.rb
145
- - lib/doze/serialization/resource_proxy.rb
146
- - lib/doze/serialization/entity.rb
147
134
  - lib/doze/serialization/resource.rb
148
- - lib/doze/entity.rb
149
- - lib/doze/responder/error.rb
150
- - lib/doze/responder/main.rb
151
- - lib/doze/responder/resource.rb
152
- - lib/doze/page.rb
153
- - lib/doze/resource.rb
154
- - lib/doze/application.rb
155
- - lib/doze/router.rb
156
- - README.md
157
- - test/functional/resource_representation_test.rb
158
- - test/functional/method_support_test.rb
159
- - test/functional/router_test.rb
160
- - test/functional/direct_response_test.rb
161
- - test/functional/error_handling_test.rb
162
- - test/functional/precondition_test.rb
135
+ - lib/doze/serialization/resource_proxy.rb
136
+ - lib/doze/serialization/www_form_encoded.rb
137
+ - lib/doze/serialization/yaml.rb
138
+ - lib/doze/uri_template.rb
139
+ - lib/doze/utils.rb
140
+ - lib/doze/version.rb
163
141
  - test/functional/auth_test.rb
164
- - test/functional/raw_path_info_test.rb
165
142
  - test/functional/base.rb
166
143
  - test/functional/cache_header_test.rb
167
- - test/functional/uri_template_test.rb
144
+ - test/functional/direct_response_test.rb
145
+ - test/functional/error_handling_test.rb
146
+ - test/functional/get_and_conneg_test.rb
168
147
  - test/functional/media_type_extensions_test.rb
148
+ - test/functional/media_type_test.rb
149
+ - test/functional/method_support_test.rb
169
150
  - test/functional/non_get_method_test.rb
170
- - test/functional/get_and_conneg_test.rb
151
+ - test/functional/precondition_test.rb
152
+ - test/functional/raw_path_info_test.rb
153
+ - test/functional/resource_representation_test.rb
154
+ - test/functional/router_test.rb
171
155
  - test/functional/serialization_test.rb
172
- - test/functional/media_type_test.rb
156
+ - test/functional/uri_template_test.rb
173
157
  homepage: https://github.com/mjwillson/doze
174
158
  licenses: []
159
+ metadata: {}
175
160
  post_install_message:
176
161
  rdoc_options:
177
- - --title
162
+ - "--title"
178
163
  - Doze
179
- - --main
164
+ - "--main"
180
165
  - README.md
181
- - --line-numbers
166
+ - "--line-numbers"
182
167
  require_paths:
183
168
  - lib
184
169
  required_ruby_version: !ruby/object:Gem::Requirement
185
- none: false
186
170
  requirements:
187
- - - ! '>='
171
+ - - ">="
188
172
  - !ruby/object:Gem::Version
189
173
  version: '0'
190
174
  required_rubygems_version: !ruby/object:Gem::Requirement
191
- none: false
192
175
  requirements:
193
- - - ! '>='
176
+ - - ">="
194
177
  - !ruby/object:Gem::Version
195
178
  version: '0'
196
179
  requirements: []
197
180
  rubyforge_project:
198
- rubygems_version: 1.8.23
181
+ rubygems_version: 2.2.2
199
182
  signing_key:
200
- specification_version: 3
183
+ specification_version: 4
201
184
  summary: RESTful resource-oriented API framework
202
185
  test_files:
203
186
  - test/functional/resource_representation_test.rb