Commit Graph

21 Commits

Author SHA1 Message Date
Hakan Ensari
3fdae1090b Always set Content-Type to JSON
Fixes #45
2017-01-08 23:21:57 +00:00
Hakan Ensari
7b653b1fd8 Cache responses 2017-01-08 23:21:56 +00:00
Hakan Ensari
60f980a6ee Fold conversion into quote 2017-01-03 12:44:13 +00:00
Vincent Durand
ad64574745 Add GET #converter API route
It adds a quote helper which return the Quote instance
to be injected, and uses this new object for the quote's attributes.
2016-09-22 18:53:31 +02:00
Hakan Ensari
2bb4aeb497 Configure rack cors 2016-06-08 14:49:43 +01:00
Hakan Ensari
250095d262 Use rack-cors
We will only return Access-Control headers if request includes an
Origin header

Fixes #18
2016-05-09 11:51:54 +01:00
Hakan Ensari
07781b6d76 Use Oj to generate JSON
Warming up --------------------------------------
                json    16.465k i/100ms
                yajl    18.574k i/100ms
                  oj    34.073k i/100ms
Calculating -------------------------------------
                json    182.828k (± 7.8%) i/s -    922.040k in
5.075699s
                yajl    196.839k (± 4.5%) i/s -    984.422k in
5.011087s
                  oj    384.813k (± 5.9%) i/s -      1.942M in
5.065475s

Comparison:
                  oj:   384813.2 i/s
                yajl:   196839.0 i/s - 1.95x slower
                json:   182827.5 i/s - 2.10x slower
2016-05-09 11:51:54 +01:00
Hakan Ensari
92ed532543 Fix OPTIONS requests
#18
2016-04-25 19:10:15 +01:00
Hakan Ensari
702f6ac9aa Refactor internals
- Removed yajl-ruby
- Removed sinatra-jsonp
- Inlined #halt_with_message
- Added last_modified header to root path
2016-04-24 17:15:02 +01:00
Hakan Ensari
59df76477e Further refactor cross-origin
- Add all [required
headers](https://github.com/britg/sinatra-cross_origin/blob/master/lib/s
inatra/cross_origin.rb#L51-L58)
- Respond to preflight requests

#18
2016-04-24 16:19:36 +01:00
Hakan Ensari
1d059cd049 Refactor cross-origin
- Drop cross_origin gem
- Add header to all responses

#18
2016-04-24 15:39:08 +01:00
Hakan Ensari
b6b697872e Set TargetRubyVersion to 2.3 in Rubocop 2016-04-11 15:05:15 +01:00
Hakan Ensari
5094956f7c Add Last Modified header 2015-09-15 12:01:16 +01:00
Hakan Ensari
1c128eb84c Convert Snapshot into value object 2015-08-30 11:54:49 +01:00
Hakan Ensari
4c72b6a139 Fix Rubocop warnings 2015-05-25 12:13:05 +01:00
hakanensari
f479803a92 Allow cross-origin
Closes #2
2014-10-07 12:08:28 +01:00
hakanensari
76aa21c239 Add root path 2014-06-19 12:31:35 +01:00
hakanensari
3c146f643f Handle more edge cases 2014-05-16 20:35:16 +01:00
hakanensari
3c0f4a060c Ensure historical data is returned 2014-03-17 10:15:05 +00:00
hakanensari
0931da3add Improve error handling 2014-03-17 10:10:39 +00:00
hakanensari
4fdd65ac3c Use a minimal app framework 2014-03-14 12:15:27 +00:00