clientura 0.0.6

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.
@@ -0,0 +1,123 @@
1
+ class TestServer < Sinatra::Base
2
+ register Sinatra::Namespace
3
+
4
+ get '/' do
5
+ json data: 'root'
6
+ end
7
+
8
+ get '/res' do
9
+ json data: 'resource'
10
+ end
11
+
12
+ get '/name' do
13
+ json data: 'name'
14
+ end
15
+
16
+ get '/echo_argument/:argument' do
17
+ json data: params[:argument]
18
+ end
19
+
20
+ get '/echo_header' do
21
+ json data: env['HTTP_TOKEN']
22
+ end
23
+
24
+ get '/echo_param' do
25
+ json data: params['param']
26
+ end
27
+
28
+ post '/data' do
29
+ json data: JSON.parse(request.body.read)['json_data']
30
+ end
31
+
32
+ seed = rand 50..100
33
+ left = rand 50
34
+ right = seed - left
35
+
36
+ get '/left_operand' do
37
+ json data: params['key'] == 'Secret' ? left : nil
38
+ end
39
+
40
+ get '/right_operand' do
41
+ json data: params['key'] == 'Secret' ? right : nil
42
+ end
43
+
44
+ post '/sum' do
45
+ sum = JSON.parse(request.body.read)['sum']
46
+ json data: seed == sum
47
+ end
48
+
49
+ get '/comments/:id' do
50
+ json data: {
51
+ '1' => { 'id' => '1', 'user_id' => '2', 'tag_id' => '3' }
52
+ }[params[:id]]
53
+ end
54
+
55
+ get '/users/:id' do
56
+ json data: { '2' => { 'id' => '2' } }[params[:id]]
57
+ end
58
+
59
+ get '/tags/:id' do
60
+ json data: { '3' => { 'id' => '3' } }[params[:id]]
61
+ end
62
+
63
+ namespace '/real_world' do
64
+ get { 200 }
65
+
66
+ get '/some' do
67
+ 'get'
68
+ end
69
+
70
+ post '/some' do
71
+ 'post'
72
+ end
73
+
74
+ patch '/some' do
75
+ 'patch'
76
+ end
77
+
78
+ put '/some' do
79
+ 'put'
80
+ end
81
+
82
+ delete '/some' do
83
+ 'delete'
84
+ end
85
+
86
+ get '/pass_token' do
87
+ env['HTTP_AUTHTOKEN'] == 'Secret' ? 200 : 403
88
+ end
89
+
90
+ get '/parse_response' do
91
+ json data: 'Awesome!'
92
+ end
93
+
94
+ get '/pass_query_string' do
95
+ params[:echo]
96
+ end
97
+
98
+ get '/get_answer_header' do
99
+ headers 'Answer' => 'Awesome!'
100
+ end
101
+
102
+ get '/namespace/namespaced' do
103
+ 200
104
+ end
105
+
106
+ get '/comments/:id' do
107
+ json data: {
108
+ '1' => { 'id' => '1',
109
+ 'body' => 'Awesome!',
110
+ 'user_id' => '2',
111
+ 'attachment_ids' => ['3'] }
112
+ }[params[:id]]
113
+ end
114
+
115
+ get '/users/:id' do
116
+ json data: { '2' => { 'id' => '2', 'name' => 'Me' } }[params[:id]]
117
+ end
118
+
119
+ get '/attachments/:id' do
120
+ json data: { '3' => { 'id' => '3', 'type' => 'image' } }[params[:id]]
121
+ end
122
+ end
123
+ end
metadata ADDED
@@ -0,0 +1,309 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: clientura
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.6
5
+ platform: ruby
6
+ authors:
7
+ - Vlad Shmyhlo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-03-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: http
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: concurrent-ruby
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: concurrent-ruby-edge
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.2'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: concurrent-ruby-ext
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: activesupport
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '4.0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '4.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rdoc
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: bundler
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: jeweler
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: simplecov
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rubocop
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: pry
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: sinatra
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: sinatra-contrib
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: rack
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ - !ruby/object:Gem::Dependency
224
+ name: thin
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
237
+ - !ruby/object:Gem::Dependency
238
+ name: codeclimate-test-reporter
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - ">="
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ version: '0'
251
+ description: DSL for defining HTTP clients
252
+ email: aion.stu@gmail.com
253
+ executables: []
254
+ extensions: []
255
+ extra_rdoc_files:
256
+ - LICENSE.txt
257
+ - README.md
258
+ - README.rdoc
259
+ files:
260
+ - ".codeclimate.yml"
261
+ - ".rspec"
262
+ - ".rubocop.yml"
263
+ - ".ruby-gemset"
264
+ - ".ruby-version"
265
+ - ".travis.yml"
266
+ - Gemfile
267
+ - Gemfile.lock
268
+ - LICENSE.txt
269
+ - README.md
270
+ - README.rdoc
271
+ - Rakefile
272
+ - VERSION
273
+ - clientura.gemspec
274
+ - lib/clientura.rb
275
+ - lib/clientura/client.rb
276
+ - lib/clientura/client/endpoint.rb
277
+ - lib/clientura/client/middleware_function_context.rb
278
+ - lib/clientura/client/request.rb
279
+ - lib/clientura/version.rb
280
+ - spec/clientura/adequate_spec.rb
281
+ - spec/clientura/client_spec.rb
282
+ - spec/clientura_spec.rb
283
+ - spec/spec_helper.rb
284
+ - spec/support/test_server.rb
285
+ homepage: http://github.com/v-shmyhlo/clientura
286
+ licenses:
287
+ - MIT
288
+ metadata: {}
289
+ post_install_message:
290
+ rdoc_options: []
291
+ require_paths:
292
+ - lib
293
+ required_ruby_version: !ruby/object:Gem::Requirement
294
+ requirements:
295
+ - - ">="
296
+ - !ruby/object:Gem::Version
297
+ version: '0'
298
+ required_rubygems_version: !ruby/object:Gem::Requirement
299
+ requirements:
300
+ - - ">="
301
+ - !ruby/object:Gem::Version
302
+ version: '0'
303
+ requirements: []
304
+ rubyforge_project:
305
+ rubygems_version: 2.4.8
306
+ signing_key:
307
+ specification_version: 4
308
+ summary: DSL for defining HTTP clients
309
+ test_files: []