evil-client 0.3.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +0 -11
  3. data/.gitignore +1 -0
  4. data/.rspec +0 -1
  5. data/.rubocop.yml +22 -19
  6. data/.travis.yml +1 -0
  7. data/CHANGELOG.md +251 -6
  8. data/LICENSE.txt +3 -1
  9. data/README.md +47 -81
  10. data/docs/helpers/body.md +93 -0
  11. data/docs/helpers/connection.md +19 -0
  12. data/docs/helpers/headers.md +72 -0
  13. data/docs/helpers/http_method.md +39 -0
  14. data/docs/helpers/let.md +14 -0
  15. data/docs/helpers/logger.md +24 -0
  16. data/docs/helpers/middleware.md +56 -0
  17. data/docs/helpers/operation.md +103 -0
  18. data/docs/helpers/option.md +50 -0
  19. data/docs/helpers/path.md +37 -0
  20. data/docs/helpers/query.md +59 -0
  21. data/docs/helpers/response.md +40 -0
  22. data/docs/helpers/scope.md +121 -0
  23. data/docs/helpers/security.md +102 -0
  24. data/docs/helpers/validate.md +68 -0
  25. data/docs/index.md +70 -78
  26. data/docs/license.md +5 -1
  27. data/docs/rspec.md +96 -0
  28. data/evil-client.gemspec +10 -8
  29. data/lib/evil/client.rb +126 -72
  30. data/lib/evil/client/builder.rb +47 -0
  31. data/lib/evil/client/builder/operation.rb +40 -0
  32. data/lib/evil/client/builder/scope.rb +31 -0
  33. data/lib/evil/client/chaining.rb +17 -0
  34. data/lib/evil/client/connection.rb +60 -20
  35. data/lib/evil/client/container.rb +66 -0
  36. data/lib/evil/client/container/operation.rb +23 -0
  37. data/lib/evil/client/container/scope.rb +28 -0
  38. data/lib/evil/client/exceptions/definition_error.rb +15 -0
  39. data/lib/evil/client/exceptions/name_error.rb +32 -0
  40. data/lib/evil/client/exceptions/response_error.rb +42 -0
  41. data/lib/evil/client/exceptions/type_error.rb +29 -0
  42. data/lib/evil/client/exceptions/validation_error.rb +27 -0
  43. data/lib/evil/client/formatter.rb +49 -0
  44. data/lib/evil/client/formatter/form.rb +45 -0
  45. data/lib/evil/client/formatter/multipart.rb +33 -0
  46. data/lib/evil/client/formatter/part.rb +66 -0
  47. data/lib/evil/client/formatter/text.rb +21 -0
  48. data/lib/evil/client/resolver.rb +84 -0
  49. data/lib/evil/client/resolver/body.rb +22 -0
  50. data/lib/evil/client/resolver/format.rb +30 -0
  51. data/lib/evil/client/resolver/headers.rb +46 -0
  52. data/lib/evil/client/resolver/http_method.rb +34 -0
  53. data/lib/evil/client/resolver/middleware.rb +36 -0
  54. data/lib/evil/client/resolver/query.rb +39 -0
  55. data/lib/evil/client/resolver/request.rb +96 -0
  56. data/lib/evil/client/resolver/response.rb +26 -0
  57. data/lib/evil/client/resolver/security.rb +113 -0
  58. data/lib/evil/client/resolver/uri.rb +35 -0
  59. data/lib/evil/client/rspec.rb +127 -0
  60. data/lib/evil/client/schema.rb +105 -0
  61. data/lib/evil/client/schema/operation.rb +177 -0
  62. data/lib/evil/client/schema/scope.rb +73 -0
  63. data/lib/evil/client/settings.rb +172 -0
  64. data/lib/evil/client/settings/validator.rb +64 -0
  65. data/mkdocs.yml +21 -15
  66. data/spec/features/custom_connection_spec.rb +17 -0
  67. data/spec/features/operation/middleware_spec.rb +50 -0
  68. data/spec/features/operation/options_spec.rb +71 -0
  69. data/spec/features/operation/request_spec.rb +94 -0
  70. data/spec/features/operation/response_spec.rb +48 -0
  71. data/spec/features/scope/options_spec.rb +52 -0
  72. data/spec/fixtures/locales/en.yml +16 -0
  73. data/spec/fixtures/test_client.rb +76 -0
  74. data/spec/spec_helper.rb +18 -6
  75. data/spec/support/fixtures_helper.rb +7 -0
  76. data/spec/unit/builder/operation_spec.rb +90 -0
  77. data/spec/unit/builder/scope_spec.rb +84 -0
  78. data/spec/unit/client_spec.rb +137 -0
  79. data/spec/unit/connection_spec.rb +78 -0
  80. data/spec/unit/container/operation_spec.rb +81 -0
  81. data/spec/unit/container/scope_spec.rb +61 -0
  82. data/spec/unit/container_spec.rb +107 -0
  83. data/spec/unit/exceptions/definition_error_spec.rb +15 -0
  84. data/spec/unit/exceptions/name_error_spec.rb +77 -0
  85. data/spec/unit/exceptions/response_error_spec.rb +22 -0
  86. data/spec/unit/exceptions/type_error_spec.rb +71 -0
  87. data/spec/unit/exceptions/validation_error_spec.rb +13 -0
  88. data/spec/unit/formatter/form_spec.rb +27 -0
  89. data/spec/unit/formatter/multipart_spec.rb +23 -0
  90. data/spec/unit/formatter/part_spec.rb +49 -0
  91. data/spec/unit/formatter/text_spec.rb +37 -0
  92. data/spec/unit/formatter_spec.rb +46 -0
  93. data/spec/unit/resolver/body_spec.rb +65 -0
  94. data/spec/unit/resolver/format_spec.rb +66 -0
  95. data/spec/unit/resolver/headers_spec.rb +93 -0
  96. data/spec/unit/resolver/http_method_spec.rb +67 -0
  97. data/spec/unit/resolver/middleware_spec.rb +83 -0
  98. data/spec/unit/resolver/query_spec.rb +85 -0
  99. data/spec/unit/resolver/request_spec.rb +121 -0
  100. data/spec/unit/resolver/response_spec.rb +64 -0
  101. data/spec/unit/resolver/security_spec.rb +156 -0
  102. data/spec/unit/resolver/uri_spec.rb +117 -0
  103. data/spec/unit/rspec_spec.rb +342 -0
  104. data/spec/unit/schema/operation_spec.rb +309 -0
  105. data/spec/unit/schema/scope_spec.rb +110 -0
  106. data/spec/unit/schema_spec.rb +157 -0
  107. data/spec/unit/settings/validator_spec.rb +128 -0
  108. data/spec/unit/settings_spec.rb +248 -0
  109. metadata +192 -135
  110. data/docs/base_url.md +0 -38
  111. data/docs/documentation.md +0 -9
  112. data/docs/headers.md +0 -59
  113. data/docs/http_method.md +0 -31
  114. data/docs/model.md +0 -173
  115. data/docs/operation.md +0 -0
  116. data/docs/overview.md +0 -0
  117. data/docs/path.md +0 -48
  118. data/docs/query.md +0 -99
  119. data/docs/responses.md +0 -66
  120. data/docs/security.md +0 -102
  121. data/docs/settings.md +0 -32
  122. data/lib/evil/client/connection/net_http.rb +0 -57
  123. data/lib/evil/client/dsl.rb +0 -127
  124. data/lib/evil/client/dsl/base.rb +0 -26
  125. data/lib/evil/client/dsl/files.rb +0 -37
  126. data/lib/evil/client/dsl/headers.rb +0 -16
  127. data/lib/evil/client/dsl/http_method.rb +0 -24
  128. data/lib/evil/client/dsl/operation.rb +0 -91
  129. data/lib/evil/client/dsl/operations.rb +0 -41
  130. data/lib/evil/client/dsl/path.rb +0 -25
  131. data/lib/evil/client/dsl/query.rb +0 -16
  132. data/lib/evil/client/dsl/response.rb +0 -61
  133. data/lib/evil/client/dsl/responses.rb +0 -29
  134. data/lib/evil/client/dsl/scope.rb +0 -27
  135. data/lib/evil/client/dsl/security.rb +0 -57
  136. data/lib/evil/client/dsl/verifier.rb +0 -35
  137. data/lib/evil/client/middleware.rb +0 -81
  138. data/lib/evil/client/middleware/base.rb +0 -11
  139. data/lib/evil/client/middleware/merge_security.rb +0 -20
  140. data/lib/evil/client/middleware/normalize_headers.rb +0 -17
  141. data/lib/evil/client/middleware/stringify_form.rb +0 -40
  142. data/lib/evil/client/middleware/stringify_json.rb +0 -19
  143. data/lib/evil/client/middleware/stringify_multipart.rb +0 -36
  144. data/lib/evil/client/middleware/stringify_multipart/part.rb +0 -36
  145. data/lib/evil/client/middleware/stringify_query.rb +0 -35
  146. data/lib/evil/client/operation.rb +0 -34
  147. data/lib/evil/client/operation/request.rb +0 -26
  148. data/lib/evil/client/operation/response.rb +0 -39
  149. data/lib/evil/client/operation/response_error.rb +0 -13
  150. data/lib/evil/client/operation/unexpected_response_error.rb +0 -19
  151. data/spec/features/instantiation_spec.rb +0 -68
  152. data/spec/features/middleware_spec.rb +0 -79
  153. data/spec/features/operation_with_documentation_spec.rb +0 -41
  154. data/spec/features/operation_with_files_spec.rb +0 -40
  155. data/spec/features/operation_with_form_body_spec.rb +0 -158
  156. data/spec/features/operation_with_headers_spec.rb +0 -99
  157. data/spec/features/operation_with_http_method_spec.rb +0 -45
  158. data/spec/features/operation_with_json_body_spec.rb +0 -156
  159. data/spec/features/operation_with_nested_responses_spec.rb +0 -95
  160. data/spec/features/operation_with_path_spec.rb +0 -47
  161. data/spec/features/operation_with_query_spec.rb +0 -84
  162. data/spec/features/operation_with_security_spec.rb +0 -228
  163. data/spec/features/scoping_spec.rb +0 -48
  164. data/spec/support/test_client.rb +0 -15
  165. data/spec/unit/evil/client/connection/net_http_spec.rb +0 -38
  166. data/spec/unit/evil/client/dsl/files_spec.rb +0 -37
  167. data/spec/unit/evil/client/dsl/operation_spec.rb +0 -374
  168. data/spec/unit/evil/client/dsl/operations_spec.rb +0 -29
  169. data/spec/unit/evil/client/dsl/scope_spec.rb +0 -32
  170. data/spec/unit/evil/client/dsl/security_spec.rb +0 -135
  171. data/spec/unit/evil/client/middleware/merge_security_spec.rb +0 -32
  172. data/spec/unit/evil/client/middleware/normalize_headers_spec.rb +0 -17
  173. data/spec/unit/evil/client/middleware/stringify_form_spec.rb +0 -63
  174. data/spec/unit/evil/client/middleware/stringify_json_spec.rb +0 -61
  175. data/spec/unit/evil/client/middleware/stringify_multipart/part_spec.rb +0 -59
  176. data/spec/unit/evil/client/middleware/stringify_multipart_spec.rb +0 -62
  177. data/spec/unit/evil/client/middleware/stringify_query_spec.rb +0 -40
  178. data/spec/unit/evil/client/middleware_spec.rb +0 -46
  179. data/spec/unit/evil/client/operation/request_spec.rb +0 -49
  180. data/spec/unit/evil/client/operation/response_spec.rb +0 -63
@@ -0,0 +1,128 @@
1
+ RSpec.describe Evil::Client::Settings::Validator do
2
+ let(:validator) { described_class.new(schema, key, &block) }
3
+ let(:schema) { double to_s: "Test::Api.users.update" }
4
+ let(:key) { :token_present }
5
+ let(:block) { proc { 1 if token.to_s != "" } }
6
+
7
+ describe ".new" do
8
+ subject { validator }
9
+ it { is_expected.to be_a described_class }
10
+
11
+ context "when key is missed" do
12
+ let(:key) { nil }
13
+
14
+ it "raises ArgumentError" do
15
+ expect { subject }.to raise_error ArgumentError
16
+ end
17
+ end
18
+
19
+ context "when key is empty" do
20
+ let(:key) { "" }
21
+
22
+ it "raises ArgumentError" do
23
+ expect { subject }.to raise_error ArgumentError
24
+ end
25
+ end
26
+
27
+ context "when key cannot be symbolized" do
28
+ let(:key) { 1 }
29
+
30
+ it "raises ArgumentError" do
31
+ expect { subject }.to raise_error ArgumentError
32
+ end
33
+ end
34
+
35
+ context "when block is missed" do
36
+ let(:block) { nil }
37
+
38
+ it "raises ArgumentError" do
39
+ expect { subject }.to raise_error ArgumentError
40
+ end
41
+ end
42
+ end
43
+
44
+ describe "#to_s" do
45
+ subject { validator.to_s }
46
+
47
+ it "represents validator in a human-friendly manner" do
48
+ expect(subject).to eq "Test::Api.users.update.validator[:token_present]"
49
+ end
50
+ end
51
+
52
+ describe "#to_str" do
53
+ subject { validator.to_str }
54
+
55
+ it "represents validator in a human-friendly manner" do
56
+ expect(subject).to eq "Test::Api.users.update.validator[:token_present]"
57
+ end
58
+ end
59
+
60
+ describe "#inspect" do
61
+ subject { validator.inspect }
62
+
63
+ it "represents validator in a human-friendly manner" do
64
+ expect(subject).to eq "Test::Api.users.update.validator[:token_present]"
65
+ end
66
+ end
67
+
68
+ describe "#call" do
69
+ let(:log) { StringIO.new }
70
+ let(:logger) { Logger.new(log) }
71
+ let(:options) { { id: 7, token: token } }
72
+ let(:token) { "foo" }
73
+
74
+ let(:settings) do
75
+ double options: options, to_s: "my_settings", logger: logger, **options
76
+ end
77
+
78
+ subject { validator.call settings }
79
+
80
+ context "when block returns truthy value" do
81
+ it { is_expected.to eql true }
82
+
83
+ it "logs the result" do
84
+ subject
85
+
86
+ expect(log.string).to include validator.to_s
87
+ expect(log.string).to include "passed for my_settings"
88
+ end
89
+
90
+ context "when logger level was set to INFO" do
91
+ before { logger.level = Logger::INFO }
92
+
93
+ it "skips logging" do
94
+ expect { subject }.not_to change { log.string }
95
+ end
96
+ end
97
+ end
98
+
99
+ context "when block returns falsey value" do
100
+ let(:token) { nil }
101
+
102
+ it "raises Evil::Client::ValidationError" do
103
+ # see spec/fixtures/locales/en.yml
104
+ expect { subject }
105
+ .to raise_error Evil::Client::ValidationError,
106
+ "To update user id:7 you must provide a token"
107
+ end
108
+
109
+ it "logs the result" do
110
+ subject rescue nil
111
+
112
+ expect(log.string).to include validator.to_s
113
+ expect(log.string).to include "failed for my_settings"
114
+ end
115
+ end
116
+
117
+ context "when block raises" do
118
+ let(:block) { proc { raise "my_problem" } }
119
+
120
+ it "logs the result" do
121
+ subject rescue nil
122
+
123
+ expect(log.string).to include validator.to_s
124
+ expect(log.string).to include "broken for my_settings with my_problem"
125
+ end
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,248 @@
1
+ RSpec.describe Evil::Client::Settings do
2
+ let(:settings) { klass.new(logger, options) }
3
+ let(:log) { StringIO.new }
4
+ let(:logger) { Logger.new log }
5
+ let(:klass) { Class.new(described_class) }
6
+ let(:options) { { "id" => 42, "name" => "Andrew" } }
7
+ let(:dsl_methods) do
8
+ %i[options datetime logger scope basic_auth key_auth token_auth]
9
+ end
10
+
11
+ before { klass.instance_variable_set :@schema, "Test::Api.users.update" }
12
+
13
+ describe ".schema" do
14
+ subject { klass.schema }
15
+
16
+ it "returns the schema class the settings belongs to" do
17
+ expect(subject).to eq "Test::Api.users.update"
18
+ end
19
+ end
20
+
21
+ describe ".option" do
22
+ it "is defined by Dry::Initializer DSL" do
23
+ expect(klass).to be_a Dry::Initializer
24
+ end
25
+
26
+ it "fails when method name is reserved for DSL" do
27
+ dsl_methods.each do |name|
28
+ expect { klass.option name }
29
+ .to raise_error Evil::Client::NameError
30
+ end
31
+ end
32
+
33
+ it "allows the option to be renamed" do
34
+ expect { klass.option :basic_auth, as: :something }.not_to raise_error
35
+ end
36
+ end
37
+
38
+ describe ".param" do
39
+ before do
40
+ klass.param :id, optional: true
41
+ klass.param :email, optional: true
42
+ end
43
+
44
+ subject { settings.options }
45
+
46
+ it "acts like .option" do
47
+ expect(subject).to eq id: 42
48
+ end
49
+ end
50
+
51
+ describe ".let" do
52
+ before do
53
+ klass.param :id
54
+ klass.let(:square_id) { id**2 }
55
+ end
56
+
57
+ subject { settings.square_id }
58
+
59
+ it "adds the corresponding memoizer to the instance" do
60
+ expect(subject).to eq(42**2)
61
+ end
62
+
63
+ it "fails when method name is reserved for DSL" do
64
+ dsl_methods.each do |name|
65
+ expect { klass.let(name) { 0 } }
66
+ .to raise_error Evil::Client::NameError
67
+ end
68
+ end
69
+ end
70
+
71
+ describe ".validate" do
72
+ before do
73
+ klass.param :name
74
+ klass.validate(:name_present) { name.to_s != "" }
75
+ end
76
+
77
+ let(:options) { { "name" => "" } }
78
+
79
+ it "adds validation for an instance" do
80
+ # see spec/fixtures/locale/en.yml
81
+ expect { settings }
82
+ .to raise_error(Evil::Client::ValidationError, "The user has no name")
83
+ end
84
+
85
+ it "gives logger to validators" do
86
+ settings rescue nil
87
+
88
+ expect(log.string).to include "#{klass.schema}.validator[:name_present]"
89
+ expect(log.string).to include "failed"
90
+ end
91
+ end
92
+
93
+ describe ".name" do
94
+ subject { klass.name }
95
+
96
+ it "represents settins class in a human-friendly manner" do
97
+ expect(subject).to eq "Test::Api.users.update"
98
+ end
99
+ end
100
+
101
+ describe ".inspect" do
102
+ subject { klass.inspect }
103
+
104
+ it "represents settins class in a human-friendly manner" do
105
+ expect(subject).to eq "Test::Api.users.update"
106
+ end
107
+ end
108
+
109
+ describe ".to_s" do
110
+ subject { klass.to_s }
111
+
112
+ it "represents settins class in a human-friendly manner" do
113
+ expect(subject).to eq "Test::Api.users.update"
114
+ end
115
+ end
116
+
117
+ describe ".to_str" do
118
+ subject { klass.to_str }
119
+
120
+ it "represents settins class in a human-friendly manner" do
121
+ expect(subject).to eq "Test::Api.users.update"
122
+ end
123
+ end
124
+
125
+ describe ".new" do
126
+ subject { settings }
127
+
128
+ it "sets the logger" do
129
+ expect(subject.logger).to eq logger
130
+ end
131
+
132
+ it "logs the initial params" do
133
+ subject
134
+
135
+ expect(log.string).to include klass.to_s
136
+ expect(log.string).to include options.to_s
137
+ expect(log.string).to include settings.to_s
138
+ expect(log.string).to include "initialized"
139
+ end
140
+
141
+ context "when logger level was set to INFO" do
142
+ before { logger.level = Logger::INFO }
143
+
144
+ it "skips logging" do
145
+ expect { subject }.not_to change { log.string }
146
+ end
147
+ end
148
+
149
+ context "with wrong options" do
150
+ before { klass.option :user, as: :customer }
151
+
152
+ it "raises Evil::Client::ValidationError" do
153
+ expect { subject }.to raise_error Evil::Client::ValidationError, /user/
154
+ end
155
+ end
156
+ end
157
+
158
+ describe "#logger=" do
159
+ let(:new_logger) { double }
160
+ subject { settings.logger = new_logger }
161
+
162
+ it "sets a new logger" do
163
+ expect { subject }.to change { settings.logger }.to new_logger
164
+ end
165
+ end
166
+
167
+ describe "#options" do
168
+ before do
169
+ klass.option :id, optional: true
170
+ klass.option :email, optional: true
171
+ end
172
+
173
+ subject { settings.options }
174
+
175
+ it "slices declared options from the assigned ones" do
176
+ expect(subject).to eq id: 42
177
+ end
178
+ end
179
+
180
+ describe "#datetime" do
181
+ let(:time) { DateTime.parse "2017-07-21 16:58:00 UTC" }
182
+ subject { settings.datetime value }
183
+
184
+ context "with a parceable string" do
185
+ let(:value) { time.to_s }
186
+
187
+ it "applies RFC2822" do
188
+ expect(subject).to eq "Fri, 21 Jul 2017 16:58:00 +0000"
189
+ end
190
+ end
191
+
192
+ context "with a date" do
193
+ let(:value) { time.to_date }
194
+
195
+ it "applies RFC2822" do
196
+ expect(subject).to eq "Fri, 21 Jul 2017 00:00:00 +0000"
197
+ end
198
+ end
199
+
200
+ context "with a time" do
201
+ let(:value) { time }
202
+
203
+ it "applies RFC2822" do
204
+ expect(subject).to eq "Fri, 21 Jul 2017 16:58:00 +0000"
205
+ end
206
+ end
207
+
208
+ context "with a datetime" do
209
+ let(:value) { time.to_datetime }
210
+
211
+ it "applies RFC2822" do
212
+ expect(subject).to eq "Fri, 21 Jul 2017 16:58:00 +0000"
213
+ end
214
+ end
215
+
216
+ context "with unparseable value" do
217
+ let(:value) { "foo" }
218
+
219
+ it "raises ArgumentError" do
220
+ expect { subject }.to raise_error(ArgumentError)
221
+ end
222
+ end
223
+ end
224
+
225
+ describe "#to_s" do
226
+ subject { settings.to_s }
227
+
228
+ it "represents instance of settings in a human-friendly manner" do
229
+ expect(subject).to include "#<Test::Api.users.update:"
230
+ end
231
+ end
232
+
233
+ describe "#to_str" do
234
+ subject { settings.to_str }
235
+
236
+ it "represents instance of settings in a human-friendly manner" do
237
+ expect(subject).to include "#<Test::Api.users.update:"
238
+ end
239
+ end
240
+
241
+ describe "#inspect" do
242
+ subject { settings.inspect }
243
+
244
+ it "represents instance of settings in a human-friendly manner" do
245
+ expect(subject).to include "#<Test::Api.users.update:"
246
+ end
247
+ end
248
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evil-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kozin (nepalez)
@@ -9,70 +9,78 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-07-14 00:00:00.000000000 Z
12
+ date: 2017-08-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: evil-struct
15
+ name: dry-initializer
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 0.0.2
20
+ version: '1.4'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ">="
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 0.0.2
27
+ version: '1.4'
28
+ - !ruby/object:Gem::Dependency
29
+ name: i18n
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 0.8.6
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 0.8.6
28
42
  - !ruby/object:Gem::Dependency
29
43
  name: mime-types
30
44
  requirement: !ruby/object:Gem::Requirement
31
45
  requirements:
32
- - - ">"
46
+ - - "~>"
33
47
  - !ruby/object:Gem::Version
34
- version: '1'
48
+ version: '3.1'
35
49
  type: :runtime
36
50
  prerelease: false
37
51
  version_requirements: !ruby/object:Gem::Requirement
38
52
  requirements:
39
- - - ">"
53
+ - - "~>"
40
54
  - !ruby/object:Gem::Version
41
- version: '1'
55
+ version: '3.1'
42
56
  - !ruby/object:Gem::Dependency
43
57
  name: rack
44
58
  requirement: !ruby/object:Gem::Requirement
45
59
  requirements:
46
- - - ">="
60
+ - - "~>"
47
61
  - !ruby/object:Gem::Version
48
62
  version: '1'
49
- - - "<"
50
- - !ruby/object:Gem::Version
51
- version: '3'
52
63
  type: :runtime
53
64
  prerelease: false
54
65
  version_requirements: !ruby/object:Gem::Requirement
55
66
  requirements:
56
- - - ">="
67
+ - - "~>"
57
68
  - !ruby/object:Gem::Version
58
69
  version: '1'
59
- - - "<"
60
- - !ruby/object:Gem::Version
61
- version: '3'
62
70
  - !ruby/object:Gem::Dependency
63
- name: dry-types
71
+ name: rake
64
72
  requirement: !ruby/object:Gem::Requirement
65
73
  requirements:
66
- - - "~>"
74
+ - - ">="
67
75
  - !ruby/object:Gem::Version
68
- version: '0.9'
76
+ version: '10'
69
77
  type: :development
70
78
  prerelease: false
71
79
  version_requirements: !ruby/object:Gem::Requirement
72
80
  requirements:
73
- - - "~>"
81
+ - - ">="
74
82
  - !ruby/object:Gem::Version
75
- version: '0.9'
83
+ version: '10'
76
84
  - !ruby/object:Gem::Dependency
77
85
  name: rspec
78
86
  requirement: !ruby/object:Gem::Requirement
@@ -88,49 +96,65 @@ dependencies:
88
96
  - !ruby/object:Gem::Version
89
97
  version: '3.0'
90
98
  - !ruby/object:Gem::Dependency
91
- name: rake
99
+ name: rspec-its
92
100
  requirement: !ruby/object:Gem::Requirement
93
101
  requirements:
94
102
  - - "~>"
95
103
  - !ruby/object:Gem::Version
96
- version: '11'
104
+ version: '1.2'
97
105
  type: :development
98
106
  prerelease: false
99
107
  version_requirements: !ruby/object:Gem::Requirement
100
108
  requirements:
101
109
  - - "~>"
102
110
  - !ruby/object:Gem::Version
103
- version: '11'
111
+ version: '1.2'
104
112
  - !ruby/object:Gem::Dependency
105
- name: webmock
113
+ name: rubocop
106
114
  requirement: !ruby/object:Gem::Requirement
107
115
  requirements:
108
116
  - - "~>"
109
117
  - !ruby/object:Gem::Version
110
- version: '2.1'
118
+ version: '0.42'
111
119
  type: :development
112
120
  prerelease: false
113
121
  version_requirements: !ruby/object:Gem::Requirement
114
122
  requirements:
115
123
  - - "~>"
116
124
  - !ruby/object:Gem::Version
117
- version: '2.1'
125
+ version: '0.42'
118
126
  - !ruby/object:Gem::Dependency
119
- name: rubocop
127
+ name: timecop
120
128
  requirement: !ruby/object:Gem::Requirement
121
129
  requirements:
122
130
  - - "~>"
123
131
  - !ruby/object:Gem::Version
124
- version: '0.44'
132
+ version: '0.9'
125
133
  type: :development
126
134
  prerelease: false
127
135
  version_requirements: !ruby/object:Gem::Requirement
128
136
  requirements:
129
137
  - - "~>"
130
138
  - !ruby/object:Gem::Version
131
- version: '0.44'
139
+ version: '0.9'
140
+ - !ruby/object:Gem::Dependency
141
+ name: webmock
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - "~>"
145
+ - !ruby/object:Gem::Version
146
+ version: '2.1'
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - "~>"
152
+ - !ruby/object:Gem::Version
153
+ version: '2.1'
132
154
  description:
133
- email: andrew.kozin@gmail.com
155
+ email:
156
+ - andrew.kozin@gmail.com
157
+ - nepalez@evilmartians.com
134
158
  executables: []
135
159
  extensions: []
136
160
  extra_rdoc_files:
@@ -147,85 +171,106 @@ files:
147
171
  - LICENSE.txt
148
172
  - README.md
149
173
  - Rakefile
150
- - docs/base_url.md
151
- - docs/documentation.md
152
- - docs/headers.md
153
- - docs/http_method.md
174
+ - docs/helpers/body.md
175
+ - docs/helpers/connection.md
176
+ - docs/helpers/headers.md
177
+ - docs/helpers/http_method.md
178
+ - docs/helpers/let.md
179
+ - docs/helpers/logger.md
180
+ - docs/helpers/middleware.md
181
+ - docs/helpers/operation.md
182
+ - docs/helpers/option.md
183
+ - docs/helpers/path.md
184
+ - docs/helpers/query.md
185
+ - docs/helpers/response.md
186
+ - docs/helpers/scope.md
187
+ - docs/helpers/security.md
188
+ - docs/helpers/validate.md
154
189
  - docs/index.md
155
190
  - docs/license.md
156
- - docs/model.md
157
- - docs/operation.md
158
- - docs/overview.md
159
- - docs/path.md
160
- - docs/query.md
161
- - docs/responses.md
162
- - docs/security.md
163
- - docs/settings.md
191
+ - docs/rspec.md
164
192
  - evil-client.gemspec
165
193
  - lib/evil-client.rb
166
194
  - lib/evil/client.rb
195
+ - lib/evil/client/builder.rb
196
+ - lib/evil/client/builder/operation.rb
197
+ - lib/evil/client/builder/scope.rb
198
+ - lib/evil/client/chaining.rb
167
199
  - lib/evil/client/connection.rb
168
- - lib/evil/client/connection/net_http.rb
169
- - lib/evil/client/dsl.rb
170
- - lib/evil/client/dsl/base.rb
171
- - lib/evil/client/dsl/files.rb
172
- - lib/evil/client/dsl/headers.rb
173
- - lib/evil/client/dsl/http_method.rb
174
- - lib/evil/client/dsl/operation.rb
175
- - lib/evil/client/dsl/operations.rb
176
- - lib/evil/client/dsl/path.rb
177
- - lib/evil/client/dsl/query.rb
178
- - lib/evil/client/dsl/response.rb
179
- - lib/evil/client/dsl/responses.rb
180
- - lib/evil/client/dsl/scope.rb
181
- - lib/evil/client/dsl/security.rb
182
- - lib/evil/client/dsl/verifier.rb
183
- - lib/evil/client/middleware.rb
184
- - lib/evil/client/middleware/base.rb
185
- - lib/evil/client/middleware/merge_security.rb
186
- - lib/evil/client/middleware/normalize_headers.rb
187
- - lib/evil/client/middleware/stringify_form.rb
188
- - lib/evil/client/middleware/stringify_json.rb
189
- - lib/evil/client/middleware/stringify_multipart.rb
190
- - lib/evil/client/middleware/stringify_multipart/part.rb
191
- - lib/evil/client/middleware/stringify_query.rb
192
- - lib/evil/client/operation.rb
193
- - lib/evil/client/operation/request.rb
194
- - lib/evil/client/operation/response.rb
195
- - lib/evil/client/operation/response_error.rb
196
- - lib/evil/client/operation/unexpected_response_error.rb
200
+ - lib/evil/client/container.rb
201
+ - lib/evil/client/container/operation.rb
202
+ - lib/evil/client/container/scope.rb
203
+ - lib/evil/client/exceptions/definition_error.rb
204
+ - lib/evil/client/exceptions/name_error.rb
205
+ - lib/evil/client/exceptions/response_error.rb
206
+ - lib/evil/client/exceptions/type_error.rb
207
+ - lib/evil/client/exceptions/validation_error.rb
208
+ - lib/evil/client/formatter.rb
209
+ - lib/evil/client/formatter/form.rb
210
+ - lib/evil/client/formatter/multipart.rb
211
+ - lib/evil/client/formatter/part.rb
212
+ - lib/evil/client/formatter/text.rb
213
+ - lib/evil/client/resolver.rb
214
+ - lib/evil/client/resolver/body.rb
215
+ - lib/evil/client/resolver/format.rb
216
+ - lib/evil/client/resolver/headers.rb
217
+ - lib/evil/client/resolver/http_method.rb
218
+ - lib/evil/client/resolver/middleware.rb
219
+ - lib/evil/client/resolver/query.rb
220
+ - lib/evil/client/resolver/request.rb
221
+ - lib/evil/client/resolver/response.rb
222
+ - lib/evil/client/resolver/security.rb
223
+ - lib/evil/client/resolver/uri.rb
224
+ - lib/evil/client/rspec.rb
225
+ - lib/evil/client/schema.rb
226
+ - lib/evil/client/schema/operation.rb
227
+ - lib/evil/client/schema/scope.rb
228
+ - lib/evil/client/settings.rb
229
+ - lib/evil/client/settings/validator.rb
197
230
  - mkdocs.yml
198
- - spec/features/instantiation_spec.rb
199
- - spec/features/middleware_spec.rb
200
- - spec/features/operation_with_documentation_spec.rb
201
- - spec/features/operation_with_files_spec.rb
202
- - spec/features/operation_with_form_body_spec.rb
203
- - spec/features/operation_with_headers_spec.rb
204
- - spec/features/operation_with_http_method_spec.rb
205
- - spec/features/operation_with_json_body_spec.rb
206
- - spec/features/operation_with_nested_responses_spec.rb
207
- - spec/features/operation_with_path_spec.rb
208
- - spec/features/operation_with_query_spec.rb
209
- - spec/features/operation_with_security_spec.rb
210
- - spec/features/scoping_spec.rb
231
+ - spec/features/custom_connection_spec.rb
232
+ - spec/features/operation/middleware_spec.rb
233
+ - spec/features/operation/options_spec.rb
234
+ - spec/features/operation/request_spec.rb
235
+ - spec/features/operation/response_spec.rb
236
+ - spec/features/scope/options_spec.rb
237
+ - spec/fixtures/locales/en.yml
238
+ - spec/fixtures/test_client.rb
211
239
  - spec/spec_helper.rb
212
- - spec/support/test_client.rb
213
- - spec/unit/evil/client/connection/net_http_spec.rb
214
- - spec/unit/evil/client/dsl/files_spec.rb
215
- - spec/unit/evil/client/dsl/operation_spec.rb
216
- - spec/unit/evil/client/dsl/operations_spec.rb
217
- - spec/unit/evil/client/dsl/scope_spec.rb
218
- - spec/unit/evil/client/dsl/security_spec.rb
219
- - spec/unit/evil/client/middleware/merge_security_spec.rb
220
- - spec/unit/evil/client/middleware/normalize_headers_spec.rb
221
- - spec/unit/evil/client/middleware/stringify_form_spec.rb
222
- - spec/unit/evil/client/middleware/stringify_json_spec.rb
223
- - spec/unit/evil/client/middleware/stringify_multipart/part_spec.rb
224
- - spec/unit/evil/client/middleware/stringify_multipart_spec.rb
225
- - spec/unit/evil/client/middleware/stringify_query_spec.rb
226
- - spec/unit/evil/client/middleware_spec.rb
227
- - spec/unit/evil/client/operation/request_spec.rb
228
- - spec/unit/evil/client/operation/response_spec.rb
240
+ - spec/support/fixtures_helper.rb
241
+ - spec/unit/builder/operation_spec.rb
242
+ - spec/unit/builder/scope_spec.rb
243
+ - spec/unit/client_spec.rb
244
+ - spec/unit/connection_spec.rb
245
+ - spec/unit/container/operation_spec.rb
246
+ - spec/unit/container/scope_spec.rb
247
+ - spec/unit/container_spec.rb
248
+ - spec/unit/exceptions/definition_error_spec.rb
249
+ - spec/unit/exceptions/name_error_spec.rb
250
+ - spec/unit/exceptions/response_error_spec.rb
251
+ - spec/unit/exceptions/type_error_spec.rb
252
+ - spec/unit/exceptions/validation_error_spec.rb
253
+ - spec/unit/formatter/form_spec.rb
254
+ - spec/unit/formatter/multipart_spec.rb
255
+ - spec/unit/formatter/part_spec.rb
256
+ - spec/unit/formatter/text_spec.rb
257
+ - spec/unit/formatter_spec.rb
258
+ - spec/unit/resolver/body_spec.rb
259
+ - spec/unit/resolver/format_spec.rb
260
+ - spec/unit/resolver/headers_spec.rb
261
+ - spec/unit/resolver/http_method_spec.rb
262
+ - spec/unit/resolver/middleware_spec.rb
263
+ - spec/unit/resolver/query_spec.rb
264
+ - spec/unit/resolver/request_spec.rb
265
+ - spec/unit/resolver/response_spec.rb
266
+ - spec/unit/resolver/security_spec.rb
267
+ - spec/unit/resolver/uri_spec.rb
268
+ - spec/unit/rspec_spec.rb
269
+ - spec/unit/schema/operation_spec.rb
270
+ - spec/unit/schema/scope_spec.rb
271
+ - spec/unit/schema_spec.rb
272
+ - spec/unit/settings/validator_spec.rb
273
+ - spec/unit/settings_spec.rb
229
274
  homepage: https://github.com/evilmartians/evil-client
230
275
  licenses:
231
276
  - MIT
@@ -251,35 +296,47 @@ signing_key:
251
296
  specification_version: 4
252
297
  summary: Human-friendly DSL for building HTTP(s) clients in Ruby
253
298
  test_files:
254
- - spec/features/instantiation_spec.rb
255
- - spec/features/middleware_spec.rb
256
- - spec/features/operation_with_documentation_spec.rb
257
- - spec/features/operation_with_files_spec.rb
258
- - spec/features/operation_with_form_body_spec.rb
259
- - spec/features/operation_with_headers_spec.rb
260
- - spec/features/operation_with_http_method_spec.rb
261
- - spec/features/operation_with_json_body_spec.rb
262
- - spec/features/operation_with_nested_responses_spec.rb
263
- - spec/features/operation_with_path_spec.rb
264
- - spec/features/operation_with_query_spec.rb
265
- - spec/features/operation_with_security_spec.rb
266
- - spec/features/scoping_spec.rb
299
+ - spec/features/custom_connection_spec.rb
300
+ - spec/features/operation/middleware_spec.rb
301
+ - spec/features/operation/options_spec.rb
302
+ - spec/features/operation/request_spec.rb
303
+ - spec/features/operation/response_spec.rb
304
+ - spec/features/scope/options_spec.rb
305
+ - spec/fixtures/locales/en.yml
306
+ - spec/fixtures/test_client.rb
267
307
  - spec/spec_helper.rb
268
- - spec/support/test_client.rb
269
- - spec/unit/evil/client/connection/net_http_spec.rb
270
- - spec/unit/evil/client/dsl/files_spec.rb
271
- - spec/unit/evil/client/dsl/operation_spec.rb
272
- - spec/unit/evil/client/dsl/operations_spec.rb
273
- - spec/unit/evil/client/dsl/scope_spec.rb
274
- - spec/unit/evil/client/dsl/security_spec.rb
275
- - spec/unit/evil/client/middleware/merge_security_spec.rb
276
- - spec/unit/evil/client/middleware/normalize_headers_spec.rb
277
- - spec/unit/evil/client/middleware/stringify_form_spec.rb
278
- - spec/unit/evil/client/middleware/stringify_json_spec.rb
279
- - spec/unit/evil/client/middleware/stringify_multipart/part_spec.rb
280
- - spec/unit/evil/client/middleware/stringify_multipart_spec.rb
281
- - spec/unit/evil/client/middleware/stringify_query_spec.rb
282
- - spec/unit/evil/client/middleware_spec.rb
283
- - spec/unit/evil/client/operation/request_spec.rb
284
- - spec/unit/evil/client/operation/response_spec.rb
308
+ - spec/support/fixtures_helper.rb
309
+ - spec/unit/builder/operation_spec.rb
310
+ - spec/unit/builder/scope_spec.rb
311
+ - spec/unit/client_spec.rb
312
+ - spec/unit/connection_spec.rb
313
+ - spec/unit/container/operation_spec.rb
314
+ - spec/unit/container/scope_spec.rb
315
+ - spec/unit/container_spec.rb
316
+ - spec/unit/exceptions/definition_error_spec.rb
317
+ - spec/unit/exceptions/name_error_spec.rb
318
+ - spec/unit/exceptions/response_error_spec.rb
319
+ - spec/unit/exceptions/type_error_spec.rb
320
+ - spec/unit/exceptions/validation_error_spec.rb
321
+ - spec/unit/formatter/form_spec.rb
322
+ - spec/unit/formatter/multipart_spec.rb
323
+ - spec/unit/formatter/part_spec.rb
324
+ - spec/unit/formatter/text_spec.rb
325
+ - spec/unit/formatter_spec.rb
326
+ - spec/unit/resolver/body_spec.rb
327
+ - spec/unit/resolver/format_spec.rb
328
+ - spec/unit/resolver/headers_spec.rb
329
+ - spec/unit/resolver/http_method_spec.rb
330
+ - spec/unit/resolver/middleware_spec.rb
331
+ - spec/unit/resolver/query_spec.rb
332
+ - spec/unit/resolver/request_spec.rb
333
+ - spec/unit/resolver/response_spec.rb
334
+ - spec/unit/resolver/security_spec.rb
335
+ - spec/unit/resolver/uri_spec.rb
336
+ - spec/unit/rspec_spec.rb
337
+ - spec/unit/schema/operation_spec.rb
338
+ - spec/unit/schema/scope_spec.rb
339
+ - spec/unit/schema_spec.rb
340
+ - spec/unit/settings/validator_spec.rb
341
+ - spec/unit/settings_spec.rb
285
342
  has_rdoc: