Class: Sift::Router
Class Method Summary collapse
- .add_default_headers(options) ⇒ Object
- .get(path, options = {}) ⇒ Object
- .post(path, options = {}) ⇒ Object
- .serialize_body(options) ⇒ Object
- .wrap_response(response) ⇒ Object
Class Method Details
.add_default_headers(options) ⇒ Object
25 26 27 28 29 |
# File 'lib/sift/router.rb', line 25 def add_default_headers() [:headers] = { "User-Agent" => Sift::Client.user_agent }.merge([:headers] || {}) end |
.get(path, options = {}) ⇒ Object
9 10 11 12 13 |
# File 'lib/sift/router.rb', line 9 def get(path, = {}) serialize_body() add_default_headers() wrap_response(super(path, )) end |
.post(path, options = {}) ⇒ Object
15 16 17 18 19 |
# File 'lib/sift/router.rb', line 15 def post(path, = {}) serialize_body() add_default_headers() wrap_response(super(path, )) end |
.serialize_body(options) ⇒ Object
21 22 23 |
# File 'lib/sift/router.rb', line 21 def serialize_body() [:body] = MultiJson.dump([:body]) if [:body] end |