hyperion_http 0.1.7 → 0.1.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff839cd9280b6f5ca5629404af5eed86a6bd44e4
4
- data.tar.gz: 4cfd0125216b32cb9c01f59cda244314a0eb0994
3
+ metadata.gz: bd1bb08f526c6320e99bbc66052e3ab4656e374f
4
+ data.tar.gz: 25c5a2e50937af640d09c60d34144e4d579b769b
5
5
  SHA512:
6
- metadata.gz: 656b2d028d48ff5d374fca0c048ef55b6e97e5aff5fede47bb2adc5bd5c840406bfca6ce587933747584003dbf71589ddda53afcce573b438742784bcf3c7bec
7
- data.tar.gz: f1c71106ea625105e8a02fc4d8edb6c600b641e45982300c2b661132f341fd363af5f74317f3c32be8c9dfbe25bc33013a6312b4ac2109aa228e37baaf4ca2ef
6
+ metadata.gz: 4f384cd0917f0273a17c7e1b7a1214690dc8fceb64ea8b4879e92b56c92cba941961b86e672137e84e2a8c174d1cfd42ad23708a539bda6cbde24e0c2b16c994
7
+ data.tar.gz: 7f9ca1053b7cd9d004480bb2737f432aecc3a952bb541a49bbc3bb4dedc709beb4954eb69abc6ad483774420206ae0e3d83b79ce5f7341ee376c54170c3fd3c3
data/CHANGES.md CHANGED
@@ -1,3 +1,253 @@
1
+ ## [0.1.7](https://github.com/indigobio/hyperion/compare/v0.1.6...indigobio:v0.1.7) (2015-12-14)
2
+
3
+ - fake_route now works with multipart body
4
+ ([6e1e7d3](https://github.com/indigobio/hyperion/commit/6e1e7d3c4db6e284522ed468adbac1fecd8fcb91))
5
+
6
+
7
+ ## [0.1.6](https://github.com/indigobio/hyperion/compare/v0.1.5...indigobio:v0.1.6) (2015-11-16)
8
+
9
+ - added form data support
10
+ ([68f8ef0](https://github.com/indigobio/hyperion/commit/68f8ef0258da941b2cdf6b4e12081d8c979be50a))
11
+
12
+
13
+ ## [0.1.5](https://github.com/indigobio/hyperion/compare/v0.1.4...indigobio:v0.1.5) (2015-11-13)
14
+
15
+ - Propagate logatron headers
16
+ ([03c8fc8](https://github.com/indigobio/hyperion/commit/03c8fc8df0c40a2008a13496036d2e9aa741e7ba))
17
+ - Use logatron
18
+ ([5f9182f](https://github.com/indigobio/hyperion/commit/5f9182f875c396d73e5c3e412a424946ad7c5d99))
19
+ - Restrict Oj from loading decimal numbers as BigDecimal
20
+ ([56537a6](https://github.com/indigobio/hyperion/commit/56537a6054691e5e89397fbc860159e08485a479))
21
+
22
+
23
+ ## [0.1.4](https://github.com/indigobio/hyperion/compare/v0.1.3...indigobio:v0.1.4) (2015-11-11)
24
+
25
+ - Added a spec in superion for passing headers into the belly of the beast
26
+ ([dd01c70](https://github.com/indigobio/hyperion/commit/dd01c70dc72f90302121da7416930734a71be249))
27
+ - Passthrough of headers
28
+ ([a49851b](https://github.com/indigobio/hyperion/commit/a49851b67146fa31730a2109e332dd19152b946b))
29
+
30
+
31
+ ## [0.1.3](https://github.com/indigobio/hyperion/compare/v0.1.2...indigobio:v0.1.3) (2015-11-02)
32
+
33
+ - Expect header causes problems on AWS. Found a better way to disable the header.
34
+ ([7949c98](https://github.com/indigobio/hyperion/commit/7949c98c962c05616e91afa10b153f4153a2c95c))
35
+ - Renamed gem to hyperion_http
36
+ ([0fab86b](https://github.com/indigobio/hyperion/commit/0fab86bc92fc7d279ce5b2ca32d5f2cad5261f4e))
37
+
38
+
39
+ ## [0.1.2](https://github.com/indigobio/hyperion/compare/ddb7f399f4fd18c3e1fee07495bb082da9b6f2ff...indigobio:v0.1.2) (2015-10-14)
40
+
41
+ - Attempted to solve problem in tests where clients hit an old server
42
+ ([420f017](https://github.com/indigobio/hyperion/commit/420f017b1d2e1dcd39f313982fe713c29d7ff3a9))
43
+ - Updated gems. Hyperion.fake supports up to RSpec 3.3 now.
44
+ ([d82184a](https://github.com/indigobio/hyperion/commit/d82184a95ae6a3b85d37ee8db49487f4a417aea5))
45
+ - Changed require for rspec to use rspec/core
46
+ ([4e29d43](https://github.com/indigobio/hyperion/commit/4e29d431d58375487a27a947e745adaba12566c1))
47
+ - Added RspecJunitFormatter gem as development dependency
48
+ ([b8a8d34](https://github.com/indigobio/hyperion/commit/b8a8d34c8d16c056f3873ee615ca82311586eb0d))
49
+ - Fixed Time object in tests to have specified timezone
50
+ ([aec7305](https://github.com/indigobio/hyperion/commit/aec73059941eae3ff59289b5592f94eeb9198b33))
51
+ - Fixed timezone representation in tests
52
+ ([de8f2fa](https://github.com/indigobio/hyperion/commit/de8f2faba7fbb046975d8c65a02d9bbd0b21d7c1))
53
+ - Improved Errors section
54
+ ([b116b26](https://github.com/indigobio/hyperion/commit/b116b26080d73eee0f16262aa3bdd4b47c86e715))
55
+ - Added Maintenance section
56
+ ([5ffaf31](https://github.com/indigobio/hyperion/commit/5ffaf31b0b06aafbad1470ec867dd8927e290a3d))
57
+ - Filled out Versioning section
58
+ ([5dd0fc2](https://github.com/indigobio/hyperion/commit/5dd0fc2b2f3387bfb725777eef1a28e628f170e9))
59
+ - Whitelisted branches in travisCI config
60
+ ([a1c9eab](https://github.com/indigobio/hyperion/commit/a1c9eab54d6043fec681b5af0905aba7f2251e4b))
61
+ - Fixed tests failing on TravisCI
62
+ ([ca26e20](https://github.com/indigobio/hyperion/commit/ca26e206ccf7bc155f63e2c10875aec4b80d36a8))
63
+ - constraint rspec version
64
+ ([439d01e](https://github.com/indigobio/hyperion/commit/439d01eaf2d89375bc12fdbaa31253b3d45efc98))
65
+ - Default rake task runs rspec
66
+ ([da171c5](https://github.com/indigobio/hyperion/commit/da171c59a75a071cf00eb50af18456677d26b3ae))
67
+ - TravisCI integration
68
+ ([3ed1637](https://github.com/indigobio/hyperion/commit/3ed16378c4db1dff742c7e63c2995838fcfb3625))
69
+ - Renamed `ClientErrorResponse#body` -> `ClientErrorResponse#content`
70
+ ([8e95ddf](https://github.com/indigobio/hyperion/commit/8e95ddf4a02909ee2eda7349c3f8ee28db9cb8de))
71
+ - json enum support from abstractivator
72
+ ([2140f6f](https://github.com/indigobio/hyperion/commit/2140f6fb5c1fa544b41c819e624ae01916ce2642))
73
+ - another enum tweak
74
+ ([470fd2e](https://github.com/indigobio/hyperion/commit/470fd2ed9146d5bb0bf639df308bfa711cf324fc))
75
+ - upgraded abstractivator for wrapped enum values
76
+ ([39b934f](https://github.com/indigobio/hyperion/commit/39b934f0f83904cc7174e4f3f4cef63c9c9b9d57))
77
+ - abstractivator 0.0.27
78
+ ([97a00b2](https://github.com/indigobio/hyperion/commit/97a00b24f770e2bcf55ca6cc9f7e78d6f4318286))
79
+ - Fixed bug due to missing `require`
80
+ ([102cbcb](https://github.com/indigobio/hyperion/commit/102cbcb10aa33c1d5f379b04e95304ef9860205e))
81
+ - Removed Superion.missing
82
+ ([f565d5f](https://github.com/indigobio/hyperion/commit/f565d5f8f834f695911af8d78a037fdb99ab9602))
83
+ - Removed hyperion_fallthrough
84
+ ([14354ce](https://github.com/indigobio/hyperion/commit/14354cec924709fc1481a5e617b77aa813cdeb89))
85
+ - Renamed Superion -> Hyperion::Requestor
86
+ ([e9c4e15](https://github.com/indigobio/hyperion/commit/e9c4e153aa9dcba8f388b47d91da199148001c7c))
87
+ - Added to readme
88
+ ([88b732c](https://github.com/indigobio/hyperion/commit/88b732cc9150b97711804adc76032ab9d696b8b1))
89
+ - Use Oj's time formatting facilities, rather than a hack.
90
+ ([4a8ef9e](https://github.com/indigobio/hyperion/commit/4a8ef9e63f2d79f6e24c9e75cb5f65c17955889a))
91
+ - Added doc comments
92
+ ([4445689](https://github.com/indigobio/hyperion/commit/44456894e62acc1aa514b8ddf08ed26b7cd2dfe9))
93
+ - README tweaks
94
+ ([24a19b1](https://github.com/indigobio/hyperion/commit/24a19b11f8e5bad135e087bd2c93ce9b8178b885))
95
+ - More README additions
96
+ ([7c79296](https://github.com/indigobio/hyperion/commit/7c7929620d6f22a9fd952631fa976149eaedae45))
97
+ - First stab at README
98
+ ([6b1833b](https://github.com/indigobio/hyperion/commit/6b1833b54b4ae8d2ad23674ccd166c0edf2e7e85))
99
+ - Factored out the vendor string
100
+ ([bfc4d8c](https://github.com/indigobio/hyperion/commit/bfc4d8c18b6c897e7e5945d7ca93ad03fbb3ed2c))
101
+ - Cleaned up Hyperion::fake code
102
+ ([ab9431a](https://github.com/indigobio/hyperion/commit/ab9431a7aff88ebd3f5cbde9fc256287f5259fec))
103
+ - tweak
104
+ ([9a32738](https://github.com/indigobio/hyperion/commit/9a32738da123efe1589f996a587f69012836e2b3))
105
+ - reinstated superion specs
106
+ ([17ea2a8](https://github.com/indigobio/hyperion/commit/17ea2a8d8fa1877e992039e2efb7622105a73e94))
107
+ - Allow dispatching on client error code
108
+ ([41fa215](https://github.com/indigobio/hyperion/commit/41fa2150becd2891fa7bcc381fc76169ecc670db))
109
+ - Cleaned up error raising. Moved superion code into lib/hyperion
110
+ ([05725aa](https://github.com/indigobio/hyperion/commit/05725aae1e7a9d4f1c355c9e3766982f59a6b594))
111
+ - Switch to new style enums
112
+ ([c9225f1](https://github.com/indigobio/hyperion/commit/c9225f1347f4a5cb6204266e72aa22209715862c))
113
+ - Upgraded abstractivator. Fixed failing spec due to Oj behavior change.
114
+ ([aed6f12](https://github.com/indigobio/hyperion/commit/aed6f12026c1087e2e6b3c78aea6548899911fc5))
115
+ - Log when requests complete
116
+ ([812b71e](https://github.com/indigobio/hyperion/commit/812b71ea59525a8bf882c3b07eaeb81f916ad510))
117
+ - Do not require dispatch predicates to take an argument
118
+ ([1ab265b](https://github.com/indigobio/hyperion/commit/1ab265ba4052af924829933057640878e354b49f))
119
+ - Code cleanup
120
+ ([a92e6d3](https://github.com/indigobio/hyperion/commit/a92e6d30f9a25a54f5d0839c99662b6bc7a479be))
121
+ - Fixed bug where superion's interface was too loose
122
+ ([806d280](https://github.com/indigobio/hyperion/commit/806d280ea0d7b6e089c2aeeace551696666d6df8))
123
+ - Fixed slow POSTs > 1KB
124
+ ([53db42b](https://github.com/indigobio/hyperion/commit/53db42b05ff51f82f7ea9c3ba475c8023e38d007))
125
+ - Allow query to be nil (bugfix)
126
+ ([b9c6df5](https://github.com/indigobio/hyperion/commit/b9c6df55d7143df943ce8ac0a021fcece065904e))
127
+ - 0.0.45
128
+ ([a1fe768](https://github.com/indigobio/hyperion/commit/a1fe7688008c6b8f65921c6024637238e28781ec))
129
+ - Cleaned up HyperionUri
130
+ ([0268c97](https://github.com/indigobio/hyperion/commit/0268c97c6d65627e7c4d39e3d6a2dc682e822f0e))
131
+ - Support query params that are arrays
132
+ ([c7e5e00](https://github.com/indigobio/hyperion/commit/c7e5e0057d529a989eac80f2e13e5d20db3e5548))
133
+ - Added ci.sh
134
+ ([af6bd5b](https://github.com/indigobio/hyperion/commit/af6bd5be9fea93fbe5322ee44176ce03ec39aad2))
135
+ - Fixed "require" problems
136
+ ([d54b13c](https://github.com/indigobio/hyperion/commit/d54b13c5a7352398d8460dd6942d8344ecaddc9b))
137
+ - Raise an error if superion response falls through and no superion_fallthrough method is defined.
138
+ ([d46d84a](https://github.com/indigobio/hyperion/commit/d46d84acd4341b0b5ac9993d0ac6b6fb3484983a))
139
+ - Always read client error response as JSON
140
+ ([c043a9e](https://github.com/indigobio/hyperion/commit/c043a9ec75df7ac4330566158044fbec9d5b2e9d))
141
+ - Made ClientErrorResponse constructor interface less error-prone
142
+ ([19eaadd](https://github.com/indigobio/hyperion/commit/19eaadde9e541194d1ec0f3b938d2aa09895831d))
143
+ - Fixed ClientErrorResponse#from_attrs
144
+ ([0f79140](https://github.com/indigobio/hyperion/commit/0f79140acee6c7c4d8ab5c1902b0acdb129a0970))
145
+ - Moved mimic back to being a runtime dependency
146
+ ([36feba4](https://github.com/indigobio/hyperion/commit/36feba4dc9c25ddf3610629e0ac9c3429838f155))
147
+ - Refactored to appease CodeClimate
148
+ ([465e7cc](https://github.com/indigobio/hyperion/commit/465e7cc1c24b497fe10caa44be72794ce4bd2582))
149
+ - Read 400-level bodies as ClientErrorResponse
150
+ ([9447159](https://github.com/indigobio/hyperion/commit/94471595a3fb2944e8b1ffaafb0700d71bc413e1))
151
+ - Catch raised errors in handler predicates
152
+ ([506d06b](https://github.com/indigobio/hyperion/commit/506d06b42da41bebfd164cd2682918a8bd97dcd5))
153
+ - Added superion
154
+ ([5ed8757](https://github.com/indigobio/hyperion/commit/5ed8757f26749f88dd4e6f7de217bbf7fb6d9bee))
155
+ - Pass the HyperionResult to the block, since it won't always be in lexical scope.
156
+ ([2370e54](https://github.com/indigobio/hyperion/commit/2370e54e83135acfd35edbdfb5947eeb3e74232e))
157
+ - If parsing JSON fails, just return the unparsed JSON.
158
+ ([2b41d2f](https://github.com/indigobio/hyperion/commit/2b41d2fdce0c7bd821d32397028fe22db5356b7b))
159
+ - Hyperion.fake: try to serialize body of rack results
160
+ ([ab38b77](https://github.com/indigobio/hyperion/commit/ab38b77a7170d3a652dcb553f4d21c8e90127289))
161
+ - Pretty ResponseDescriptor#to_s
162
+ ([f2f28d9](https://github.com/indigobio/hyperion/commit/f2f28d9812372c69566479d5c84d4ad83cdfe215))
163
+ - Canonicalize HyperionUri#to_s output by sorting query param names to make route matching possible.
164
+ ([002f7e8](https://github.com/indigobio/hyperion/commit/002f7e81972a20e84d8bd9877d7d189e5148b28a))
165
+ - Fixed logging bug where the logger would capture the first time it saw it.
166
+ ([e7e267a](https://github.com/indigobio/hyperion/commit/e7e267a40ef9e2f68cc7aa3eb2ff8f307ed8743b))
167
+ - HyperionUri (models query params as a hash)
168
+ ([7d552b9](https://github.com/indigobio/hyperion/commit/7d552b9221c904382d1205a82f5b085e8290196c))
169
+ - Pretty HyperionResult#to_s
170
+ ([a8f6cfa](https://github.com/indigobio/hyperion/commit/a8f6cfac9c76c0595f4f518f1798da3486477344))
171
+ - Include requested route on response object
172
+ ([a0fcc4c](https://github.com/indigobio/hyperion/commit/a0fcc4c6b088879f74be151dd621115b78415e59))
173
+ - JSON writing fixes
174
+ ([c1de890](https://github.com/indigobio/hyperion/commit/c1de890960ad0006a6f3b64a365e88804b4a19a3))
175
+ - Added the ability to match responses on an HTTP code range
176
+ ([ee93c51](https://github.com/indigobio/hyperion/commit/ee93c51a84029f43ca703e501954bd57c32d5efe))
177
+ - Friendly RestRoute#to_s
178
+ ([e3db641](https://github.com/indigobio/hyperion/commit/e3db6415bc64aa2f33997caa9e7c8b8d765293ec))
179
+ - Tolerate Railes.logger == nil
180
+ ([40a8ceb](https://github.com/indigobio/hyperion/commit/40a8cebd3a77aafcbf2479b8eb2ce3c2581d3e55))
181
+ - Use Rails.logger if present
182
+ ([b209b8b](https://github.com/indigobio/hyperion/commit/b209b8b44e83026dd438f2d796c049925c849681))
183
+ - Removed unnecessary shared examples from tests
184
+ ([f337522](https://github.com/indigobio/hyperion/commit/f3375222ecbf7732da19ffa75f9223d45de1e68f))
185
+ - Fixed bug with Hyperion fake not defaulting the port to 80
186
+ ([0a33d52](https://github.com/indigobio/hyperion/commit/0a33d5216c964d81cd46f64af0e105309d7014d5))
187
+ - Allow payload descriptor to be nil (for things like DELETE)
188
+ ([12dd4bf](https://github.com/indigobio/hyperion/commit/12dd4bf02c436652798130042d45249930f36c8d))
189
+ - fixed contract
190
+ ([8ddfdaa](https://github.com/indigobio/hyperion/commit/8ddfdaa3565ac478413dac94abad7e39ca1e33b6))
191
+ - fixed contract
192
+ ([fdccd0a](https://github.com/indigobio/hyperion/commit/fdccd0a84d754f4ef70ab12b539f0a47e7561c54))
193
+ - fixed contract
194
+ ([4afa67f](https://github.com/indigobio/hyperion/commit/4afa67f706fafcce9ff9f745c016ef1edc143bc1))
195
+ - fixed bug
196
+ ([6403cd7](https://github.com/indigobio/hyperion/commit/6403cd78cbceadea233c1db46a08cb54c1cea30f))
197
+ - Added some method contracts
198
+ ([1c52054](https://github.com/indigobio/hyperion/commit/1c52054ec5fc386b7c461556de8552a4a3508dbb))
199
+ - Log stubs and requests for debugging purposes.
200
+ ([18647ac](https://github.com/indigobio/hyperion/commit/18647acc0168e273a13170aafd202b189b901b15))
201
+ - Return 404 instead of crashing when headers are the only thing preventing a faked route from matching.
202
+ ([9e7af87](https://github.com/indigobio/hyperion/commit/9e7af8764f08b9f3606d3ec17d92e326c5bc6450))
203
+ - Serialize the POST/PUT payload according to the route's payload descriptor.
204
+ ([7652e5a](https://github.com/indigobio/hyperion/commit/7652e5a072b9ec5eafd19f75dae7893c65302b1e))
205
+ - If Hyperion.fake allow is passed a route, its block can now return an object instead of a rack-style response.
206
+ ([47f2b1e](https://github.com/indigobio/hyperion/commit/47f2b1ec65ebed3413b7fc9af21802fd169dc4e4))
207
+ - Hyperion::request now takes a block for dispatching on response properties.
208
+ ([86328c7](https://github.com/indigobio/hyperion/commit/86328c7dc4604b2713b089b1bb9bd489a4886ea9))
209
+ - Improved documentation; monkeypatched some methods onto URI
210
+ ([c106480](https://github.com/indigobio/hyperion/commit/c106480992f598adad8e32cb86514f1640ac55c2))
211
+ - Print to stdout when a request is redirected due to a stub/fake
212
+ ([be05c3f](https://github.com/indigobio/hyperion/commit/be05c3f966aecaac80ee9dfeb9f7afb9c17afec4))
213
+ - Refactored
214
+ ([7ca0f4d](https://github.com/indigobio/hyperion/commit/7ca0f4de4b4416d923d4a2f13f0c0da8c64a507b))
215
+ - bump
216
+ ([905815e](https://github.com/indigobio/hyperion/commit/905815e0f6c2c20967d9004bf1d68d375eda9046))
217
+ - fixed bug
218
+ ([4081fcf](https://github.com/indigobio/hyperion/commit/4081fcf746f318cd20c1154fbc16ad3fed888c06))
219
+ - Removed RestRoute.path; uri is now a URI object. Hyperion.fake's allow() now takes routes too
220
+ ([6bc1aff](https://github.com/indigobio/hyperion/commit/6bc1affe378e18567775508c5224b79a08e65ebd))
221
+ - Added PUT and DELETE
222
+ ([3a11fee](https://github.com/indigobio/hyperion/commit/3a11fee5386e02a3f9807a1c48b250fbc789fc0c))
223
+ - Removed hyperion/util.rb
224
+ ([096ba85](https://github.com/indigobio/hyperion/commit/096ba8514d4c0561cc8a4f534d335711786b8d63))
225
+ - Hyperion::fake can be called multiple times to add new routes
226
+ ([52398cb](https://github.com/indigobio/hyperion/commit/52398cbee465f6f9cd94d60d6f880fd7c0c4f257))
227
+ - Added Hyperion::request
228
+ ([31ccb42](https://github.com/indigobio/hyperion/commit/31ccb42ab7a758c883e902e54907e86e28185968))
229
+ - Hyperion::ResponseParams => ResponseParams
230
+ ([dbedbf4](https://github.com/indigobio/hyperion/commit/dbedbf4906aa97c0973d688da8548c8295f586b4))
231
+ - Don't try to hook RSpec when RSpec is not being used
232
+ ([2da102a](https://github.com/indigobio/hyperion/commit/2da102ae8bd6bcd24e9b3a4d1744800d40e1abea))
233
+ - Fake now cleans up after itself in all groups
234
+ ([5d66fb2](https://github.com/indigobio/hyperion/commit/5d66fb246e21d9bb187303e85663f84409180a5b))
235
+ - Fixed header comparison for Hyperion::fake
236
+ ([530df29](https://github.com/indigobio/hyperion/commit/530df295310688ddbb944b503dd5c04ab2777bf8))
237
+ - Hyperion.fake now cleans up after itself automagically
238
+ ([5ae95d7](https://github.com/indigobio/hyperion/commit/5ae95d74e4f9fe65fd6f2b9f396b90bac0a5102a))
239
+ - Made private Hyperion::Test methods actually private
240
+ ([63ebe87](https://github.com/indigobio/hyperion/commit/63ebe87c0603019f3c070ac715026972c6fc79ef))
241
+ - Hyperion::fake now passes tests
242
+ ([b3a18ad](https://github.com/indigobio/hyperion/commit/b3a18ad4de2bc876f8d5ba9e9aa9c973f8486876))
243
+ - Fixed broken other tests
244
+ ([06ac677](https://github.com/indigobio/hyperion/commit/06ac6779a3ca6e02660abdd88fafce95100142e0))
245
+ - wip
246
+ ([9858b28](https://github.com/indigobio/hyperion/commit/9858b28e8c95b35f2984a9325cc6e1a66a6926d9))
247
+ - Fixed gemspec dependencies
248
+ ([585b3d1](https://github.com/indigobio/hyperion/commit/585b3d1b25c8a4821362f2932944e296b2865415))
249
+
250
+
1
251
  ### 0.0.16
2
252
  - Hyperion::request can now take a block an easily dispatch on response status, code, or other stuff
3
253
 
@@ -120,7 +370,6 @@
120
370
  - Fixed bug due to missing `require`
121
371
 
122
372
  ### 0.0.54
123
- - abstractivator 0.0.27
124
373
 
125
374
  ### 0.0.55
126
375
  - upgraded abstractivator for wrapped enum values
@@ -135,7 +384,6 @@
135
384
  - Renamed `ClientErrorResponse#body` -> `ClientErrorResponse#content`
136
385
 
137
386
  ### 0.1.0
138
- - Bumped version
139
387
 
140
388
  ### 0.1.1
141
389
  - Attempted to solve problem in tests where clients hit an old server while
data/build.yml ADDED
@@ -0,0 +1,2 @@
1
+ changelog:
2
+ show_commits: true
@@ -30,6 +30,6 @@ Gem::Specification.new do |spec|
30
30
  spec.add_runtime_dependency 'immutable_struct', '~> 1.1'
31
31
  spec.add_runtime_dependency 'oj', '~> 2.12'
32
32
  spec.add_runtime_dependency 'typhoeus', '~> 0.7'
33
- spec.add_runtime_dependency 'mimic', '~> 0.4.3'
33
+ spec.add_runtime_dependency 'mimic', '0.4.3' # pin because 0.4.4 breaks tests
34
34
  spec.add_runtime_dependency 'logatron'
35
35
  end
@@ -14,6 +14,10 @@ class Hyperion
14
14
  end
15
15
  end
16
16
 
17
+ def log_result(result)
18
+ logger.error(dump_json(result.as_json)) if should_log_result?(result)
19
+ end
20
+
17
21
  def log_stub(rule)
18
22
  mr = rule.mimic_route
19
23
  logger.debug "Stubbed #{mr.method.to_s.upcase} #{mr.path}"
@@ -23,7 +27,18 @@ class Hyperion
23
27
  private
24
28
 
25
29
  def log_headers(headers, logger)
26
- headers.each_pair { |k, v| logger.info " #{k}: #{v}" unless k == 'Expect' }
30
+ h = headers.delete_if { |_k, v| v.nil? }
31
+ logger.info(dump_json(h))
32
+ end
33
+
34
+ def should_log_result?(result)
35
+ result.body && result.status != HyperionStatus::SUCCESS
36
+ end
37
+
38
+ def dump_json(obj)
39
+ Oj.dump(obj)
40
+ rescue
41
+ obj.inspect
27
42
  end
28
43
  end
29
44
  end
@@ -1,3 +1,3 @@
1
1
  class Hyperion
2
- VERSION = '0.1.7'
2
+ VERSION = '0.1.8'
3
3
  end
@@ -7,6 +7,7 @@ class Hyperion
7
7
  # Produces a hyperion result object from a typhoeus result object
8
8
  class ResultMaker
9
9
  include Hyperion::Formats
10
+ include Hyperion::Logger
10
11
 
11
12
  def self.make(route, typho_result, continuation=nil)
12
13
  self.new(route).make(typho_result, continuation)
@@ -35,29 +36,31 @@ class Hyperion
35
36
  read_body = proc { read(typho_result.body, route.response_descriptor) }
36
37
  code = typho_result.code
37
38
 
38
- if typho_result.success?
39
- result_class.new(route, HyperionStatus::SUCCESS, code, read_body.call)
39
+ result = if typho_result.success?
40
+ result_class.new(route, HyperionStatus::SUCCESS, code, read_body.call)
40
41
 
41
- elsif typho_result.timed_out?
42
- result_class.new(route, HyperionStatus::TIMED_OUT)
42
+ elsif typho_result.timed_out?
43
+ result_class.new(route, HyperionStatus::TIMED_OUT)
43
44
 
44
- elsif code == 0
45
- result_class.new(route, HyperionStatus::NO_RESPONSE)
45
+ elsif code == 0
46
+ result_class.new(route, HyperionStatus::NO_RESPONSE)
46
47
 
47
- elsif code == 404
48
- result_class.new(route, HyperionStatus::BAD_ROUTE, code)
48
+ elsif code == 404
49
+ result_class.new(route, HyperionStatus::BAD_ROUTE, code)
49
50
 
50
- elsif (400..499).include?(code)
51
- hash_body = read(typho_result.body, :json)
52
- err = ClientErrorResponse.from_attrs(hash_body) || hash_body
53
- result_class.new(route, HyperionStatus::CLIENT_ERROR, code, err)
51
+ elsif (400..499).include?(code)
52
+ hash_body = read(typho_result.body, :json)
53
+ err = ClientErrorResponse.from_attrs(hash_body) || hash_body
54
+ result_class.new(route, HyperionStatus::CLIENT_ERROR, code, err)
54
55
 
55
- elsif (500..599).include?(code)
56
- result_class.new(route, HyperionStatus::SERVER_ERROR, code, read_body.call)
56
+ elsif (500..599).include?(code)
57
+ result_class.new(route, HyperionStatus::SERVER_ERROR, code, read_body.call)
57
58
 
58
- else
59
- result_class.new(route, HyperionStatus::CHECK_CODE, code, read_body.call)
60
- end
59
+ else
60
+ result_class.new(route, HyperionStatus::CHECK_CODE, code, read_body.call)
61
+ end
62
+ log_result(result)
63
+ result
61
64
  end
62
65
 
63
66
  end
@@ -5,9 +5,9 @@ require 'hyperion/types/client_error_detail'
5
5
  class ClientErrorResponse
6
6
  # The structure expected in a 400 response.
7
7
 
8
- attr_reader :code # [ClientErrorCode] The type of error. At least one of the ErrorInfos should have the same code.
8
+ attr_reader :code # [ClientErrorCode] The type of error. At least one of the ClientErrorDetails should have the same code.
9
9
  attr_reader :message # [String] An error message that can be presented to the user
10
- attr_reader :errors # [Array<ErrorInfo>] Structured information with error specifics
10
+ attr_reader :errors # [Array<ClientErrorDetail>] Structured information with error specifics
11
11
  attr_reader :content # [String, nil] Optional content to return; may be an application-specific description of the error.
12
12
 
13
13
  def initialize(message, errors, code=nil, content=nil)
@@ -3,6 +3,7 @@ require 'active_support/inflector'
3
3
  class HyperionResult
4
4
  attr_reader :route, :status, :code, :body
5
5
 
6
+ # @param route [RestRoute]
6
7
  # @param status [HyperionStatus]
7
8
  # @param code [Integer] the HTTP response code
8
9
  # @param body [Object, Hash<String,Object>] the deserialized response body.
@@ -12,6 +13,15 @@ class HyperionResult
12
13
  @route, @status, @code, @body = route, status, code, body
13
14
  end
14
15
 
16
+ def as_json(*_args)
17
+ {
18
+ 'route' => route.as_json(*_args),
19
+ 'status' => status.value,
20
+ 'code' => code,
21
+ 'body' => body.as_json(*_args),
22
+ }
23
+ end
24
+
15
25
  def to_s
16
26
  if status == HyperionStatus::CHECK_CODE
17
27
  "HTTP #{code}: #{route.to_s}"
@@ -6,4 +6,10 @@ class PayloadDescriptor
6
6
  def initialize(format)
7
7
  @format = format
8
8
  end
9
+
10
+ def as_json(*_args)
11
+ {
12
+ 'format' => format.to_s,
13
+ }
14
+ end
9
15
  end
@@ -14,6 +14,14 @@ class ResponseDescriptor
14
14
  @type, @version, @format = type, version, format
15
15
  end
16
16
 
17
+ def as_json(*_args)
18
+ {
19
+ 'type' => type,
20
+ 'version' => version,
21
+ 'format' => format.to_s
22
+ }
23
+ end
24
+
17
25
  def to_s
18
26
  short_mimetype(self)
19
27
  end
@@ -14,6 +14,15 @@ class RestRoute
14
14
  @payload_descriptor = payload_descriptor
15
15
  end
16
16
 
17
+ def as_json(*_args)
18
+ {
19
+ 'method' => method.to_s,
20
+ 'uri' => uri.to_s,
21
+ 'response_descriptor' => response_descriptor.as_json(*_args),
22
+ 'payload_descriptor' => payload_descriptor.as_json(*_args),
23
+ }
24
+ end
25
+
17
26
  def to_s
18
27
  "#{method.to_s.upcase} #{uri}"
19
28
  end
@@ -54,7 +54,7 @@ class Hyperion
54
54
  expect(format_for('multipart/form-data; boundary=------------------------2b463b63688b28fa')).to eql Multipart.format
55
55
  end
56
56
  it 'raises an error if the content type is unknown' do
57
- expect{format_for('aaa/bbb')}.to raise_error
57
+ expect{format_for('aaa/bbb')}.to raise_error /Unsupported content type/
58
58
  end
59
59
  end
60
60
 
@@ -6,14 +6,12 @@ describe Hyperion::Logger do
6
6
  include Hyperion::Logger
7
7
 
8
8
  it 'logs to $stdout by default' do
9
- output = StringIO.new
10
- with_stdout(output) do
9
+ output = capture_stdout do
11
10
  logger.debug 'xyzzy'
12
11
  logger.debug 'qwerty'
13
12
  end
14
- output_str = output.string
15
- expect(output_str).to include 'xyzzy'
16
- expect(output_str).to include 'qwerty'
13
+ expect(output).to include 'xyzzy'
14
+ expect(output).to include 'qwerty'
17
15
  end
18
16
 
19
17
  it 'logs to Rails.logger if present' do
@@ -27,24 +25,121 @@ describe Hyperion::Logger do
27
25
  end
28
26
 
29
27
  it 'respects the log level' do
30
- output = StringIO.new
31
- with_stdout(output) do
28
+ output = capture_stdout do
32
29
  Logatron.level = Logatron::ERROR
33
30
  logger.debug 'xyzzy'
34
31
  logger.error 'qwerty'
35
32
  Logatron.level = Logatron::DEBUG
36
33
  end
37
- output_str = output.string
38
- expect(output_str).to include 'qwert'
39
- expect(output_str).to_not include 'xyzzy'
34
+ expect(output).to include 'qwert'
35
+ expect(output).to_not include 'xyzzy'
36
+ end
37
+
38
+ context '#with_request_logging' do
39
+ let(:route) { RestRoute.new(:get, 'http://test.com', ResponseDescriptor.new('type', 1, :json)) }
40
+ let(:uri) { 'http://foo.bar' }
41
+ let(:headers) { {'Present' => 'here', 'Empty' => '', 'Absent' => nil} }
42
+ let!(:error_raised) { false }
43
+
44
+ it 'logs the method' do
45
+ expect(the_log).to include 'GET'
46
+ end
47
+ it 'logs the URI' do
48
+ expect(the_log).to include uri
49
+ end
50
+ context 'when the block raises an error' do
51
+ let!(:error_raised) { true }
52
+ it 'logs the headers when the block raises an error' do
53
+ expect(the_log).to include '"Present":"here"'
54
+ expect(the_log).to include '"Empty":""'
55
+ end
56
+ it 'hides nil headers' do
57
+ expect(the_log).to_not include 'Absent'
58
+ end
59
+ end
60
+
61
+ def the_log
62
+ capture_stdout do
63
+ begin
64
+ with_request_logging(route, uri, headers) { raise 'oops' if error_raised }
65
+ rescue
66
+ end
67
+ end
68
+ end
69
+ end
70
+
71
+ context '#log_result' do
72
+ let(:response_desc) { ResponseDescriptor.new('type', 1, :json) }
73
+ let(:payload_desc) { PayloadDescriptor.new(:protobuf) }
74
+ let(:route) { RestRoute.new(:get, 'http://test.com', response_desc, payload_desc) }
75
+
76
+ context 'for a successful response' do
77
+ let(:result) { HyperionResult.new(route, HyperionStatus::SUCCESS, 200, 'test') }
78
+ it 'does not log anything' do
79
+ verify_result_not_logged
80
+ end
81
+ end
82
+
83
+ context 'for an unsuccessful response' do
84
+ context 'with no body' do
85
+ let(:result) { HyperionResult.new(route, HyperionStatus::TIMED_OUT) }
86
+ it 'does not log anything ' do
87
+ verify_result_not_logged
88
+ end
89
+ end
90
+
91
+ context 'with a ClientErrorResponse body' do
92
+ let(:message) { 'test' }
93
+ let(:code) { ClientErrorCode::MISSING }
94
+ let(:error) { ClientErrorDetail.new(code, 'resource', field: 'field', value: 1, reason: 'oops') }
95
+ let(:content) { 'content' }
96
+ let(:error_response) { ClientErrorResponse.new(message, [error], code, content) }
97
+ let(:result) { HyperionResult.new(route, HyperionStatus::CLIENT_ERROR, 400, error_response) }
98
+
99
+ it 'logs the key value pairs of the ClientErrorResponse' do
100
+ verify_result_logged
101
+ end
102
+ end
103
+
104
+ context 'for all other bodies' do
105
+ let(:body) { 'error' }
106
+ let(:result) { HyperionResult.new(route, HyperionStatus::CLIENT_ERROR, 500, body) }
107
+ it 'logs them' do
108
+ verify_result_logged
109
+ end
110
+ end
111
+ end
112
+
113
+ def verify_result_not_logged
114
+ output = capture_stdout do
115
+ log_result(result)
116
+ end
117
+ expect(output).to be_empty
118
+ end
119
+
120
+ def verify_result_logged
121
+ output = capture_stdout do
122
+ log_result(result)
123
+ end
124
+ expect(output).to eql Oj.dump(result.as_json) + "\n"
125
+ end
126
+ end
127
+
128
+ def capture_stdout
129
+ output = StringIO.new
130
+ with_stdout(output) do
131
+ yield
132
+ end
133
+ output.string
40
134
  end
41
135
 
42
136
  def with_stdout(io)
137
+ prev_logger = Logatron.configuration.logger
43
138
  set_log_io(io)
44
139
  begin
45
140
  yield
46
141
  ensure
47
- set_log_io($stdout)
142
+ Logatron.configuration.logger = prev_logger
48
143
  end
49
144
  end
50
145
 
@@ -7,7 +7,7 @@ RSpec.configure do |config|
7
7
  end
8
8
 
9
9
  Logatron.configure do |c|
10
- c.logger = Logger.new($stdout)
10
+ c.logger = Logger.new(ENV['VERBOSE'] == 'true' ? $stdout : '/dev/null')
11
11
  c.level = Logatron::DEBUG
12
12
  c.transformer = proc {|x| x[:body]}
13
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyperion_http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Indigo BioAutomation, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-14 00:00:00.000000000 Z
11
+ date: 2016-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -168,14 +168,14 @@ dependencies:
168
168
  name: mimic
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - "~>"
171
+ - - '='
172
172
  - !ruby/object:Gem::Version
173
173
  version: 0.4.3
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - "~>"
178
+ - - '='
179
179
  - !ruby/object:Gem::Version
180
180
  version: 0.4.3
181
181
  - !ruby/object:Gem::Dependency
@@ -207,6 +207,7 @@ files:
207
207
  - LICENSE.txt
208
208
  - README.md
209
209
  - Rakefile
210
+ - build.yml
210
211
  - hyperion_http.gemspec
211
212
  - lib/hyperion.rb
212
213
  - lib/hyperion/aux/bug_error.rb